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>
|
||||
</v-col>
|
||||
<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">
|
||||
<template #activator="{ on, attrs }">
|
||||
<v-chip
|
||||
@ -37,16 +47,16 @@
|
||||
</v-chip>
|
||||
</template>
|
||||
<v-list dense class="py-0">
|
||||
<v-list-item @click="doRecovery(false)">
|
||||
<v-list-item-icon class="mr-0">
|
||||
<v-list-item v-if="!isCorrupt" @click="doRecovery(false)">
|
||||
<v-list-item-icon class="mr-0 pt-1">
|
||||
<v-icon small>{{ mdiReload }}</v-icon>
|
||||
</v-list-item-icon>
|
||||
<v-list-item-content>
|
||||
<v-list-item-title>{{ $t('Machine.UpdatePanel.SoftRecovery') }}</v-list-item-title>
|
||||
</v-list-item-content>
|
||||
</v-list-item>
|
||||
<v-list-item @click="doRecovery(true)">
|
||||
<v-list-item-icon class="mr-0">
|
||||
<v-list-item :disabled="!existsRecoveryUrl" @click="doRecovery(true)">
|
||||
<v-list-item-icon class="mr-0 pt-1">
|
||||
<v-icon small>{{ mdiReload }}</v-icon>
|
||||
</v-list-item-icon>
|
||||
<v-list-item-content>
|
||||
@ -70,26 +80,6 @@
|
||||
</v-chip>
|
||||
</v-col>
|
||||
</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-col class="px-6 pt-0">
|
||||
<v-alert
|
||||
@ -99,7 +89,21 @@
|
||||
dense
|
||||
border="left"
|
||||
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 }}
|
||||
</v-alert>
|
||||
</v-col>
|
||||
@ -123,7 +127,7 @@ import { Component, Mixins, Prop } from 'vue-property-decorator'
|
||||
import BaseMixin from '@/components/mixins/base'
|
||||
import { ServerUpdateManagerStateGitRepo } from '@/store/server/updateManager/types'
|
||||
import {
|
||||
mdiAlertCircle,
|
||||
mdiCloseCircle,
|
||||
mdiCheck,
|
||||
mdiHelpCircleOutline,
|
||||
mdiInformation,
|
||||
@ -141,11 +145,13 @@ export default class UpdatePanelEntry extends Mixins(BaseMixin) {
|
||||
mdiInformation = mdiInformation
|
||||
mdiMenuDown = mdiMenuDown
|
||||
mdiReload = mdiReload
|
||||
mdiAlertCircle = mdiAlertCircle
|
||||
mdiCloseCircle = mdiCloseCircle
|
||||
|
||||
boolShowCommitList = false
|
||||
boolShowUpdateHint = false
|
||||
|
||||
toggleAnomalies = false
|
||||
|
||||
@Prop({ required: true }) readonly repo!: ServerUpdateManagerStateGitRepo
|
||||
|
||||
get name() {
|
||||
@ -230,6 +236,10 @@ export default class UpdatePanelEntry extends Mixins(BaseMixin) {
|
||||
return this.repo.is_dirty ?? false
|
||||
}
|
||||
|
||||
get isCorrupt() {
|
||||
return this.repo.corrupt ?? false
|
||||
}
|
||||
|
||||
get debugEnabled() {
|
||||
return this.repo.debug_enabled ?? false
|
||||
}
|
||||
@ -240,19 +250,21 @@ export default class UpdatePanelEntry extends Mixins(BaseMixin) {
|
||||
return !this.debugEnabled && (this.repo.detached ?? false)
|
||||
}
|
||||
|
||||
get needsRecovery() {
|
||||
return !this.isValid || this.isDirty
|
||||
get existsRecoveryUrl() {
|
||||
const url = this.repo.recovery_url ?? '?'
|
||||
|
||||
return url !== '?'
|
||||
}
|
||||
|
||||
get btnDisabled() {
|
||||
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))
|
||||
}
|
||||
|
||||
get btnIcon() {
|
||||
if (this.isDetached || !this.isValid || this.isDirty) return mdiAlertCircle
|
||||
if (this.isDetached || !this.isValid || this.isCorrupt || this.isDirty) return mdiCloseCircle
|
||||
|
||||
if (
|
||||
this.commitsBehind.length ||
|
||||
@ -266,8 +278,7 @@ export default class UpdatePanelEntry extends Mixins(BaseMixin) {
|
||||
}
|
||||
|
||||
get btnColor() {
|
||||
if (this.isDetached || !this.isValid) return 'orange'
|
||||
if (this.isDirty) return 'red'
|
||||
if (this.isCorrupt || this.isDetached || this.isDirty || !this.isValid) return 'orange'
|
||||
|
||||
if (
|
||||
this.commitsBehind.length ||
|
||||
@ -279,9 +290,10 @@ export default class UpdatePanelEntry extends Mixins(BaseMixin) {
|
||||
}
|
||||
|
||||
get btnText() {
|
||||
if (this.isCorrupt) return this.$t('Machine.UpdatePanel.Corrupt')
|
||||
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.isValid) return this.$t('Machine.UpdatePanel.Invalid')
|
||||
if (
|
||||
this.commitsBehind.length ||
|
||||
(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')
|
||||
}
|
||||
|
||||
get notificationText() {
|
||||
if (this.isDetached) return this.$t('Machine.UpdatePanel.Notification.Detached')
|
||||
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 anomalies() {
|
||||
return this.repo.anomalies ?? []
|
||||
}
|
||||
|
||||
get warnings() {
|
||||
@ -323,8 +320,12 @@ export default class UpdatePanelEntry extends Mixins(BaseMixin) {
|
||||
return semver.gt(this.remoteVersion, this.localVersion)
|
||||
}
|
||||
|
||||
get repo_name() {
|
||||
return this.repo.repo_name ?? this.repo.name ?? ''
|
||||
}
|
||||
|
||||
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() {
|
||||
|
@ -85,8 +85,12 @@ export default class GitCommitsListDayCommit extends Mixins(BaseMixin) {
|
||||
})
|
||||
}
|
||||
|
||||
get repo_name() {
|
||||
return this.repo.repo_name ?? this.repo.name ?? ''
|
||||
}
|
||||
|
||||
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() {
|
||||
|
@ -69,13 +69,17 @@ export default class UpdateHintAlert extends Mixins(BaseMixin) {
|
||||
return null
|
||||
}
|
||||
|
||||
get repo_name() {
|
||||
return this.repo.repo_name ?? this.repo.name ?? ''
|
||||
}
|
||||
|
||||
get externalLink() {
|
||||
if (this.name === 'klipper') return '//www.klipper3d.org/Config_Changes.html'
|
||||
if (this.name === 'moonraker') return '//moonraker.readthedocs.io/en/latest/changelog/'
|
||||
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() {
|
||||
|
@ -490,6 +490,7 @@
|
||||
"CommittedHoursAgo": "committed {hours} hours ago",
|
||||
"CommittedOnDate": "committed on {date}",
|
||||
"CommittedYesterday": "committed yesterday",
|
||||
"Corrupt": "corrupt",
|
||||
"ConfigChanges": "Config Changes",
|
||||
"CountPackagesCanBeUpgraded": "{count} packages can be upgraded",
|
||||
"Detached": "detached",
|
||||
|
@ -32,6 +32,7 @@ export interface ServerUpdateManagerStateGitRepoCommit {
|
||||
|
||||
export interface ServerUpdateManagerStateGitRepo {
|
||||
name: string
|
||||
repo_name?: string
|
||||
configured_type: string
|
||||
detected_type?: string
|
||||
channel?: string
|
||||
@ -47,12 +48,15 @@ export interface ServerUpdateManagerStateGitRepo {
|
||||
remote_hash?: string
|
||||
is_valid?: boolean
|
||||
is_dirty?: boolean
|
||||
corrupt?: boolean
|
||||
detached?: boolean
|
||||
debug_enabled?: boolean
|
||||
commits_behind?: ServerUpdateManagerStateGitRepoCommit[]
|
||||
git_messages?: string[]
|
||||
anomalies?: string[]
|
||||
warnings?: string[]
|
||||
info_tags?: string[]
|
||||
recovery_url?: string
|
||||
}
|
||||
|
||||
export interface ServerUpdateManagerStateGitRepoGroupedCommits {
|
||||
|
Loading…
x
Reference in New Issue
Block a user