Skip to content

Commit

Permalink
disable update button for manual-install (#206)
Browse files Browse the repository at this point in the history
Signed-off-by: Andrey Borysenko <andrey18106x@gmail.com>
  • Loading branch information
andrey18106 authored Jan 11, 2024
1 parent d3c6e7e commit abc62a9
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/components/Apps/AppDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
class="update primary"
type="button"
:value="t('settings', 'Update to {version}', { version: app.update })"
:disabled="installing || isLoading"
:disabled="installing || isLoading || isManualInstall"
:title="updateButtonText"
@click="update(app.id)">
<input v-if="app.canUnInstall"
class="uninstall"
Expand Down
3 changes: 2 additions & 1 deletion src/components/Apps/AppItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@
<div v-if="isLoading || isInitializing" class="icon icon-loading-small" />
<NcButton v-if="app.update"
type="primary"
:disabled="installing || isLoading || !defaultDeployDaemonAccessible"
:disabled="installing || isLoading || !defaultDeployDaemonAccessible || isManualInstall"
:title="updateButtonText"
@click.stop="update(app.id)">
{{ t('settings', 'Update to {update}', {update:app.update}) }}
</NcButton>
Expand Down
4 changes: 2 additions & 2 deletions src/components/Apps/AppList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ export default {
return this.apps.filter(app => app.update).length > 0
},
showUpdateAll() {
return this.hasPendingUpdate && this.useListView
return this.hasPendingUpdate && this.useListView && !this.apps.every(app => app?.daemon?.accepts_deploy_id !== 'manual_install')
},
apps() {
const apps = this.$store.getters.getAllApps
Expand Down Expand Up @@ -219,7 +219,7 @@ export default {
updateAll() {
const limit = pLimit(1)
this.apps
.filter(app => app.update)
.filter(app => app.update && app.daemon.accepts_deploy_id !== 'manual_install')
.map(app => limit(() => this.$store.dispatch('updateApp', { appId: app.id })),
)
},
Expand Down
9 changes: 9 additions & 0 deletions src/mixins/AppManagement.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@ export default {
isInitializing() {
return this.app && Object.hasOwn(this.app?.status, 'progress') && this.app.status.progress < 100
},
isManualInstall() {
return this.app?.daemon?.accepts_deploy_id === 'manual-install'
},
updateButtonText() {
if (this.app?.daemon?.accepts_deploy_id === 'manual-install') {
return t('app_api', 'manual-install apps cannot be updated')
}
return ''
},
enableButtonText() {
if (this.app && Object.hasOwn(this.app?.status, 'progress')) {
return t('app_api', '{progress}% Initializing', { progress: this.app.status?.progress })
Expand Down

0 comments on commit abc62a9

Please sign in to comment.