Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

correct the logs availability UI state #289

Merged
merged 2 commits into from
May 8, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
15 changes: 15 additions & 0 deletions 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 @@ -320,12 +329,15 @@ export default {
break
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
Loading