Skip to content

Commit

Permalink
correct the logs availability UI state
Browse files Browse the repository at this point in the history
Signed-off-by: Andrey Borysenko <andrey18106x@gmail.com>
  • Loading branch information
andrey18106 committed May 8, 2024
1 parent 139e793 commit c4b55c5
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/adminSettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ import Vue from 'vue'
import './bootstrap.js'
import AdminSettings from './components/AdminSettings.vue'
import { generateFilePath } from '@nextcloud/router'
import { Tooltip } from '@nextcloud/vue'

Vue.directive('tooltip', Tooltip)

// eslint-disable-next-line
__webpack_public_path__ = generateFilePath(appName, '', 'js/')
Expand Down
17 changes: 16 additions & 1 deletion src/components/DaemonConfig/DaemonTestDeploy.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@
</div>
<div class="actions">
<NcButton
v-tooltip="{ content: downloadLogsTooltip, placement: 'top' }"
:disabled="!canDownloadLogs"
type="tertiary"
:href="getDownloadLogsUrl()"
target="_blank"
Expand Down Expand Up @@ -128,6 +130,7 @@ export default {
stoppingTest: false,
testRunning: false,
polling: null,
canDownloadLogs: false,
statusChecks: {
register: {
id: 'register',
Expand Down Expand Up @@ -205,6 +208,12 @@ export default {
initHeadingProgress() {
return `${this.statusChecks.init.title} (${this.statusChecks.init.progress}%)`
},
downloadLogsTooltip() {
if (!this.canDownloadLogs) {
return t('app_api', 'Only if ExApp container is preset')
}
return null
},
},
beforeMount() {
this.fetchTestDeployStatus()
Expand Down Expand Up @@ -318,14 +327,17 @@ export default {
case 'image_pull':
statusCheck.passed = status.deploy >= 94
break
case 'container_started':
case 'container_started':
statusCheck.passed = status.deploy >= 98
this.canDownloadLogs = true // at status.deploy = 97 container is already created
break
case 'heartbeat':
statusCheck.passed = status.deploy === 100
this.canDownloadLogs = true
break
case 'init':
statusCheck.passed = status.init === 100
this.canDownloadLogs = true
break
case 'enabled':
statusCheck.passed = status.init === 100 && status.deploy === 100 && status.action === '' && status.error === ''
Expand Down Expand Up @@ -401,6 +413,9 @@ export default {
this.polling = null
},
getDownloadLogsUrl() {
if (!this.canDownloadLogs) {
return null
}
return generateUrl('/apps/app_api/apps/logs/test-deploy')
},
},
Expand Down

0 comments on commit c4b55c5

Please sign in to comment.