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

fix(updateManager): fix updatr for git_repos without semver #1925

Merged
Merged
Changes from all commits
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
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
Loading