Skip to content

Commit

Permalink
Issue codecentric#1187 - Add button for requesting actuator/bus-refre…
Browse files Browse the repository at this point in the history
…sh endpoint
  • Loading branch information
skosijer committed Nov 22, 2019
1 parent d4a632f commit 8dadb01
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ class Instance {
return this.axios.post(uri`actuator/refresh`);
}

async refreshContextAllInstances() {
return this.axios.post(uri`actuator/bus-refresh`);
}

async fetchLiquibase() {
return this.axios.get(uri`actuator/liquibase`);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@

<template>
<div class="box">
<h1 class="is-size-6" v-text="$t('instances.env.manager')" />
<h1 class="is-size-6" v-text="$t('instances.env.manager')"/>
<datalist id="allPropertyNames">
<option v-for="name in allPropertyNames" :key="name" v-text="name" />
<option v-for="name in allPropertyNames" :key="name" v-text="name"/>
</datalist>
<div class="field is-horizontal" v-for="(prop, index) in managedProperties" :key="`managed-${index}`">
<div class="field-body">
Expand All @@ -28,38 +28,49 @@
v-model="prop.name" @input="handlePropertyNameChange(prop, index)"
>
</div>
<p class="help is-danger" v-text="prop.validation" />
<p class="help is-danger" v-text="prop.validation"/>
</div>
<div class="field">
<div class="control has-icons-right" :class="{'is-loading' : prop.status === 'executing'}">
<input class="input" type="text" placeholder="Value" v-model="prop.input"
@input="prop.status = null"
>
<span class="icon is-right has-text-success" v-if="prop.status === 'completed'">
<font-awesome-icon icon="check" />
<font-awesome-icon icon="check"/>
</span>
<span class="icon is-right has-text-warning" v-else-if="prop.status === 'failed'">
<font-awesome-icon icon="exclamation-triangle" />
<font-awesome-icon icon="exclamation-triangle"/>
</span>
<span class="icon is-right" v-else-if="prop.input !== prop.value">
<font-awesome-icon icon="pencil-alt" />
<font-awesome-icon icon="pencil-alt"/>
</span>
</div>
</div>
</div>
</div>
<div class="field is-horizontal">
<div class="field-body" v-if="instance.hasEndpoint('refresh')">
<div class="field">
<div class="field is-grouped is-grouped-left">
<div class="control">
<sba-confirm-button class="button is-light"
:class="{'is-loading' : refreshStatus === 'executing', 'is-danger' : refreshStatus === 'failed', 'is-info' : refreshStatus === 'completed'}"
:disabled="refreshStatus === 'executing'"
@click="refreshContext"
>
<span v-if="refreshStatus === 'completed'" v-text="$t('instances.env.context_refreshed')" />
<span v-else-if="refreshStatus === 'failed'" v-text="$t('instances.env.context_refresh_failed')" />
<span v-else v-text="$t('instances.env.context_refresh')" />
<span v-if="refreshStatus === 'completed'" v-text="$t('instances.env.context_refreshed')"/>
<span v-else-if="refreshStatus === 'failed'" v-text="$t('instances.env.context_refresh_failed')"/>
<span v-else v-text="$t('instances.env.context_refresh')"/>
</sba-confirm-button>
</div>
<div class="control">
<sba-confirm-button class="button is-light"
:class="{'is-loading' : refreshStatusAllInstances === 'executing', 'is-danger' : refreshStatusAllInstances === 'failed', 'is-info' : refreshStatusAllInstances === 'completed'}"
:disabled="refreshStatusAllInstances === 'executing'"
@click="refreshContextAllInstances"
>
<span v-if="refreshStatusAllInstances === 'completed'" v-text="$t('instances.env.context_refreshed')"/>
<span v-else-if="refreshStatusAllInstances === 'failed'" v-text="$t('instances.env.context_refresh_failed')"/>
<span v-else v-text="$t('instances.env.context_refresh_all_instances')"/>
</sba-confirm-button>
</div>
</div>
Expand All @@ -72,9 +83,9 @@
:disabled="!hasManagedProperty || resetStatus === 'executing'"
@click="resetEnvironment"
>
<span v-if="resetStatus === 'completed'" v-text="$t('instances.env.context_resetted')" />
<span v-else-if="resetStatus === 'failed'" v-text="$t('instances.env.context_reset_failed')" />
<span v-else v-text="$t('instances.env.context_reset')" />
<span v-if="resetStatus === 'completed'" v-text="$t('instances.env.context_resetted')"/>
<span v-else-if="resetStatus === 'failed'" v-text="$t('instances.env.context_reset_failed')"/>
<span v-else v-text="$t('instances.env.context_reset')"/>
</button>
</div>
<div class="control">
Expand All @@ -83,9 +94,9 @@
:disabled="hasErrorProperty || !hasChangedProperty || updateStatus === 'executing'"
@click="updateEnvironment"
>
<span v-if="updateStatus === 'completed'" v-text="$t('instances.env.context_updated')" />
<span v-else-if="updateStatus === 'failed'" v-text="$t('instances.env.context_update_failed')" />
<span v-else v-text="$t('instances.env.context_updated')" />
<span v-if="updateStatus === 'completed'" v-text="$t('instances.env.context_updated')"/>
<span v-else-if="updateStatus === 'failed'" v-text="$t('instances.env.context_update_failed')"/>
<span v-else v-text="$t('instances.env.context_updated')"/>
</button>
</div>
</div>
Expand Down Expand Up @@ -115,6 +126,7 @@
data: () => ({
error: null,
refreshStatus: null,
refreshStatusAllInstances: null,
resetStatus: null,
updateStatus: null,
managedProperties: [{
Expand Down Expand Up @@ -168,6 +180,18 @@
error: () => vm.$emit('reset')
});
},
refreshContextAllInstances() {
const vm = this;
from(vm.instance.refreshContextAllInstances())
.pipe(listen(status => vm.refreshStatusAllInstances = status))
.subscribe({
complete: () => {
setTimeout(() => vm.refreshStatusAllInstances = null, 2500);
return vm.$emit('reset');
},
error: () => vm.$emit('reset')
});
},
updateEnvironment() {
const vm = this;
from(vm.managedProperties)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"manager": "Umgebungskonfiguration anpassen",
"active_profile": "Profil",
"context_refresh": "Kontext neuladen",
"context_refresh_all_instances": "Aktualisieren Sie den Kontext aller Instanzen",
"context_refresh_failed": "Fehlgeschlagen",
"context_refreshed": "Kontext neu geladen",
"context_reset": "Zurücksetzen",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"manager": "Environment Manager",
"active_profile": "Profile",
"context_refresh": "Refresh Context",
"context_refresh_all_instances": "Refresh Context for all instances",
"context_refresh_failed": "Failed",
"context_refreshed": "Context refreshed",
"context_reset": "Reset",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"manager": "Gestionnaire d'environnement",
"active_profile": "Profil",
"context_refresh": "Rafraîchir le contexte",
"context_refresh_all_instances": "Rafraîchir le contexte pour toutes les instances",
"context_refresh_failed": "Echec",
"context_refreshed": "Contexte rafraîchi",
"context_reset": "Réinitialiser",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"manager": "환경 관리자",
"active_profile": "프로파일",
"context_refresh": "컨텍스트 갱신",
"context_refresh_all_instances": "모든 인스턴스의 컨텍스트를 새로 고칩니다",
"context_refresh_failed": "실패",
"context_refreshed": "컨텍스트가 갱신되었습니다.",
"context_reset": "초기화",
Expand Down

0 comments on commit 8dadb01

Please sign in to comment.