forked from Jigsaw-Code/outline-apps
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathservers-view.html
123 lines (118 loc) · 4.2 KB
/
servers-view.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
<!--
Copyright 2018 The Outline Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<link rel="import" href="../bower_components/paper-button/paper-button.html">
<link rel="import" href="server-list.html">
<link rel="import" href="server-connection-viz.html">
<link rel="import" href="user-comms-dialog.html">
<dom-module id="servers-view">
<template>
<style>
:host {
margin: 0!important;
width: 100%;
height: 100%;
/* Use vh, as % does not work in iOS. |header-height|+|server-margin| = 64px.
* Subtract |header-height| to fix iOS padding, and |server-margin| to fix scrolling in Android.
*/
height: -webkit-calc(100vh - 64px);
font-size: 14px;
line-height: 20px;
};
:host a {
color: var(--medium-green);
text-decoration: none;
}
/* Do not remove, this allows the hidden attribute to work with flex displays. */
[hidden] {
display: none !important;
}
.server-list-container {
background-color: #EFEFEF;
width: 100%;
height: 100%;
}
.flex-column-container {
margin: 0 auto;
width: 100%;
height: 100%;
text-align: center;
display: -webkit-flex;
-webkit-flex-wrap: wrap;
flex-wrap: wrap;
-webkit-flex-direction: column;
flex-direction: column;
-webkit-flex: 1;
flex: 1;
justify-content: center;
}
.header {
font-size: 20px;
color: rgba(0,0,0,0.87);
line-height: 32px;
margin-top: 34px;
}
.subtle {
color: rgba(0,0,0,0.54);
}
.footer {
margin: 0;
padding: 24px 0 16px 0;
border-top-width: 1px;
border-top-color: rgba(0,0,0,0.08);
border-top-style: solid;
}
paper-button {
display: flex;
flex-direction: column;
text-transform: none;
outline: none; /* Remove outline for Safari. */
}
</style>
<div class="server-list-container">
<div class="flex-column-container" hidden$="[[!shouldShowZeroState]]">
<div class="flex-column-container">
<paper-button noink on-tap="_requestPromptAddServer">
<server-connection-viz state="ZERO_STATE" root-path="[[rootPath]]"></server-connection-viz>
<div class="header">[[localize('server-add')]]</div>
<div class="subtle">[[localize('server-add-zero-state-instructions')]]</div>
</paper-button>
</div>
<div class="footer subtle" inner-h-t-m-l="[[localize('server-create-your-own-zero-state', 'breakLine', '<br/>', 'openLink', '<a href=https://s3.amazonaws.com/outline-vpn/index.html>', 'closeLink', '</a>')]]">
</div>
</div>
<user-comms-dialog id="autoConnectDialog" localize="[[localize]]" title-localization-key="auto-connect-dialog-title" detail-localization-key="auto-connect-dialog-detail" fire-event-on-hide="AutoConnectDialogDismissed"></user-comms-dialog>
<server-list id="serverList" hidden$="[[shouldShowZeroState]]" servers="{{servers}}" localize="[[localize]]" root-path="[[rootPath]]"></server-list>
</div>
</template>
<script>
'use strict';
Polymer({
is: 'servers-view',
properties: {
localize: Function,
rootPath: String,
servers: Array,
shouldShowZeroState: {
type: Boolean,
computed: '_computeShouldShowZeroState(servers)'
}
},
_computeShouldShowZeroState: function (servers) {
return !!servers ? servers.length === 0 : false;
},
_requestPromptAddServer: function() {
this.fire('PromptAddServerRequested', {});
}
});
</script>
</dom-module>