-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathenv-form.html
195 lines (171 loc) · 8.97 KB
/
env-form.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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>ftployin</title>
<link rel="stylesheet" href="assets/css/app.min.css">
</head>
<body>
<div id="modal">
<div class="ui window-title drag-region">{{ title }}</div>
<div class="ui window-body modal env-form">
<div class="ui form full-height">
<div class="body full-height">
<div class="ui tabs">
<div class="labels">
<div class="tab-label active" tab="general">general</div>
<div class="tab-label" tab="files">virtual files</div>
</div>
<div class="contents">
<div class="tab-content active padding-v-8" tab-name="general">
<div class="cols">
<div class="col-12">
<div class="input-group">
<label for="name">name:</label>
<input type="text" class="col-10" id="name" v-model="form.name">
</div>
</div>
</div>
<div class="cols">
<div class="col-7">
<div class="input-group">
<label for="host">host:</label>
<input type="text" class="col-9" id="name" v-model="form.host">
</div>
</div>
<div class="col-2">
<div class="input-group">
<label for="port">port:</label>
<input type="text" class="col-2" id="name" v-model="form.port">
</div>
</div>
<div class="col-3">
<div class="input-group">
<input type="checkbox" id="secure" v-model="form.secure">
<label for="secure">secure</label>
</div>
</div>
</div>
<div class="cols">
<div class="col-6">
<div class="input-group">
<label for="username">username:</label>
<input type="text" class="col-8" id="name" v-model="form.user">
</div>
</div>
<div class="col-6">
<div class="input-group">
<label for="password">password:</label>
<input type="password" class="col-8" id="name" v-model="form.password">
</div>
</div>
</div>
<div class="cols">
<div class="col-12">
<div class="input-group">
<label for="remoteDir">remote dir:</label>
<input type="text" class="col-9" id="remoteDir" v-model="form.remoteDir">
</div>
</div>
</div>
<div class="cols">
<div class="col-12">
<div class="input-group">
<label for="exclude">exclude:</label>
<textarea class="col-12" id="exclude" v-model="excludeLines" rows="8"></textarea>
</div>
</div>
</div>
</div>
<div class="tab-content" tab-name="files">
<div class="padding-16">
<div class="ui note">
<i class="icon icon-info-circle"></i>
this files may not exists on project but you need to upload them.
</div>
<button class="ui btn small yellow float padding-h-16" @click="addFile()">
<i class="icon icon-plus"></i>
file
</button>
<div class="virtual-files-list">
<div class="file" v-for="file in form.files">
<div class="title">
<button class="ui btn small inverse gray float right close" @click="removeFile(file)">
<i class="icon icon-trash"></i>
</button>
<span class="ui text gray sub pre-icon-file">
<i class="icon icon-file-code-o"></i>
</span>
<input type="text" v-model="file.path" placeholder="/path/to/your/file">
</div>
<div class="wrapper-editor">
<code-editor
:code="file.content"
@update="code => file.content = code"
placeholder="/* your code here */"
></code-editor>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="footer">
<div class="cols">
<div class="col-3">
<button class="ui btn pink" v-on:click="close()">cancel</button>
</div>
<div class="col-3 offset-6">
<button class="ui btn green" v-on:click="save()">save</button>
</div>
</div>
</div>
</div>
</div>
</div>
<script src="assets/js/vue.min.js"></script>
<script src="src/js/ui/tabs.js"></script>
<script src="src/js/ui/code-editor.js"></script>
<script>
const modal = require('electron-modal');
const methods = {};
const computed = {};
computed.excludeLines = {
get: function () {
return (this.form.exclude instanceof Array)
? this.form.exclude.join("\n")
: this.form.exclude;
},
set: function (value) {
if (value) {
this.form.exclude = value.split("\n")
.map(l => l.trim());
}
}
};
methods.save = function () {
if (this.form.exclude instanceof Array) {
this.form.exclude = this.form.exclude.filter(l => l);
}
this.form.files = this.form.files.filter(f => (f.path || '').trim());
modal.emit(this.action, this.form);
modal.close();
};
methods.close = function () {
modal.close();
};
methods.addFile = function () {
this.form.files.push({path: null, content: null});
}
methods.removeFile = function (file) {
this.form.files.splice(this.form.files.indexOf(file), 1);
}
modal.getData().then((data) => {
data.form.files = data.form.files || [{ path: null, content: null }];
new Vue({ el: '#modal', data, methods, computed });
});
</script>
</body>
</html>