From 6ec2b68f7ec184f36499c9bd5befdb6700e9b27f Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Tue, 2 Jul 2024 19:39:39 +0200 Subject: [PATCH 1/2] fix(updateManager): fix update button for git_repos without semver Signed-off-by: Stefan Dej --- .../panels/Machine/UpdatePanel/Entry.vue | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/src/components/panels/Machine/UpdatePanel/Entry.vue b/src/components/panels/Machine/UpdatePanel/Entry.vue index bbe722065..d4decf944 100644 --- a/src/components/panels/Machine/UpdatePanel/Entry.vue +++ b/src/components/panels/Machine/UpdatePanel/Entry.vue @@ -264,19 +264,20 @@ export default class UpdatePanelEntry extends Mixins(BaseMixin) { if (['printing', 'paused'].includes(this.printer_state)) return true if (!this.isValid || this.isCorrupt || this.isDirty || this.commitsBehind.length) return false - return !(this.localVersion && this.remoteVersion && semver.gt(this.remoteVersion, this.localVersion)) + if (this.type === 'web') return !this.webUpdatable + + return this.commitsBehind.length === 0 } get btnIcon() { if (this.isDetached || !this.isValid || this.isCorrupt || this.isDirty) return mdiCloseCircle - if ( - this.commitsBehind.length || - (this.localVersion && this.remoteVersion && semver.gt(this.remoteVersion, this.localVersion)) - ) - return mdiProgressUpload + if (this.type === 'web') { + if (this.webUpdatable) return mdiProgressUpload + else if (this.localVersion === null || this.remoteVersion === null) return mdiHelpCircleOutline + } - if (this.localVersion === null || this.remoteVersion === null) return mdiHelpCircleOutline + if (this.type === 'git_repo' && this.commitsBehind.length) return mdiProgressUpload return mdiCheck } @@ -298,13 +299,14 @@ export default class UpdatePanelEntry extends Mixins(BaseMixin) { if (this.isDetached) return this.$t('Machine.UpdatePanel.Detached') if (this.isDirty) return this.$t('Machine.UpdatePanel.Dirty') if (!this.isValid) return this.$t('Machine.UpdatePanel.Invalid') - if ( - this.commitsBehind.length || - (this.localVersion && this.remoteVersion && semver.gt(this.remoteVersion, this.localVersion)) - ) - return this.$t('Machine.UpdatePanel.Update') - if (this.localVersion === null || this.remoteVersion === null) return this.$t('Machine.UpdatePanel.Unknown') + if (this.type === 'web') { + if (this.webUpdatable) return this.$t('Machine.UpdatePanel.Update') + else if (this.localVersion === null || this.remoteVersion === null) + return this.$t('Machine.UpdatePanel.Unknown') + } + + if (this.type === 'git_repo' && this.commitsBehind.length) return this.$t('Machine.UpdatePanel.Update') return this.$t('Machine.UpdatePanel.UpToDate') } From 5d753dcfcedd3d8db10eff4cbfa357e9870cf08c Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Tue, 2 Jul 2024 20:51:37 +0200 Subject: [PATCH 2/2] fix(updateManager): fix also button color Signed-off-by: Stefan Dej --- src/components/panels/Machine/UpdatePanel/Entry.vue | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/components/panels/Machine/UpdatePanel/Entry.vue b/src/components/panels/Machine/UpdatePanel/Entry.vue index d4decf944..a13f7c3e8 100644 --- a/src/components/panels/Machine/UpdatePanel/Entry.vue +++ b/src/components/panels/Machine/UpdatePanel/Entry.vue @@ -285,11 +285,8 @@ export default class UpdatePanelEntry extends Mixins(BaseMixin) { get btnColor() { if (this.isCorrupt || this.isDetached || this.isDirty || !this.isValid) return 'orange' - if ( - this.commitsBehind.length || - (this.localVersion && this.remoteVersion && semver.gt(this.remoteVersion, this.localVersion)) - ) - return 'primary' + if (this.type === 'web' && this.webUpdatable) return 'primary' + if (this.type === 'git_repo' && this.commitsBehind.length) return 'primary' return 'green' }