Skip to content

Commit

Permalink
add remove test ExApp button
Browse files Browse the repository at this point in the history
Signed-off-by: Andrey Borysenko <[email protected]>
  • Loading branch information
andrey18106 committed May 8, 2024
1 parent 65bdfd1 commit 82256b4
Showing 1 changed file with 37 additions and 2 deletions.
39 changes: 37 additions & 2 deletions src/components/DaemonConfig/DaemonTestDeploy.vue
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,18 @@
</template>
{{ t('app_api', 'Download ExApp logs') }}
</NcButton>
<NcButton
v-if="!testRunning && hasTestDeployResults"
v-tooltip="{ content: t('app_api', 'Remove test ExApp'), placement: 'top' }"
:disabled="stoppingTest"
type="tertiary"
style="margin-right: 10px;"
@click="removeTestExApp">
<template #icon>
<TrashCan v-if="!stoppingTest" :size="20" />
<NcLoadingIcon v-else :size="20" />
</template>
</NcButton>
<NcButton
v-if="!testRunning"
:disabled="startingTest"
Expand All @@ -77,6 +89,9 @@
{{ t('app_api', 'Stop Deploy test') }}
</NcButton>
</div>
<p v-if="testRunning" class="warning-text">
{{ t('app_api', 'ExApp is unregistered and container is removed on "Stop deploy test"') }}
</p>
</div>
</NcModal>
</template>
Expand All @@ -95,6 +110,7 @@ import Check from 'vue-material-design-icons/Check.vue'
import StopIcon from 'vue-material-design-icons/Stop.vue'
import OpenInNew from 'vue-material-design-icons/OpenInNew.vue'
import Download from 'vue-material-design-icons/Download.vue'
import TrashCan from 'vue-material-design-icons/TrashCan.vue'
export default {
name: 'DaemonTestDeploy',
Expand All @@ -107,6 +123,7 @@ export default {
StopIcon,
OpenInNew,
Download,
TrashCan,
},
props: {
show: {
Expand Down Expand Up @@ -214,6 +231,9 @@ export default {
}
return null
},
hasTestDeployResults() {
return Object.values(this.statusChecks).some(statusCheck => statusCheck.passed || statusCheck.error)
},
},
beforeMount() {
this.fetchTestDeployStatus()
Expand All @@ -225,8 +245,7 @@ export default {
closeModal() {
this.$emit('update:show', false)
},
startDeployTest() {
this.startingTest = true
_cleanupStatusChecks() {
Object.values(this.statusChecks).forEach(statusCheck => {
statusCheck.loading = false
statusCheck.passed = false
Expand All @@ -239,6 +258,10 @@ export default {
statusCheck.heartbeat_count = null
}
})
},
startDeployTest() {
this.startingTest = true
this._cleanupStatusChecks()
this._startDeployTest().then((res) => {
this.testRunning = true
if (this._detectCurrentStep(res.data.status) === 'register') {
Expand Down Expand Up @@ -272,6 +295,11 @@ export default {
this.fetchTestDeployStatus()
}, 1000)
},
removeTestExApp() {
this._stopDeployTest().then(() => {
this._cleanupStatusChecks()
})
},
stopDeployTest() {
this._stopDeployTest().then(() => {
Object.values(this.statusChecks).forEach(statusCheck => {
Expand Down Expand Up @@ -440,5 +468,12 @@ export default {
.error {
color: var(--color-error-text);
}
.warning-text {
display: flex;
justify-content: flex-end;
margin-top: 10px;
color: var(--color-warning-text);
}
}
</style>

0 comments on commit 82256b4

Please sign in to comment.