From bee05b351923d9a9751e1946a9168f76c312b935 Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Sat, 6 Jul 2024 20:24:53 +0200 Subject: [PATCH] fix(updateManager): fix updatr for git_repos without semver (#1925) --- .../panels/Machine/UpdatePanel/Entry.vue | 35 +++++++++---------- 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/src/components/panels/Machine/UpdatePanel/Entry.vue b/src/components/panels/Machine/UpdatePanel/Entry.vue index bbe722065..a13f7c3e8 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 } @@ -284,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' } @@ -298,13 +296,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') }