fix: fix multiple issues in the refactored update manager (#1497)
This commit is contained in:
parent
6a4cca751c
commit
9eb133bd85
@ -19,7 +19,17 @@
|
|||||||
<span v-else>{{ versionOutput }}</span>
|
<span v-else>{{ versionOutput }}</span>
|
||||||
</v-col>
|
</v-col>
|
||||||
<v-col class="col-auto pr-6 text-right" align-self="center">
|
<v-col class="col-auto pr-6 text-right" align-self="center">
|
||||||
<template v-if="needsRecovery">
|
<v-chip
|
||||||
|
v-if="anomalies.length > 0"
|
||||||
|
small
|
||||||
|
label
|
||||||
|
outlined
|
||||||
|
color="primary"
|
||||||
|
class="minwidth-0 px-1 mr-2"
|
||||||
|
@click="toggleAnomalies = !toggleAnomalies">
|
||||||
|
<v-icon small>{{ mdiInformation }}</v-icon>
|
||||||
|
</v-chip>
|
||||||
|
<template v-if="!isValid">
|
||||||
<v-menu :offset-y="true">
|
<v-menu :offset-y="true">
|
||||||
<template #activator="{ on, attrs }">
|
<template #activator="{ on, attrs }">
|
||||||
<v-chip
|
<v-chip
|
||||||
@ -37,16 +47,16 @@
|
|||||||
</v-chip>
|
</v-chip>
|
||||||
</template>
|
</template>
|
||||||
<v-list dense class="py-0">
|
<v-list dense class="py-0">
|
||||||
<v-list-item @click="doRecovery(false)">
|
<v-list-item v-if="!isCorrupt" @click="doRecovery(false)">
|
||||||
<v-list-item-icon class="mr-0">
|
<v-list-item-icon class="mr-0 pt-1">
|
||||||
<v-icon small>{{ mdiReload }}</v-icon>
|
<v-icon small>{{ mdiReload }}</v-icon>
|
||||||
</v-list-item-icon>
|
</v-list-item-icon>
|
||||||
<v-list-item-content>
|
<v-list-item-content>
|
||||||
<v-list-item-title>{{ $t('Machine.UpdatePanel.SoftRecovery') }}</v-list-item-title>
|
<v-list-item-title>{{ $t('Machine.UpdatePanel.SoftRecovery') }}</v-list-item-title>
|
||||||
</v-list-item-content>
|
</v-list-item-content>
|
||||||
</v-list-item>
|
</v-list-item>
|
||||||
<v-list-item @click="doRecovery(true)">
|
<v-list-item :disabled="!existsRecoveryUrl" @click="doRecovery(true)">
|
||||||
<v-list-item-icon class="mr-0">
|
<v-list-item-icon class="mr-0 pt-1">
|
||||||
<v-icon small>{{ mdiReload }}</v-icon>
|
<v-icon small>{{ mdiReload }}</v-icon>
|
||||||
</v-list-item-icon>
|
</v-list-item-icon>
|
||||||
<v-list-item-content>
|
<v-list-item-content>
|
||||||
@ -70,26 +80,6 @@
|
|||||||
</v-chip>
|
</v-chip>
|
||||||
</v-col>
|
</v-col>
|
||||||
</v-row>
|
</v-row>
|
||||||
<v-row v-if="notificationText" class="mt-0">
|
|
||||||
<v-col class="px-6 pt-0">
|
|
||||||
<v-alert text dense :color="notificationColor" :icon="notificationIcon" border="left">
|
|
||||||
{{ notificationText }}
|
|
||||||
</v-alert>
|
|
||||||
</v-col>
|
|
||||||
</v-row>
|
|
||||||
<v-row v-if="gitMessages.length" class="mt-0">
|
|
||||||
<v-col class="px-6 pt-0">
|
|
||||||
<v-alert
|
|
||||||
v-for="(message, index) in gitMessages"
|
|
||||||
:key="'message_' + index"
|
|
||||||
text
|
|
||||||
dense
|
|
||||||
border="left"
|
|
||||||
type="info">
|
|
||||||
{{ message }}
|
|
||||||
</v-alert>
|
|
||||||
</v-col>
|
|
||||||
</v-row>
|
|
||||||
<v-row v-if="warnings.length" class="mt-0">
|
<v-row v-if="warnings.length" class="mt-0">
|
||||||
<v-col class="px-6 pt-0">
|
<v-col class="px-6 pt-0">
|
||||||
<v-alert
|
<v-alert
|
||||||
@ -99,7 +89,21 @@
|
|||||||
dense
|
dense
|
||||||
border="left"
|
border="left"
|
||||||
color="orange"
|
color="orange"
|
||||||
:icon="mdiAlertCircle">
|
:icon="mdiCloseCircle">
|
||||||
|
{{ message }}
|
||||||
|
</v-alert>
|
||||||
|
</v-col>
|
||||||
|
</v-row>
|
||||||
|
<v-row v-show="toggleAnomalies" class="mt-0">
|
||||||
|
<v-col class="px-6 pt-0">
|
||||||
|
<v-alert
|
||||||
|
v-for="(message, index) in anomalies"
|
||||||
|
:key="'anomalies_' + index"
|
||||||
|
text
|
||||||
|
dense
|
||||||
|
border="left"
|
||||||
|
color="info"
|
||||||
|
:icon="mdiInformation">
|
||||||
{{ message }}
|
{{ message }}
|
||||||
</v-alert>
|
</v-alert>
|
||||||
</v-col>
|
</v-col>
|
||||||
@ -123,7 +127,7 @@ import { Component, Mixins, Prop } from 'vue-property-decorator'
|
|||||||
import BaseMixin from '@/components/mixins/base'
|
import BaseMixin from '@/components/mixins/base'
|
||||||
import { ServerUpdateManagerStateGitRepo } from '@/store/server/updateManager/types'
|
import { ServerUpdateManagerStateGitRepo } from '@/store/server/updateManager/types'
|
||||||
import {
|
import {
|
||||||
mdiAlertCircle,
|
mdiCloseCircle,
|
||||||
mdiCheck,
|
mdiCheck,
|
||||||
mdiHelpCircleOutline,
|
mdiHelpCircleOutline,
|
||||||
mdiInformation,
|
mdiInformation,
|
||||||
@ -141,11 +145,13 @@ export default class UpdatePanelEntry extends Mixins(BaseMixin) {
|
|||||||
mdiInformation = mdiInformation
|
mdiInformation = mdiInformation
|
||||||
mdiMenuDown = mdiMenuDown
|
mdiMenuDown = mdiMenuDown
|
||||||
mdiReload = mdiReload
|
mdiReload = mdiReload
|
||||||
mdiAlertCircle = mdiAlertCircle
|
mdiCloseCircle = mdiCloseCircle
|
||||||
|
|
||||||
boolShowCommitList = false
|
boolShowCommitList = false
|
||||||
boolShowUpdateHint = false
|
boolShowUpdateHint = false
|
||||||
|
|
||||||
|
toggleAnomalies = false
|
||||||
|
|
||||||
@Prop({ required: true }) readonly repo!: ServerUpdateManagerStateGitRepo
|
@Prop({ required: true }) readonly repo!: ServerUpdateManagerStateGitRepo
|
||||||
|
|
||||||
get name() {
|
get name() {
|
||||||
@ -230,6 +236,10 @@ export default class UpdatePanelEntry extends Mixins(BaseMixin) {
|
|||||||
return this.repo.is_dirty ?? false
|
return this.repo.is_dirty ?? false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get isCorrupt() {
|
||||||
|
return this.repo.corrupt ?? false
|
||||||
|
}
|
||||||
|
|
||||||
get debugEnabled() {
|
get debugEnabled() {
|
||||||
return this.repo.debug_enabled ?? false
|
return this.repo.debug_enabled ?? false
|
||||||
}
|
}
|
||||||
@ -240,19 +250,21 @@ export default class UpdatePanelEntry extends Mixins(BaseMixin) {
|
|||||||
return !this.debugEnabled && (this.repo.detached ?? false)
|
return !this.debugEnabled && (this.repo.detached ?? false)
|
||||||
}
|
}
|
||||||
|
|
||||||
get needsRecovery() {
|
get existsRecoveryUrl() {
|
||||||
return !this.isValid || this.isDirty
|
const url = this.repo.recovery_url ?? '?'
|
||||||
|
|
||||||
|
return url !== '?'
|
||||||
}
|
}
|
||||||
|
|
||||||
get btnDisabled() {
|
get btnDisabled() {
|
||||||
if (['printing', 'paused'].includes(this.printer_state)) return true
|
if (['printing', 'paused'].includes(this.printer_state)) return true
|
||||||
if (!this.isValid || this.isDirty || this.commitsBehind.length) return false
|
if (!this.isValid || this.isCorrupt || this.isDirty || this.commitsBehind.length) return false
|
||||||
|
|
||||||
return !(this.localVersion && this.remoteVersion && semver.gt(this.remoteVersion, this.localVersion))
|
return !(this.localVersion && this.remoteVersion && semver.gt(this.remoteVersion, this.localVersion))
|
||||||
}
|
}
|
||||||
|
|
||||||
get btnIcon() {
|
get btnIcon() {
|
||||||
if (this.isDetached || !this.isValid || this.isDirty) return mdiAlertCircle
|
if (this.isDetached || !this.isValid || this.isCorrupt || this.isDirty) return mdiCloseCircle
|
||||||
|
|
||||||
if (
|
if (
|
||||||
this.commitsBehind.length ||
|
this.commitsBehind.length ||
|
||||||
@ -266,8 +278,7 @@ export default class UpdatePanelEntry extends Mixins(BaseMixin) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get btnColor() {
|
get btnColor() {
|
||||||
if (this.isDetached || !this.isValid) return 'orange'
|
if (this.isCorrupt || this.isDetached || this.isDirty || !this.isValid) return 'orange'
|
||||||
if (this.isDirty) return 'red'
|
|
||||||
|
|
||||||
if (
|
if (
|
||||||
this.commitsBehind.length ||
|
this.commitsBehind.length ||
|
||||||
@ -279,9 +290,10 @@ export default class UpdatePanelEntry extends Mixins(BaseMixin) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get btnText() {
|
get btnText() {
|
||||||
|
if (this.isCorrupt) return this.$t('Machine.UpdatePanel.Corrupt')
|
||||||
if (this.isDetached) return this.$t('Machine.UpdatePanel.Detached')
|
if (this.isDetached) return this.$t('Machine.UpdatePanel.Detached')
|
||||||
if (!this.isValid) return this.$t('Machine.UpdatePanel.Invalid')
|
|
||||||
if (this.isDirty) return this.$t('Machine.UpdatePanel.Dirty')
|
if (this.isDirty) return this.$t('Machine.UpdatePanel.Dirty')
|
||||||
|
if (!this.isValid) return this.$t('Machine.UpdatePanel.Invalid')
|
||||||
if (
|
if (
|
||||||
this.commitsBehind.length ||
|
this.commitsBehind.length ||
|
||||||
(this.localVersion && this.remoteVersion && semver.gt(this.remoteVersion, this.localVersion))
|
(this.localVersion && this.remoteVersion && semver.gt(this.remoteVersion, this.localVersion))
|
||||||
@ -293,23 +305,8 @@ export default class UpdatePanelEntry extends Mixins(BaseMixin) {
|
|||||||
return this.$t('Machine.UpdatePanel.UpToDate')
|
return this.$t('Machine.UpdatePanel.UpToDate')
|
||||||
}
|
}
|
||||||
|
|
||||||
get notificationText() {
|
get anomalies() {
|
||||||
if (this.isDetached) return this.$t('Machine.UpdatePanel.Notification.Detached')
|
return this.repo.anomalies ?? []
|
||||||
if (this.isDirty) return this.$t('Machine.UpdatePanel.Notification.Dirty')
|
|
||||||
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
|
|
||||||
get notificationColor() {
|
|
||||||
return this.btnColor
|
|
||||||
}
|
|
||||||
|
|
||||||
get notificationIcon() {
|
|
||||||
return this.btnIcon
|
|
||||||
}
|
|
||||||
|
|
||||||
get gitMessages() {
|
|
||||||
return this.repo.git_messages ?? []
|
|
||||||
}
|
}
|
||||||
|
|
||||||
get warnings() {
|
get warnings() {
|
||||||
@ -323,8 +320,12 @@ export default class UpdatePanelEntry extends Mixins(BaseMixin) {
|
|||||||
return semver.gt(this.remoteVersion, this.localVersion)
|
return semver.gt(this.remoteVersion, this.localVersion)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get repo_name() {
|
||||||
|
return this.repo.repo_name ?? this.repo.name ?? ''
|
||||||
|
}
|
||||||
|
|
||||||
get webLinkRelease() {
|
get webLinkRelease() {
|
||||||
return `https://github.com/${this.repo.owner}/${this.repo.name}/releases/tag/${this.repo.remote_version}`
|
return `https://github.com/${this.repo.owner}/${this.repo_name}/releases/tag/${this.repo.remote_version}`
|
||||||
}
|
}
|
||||||
|
|
||||||
get hideUpdateWarning() {
|
get hideUpdateWarning() {
|
||||||
|
@ -85,8 +85,12 @@ export default class GitCommitsListDayCommit extends Mixins(BaseMixin) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get repo_name() {
|
||||||
|
return this.repo.repo_name ?? this.repo.name ?? ''
|
||||||
|
}
|
||||||
|
|
||||||
get commitHref() {
|
get commitHref() {
|
||||||
return `https://github.com/${this.repo.owner}/${this.repo.name}/commit/${this.commit.sha}`
|
return `https://github.com/${this.repo.owner}/${this.repo_name}/commit/${this.commit.sha}`
|
||||||
}
|
}
|
||||||
|
|
||||||
get commitShortSha() {
|
get commitShortSha() {
|
||||||
|
@ -69,13 +69,17 @@ export default class UpdateHintAlert extends Mixins(BaseMixin) {
|
|||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get repo_name() {
|
||||||
|
return this.repo.repo_name ?? this.repo.name ?? ''
|
||||||
|
}
|
||||||
|
|
||||||
get externalLink() {
|
get externalLink() {
|
||||||
if (this.name === 'klipper') return '//www.klipper3d.org/Config_Changes.html'
|
if (this.name === 'klipper') return '//www.klipper3d.org/Config_Changes.html'
|
||||||
if (this.name === 'moonraker') return '//moonraker.readthedocs.io/en/latest/changelog/'
|
if (this.name === 'moonraker') return '//moonraker.readthedocs.io/en/latest/changelog/'
|
||||||
if (this.repo?.configured_type === 'web')
|
if (this.repo?.configured_type === 'web')
|
||||||
return `//github.com/${this.repo.owner}/${this.repo.name}/releases/tag/${this.repo.remote_version}`
|
return `//github.com/${this.repo.owner}/${this.repo_name}/releases/tag/${this.repo.remote_version}`
|
||||||
|
|
||||||
return `//github.com/${this.repo.owner}/${this.repo.name}`
|
return `//github.com/${this.repo.owner}/${this.repo_name}`
|
||||||
}
|
}
|
||||||
|
|
||||||
get externalLinkText() {
|
get externalLinkText() {
|
||||||
|
@ -490,6 +490,7 @@
|
|||||||
"CommittedHoursAgo": "committed {hours} hours ago",
|
"CommittedHoursAgo": "committed {hours} hours ago",
|
||||||
"CommittedOnDate": "committed on {date}",
|
"CommittedOnDate": "committed on {date}",
|
||||||
"CommittedYesterday": "committed yesterday",
|
"CommittedYesterday": "committed yesterday",
|
||||||
|
"Corrupt": "corrupt",
|
||||||
"ConfigChanges": "Config Changes",
|
"ConfigChanges": "Config Changes",
|
||||||
"CountPackagesCanBeUpgraded": "{count} packages can be upgraded",
|
"CountPackagesCanBeUpgraded": "{count} packages can be upgraded",
|
||||||
"Detached": "detached",
|
"Detached": "detached",
|
||||||
|
@ -32,6 +32,7 @@ export interface ServerUpdateManagerStateGitRepoCommit {
|
|||||||
|
|
||||||
export interface ServerUpdateManagerStateGitRepo {
|
export interface ServerUpdateManagerStateGitRepo {
|
||||||
name: string
|
name: string
|
||||||
|
repo_name?: string
|
||||||
configured_type: string
|
configured_type: string
|
||||||
detected_type?: string
|
detected_type?: string
|
||||||
channel?: string
|
channel?: string
|
||||||
@ -47,12 +48,15 @@ export interface ServerUpdateManagerStateGitRepo {
|
|||||||
remote_hash?: string
|
remote_hash?: string
|
||||||
is_valid?: boolean
|
is_valid?: boolean
|
||||||
is_dirty?: boolean
|
is_dirty?: boolean
|
||||||
|
corrupt?: boolean
|
||||||
detached?: boolean
|
detached?: boolean
|
||||||
debug_enabled?: boolean
|
debug_enabled?: boolean
|
||||||
commits_behind?: ServerUpdateManagerStateGitRepoCommit[]
|
commits_behind?: ServerUpdateManagerStateGitRepoCommit[]
|
||||||
git_messages?: string[]
|
git_messages?: string[]
|
||||||
|
anomalies?: string[]
|
||||||
warnings?: string[]
|
warnings?: string[]
|
||||||
info_tags?: string[]
|
info_tags?: string[]
|
||||||
|
recovery_url?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ServerUpdateManagerStateGitRepoGroupedCommits {
|
export interface ServerUpdateManagerStateGitRepoGroupedCommits {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user