Skip to content

Commit

Permalink
Merge pull request #133 from biothings/modal-es-selection
Browse files Browse the repository at this point in the history
updated es loading in modal for api and diff release
  • Loading branch information
DylanWelzel authored Feb 12, 2024
2 parents 01ff445 + 3ce659e commit 3d8352d
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 22 deletions.
35 changes: 24 additions & 11 deletions webapp/src/ApiGrid.vue
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,20 @@
<br>
<br>

<label>Select a ElasticSeach server</label>
<label>Select an ElasticSearch server</label>
<div>
<select class="ui fluid es_servers dropdown" name="es_server">
<option value="">------</option>
<option v-if="es_servers" v-for="(server_data, es_server) in es_servers"
:value="es_server"
>
{{ es_server}} ({{ server_data.host }})
</option>
</select>
<br>
<div class="ui fluid es_servers dropdown selection" :class="{loading: isLoadingESServers}">
<input type="hidden" name="es_server">
<i class="dropdown icon"></i>
<div class="default text" v-if="isLoadingESServers">Loading...</div>
<div class="default text" v-else>Select an ElasticSearch server</div>
<div class="menu">
<div v-if="!isLoadingESServers" v-for="(server_data, es_server) in es_servers" :key="es_server" class="item" :data-value="es_server">
{{ es_server }} ({{ server_data.host }})
</div>
</div>
</div>
<br>
</div>

<label>Select a backend the API will connect to to serve the data</label>
Expand Down Expand Up @@ -181,7 +184,8 @@ export default {
es_servers: {},
backends: {},
isLoadingBackends: false,
backendsDisabled: true
backendsDisabled: true,
isLoadingESServers: false
}
},
components: { API, PaginatedList },
Expand All @@ -205,12 +209,21 @@ export default {
},
fetchESServers: function () {
const self = this
self.isLoadingESServers = true
axios.get(axios.defaults.baseURL + '/config')
.then(response => {
const conf = response.data.result.scope.config
self.es_servers = conf.INDEX_CONFIG.value.env
})
.catch(err => {
console.log('Error getting index environments: ')
console.log(err)
self.loaderror(err)
})
.finally(() => {
self.isLoadingESServers = false
})
},
fetchIndexes: function() {
const self = this
Expand Down
35 changes: 24 additions & 11 deletions webapp/src/DiffReleaseEvent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,20 @@
<div class="ui form">
<div class="ui centered grid">
<div class="eight wide column">
<label>Select a ElasticSeach server</label>
<label>Select an ElasticSearch server</label>
<div>
<select class="ui fluid es_servers dropdown" name="es_server">
<option value="">------</option>
<option v-if="es_servers" v-for="(server_data, es_server) in es_servers"
:value="es_server"
>
{{ es_server}} ({{ server_data.host }})
</option>
</select>
<br>
<div class="ui fluid es_servers dropdown selection" :class="{loading: isLoadingESServers}">
<input type="hidden" name="es_server">
<i class="dropdown icon"></i>
<div class="default text" v-if="isLoadingESServers">Loading...</div>
<div class="default text" v-else>Select an ElasticSearch server</div>
<div class="menu">
<div v-if="!isLoadingESServers" v-for="(server_data, es_server) in es_servers" :key="es_server" class="item" :data-value="es_server">
{{ es_server }} ({{ server_data.host }})
</div>
</div>
</div>
<br>
</div>

<label>Select a backend to apply the diff to</label>
Expand Down Expand Up @@ -213,7 +216,8 @@ export default {
es_servers: {},
selecting_build_config: null,
isLoadingBackends: false,
backendsDisabled: true
backendsDisabled: true,
isLoadingESServers: false,
}
},
computed: {
Expand All @@ -233,6 +237,7 @@ export default {
methods: {
fetchESServers: function () {
const self = this
self.isLoadingESServers = true
axios.get(axios.defaults.baseURL + '/config')
.then(response => {
Expand All @@ -247,6 +252,14 @@ export default {
self.es_servers = conf.INDEX_CONFIG.value.env
})
.catch(err => {
console.log('Error getting ES servers: ')
console.log(err)
self.loaderror(err)
})
.finally(() => {
self.isLoadingESServers = false
})
},
applyDiff (release) {
var self = this
Expand Down

0 comments on commit 3d8352d

Please sign in to comment.