Skip to content
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
20 changes: 12 additions & 8 deletions src/components/panels/Machine/UpdatePanel/Entry.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
{{ versionOutput }}
</a>
</template>
<template v-else-if="(type === 'web' || type === 'executable') && semverUpdatable">
<a class="info--text text-decoration-none" :href="webLinkRelease" target="_blank">
<template v-else-if="type === 'python' && semverUpdatable">
<a class="info--text text-decoration-none" :href="pythonChangelog" target="_blank">
<v-icon small color="info" class="mr-1">{{ mdiUpdate }}</v-icon>
{{ versionOutput }}
</a>
</template>
<template v-else-if="type === 'python' && semverUpdatable">
<a class="info--text text-decoration-none" :href="pythonChangelog" target="_blank">
<template v-else-if="isSemverType && semverUpdatable">
<a class="info--text text-decoration-none" :href="webLinkRelease" target="_blank">
<v-icon small color="info" class="mr-1">{{ mdiUpdate }}</v-icon>
{{ versionOutput }}
</a>
Expand Down Expand Up @@ -172,6 +172,10 @@ export default class UpdatePanelEntry extends Mixins(BaseMixin) {
return this.repo.configured_type
}

get isSemverType() {
return ['executable', 'python', 'web', 'zip'].includes(this.type)
}

get localVersion() {
const version = this.repo.version ?? '?'
if (!semver.valid(version, { loose: true })) return null
Expand Down Expand Up @@ -271,15 +275,15 @@ 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

if (['python', 'web', 'executable'].includes(this.type)) return !this.semverUpdatable
if (this.isSemverType) return !this.semverUpdatable

return this.commitsBehind.length === 0
}

get btnIcon() {
if (this.isDetached || !this.isValid || this.isCorrupt || this.isDirty) return mdiCloseCircle

if (['python', 'web', 'executable'].includes(this.type)) {
if (this.isSemverType) {
if (this.semverUpdatable) return mdiProgressUpload
else if (this.localVersion === null || this.remoteVersion === null) return mdiHelpCircleOutline
}
Expand All @@ -292,7 +296,7 @@ export default class UpdatePanelEntry extends Mixins(BaseMixin) {
get btnColor() {
if (this.isCorrupt || this.isDetached || this.isDirty || !this.isValid) return 'orange'

if (['python', 'web', 'executable'].includes(this.type) && this.semverUpdatable) return 'primary'
if (this.isSemverType && this.semverUpdatable) return 'primary'
if (this.type === 'git_repo' && this.commitsBehind.length) return 'primary'

return 'green'
Expand All @@ -304,7 +308,7 @@ export default class UpdatePanelEntry extends Mixins(BaseMixin) {
if (this.isDirty) return this.$t('Machine.UpdatePanel.Dirty')
if (!this.isValid) return this.$t('Machine.UpdatePanel.Invalid')

if (['python', 'web', 'executable'].includes(this.type)) {
if (this.isSemverType) {
if (this.semverUpdatable) return this.$t('Machine.UpdatePanel.Update')
else if (this.localVersion === null || this.remoteVersion === null)
return this.$t('Machine.UpdatePanel.Unknown')
Expand Down
Loading