Skip to content

Commit

Permalink
fix(updateManager): fix updatr for git_repos without semver (#1925)
Browse files Browse the repository at this point in the history
  • Loading branch information
meteyou authored Jul 6, 2024
1 parent 43a20d8 commit bee05b3
Showing 1 changed file with 17 additions and 18 deletions.
35 changes: 17 additions & 18 deletions src/components/panels/Machine/UpdatePanel/Entry.vue
Original file line number Diff line number Diff line change
Expand Up @@ -264,31 +264,29 @@ 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
}
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'
}
Expand All @@ -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')
}
Expand Down

0 comments on commit bee05b3

Please sign in to comment.