Skip to content

Commit 9303607

Browse files
committed
Added loading indication for DO regions
1 parent 0f07c6d commit 9303607

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

app/static/app.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ new Vue({
8686
el: '#provider_app',
8787
data: {
8888
loading: false,
89+
do_region_loading: false,
8990
do_regions: [],
9091
extra_args: provider_extra_args,
9192
providers_map: [
@@ -115,6 +116,7 @@ new Vue({
115116
this.extra_args.do_token
116117
) {
117118
this.loading = true;
119+
this.do_region_loading = true;
118120
fetch('/do/regions', {
119121
method: 'POST',
120122
headers: {
@@ -128,6 +130,7 @@ new Vue({
128130
})
129131
.finally(() => {
130132
this.loading = false;
133+
this.do_region_loading = false;
131134
});
132135
}
133136
}
@@ -161,6 +164,9 @@ new Vue({
161164
},
162165
show_backdrop() {
163166
return this.status === 'running';
167+
},
168+
is_success() {
169+
return this.result === 0;
164170
}
165171
},
166172
watch: {

app/static/index.html

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
66
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
77
integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
8-
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/xterm/3.14.5/xterm.min.css"
9-
integrity="sha256-uTIrmf95e6IHlacC0wpDaPS58eWF314UC7OgdrD6AdU=" crossorigin="anonymous"/>
108
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.6.10/vue.min.js"
119
integrity="sha256-chlNFSVx3TdcQ2Xlw7SvnbLAavAQLO0Y/LBiWX04viY=" crossorigin="anonymous"></script>
1210
<style>
@@ -178,8 +176,14 @@ <h4>Digital Ocean Options</h4>
178176
@blur="load_do_regions"/>
179177
</div>
180178
<div class="form-group">
181-
<label for="id_region">What region should the server be located in?</label>
182-
<select name="region" id="id_region" class="form-control" v-model="extra_args.region">
179+
<label v-if="do_regions.length > 0" for="id_region">What region should the server be located in?</label>
180+
<label v-if="do_regions.length === 0" for="id_region">Please enter API key above to select region</label>
181+
<label v-if="do_region_loading" for="id_region">Loading regions...</label>
182+
<select name="region"
183+
id="id_region"
184+
class="form-control"
185+
v-model="extra_args.region"
186+
v-bind:disabled="do_region_loading">
183187
<option value="" disabled>Select region</option>
184188
<option
185189
v-for="(region, index) in do_regions"
@@ -213,7 +217,8 @@ <h4>Digital Ocean Options</h4>
213217
</div>
214218
<div v-if="status === 'done'">
215219
<pre class="console">{{program.join(' ')}}</pre>
216-
<div class="text-success">Done!</div>
220+
<div v-if="is_success" class="text-success">Done!</div>
221+
<div v-else class="text-danger">Failed!</div>
217222
</div>
218223
</div>
219224
</footer>

0 commit comments

Comments
 (0)