refactor: display errors and warnings in the update_manager (#1453)
Co-authored-by: th33xitus <domwil1091+github@gmail.com> Co-authored-by: rackrick <45207681+rackrick@users.noreply.github.com>
This commit is contained in:
24 files changed
+1461
-698
No files matched your search
@@ -161,10 +161,14 @@ export default class TheUpdateDialog extends Mixins(BaseMixin) {
|
||||
this.complete &&
|
||||
['client', 'mainsail', 'full'].includes(this.application.toLowerCase())
|
||||
)
|
||||
window.location.reload(true)
|
||||
window.location.reload()
|
||||
else {
|
||||
this.$store.commit('server/updateManager/resetUpdateResponse')
|
||||
this.$socket.emit('machine.update.status', { refresh: false }, { action: 'server/updateManager/getStatus' })
|
||||
this.$socket.emit(
|
||||
'machine.update.status',
|
||||
{ refresh: false },
|
||||
{ action: 'server/updateManager/onUpdateStatus' }
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,63 +1,3 @@
|
||||
<style lang="scss" scoped>
|
||||
.cursor--pointer {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
ul.commits {
|
||||
list-style: none;
|
||||
|
||||
li {
|
||||
border-color: rgb(48, 54, 61);
|
||||
border-style: solid;
|
||||
border-width: 1px;
|
||||
border-bottom-width: 0;
|
||||
|
||||
&:first-child {
|
||||
border-top-left-radius: 6px;
|
||||
border-top-right-radius: 6px;
|
||||
}
|
||||
|
||||
&:last-child {
|
||||
border-bottom-width: 1px;
|
||||
border-bottom-left-radius: 6px;
|
||||
border-bottom-right-radius: 6px;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<style lang="scss">
|
||||
.v-timeline.groupedCommits {
|
||||
.v-timeline-item__dot--small {
|
||||
width: 18px;
|
||||
height: 15px;
|
||||
margin-top: 2px;
|
||||
|
||||
&:before {
|
||||
display: block;
|
||||
content: ' ';
|
||||
position: relative;
|
||||
width: 18px;
|
||||
height: 2px;
|
||||
top: 7px;
|
||||
background: rgba(255, 255, 255, 0.5);
|
||||
z-index: 1;
|
||||
}
|
||||
}
|
||||
|
||||
.v-timeline-item__inner-dot {
|
||||
background-color: #1e1e1e !important;
|
||||
border: 2px solid rgba(255, 255, 255, 0.5) !important;
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
margin-left: 5px;
|
||||
margin-top: 2px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<panel
|
||||
@@ -85,578 +25,119 @@ ul.commits {
|
||||
<span>{{ $t('Machine.UpdatePanel.CheckForUpdates') }}</span>
|
||||
</v-tooltip>
|
||||
</template>
|
||||
<v-card-text class="px-0 py-0">
|
||||
<v-container py-0 px-0>
|
||||
<div v-for="(value, key, index) of updateableSoftwares" :key="key">
|
||||
<v-divider v-if="index" class="my-0"></v-divider>
|
||||
<v-row class="py-2">
|
||||
<v-col class="pl-6">
|
||||
<strong>{{ 'name' in value ? value.name : key }}</strong>
|
||||
<br />
|
||||
<span
|
||||
:class="getVersionClickable(value) ? 'primary--text cursor--pointer' : ''"
|
||||
@click="openCommitsOverlay(key, value)">
|
||||
<v-icon v-if="getVersionClickable(value)" small color="primary" class="mr-1">
|
||||
{{ mdiInformation }}
|
||||
</v-icon>
|
||||
{{ getVersionOutput(value) }}
|
||||
</span>
|
||||
</v-col>
|
||||
<v-col class="col-auto pr-6 text-right" align-self="center">
|
||||
<template v-if="getRecoveryOptions(value)">
|
||||
<v-menu :offset-y="true" title="Webcam">
|
||||
<template #activator="{ on, attrs }">
|
||||
<v-chip
|
||||
small
|
||||
label
|
||||
outlined
|
||||
:color="getBtnColor(value)"
|
||||
:disabled="getBtnDisabled(value)"
|
||||
class="minwidth-0 px-2 text-uppercase"
|
||||
v-bind="attrs"
|
||||
v-on="on">
|
||||
<v-icon small class="mr-1">{{ getBtnIcon(value) }}</v-icon>
|
||||
{{ getBtnText(value) }}
|
||||
<v-icon small>{{ mdiMenuDown }}</v-icon>
|
||||
</v-chip>
|
||||
</template>
|
||||
<v-list dense class="py-0">
|
||||
<v-list-item @click="recovery(key, false)">
|
||||
<v-list-item-icon class="mr-0">
|
||||
<v-icon small>{{ mdiReload }}</v-icon>
|
||||
</v-list-item-icon>
|
||||
<v-list-item-content>
|
||||
<v-list-item-title>Soft Recovery</v-list-item-title>
|
||||
</v-list-item-content>
|
||||
</v-list-item>
|
||||
<v-list-item @click="recovery(key, true)">
|
||||
<v-list-item-icon class="mr-0">
|
||||
<v-icon small>{{ mdiReload }}</v-icon>
|
||||
</v-list-item-icon>
|
||||
<v-list-item-content>
|
||||
<v-list-item-title>Hard Recovery</v-list-item-title>
|
||||
</v-list-item-content>
|
||||
</v-list-item>
|
||||
</v-list>
|
||||
</v-menu>
|
||||
</template>
|
||||
<template v-else>
|
||||
<v-chip
|
||||
small
|
||||
label
|
||||
outlined
|
||||
:color="getBtnColor(value)"
|
||||
:disabled="getBtnDisabled(value)"
|
||||
class="minwidth-0 px-2 text-uppercase"
|
||||
@click="updateModule(key)">
|
||||
<v-icon small class="mr-1">{{ getBtnIcon(value) }}</v-icon>
|
||||
{{ getBtnText(value) }}
|
||||
</v-chip>
|
||||
</template>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</div>
|
||||
<template v-if="'system' in version_info">
|
||||
<v-divider class="my-0 border-top-2"></v-divider>
|
||||
<v-row class="pt-2">
|
||||
<v-col class="col-auto pl-6 text-no-wrap">
|
||||
<strong>{{ $t('Machine.UpdatePanel.System') }}</strong>
|
||||
<br />
|
||||
<v-tooltip v-if="version_info.system.package_count > 0" top :max-width="300">
|
||||
<template #activator="{ on, attrs }">
|
||||
<span v-bind="attrs" v-on="on">
|
||||
{{ version_info.system.package_count }}
|
||||
{{ $t('Machine.UpdatePanel.PackagesCanBeUpgraded') }}
|
||||
</span>
|
||||
</template>
|
||||
<span>{{ version_info.system.package_list.join(', ') }}</span>
|
||||
</v-tooltip>
|
||||
<span v-if="version_info.system.package_count === 0">
|
||||
{{ $t('Machine.UpdatePanel.OSPackages') }}
|
||||
</span>
|
||||
</v-col>
|
||||
<v-col class="pr-6 text-right" align-self="center">
|
||||
<v-chip
|
||||
small
|
||||
label
|
||||
outlined
|
||||
:color="version_info.system.package_count ? 'primary' : 'green'"
|
||||
:disabled="!version_info.system.package_count || printer_state === 'printing'"
|
||||
class="minwidth-0 px-2 text-uppercase"
|
||||
@click="updateSystem">
|
||||
<v-icon small class="mr-1">
|
||||
{{ version_info.system.package_count ? mdiProgressUpload : mdiCheck }}
|
||||
</v-icon>
|
||||
{{
|
||||
version_info.system.package_count
|
||||
? $t('Machine.UpdatePanel.Upgrade')
|
||||
: $t('Machine.UpdatePanel.UpToDate')
|
||||
}}
|
||||
</v-chip>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-card-text class="px-0 py-0 update-manager-list">
|
||||
<template v-if="checkInitState">
|
||||
<template v-for="(module, index) in modules">
|
||||
<v-divider v-if="index" :key="'divider_' + module.name" class="my-0" />
|
||||
<update-panel-entry :key="module.name" :repo="module.data" />
|
||||
</template>
|
||||
<template v-if="existsSystemModul">
|
||||
<v-divider v-if="modules.length" class="my-0" />
|
||||
<update-panel-entry-system />
|
||||
</template>
|
||||
<template v-if="showUpdateAll">
|
||||
<v-divider class="mb-0 mt-2 border-top-2"></v-divider>
|
||||
<v-row class="pt-3">
|
||||
<v-col class="text-center">
|
||||
<v-btn
|
||||
text
|
||||
color="primary"
|
||||
small
|
||||
:disabled="['printing', 'paused'].includes(printer_state)"
|
||||
@click="updateAll">
|
||||
<v-icon left>{{ mdiProgressUpload }}</v-icon>
|
||||
{{ $t('Machine.UpdatePanel.UpdateAll') }}
|
||||
</v-btn>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-divider class="mb-0 mt-2 border-top-2" />
|
||||
<update-panel-entry-all />
|
||||
</template>
|
||||
</v-container>
|
||||
</template>
|
||||
<template v-else>
|
||||
<v-row class="mt-0 mb-0">
|
||||
<v-col class="px-6">
|
||||
<v-alert class="mb-0" text dense type="info" border="left">
|
||||
{{ $t('Machine.UpdatePanel.InitUpdateManager') }}
|
||||
</v-alert>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</template>
|
||||
</v-card-text>
|
||||
</panel>
|
||||
<v-dialog v-model="commitsOverlay.bool" persistent max-width="800">
|
||||
<panel
|
||||
:title="$t('Machine.UpdatePanel.Commits')"
|
||||
:icon="mdiUpdate"
|
||||
:margin-bottom="false"
|
||||
card-class="machine-update-commits-dialog">
|
||||
<template #buttons>
|
||||
<v-btn icon tile @click="commitsOverlay.bool = false">
|
||||
<v-icon>{{ mdiCloseThick }}</v-icon>
|
||||
</v-btn>
|
||||
</template>
|
||||
<v-card-text class="py-0 px-0">
|
||||
<overlay-scrollbars style="max-height: 400px" :options="{ overflowBehavior: { x: 'hidden' } }">
|
||||
<v-row>
|
||||
<v-col class="pt-3 pl-0">
|
||||
<v-timeline class="groupedCommits" align-top dense>
|
||||
<v-timeline-item
|
||||
v-for="group of commitsOverlay.groupedCommits"
|
||||
:key="group.date.getTime()"
|
||||
small>
|
||||
<v-row class="pt-0">
|
||||
<v-col class="pr-12">
|
||||
<h3 class="caption">
|
||||
{{
|
||||
$t('Machine.UpdatePanel.CommitsOnDate', {
|
||||
date: new Date(group.date).toLocaleDateString(
|
||||
language,
|
||||
dateOptions
|
||||
),
|
||||
})
|
||||
}}
|
||||
</h3>
|
||||
<ul class="commits mt-3 pl-0">
|
||||
<li
|
||||
v-for="commit of group.commits"
|
||||
:key="commit.sha"
|
||||
class="commit px-3 py-2">
|
||||
<v-row>
|
||||
<v-col>
|
||||
<h4 class="subtitle-2 text--white mb-0">
|
||||
{{ commit.subject }}
|
||||
<v-chip
|
||||
v-if="!openCommits.includes(commit.sha)"
|
||||
outlined
|
||||
label
|
||||
x-small
|
||||
class="ml-2 px-2"
|
||||
@click="openCommits.push(commit.sha)">
|
||||
<v-icon small>{{ mdiDotsHorizontal }}</v-icon>
|
||||
</v-chip>
|
||||
</h4>
|
||||
<p
|
||||
v-if="openCommits.includes(commit.sha)"
|
||||
class="caption text--secondary mb-2"
|
||||
style="white-space: pre-line"
|
||||
v-html="commit.message"></p>
|
||||
<p class="caption mb-0">
|
||||
<span
|
||||
class="font-weight-bold text-decoration-none white--text">
|
||||
{{ commit.author }}
|
||||
</span>
|
||||
<span>{{ convertCommitDate(commit.date) }}</span>
|
||||
</p>
|
||||
</v-col>
|
||||
<v-col class="col-auto pt-4">
|
||||
<v-chip
|
||||
outlined
|
||||
label
|
||||
small
|
||||
:href="
|
||||
'https://github.com/' +
|
||||
commitsOverlay.owner +
|
||||
'/' +
|
||||
commitsOverlay.repoName +
|
||||
'/commit/' +
|
||||
commit.sha
|
||||
"
|
||||
target="_blank">
|
||||
{{ commit.sha.substr(0, 6) }}
|
||||
</v-chip>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</li>
|
||||
</ul>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-timeline-item>
|
||||
</v-timeline>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</overlay-scrollbars>
|
||||
</v-card-text>
|
||||
</panel>
|
||||
</v-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { Component, Mixins } from 'vue-property-decorator'
|
||||
import BaseMixin from '../../mixins/base'
|
||||
import semver from 'semver'
|
||||
import Panel from '@/components/ui/Panel.vue'
|
||||
import { ServerUpdateMangerStateVersionInfoGitRepoCommits } from '@/store/server/updateManager/types'
|
||||
import VueI18n from 'vue-i18n'
|
||||
import DateTimeFormatOptions = VueI18n.DateTimeFormatOptions
|
||||
import {
|
||||
mdiRefresh,
|
||||
mdiAlertCircle,
|
||||
mdiCheck,
|
||||
mdiHelpCircleOutline,
|
||||
mdiInformation,
|
||||
mdiMenuDown,
|
||||
mdiProgressUpload,
|
||||
mdiReload,
|
||||
mdiDotsHorizontal,
|
||||
mdiCloseThick,
|
||||
mdiUpdate,
|
||||
} from '@mdi/js'
|
||||
|
||||
interface groupedCommit {
|
||||
date: Date
|
||||
commits: ServerUpdateMangerStateVersionInfoGitRepoCommits[]
|
||||
}
|
||||
|
||||
interface commitsOverlay {
|
||||
bool: boolean
|
||||
owner: string
|
||||
modul: string
|
||||
repoName: string
|
||||
commits: ServerUpdateMangerStateVersionInfoGitRepoCommits[]
|
||||
groupedCommits: groupedCommit[]
|
||||
}
|
||||
import UpdatePanelEntry from '@/components/panels/Machine/UpdatePanel/Entry.vue'
|
||||
import UpdatePanelEntrySystem from '@/components/panels/Machine/UpdatePanel/EntrySystem.vue'
|
||||
import UpdatePanelEntryAll from '@/components/panels/Machine/UpdatePanel/EntryAll.vue'
|
||||
import { mdiRefresh, mdiInformation, mdiCloseThick, mdiUpdate } from '@mdi/js'
|
||||
import { ServerUpdateManagerStateGuiList } from '@/store/server/updateManager/types'
|
||||
import semver from 'semver'
|
||||
|
||||
@Component({
|
||||
components: { Panel },
|
||||
components: { Panel, UpdatePanelEntry, UpdatePanelEntrySystem, UpdatePanelEntryAll },
|
||||
})
|
||||
export default class UpdatePanel extends Mixins(BaseMixin) {
|
||||
mdiCheck = mdiCheck
|
||||
mdiRefresh = mdiRefresh
|
||||
mdiInformation = mdiInformation
|
||||
mdiMenuDown = mdiMenuDown
|
||||
mdiReload = mdiReload
|
||||
mdiProgressUpload = mdiProgressUpload
|
||||
mdiCloseThick = mdiCloseThick
|
||||
mdiDotsHorizontal = mdiDotsHorizontal
|
||||
mdiUpdate = mdiUpdate
|
||||
|
||||
private openCommits: string[] = []
|
||||
|
||||
private dateOptions: DateTimeFormatOptions = {
|
||||
year: 'numeric',
|
||||
month: 'short',
|
||||
day: 'numeric',
|
||||
}
|
||||
|
||||
private commitsOverlay: commitsOverlay = {
|
||||
bool: false,
|
||||
owner: '',
|
||||
modul: '',
|
||||
repoName: '',
|
||||
commits: [],
|
||||
groupedCommits: [],
|
||||
}
|
||||
|
||||
get language() {
|
||||
return this.$store.state.gui.general.language ?? 'en'
|
||||
}
|
||||
|
||||
get enableUpdateManager() {
|
||||
return this.$store.state.server.components.includes('update_manager')
|
||||
}
|
||||
|
||||
get version_info() {
|
||||
return this.$store.state.server.updateManager.version_info
|
||||
get modules() {
|
||||
return this.$store.getters['server/updateManager/getUpdateManagerList'] ?? []
|
||||
}
|
||||
|
||||
get updateableSoftwares() {
|
||||
return this.$store.getters['server/updateManager/getUpdateableSoftwares']
|
||||
get existsSystemModul() {
|
||||
return 'system' in this.$store.state.server.updateManager
|
||||
}
|
||||
|
||||
get systemPackagesCount() {
|
||||
return this.$store.state.server.updateManager?.system?.package_count ?? 0
|
||||
}
|
||||
|
||||
get checkInitState() {
|
||||
const initModules = this.modules.filter(
|
||||
(module: ServerUpdateManagerStateGuiList) => module.data.remote_version !== '?'
|
||||
)
|
||||
|
||||
return initModules.length > 0
|
||||
}
|
||||
|
||||
get showUpdateAll() {
|
||||
let updateableModuls = 0
|
||||
let count = 0
|
||||
|
||||
Object.keys(this.updateableSoftwares).forEach((modulename) => {
|
||||
const module = this.updateableSoftwares[modulename]
|
||||
this.modules.forEach((module: ServerUpdateManagerStateGuiList) => {
|
||||
// check git repos for updates
|
||||
if (module.type === 'git' && module.data?.commits_behind?.length) {
|
||||
count++
|
||||
return
|
||||
}
|
||||
|
||||
// check client web for updates
|
||||
if (
|
||||
'version' in module &&
|
||||
'remote_version' in module &&
|
||||
semver.valid(module.remote_version) &&
|
||||
semver.valid(module.version) &&
|
||||
semver.gt(module.remote_version, module.version)
|
||||
)
|
||||
updateableModuls++
|
||||
module.type === 'web' &&
|
||||
semver.valid(module.data?.remote_version) &&
|
||||
semver.valid(module.data?.version) &&
|
||||
semver.gt(module.data?.remote_version, module.data?.version)
|
||||
) {
|
||||
count++
|
||||
return
|
||||
}
|
||||
})
|
||||
|
||||
if (this.version_info?.system?.package_count > 0) updateableModuls++
|
||||
return updateableModuls > 1
|
||||
// check system packages for upgrades
|
||||
if (this.systemPackagesCount > 0) count++
|
||||
|
||||
return count > 1
|
||||
}
|
||||
|
||||
btnSync() {
|
||||
this.$socket.emit(
|
||||
'machine.update.status',
|
||||
{ refresh: true },
|
||||
{ action: 'server/updateManager/getStatus', loading: 'loadingBtnSyncUpdateManager' }
|
||||
{ action: 'server/updateManager/onUpdateStatus', loading: 'loadingBtnSyncUpdateManager' }
|
||||
)
|
||||
}
|
||||
|
||||
getBtnColor(object: any) {
|
||||
if (typeof object === 'object' && object !== false) {
|
||||
if ('debug_enabled' in object && !object.debug_enabled && 'detached' in object && object.detached)
|
||||
return 'orange'
|
||||
if ('is_dirty' in object && object.is_dirty) return 'orange'
|
||||
if ('is_valid' in object && !object.is_valid) return 'red'
|
||||
|
||||
if (
|
||||
'version' in object &&
|
||||
'remote_version' in object &&
|
||||
semver.valid(object.remote_version) &&
|
||||
semver.valid(object.version) &&
|
||||
semver.gt(object.remote_version, object.version)
|
||||
)
|
||||
return 'primary'
|
||||
|
||||
if ((object.commits_behind ?? []).length) return 'primary'
|
||||
|
||||
if (
|
||||
'version' in object &&
|
||||
'remote_version' in object &&
|
||||
(object.version === '?' || object.remote_version === '?')
|
||||
)
|
||||
return 'gray'
|
||||
|
||||
return 'green'
|
||||
}
|
||||
|
||||
return 'red'
|
||||
}
|
||||
|
||||
getBtnText(object: any) {
|
||||
if (typeof object === 'object' && object !== false) {
|
||||
if ('debug_enabled' in object && !object.debug_enabled && 'detached' in object && object.detached)
|
||||
return this.$t('Machine.UpdatePanel.Detached')
|
||||
if ('is_valid' in object && !object.is_valid) return this.$t('Machine.UpdatePanel.Invalid')
|
||||
if ('is_dirty' in object && object.is_dirty) return this.$t('Machine.UpdatePanel.Dirty')
|
||||
|
||||
if (
|
||||
'version' in object &&
|
||||
'remote_version' in object &&
|
||||
semver.valid(object.remote_version) &&
|
||||
semver.valid(object.version) &&
|
||||
semver.gt(object.remote_version, object.version)
|
||||
)
|
||||
return this.$t('Machine.UpdatePanel.Update')
|
||||
|
||||
if ((object.commits_behind ?? []).length) return this.$t('Machine.UpdatePanel.Update')
|
||||
|
||||
if (
|
||||
'version' in object &&
|
||||
'remote_version' in object &&
|
||||
(object.version === '?' || object.remote_version === '?')
|
||||
)
|
||||
return this.$t('Machine.UpdatePanel.Unknown')
|
||||
|
||||
return this.$t('Machine.UpdatePanel.UpToDate')
|
||||
}
|
||||
|
||||
return this.$t('Machine.UpdatePanel.ERROR')
|
||||
}
|
||||
|
||||
getBtnIcon(object: any) {
|
||||
if (typeof object === 'object' && object !== false) {
|
||||
if ('debug_enabled' in object && !object.debug_enabled && 'detached' in object && object.detached)
|
||||
return mdiAlertCircle
|
||||
if ('is_valid' in object && !object.is_valid) return mdiAlertCircle
|
||||
if ('is_dirty' in object && object.is_dirty) return mdiAlertCircle
|
||||
|
||||
if (
|
||||
'version' in object &&
|
||||
'remote_version' in object &&
|
||||
semver.valid(object.remote_version) &&
|
||||
semver.valid(object.version) &&
|
||||
semver.gt(object.remote_version, object.version)
|
||||
)
|
||||
return mdiProgressUpload
|
||||
|
||||
if ((object.commits_behind ?? []).length) return mdiProgressUpload
|
||||
|
||||
if (
|
||||
'version' in object &&
|
||||
'remote_version' in object &&
|
||||
(object.version === '?' || object.remote_version === '?')
|
||||
)
|
||||
return mdiHelpCircleOutline
|
||||
|
||||
return mdiCheck
|
||||
}
|
||||
|
||||
return 'ERROR'
|
||||
}
|
||||
|
||||
getBtnDisabled(object: any) {
|
||||
if (['printing', 'paused'].includes(this.printer_state)) return true
|
||||
|
||||
if ('is_valid' in object && !object.is_valid) return false
|
||||
if ('is_dirty' in object && object.is_dirty) return false
|
||||
|
||||
if (typeof object === 'object' && object !== false) {
|
||||
if ((object.commits_behind ?? []).length) return false
|
||||
|
||||
if (
|
||||
'version' in object &&
|
||||
'remote_version' in object &&
|
||||
semver.valid(object.remote_version) &&
|
||||
semver.valid(object.version) &&
|
||||
semver.gt(object.remote_version, object.version)
|
||||
)
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
getVersionOutput(object: any) {
|
||||
const local_version = object.version ?? '?'
|
||||
const remote_version = object.remote_version ?? '?'
|
||||
const commits_behind = object.commits_behind ?? []
|
||||
|
||||
let output = ''
|
||||
if ('remote_alias' in object && object.remote_alias !== 'origin') output += object.remote_alias
|
||||
if ('branch' in object && !['master', 'main'].includes(object.branch)) {
|
||||
if (output !== '') output += '/'
|
||||
|
||||
output += object.branch
|
||||
}
|
||||
if (output !== '') output += ': '
|
||||
|
||||
if (semver.valid(remote_version) && semver.valid(local_version) && semver.gt(remote_version, local_version))
|
||||
output += local_version + ' > ' + remote_version
|
||||
else if (commits_behind.length)
|
||||
output +=
|
||||
local_version +
|
||||
' > ' +
|
||||
this.$tc('Machine.UpdatePanel.CommitsAvailable', commits_behind.length, {
|
||||
count: commits_behind.length,
|
||||
})
|
||||
else if ('full_version_string' in object && object.full_version_string !== '?')
|
||||
output += object.full_version_string
|
||||
else output += local_version
|
||||
|
||||
return output
|
||||
}
|
||||
|
||||
getVersionClickable(object: any) {
|
||||
return 'commits_behind' in object && object.commits_behind.length
|
||||
}
|
||||
|
||||
getRecoveryOptions(object: any) {
|
||||
if ('is_valid' in object && !object.is_valid) return true
|
||||
else if ('is_dirty' in object && object.is_dirty) return true
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
updateAll() {
|
||||
this.$socket.emit('machine.update.full', {})
|
||||
}
|
||||
|
||||
updateModule(key: string) {
|
||||
if (['klipper', 'moonraker'].includes(key)) this.$socket.emit('machine.update.' + key, {})
|
||||
else this.$socket.emit('machine.update.client', { name: key })
|
||||
}
|
||||
|
||||
recovery(name: string, hard: boolean) {
|
||||
this.$socket.emit('machine.update.recover', { name: name, hard: hard })
|
||||
}
|
||||
|
||||
updateSystem() {
|
||||
this.$socket.emit('machine.update.system', {})
|
||||
}
|
||||
|
||||
openCommitsOverlay(key: string, object: any) {
|
||||
if ('commits_behind' in object && 'owner' in object && object.commits_behind.length) {
|
||||
this.openCommits = []
|
||||
this.commitsOverlay.owner = object.owner
|
||||
this.commitsOverlay.modul = key
|
||||
this.commitsOverlay.repoName = object.repo_name ?? key
|
||||
this.commitsOverlay.commits = object.commits_behind
|
||||
this.commitsOverlay.groupedCommits = []
|
||||
|
||||
let lastDate: null | Date = null
|
||||
let tmpCommits: ServerUpdateMangerStateVersionInfoGitRepoCommits[] = []
|
||||
|
||||
object.commits_behind.forEach((commit: any) => {
|
||||
const commitDate = new Date(commit.date * 1000)
|
||||
if (
|
||||
lastDate === null ||
|
||||
commitDate.getFullYear() !== lastDate.getFullYear() ||
|
||||
commitDate.getMonth() !== lastDate.getMonth() ||
|
||||
commitDate.getDay() !== lastDate.getDay()
|
||||
) {
|
||||
if (tmpCommits.length && lastDate !== null) {
|
||||
this.commitsOverlay.groupedCommits.push({
|
||||
date: lastDate,
|
||||
commits: [...tmpCommits],
|
||||
})
|
||||
}
|
||||
|
||||
lastDate = commitDate
|
||||
tmpCommits = []
|
||||
}
|
||||
|
||||
tmpCommits.push(commit)
|
||||
})
|
||||
|
||||
if (lastDate && tmpCommits.length) {
|
||||
this.commitsOverlay.groupedCommits.push({
|
||||
date: lastDate,
|
||||
commits: [...tmpCommits],
|
||||
})
|
||||
}
|
||||
|
||||
this.commitsOverlay.bool = true
|
||||
}
|
||||
}
|
||||
|
||||
convertCommitDate(timestamp: number) {
|
||||
const commitDay = new Date(timestamp * 1000)
|
||||
commitDay.setHours(0, 0, 0, 0)
|
||||
const todayDay = new Date()
|
||||
todayDay.setHours(0, 0, 0, 0)
|
||||
const diff = Math.floor(todayDay.getTime() - commitDay.getTime()) / (1000 * 60 * 60 * 24)
|
||||
|
||||
if (diff === 0) {
|
||||
const diffHours = Math.floor((new Date().getTime() - timestamp * 1000) / (1000 * 60 * 60))
|
||||
|
||||
return this.$t('Machine.UpdatePanel.CommittedHoursAgo', { hours: diffHours })
|
||||
} else if (diff === 1) return this.$t('Machine.UpdatePanel.CommittedYesterday')
|
||||
else if (diff < 29) return this.$t('Machine.UpdatePanel.CommittedDaysAgo', { days: diff })
|
||||
else
|
||||
return this.$t('Machine.UpdatePanel.CommittedOnDate', {
|
||||
date: commitDay.toLocaleDateString(this.language, this.dateOptions),
|
||||
})
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
::v-deep .update-manager-list > div:last-child > div.row {
|
||||
padding-bottom: 0 !important;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,366 @@
|
||||
<template>
|
||||
<div>
|
||||
<v-row class="py-2">
|
||||
<v-col class="pl-6">
|
||||
<strong>{{ repo.name }}</strong>
|
||||
<br />
|
||||
<template v-if="type === 'git_repo' && commitsBehind.length">
|
||||
<a class="primary--text cursor--pointer" @click="boolShowCommitList = true">
|
||||
<v-icon small color="primary" class="mr-1">{{ mdiInformation }}</v-icon>
|
||||
{{ versionOutput }}
|
||||
</a>
|
||||
</template>
|
||||
<template v-else-if="type === 'web' && webUpdatable">
|
||||
<a class="primary--text text-decoration-none" :href="webLinkRelease" target="_blank">
|
||||
<v-icon small color="primary" class="mr-1">{{ mdiInformation }}</v-icon>
|
||||
{{ versionOutput }}
|
||||
</a>
|
||||
</template>
|
||||
<span v-else>{{ versionOutput }}</span>
|
||||
</v-col>
|
||||
<v-col class="col-auto pr-6 text-right" align-self="center">
|
||||
<template v-if="needsRecovery">
|
||||
<v-menu :offset-y="true">
|
||||
<template #activator="{ on, attrs }">
|
||||
<v-chip
|
||||
small
|
||||
label
|
||||
outlined
|
||||
:color="btnColor"
|
||||
:disabled="btnDisabled"
|
||||
class="minwidth-0 px-2 text-uppercase"
|
||||
v-bind="attrs"
|
||||
v-on="on">
|
||||
<v-icon small class="mr-1">{{ btnIcon }}</v-icon>
|
||||
{{ btnText }}
|
||||
<v-icon small>{{ mdiMenuDown }}</v-icon>
|
||||
</v-chip>
|
||||
</template>
|
||||
<v-list dense class="py-0">
|
||||
<v-list-item @click="doRecovery(false)">
|
||||
<v-list-item-icon class="mr-0">
|
||||
<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-icon small>{{ mdiReload }}</v-icon>
|
||||
</v-list-item-icon>
|
||||
<v-list-item-content>
|
||||
<v-list-item-title>{{ $t('Machine.UpdatePanel.HardRecovery') }}</v-list-item-title>
|
||||
</v-list-item-content>
|
||||
</v-list-item>
|
||||
</v-list>
|
||||
</v-menu>
|
||||
</template>
|
||||
<v-chip
|
||||
v-else
|
||||
small
|
||||
label
|
||||
outlined
|
||||
:color="btnColor"
|
||||
:disabled="btnDisabled"
|
||||
class="minwidth-0 px-2 text-uppercase"
|
||||
@click="clickUpdate">
|
||||
<v-icon small class="mr-1">{{ btnIcon }}</v-icon>
|
||||
{{ btnText }}
|
||||
</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
|
||||
v-for="(message, index) in warnings"
|
||||
:key="'warnings_' + index"
|
||||
text
|
||||
dense
|
||||
border="left"
|
||||
color="orange"
|
||||
:icon="mdiAlertCircle">
|
||||
{{ message }}
|
||||
</v-alert>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<git-commits-list
|
||||
v-if="type === 'git_repo'"
|
||||
:bool-show-dialog="boolShowCommitList"
|
||||
:repo="repo"
|
||||
@close-dialog="closeCommitList" />
|
||||
<update-hint
|
||||
:bool-show-dialog="boolShowUpdateHint"
|
||||
:repo="repo"
|
||||
@open-commit-history="boolShowCommitList = true"
|
||||
@do-update="doUpdate"
|
||||
@close-dialog="closeShowUpdateHint" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { Component, Mixins, Prop } from 'vue-property-decorator'
|
||||
import BaseMixin from '@/components/mixins/base'
|
||||
import { ServerUpdateManagerStateGitRepo } from '@/store/server/updateManager/types'
|
||||
import {
|
||||
mdiAlertCircle,
|
||||
mdiCheck,
|
||||
mdiHelpCircleOutline,
|
||||
mdiInformation,
|
||||
mdiMenuDown,
|
||||
mdiProgressUpload,
|
||||
mdiReload,
|
||||
} from '@mdi/js'
|
||||
import semver from 'semver'
|
||||
import GitCommitsList from '@/components/panels/Machine/UpdatePanel/GitCommitsList.vue'
|
||||
import UpdateHint from '@/components/panels/Machine/UpdatePanel/UpdateHint.vue'
|
||||
@Component({
|
||||
components: { GitCommitsList, UpdateHint },
|
||||
})
|
||||
export default class UpdatePanelEntry extends Mixins(BaseMixin) {
|
||||
mdiInformation = mdiInformation
|
||||
mdiMenuDown = mdiMenuDown
|
||||
mdiReload = mdiReload
|
||||
mdiAlertCircle = mdiAlertCircle
|
||||
|
||||
boolShowCommitList = false
|
||||
boolShowUpdateHint = false
|
||||
|
||||
@Prop({ required: true }) readonly repo!: ServerUpdateManagerStateGitRepo
|
||||
|
||||
get name() {
|
||||
return this.repo.name ?? 'UNKNOWN'
|
||||
}
|
||||
|
||||
get type() {
|
||||
return this.repo.configured_type
|
||||
}
|
||||
|
||||
get localVersion() {
|
||||
const version = this.repo.version ?? '?'
|
||||
|
||||
if (!semver.valid(version)) return null
|
||||
|
||||
return version
|
||||
}
|
||||
|
||||
get remoteVersion() {
|
||||
const version = this.repo.remote_version ?? '?'
|
||||
|
||||
if (!semver.valid(version)) return null
|
||||
|
||||
return version
|
||||
}
|
||||
|
||||
get branch() {
|
||||
return this.repo.branch ?? 'master'
|
||||
}
|
||||
|
||||
get remoteAlias() {
|
||||
return this.repo.remote_alias ?? 'origin'
|
||||
}
|
||||
|
||||
get branchOutput() {
|
||||
if (this.remoteAlias !== 'origin') return `${this.remoteAlias}/${this.branch}`
|
||||
if (!['master', 'main'].includes(this.branch)) return this.branch
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
get commitsBehind() {
|
||||
return this.repo.commits_behind ?? []
|
||||
}
|
||||
|
||||
get fullVersionString() {
|
||||
return this.repo.full_version_string ?? null
|
||||
}
|
||||
|
||||
get versionOutput() {
|
||||
let output = this.branchOutput ? `${this.branchOutput}: ` : ''
|
||||
|
||||
if (this.localVersion && this.remoteVersion && semver.gt(this.remoteVersion, this.localVersion)) {
|
||||
return `${output}${this.localVersion} > ${this.remoteVersion}`
|
||||
}
|
||||
|
||||
if (this.commitsBehind.length) {
|
||||
const tmp = this.$tc('Machine.UpdatePanel.CommitsAvailable', this.commitsBehind.length, {
|
||||
count: this.commitsBehind.length,
|
||||
}).toString()
|
||||
|
||||
if (this.localVersion) return `${output}${this.localVersion} > ${tmp}`
|
||||
|
||||
return `${output}${tmp}`
|
||||
}
|
||||
|
||||
if (this.fullVersionString) return this.fullVersionString
|
||||
if (this.localVersion) return this.localVersion
|
||||
|
||||
return 'UNKNOWN'
|
||||
}
|
||||
|
||||
get configuredType() {
|
||||
return this.repo.configured_type ?? 'git_repo'
|
||||
}
|
||||
|
||||
get isValid() {
|
||||
return this.repo.is_valid ?? true
|
||||
}
|
||||
|
||||
get isDirty() {
|
||||
return this.repo.is_dirty ?? false
|
||||
}
|
||||
|
||||
get debugEnabled() {
|
||||
return this.repo.debug_enabled ?? false
|
||||
}
|
||||
|
||||
get isDetached() {
|
||||
if (this.configuredType !== 'git_repo') return false
|
||||
|
||||
return !this.debugEnabled && (this.repo.detached ?? false)
|
||||
}
|
||||
|
||||
get needsRecovery() {
|
||||
return !this.isValid || this.isDirty
|
||||
}
|
||||
|
||||
get btnDisabled() {
|
||||
if (['printing', 'paused'].includes(this.printer_state)) return true
|
||||
if (!this.isValid || 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.commitsBehind.length ||
|
||||
(this.localVersion && this.remoteVersion && semver.gt(this.remoteVersion, this.localVersion))
|
||||
)
|
||||
return mdiProgressUpload
|
||||
|
||||
if (this.localVersion === null || this.remoteVersion === null) return mdiHelpCircleOutline
|
||||
|
||||
return mdiCheck
|
||||
}
|
||||
|
||||
get btnColor() {
|
||||
if (this.isDetached || !this.isValid) return 'orange'
|
||||
if (this.isDirty) return 'red'
|
||||
|
||||
if (
|
||||
this.commitsBehind.length ||
|
||||
(this.localVersion && this.remoteVersion && semver.gt(this.remoteVersion, this.localVersion))
|
||||
)
|
||||
return 'primary'
|
||||
|
||||
return 'green'
|
||||
}
|
||||
|
||||
get btnText() {
|
||||
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.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')
|
||||
|
||||
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 warnings() {
|
||||
return this.repo.warnings ?? []
|
||||
}
|
||||
|
||||
get webUpdatable() {
|
||||
if (!this.localVersion) return false
|
||||
if (!this.remoteVersion) return false
|
||||
|
||||
return semver.gt(this.remoteVersion, this.localVersion)
|
||||
}
|
||||
|
||||
get webLinkRelease() {
|
||||
return `https://github.com/${this.repo.owner}/${this.repo.name}/releases/tag/${this.repo.remote_version}`
|
||||
}
|
||||
|
||||
get hideUpdateWarning() {
|
||||
return this.$store.state.gui.uiSettings.hideUpdateWarnings ?? false
|
||||
}
|
||||
|
||||
clickUpdate() {
|
||||
if (this.hideUpdateWarning) {
|
||||
this.doUpdate()
|
||||
return
|
||||
}
|
||||
|
||||
this.boolShowUpdateHint = true
|
||||
}
|
||||
|
||||
doUpdate() {
|
||||
if (['klipper', 'moonraker'].includes(this.repo.name)) {
|
||||
this.$socket.emit('machine.update.' + this.repo.name, {})
|
||||
return
|
||||
}
|
||||
|
||||
this.$socket.emit('machine.update.client', { name: this.repo.name })
|
||||
}
|
||||
|
||||
doRecovery(hard: boolean) {
|
||||
this.$socket.emit('machine.update.recover', { name: this.repo.name, hard: hard })
|
||||
}
|
||||
|
||||
closeCommitList() {
|
||||
this.boolShowCommitList = false
|
||||
}
|
||||
|
||||
closeShowUpdateHint() {
|
||||
this.boolShowUpdateHint = false
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped></style>
|
||||
@@ -0,0 +1,55 @@
|
||||
<template>
|
||||
<div>
|
||||
<v-row class="pt-3">
|
||||
<v-col class="text-center">
|
||||
<v-btn
|
||||
text
|
||||
color="primary"
|
||||
small
|
||||
:disabled="['printing', 'paused'].includes(printer_state)"
|
||||
@click="clickUpdate">
|
||||
<v-icon left>{{ mdiProgressUpload }}</v-icon>
|
||||
{{ $t('Machine.UpdatePanel.UpdateAll') }}
|
||||
</v-btn>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<update-hint-all
|
||||
:bool-show-dialog="boolShowDialog"
|
||||
@close-dialog="boolShowDialog = false"
|
||||
@update-all="updateAll" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { Component, Mixins } from 'vue-property-decorator'
|
||||
import BaseMixin from '@/components/mixins/base'
|
||||
import { mdiProgressUpload } from '@mdi/js'
|
||||
import UpdateHintAll from '@/components/panels/Machine/UpdatePanel/UpdateHintAll.vue'
|
||||
@Component({
|
||||
components: { UpdateHintAll },
|
||||
})
|
||||
export default class UpdatePanelEntryAll extends Mixins(BaseMixin) {
|
||||
mdiProgressUpload = mdiProgressUpload
|
||||
|
||||
boolShowDialog = false
|
||||
|
||||
get hideUpdateWarning() {
|
||||
return this.$store.state.gui.uiSettings.hideUpdateWarnings ?? false
|
||||
}
|
||||
|
||||
clickUpdate() {
|
||||
if (this.hideUpdateWarning) {
|
||||
this.updateAll()
|
||||
return
|
||||
}
|
||||
|
||||
this.boolShowDialog = true
|
||||
}
|
||||
|
||||
updateAll() {
|
||||
this.$socket.emit('machine.update.full', {})
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped></style>
|
||||
@@ -0,0 +1,92 @@
|
||||
<template>
|
||||
<div>
|
||||
<v-row class="py-2">
|
||||
<v-col class="pl-6">
|
||||
<strong>{{ $t('Machine.UpdatePanel.System') }}</strong>
|
||||
<br />
|
||||
<template v-if="package_count">
|
||||
<a class="primary--text cursor--pointer" @click="boolShowPackageList = true">
|
||||
<v-icon small color="primary" class="mr-1">{{ mdiInformation }}</v-icon>
|
||||
{{ $t('Machine.UpdatePanel.CountPackagesCanBeUpgraded', { count: package_count }) }}
|
||||
</a>
|
||||
</template>
|
||||
<span v-else>{{ $t('Machine.UpdatePanel.OSPackages') }}</span>
|
||||
</v-col>
|
||||
<v-col class="col-auto pr-6 text-right" align-self="center">
|
||||
<v-chip
|
||||
small
|
||||
label
|
||||
outlined
|
||||
:color="btnColor"
|
||||
:disabled="btnDisabled"
|
||||
class="minwidth-0 px-2 text-uppercase"
|
||||
@click="doUpdate">
|
||||
<v-icon small class="mr-1">{{ btnIcon }}</v-icon>
|
||||
{{ btnText }}
|
||||
</v-chip>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<system-packages-list
|
||||
:bool-show-dialog="boolShowPackageList"
|
||||
:packages-list="package_list"
|
||||
@close-dialog="closePackagesList" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { Component, Mixins } from 'vue-property-decorator'
|
||||
import BaseMixin from '@/components/mixins/base'
|
||||
import { mdiCheck, mdiInformation, mdiProgressUpload } from '@mdi/js'
|
||||
@Component
|
||||
export default class UpdatePanelEntrySystem extends Mixins(BaseMixin) {
|
||||
mdiInformation = mdiInformation
|
||||
|
||||
// to display the dialog for packages
|
||||
boolShowPackageList = false
|
||||
|
||||
get package_count() {
|
||||
return this.$store.state.server.updateManager?.system?.package_count ?? 0
|
||||
}
|
||||
|
||||
get package_list() {
|
||||
return this.$store.state.server.updateManager?.system?.package_list ?? []
|
||||
}
|
||||
|
||||
get btnDisabled() {
|
||||
// disable button if the printer is printing
|
||||
if (['printing', 'paused'].includes(this.printer_state)) return true
|
||||
|
||||
// disable button if no package is available to update
|
||||
return this.package_count === 0
|
||||
}
|
||||
|
||||
get btnIcon() {
|
||||
if (this.package_count) return mdiProgressUpload
|
||||
|
||||
return mdiCheck
|
||||
}
|
||||
|
||||
get btnColor() {
|
||||
// set button to primary, if updates are available
|
||||
if (this.package_count) return 'primary'
|
||||
|
||||
return 'green'
|
||||
}
|
||||
|
||||
get btnText() {
|
||||
if (this.package_count) return this.$t('Machine.UpdatePanel.Upgrade')
|
||||
|
||||
return this.$t('Machine.UpdatePanel.UpToDate')
|
||||
}
|
||||
|
||||
doUpdate() {
|
||||
this.$socket.emit('machine.update.system', {})
|
||||
}
|
||||
|
||||
closePackagesList() {
|
||||
this.boolShowPackageList = false
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped></style>
|
||||
@@ -0,0 +1,164 @@
|
||||
<template>
|
||||
<v-dialog v-model="boolShowDialog" persistent max-width="800">
|
||||
<panel
|
||||
:title="$t('Machine.UpdatePanel.Commits')"
|
||||
:icon="mdiUpdate"
|
||||
:margin-bottom="false"
|
||||
card-class="machine-update-commits-dialog">
|
||||
<template #buttons>
|
||||
<v-btn icon tile @click="closeDialog">
|
||||
<v-icon>{{ mdiCloseThick }}</v-icon>
|
||||
</v-btn>
|
||||
</template>
|
||||
<v-card-text class="py-0 px-0">
|
||||
<overlay-scrollbars style="max-height: 400px" :options="{ overflowBehavior: { x: 'hidden' } }">
|
||||
<v-row>
|
||||
<v-col>
|
||||
<v-timeline class="groupedCommits" align-top dense>
|
||||
<git-commits-list-day
|
||||
v-for="group of groupedCommits"
|
||||
:key="group.date.getTime()"
|
||||
:repo="repo"
|
||||
:grouped-commits="group" />
|
||||
<v-timeline-item
|
||||
v-if="displayFullHistoryWaring"
|
||||
small
|
||||
class="git-commit-list-day git-commit-list-warning">
|
||||
<v-row class="pt-0">
|
||||
<v-col class="pr-12">
|
||||
<v-alert dense text type="info">
|
||||
<p>{{ $t('Machine.UpdatePanel.MoreCommitsInfo') }}</p>
|
||||
<div class="text-center mb-3">
|
||||
<v-btn :href="linkToGithub" target="_blank">
|
||||
{{ $t('Machine.UpdatePanel.LinkToGithub') }}
|
||||
</v-btn>
|
||||
</div>
|
||||
</v-alert>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-timeline-item>
|
||||
</v-timeline>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</overlay-scrollbars>
|
||||
</v-card-text>
|
||||
</panel>
|
||||
</v-dialog>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { Component, Mixins, Prop } from 'vue-property-decorator'
|
||||
import BaseMixin from '@/components/mixins/base'
|
||||
import {
|
||||
ServerUpdateManagerStateGitRepo,
|
||||
ServerUpdateManagerStateGitRepoCommit,
|
||||
ServerUpdateManagerStateGitRepoGroupedCommits,
|
||||
} from '@/store/server/updateManager/types'
|
||||
import { mdiUpdate, mdiCloseThick } from '@mdi/js'
|
||||
import Panel from '@/components/ui/Panel.vue'
|
||||
import GitCommitsListDay from '@/components/panels/Machine/UpdatePanel/GitCommitsListDay.vue'
|
||||
|
||||
@Component({
|
||||
components: { GitCommitsListDay, Panel },
|
||||
})
|
||||
export default class GitCommitsList extends Mixins(BaseMixin) {
|
||||
mdiUpdate = mdiUpdate
|
||||
mdiCloseThick = mdiCloseThick
|
||||
|
||||
@Prop({ required: true }) readonly boolShowDialog!: boolean
|
||||
@Prop({ required: true }) readonly repo!: ServerUpdateManagerStateGitRepo | null
|
||||
|
||||
get commitsBehind(): ServerUpdateManagerStateGitRepoCommit[] {
|
||||
return this.repo?.commits_behind ?? []
|
||||
}
|
||||
|
||||
get groupedCommits() {
|
||||
let output: ServerUpdateManagerStateGitRepoGroupedCommits[] = []
|
||||
let lastCommit: ServerUpdateManagerStateGitRepoCommit | null = null
|
||||
|
||||
this.commitsBehind.forEach((commit: any) => {
|
||||
const lastCommitDate = new Date((lastCommit?.date ?? 0) * 1000)
|
||||
const commitDate = new Date(commit.date * 1000)
|
||||
|
||||
if (
|
||||
commitDate.getFullYear() !== lastCommitDate.getFullYear() ||
|
||||
commitDate.getMonth() !== lastCommitDate.getMonth() ||
|
||||
commitDate.getDay() !== lastCommitDate.getDay()
|
||||
) {
|
||||
output.push({
|
||||
date: commitDate,
|
||||
commits: [],
|
||||
})
|
||||
}
|
||||
|
||||
output[output.length - 1].commits.push(commit)
|
||||
lastCommit = commit
|
||||
})
|
||||
|
||||
return output
|
||||
}
|
||||
|
||||
get displayFullHistoryWaring() {
|
||||
return this.commitsBehind.length >= 30
|
||||
}
|
||||
|
||||
get lastCommit() {
|
||||
return this.commitsBehind.slice(-1)[0]
|
||||
}
|
||||
|
||||
get linkToGithub() {
|
||||
return `https://github.com/${this.repo?.owner}/${this.repo?.name}/commits/${this.repo?.branch}/?after=${this.lastCommit?.sha}+0`
|
||||
}
|
||||
|
||||
closeDialog() {
|
||||
this.$emit('close-dialog')
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.groupedCommits {
|
||||
padding-top: 0;
|
||||
}
|
||||
|
||||
::v-deep {
|
||||
.git-commit-list-day {
|
||||
padding-top: 24px;
|
||||
padding-bottom: 0;
|
||||
|
||||
.v-timeline-item__dot--small {
|
||||
width: 18px;
|
||||
height: 15px;
|
||||
margin-top: 2px;
|
||||
|
||||
&:before {
|
||||
display: block;
|
||||
content: ' ';
|
||||
position: relative;
|
||||
width: 18px;
|
||||
height: 2px;
|
||||
top: 7px;
|
||||
background: rgba(255, 255, 255, 0.5);
|
||||
z-index: 1;
|
||||
}
|
||||
}
|
||||
|
||||
.v-timeline-item__inner-dot {
|
||||
background-color: #1e1e1e !important;
|
||||
border: 2px solid rgba(255, 255, 255, 0.5) !important;
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
margin-left: 5px;
|
||||
margin-top: 2px;
|
||||
}
|
||||
|
||||
&.git-commit-list-warning {
|
||||
.v-timeline-item__dot--small {
|
||||
margin-top: 10px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,53 @@
|
||||
<template>
|
||||
<div>
|
||||
<v-timeline-item small class="git-commit-list-day">
|
||||
<v-row class="pt-0">
|
||||
<v-col class="pr-12">
|
||||
<h3 class="caption">
|
||||
{{ $t('Machine.UpdatePanel.CommitsOnDate', { date: groupedCommitsDate }) }}
|
||||
</h3>
|
||||
<ul class="commits mt-3 pl-0">
|
||||
<git-commits-list-day-commit
|
||||
v-for="commit of groupedCommits.commits"
|
||||
:key="commit.sha"
|
||||
:commit="commit"
|
||||
:repo="repo" />
|
||||
</ul>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-timeline-item>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { Component, Mixins, Prop } from 'vue-property-decorator'
|
||||
import BaseMixin from '@/components/mixins/base'
|
||||
import {
|
||||
ServerUpdateManagerStateGitRepo,
|
||||
ServerUpdateManagerStateGitRepoGroupedCommits,
|
||||
} from '@/store/server/updateManager/types'
|
||||
import Panel from '@/components/ui/Panel.vue'
|
||||
import GitCommitsListDayCommit from '@/components/panels/Machine/UpdatePanel/GitCommitsListDayCommit.vue'
|
||||
|
||||
@Component({
|
||||
components: { Panel, GitCommitsListDayCommit },
|
||||
})
|
||||
export default class GitCommitsListDay extends Mixins(BaseMixin) {
|
||||
@Prop({ required: true }) readonly groupedCommits!: ServerUpdateManagerStateGitRepoGroupedCommits
|
||||
@Prop({ required: true }) readonly repo!: ServerUpdateManagerStateGitRepo
|
||||
|
||||
get groupedCommitsDate() {
|
||||
return new Date(this.groupedCommits.date).toLocaleDateString(this.browserLocale, {
|
||||
year: 'numeric',
|
||||
month: 'short',
|
||||
day: 'numeric',
|
||||
})
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
ul.commits {
|
||||
list-style: none;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,116 @@
|
||||
<template>
|
||||
<li class="commit px-3 py-2">
|
||||
<v-row>
|
||||
<v-col>
|
||||
<h4 class="subtitle-2 text--white mb-0">
|
||||
{{ title }}
|
||||
<v-chip outlined label x-small class="ml-2 px-2" @click="showDetails = !showDetails">
|
||||
<v-icon small>{{ mdiDotsHorizontal }}</v-icon>
|
||||
</v-chip>
|
||||
</h4>
|
||||
<p
|
||||
v-if="showDetails"
|
||||
class="caption text--secondary mb-2"
|
||||
style="white-space: pre-line"
|
||||
v-html="message"></p>
|
||||
<p class="caption mb-0">
|
||||
<span class="font-weight-bold text-decoration-none white--text">
|
||||
{{ author }}
|
||||
</span>
|
||||
<span>{{ commitFormatDate }}</span>
|
||||
</p>
|
||||
</v-col>
|
||||
<v-col class="col-auto pt-4">
|
||||
<v-chip outlined label small :href="commitHref" target="_blank">
|
||||
{{ commitShortSha }}
|
||||
</v-chip>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</li>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { Component, Mixins, Prop } from 'vue-property-decorator'
|
||||
import BaseMixin from '@/components/mixins/base'
|
||||
import { mdiDotsHorizontal } from '@mdi/js'
|
||||
import {
|
||||
ServerUpdateManagerStateGitRepo,
|
||||
ServerUpdateManagerStateGitRepoCommit,
|
||||
} from '@/store/server/updateManager/types'
|
||||
import Panel from '@/components/ui/Panel.vue'
|
||||
|
||||
@Component({
|
||||
components: { Panel },
|
||||
})
|
||||
export default class GitCommitsListDayCommit extends Mixins(BaseMixin) {
|
||||
mdiDotsHorizontal = mdiDotsHorizontal
|
||||
|
||||
@Prop({ required: true }) readonly commit!: ServerUpdateManagerStateGitRepoCommit
|
||||
@Prop({ required: true }) readonly repo!: ServerUpdateManagerStateGitRepo
|
||||
|
||||
showDetails = false
|
||||
|
||||
get title() {
|
||||
return this.commit.subject
|
||||
}
|
||||
|
||||
get message() {
|
||||
return this.commit.message
|
||||
}
|
||||
|
||||
get author() {
|
||||
return this.commit.author
|
||||
}
|
||||
|
||||
get commitFormatDate() {
|
||||
const commitDay = new Date(this.commit.date * 1000)
|
||||
commitDay.setHours(0, 0, 0, 0)
|
||||
const todayDay = new Date()
|
||||
todayDay.setHours(0, 0, 0, 0)
|
||||
const diff = Math.floor(todayDay.getTime() - commitDay.getTime()) / (1000 * 60 * 60 * 24)
|
||||
|
||||
if (diff === 0) {
|
||||
const diffHours = Math.floor((new Date().getTime() - this.commit.date * 1000) / (1000 * 60 * 60))
|
||||
|
||||
return this.$t('Machine.UpdatePanel.CommittedHoursAgo', { hours: diffHours })
|
||||
} else if (diff === 1) return this.$t('Machine.UpdatePanel.CommittedYesterday')
|
||||
else if (diff < 29) return this.$t('Machine.UpdatePanel.CommittedDaysAgo', { days: diff })
|
||||
else
|
||||
return this.$t('Machine.UpdatePanel.CommittedOnDate', {
|
||||
date: commitDay.toLocaleDateString(this.browserLocale, {
|
||||
year: 'numeric',
|
||||
month: 'short',
|
||||
day: 'numeric',
|
||||
}),
|
||||
})
|
||||
}
|
||||
|
||||
get commitHref() {
|
||||
return `https://github.com/${this.repo.owner}/${this.repo.name}/commit/${this.commit.sha}`
|
||||
}
|
||||
|
||||
get commitShortSha() {
|
||||
return this.commit.sha.substring(0, 6)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
li.commit {
|
||||
border-color: rgb(48, 54, 61);
|
||||
border-style: solid;
|
||||
border-width: 1px;
|
||||
border-bottom-width: 0;
|
||||
|
||||
&:first-child {
|
||||
border-top-left-radius: 6px;
|
||||
border-top-right-radius: 6px;
|
||||
}
|
||||
|
||||
&:last-child {
|
||||
border-bottom-width: 1px;
|
||||
border-bottom-left-radius: 6px;
|
||||
border-bottom-right-radius: 6px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,56 @@
|
||||
<template>
|
||||
<v-dialog v-model="boolShowDialog" persistent max-width="800">
|
||||
<panel
|
||||
:title="$t('Machine.UpdatePanel.UpgradeableSystemPackages')"
|
||||
:icon="mdiPackageVariantClosed"
|
||||
:margin-bottom="false"
|
||||
card-class="machine-update-system-packages-list-dialog">
|
||||
<template #buttons>
|
||||
<v-btn icon tile @click="closeDialog">
|
||||
<v-icon>{{ mdiCloseThick }}</v-icon>
|
||||
</v-btn>
|
||||
</template>
|
||||
<v-card-text>
|
||||
<v-row>
|
||||
<v-col>
|
||||
<p>{{ $t('Machine.UpdatePanel.ThesePackagesCanBeUpgrade') }}</p>
|
||||
<p class="system-packages-list">{{ packagesList.join(', ') }}</p>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-card-text>
|
||||
<v-card-actions>
|
||||
<v-spacer />
|
||||
<v-btn text color="primary" @click="closeDialog">{{ $t('Machine.UpdatePanel.Close') }}</v-btn>
|
||||
</v-card-actions>
|
||||
</panel>
|
||||
</v-dialog>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { Component, Mixins, Prop } from 'vue-property-decorator'
|
||||
import BaseMixin from '@/components/mixins/base'
|
||||
import { mdiCloseThick, mdiPackageVariantClosed } from '@mdi/js'
|
||||
import Panel from '@/components/ui/Panel.vue'
|
||||
|
||||
@Component({
|
||||
components: { Panel },
|
||||
})
|
||||
export default class SystemPackagesList extends Mixins(BaseMixin) {
|
||||
mdiCloseThick = mdiCloseThick
|
||||
mdiPackageVariantClosed = mdiPackageVariantClosed
|
||||
|
||||
@Prop({ required: true }) readonly boolShowDialog!: boolean
|
||||
@Prop({ required: true }) readonly packagesList!: string[]
|
||||
|
||||
closeDialog() {
|
||||
this.$emit('close-dialog')
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.system-packages-list {
|
||||
font-family: monospace;
|
||||
margin-bottom: 0 !important;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,71 @@
|
||||
<template>
|
||||
<v-dialog v-model="boolShowDialog" persistent max-width="600">
|
||||
<panel
|
||||
:title="$t('Machine.UpdatePanel.AreYouSure')"
|
||||
:icon="mdiProgressQuestion"
|
||||
:margin-bottom="false"
|
||||
card-class="machine-update-hint-dialog">
|
||||
<template #buttons>
|
||||
<v-btn icon tile @click="closeDialog">
|
||||
<v-icon>{{ mdiCloseThick }}</v-icon>
|
||||
</v-btn>
|
||||
</template>
|
||||
<v-card-text>
|
||||
<v-row>
|
||||
<v-col>
|
||||
<update-hint-alert :repo="repo" @open-commit-history="openCommitHistory" />
|
||||
<div>
|
||||
<v-checkbox
|
||||
v-model="checkboxUpdateQuestion"
|
||||
:label="$t('Machine.UpdatePanel.IUnderstandTheRisks')"
|
||||
hide-details />
|
||||
</div>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-card-text>
|
||||
<v-divider />
|
||||
<v-card-actions>
|
||||
<v-spacer />
|
||||
<v-btn text @click="closeDialog">{{ $t('Machine.UpdatePanel.Abort') }}</v-btn>
|
||||
<v-btn text color="primary" :disabled="!checkboxUpdateQuestion" @click="doUpdate">
|
||||
{{ $t('Machine.UpdatePanel.StartUpdate') }}
|
||||
</v-btn>
|
||||
</v-card-actions>
|
||||
</panel>
|
||||
</v-dialog>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { Component, Mixins, Prop } from 'vue-property-decorator'
|
||||
import BaseMixin from '@/components/mixins/base'
|
||||
import { ServerUpdateManagerStateGitRepo } from '@/store/server/updateManager/types'
|
||||
import { mdiProgressQuestion, mdiCloseThick } from '@mdi/js'
|
||||
import Panel from '@/components/ui/Panel.vue'
|
||||
import GitCommitsListDay from '@/components/panels/Machine/UpdatePanel/GitCommitsListDay.vue'
|
||||
import UpdateHintAlert from '@/components/panels/Machine/UpdatePanel/UpdateHintAlert.vue'
|
||||
|
||||
@Component({
|
||||
components: { GitCommitsListDay, Panel, UpdateHintAlert },
|
||||
})
|
||||
export default class UpdateHint extends Mixins(BaseMixin) {
|
||||
mdiCloseThick = mdiCloseThick
|
||||
mdiProgressQuestion = mdiProgressQuestion
|
||||
|
||||
checkboxUpdateQuestion = false
|
||||
|
||||
@Prop({ required: true }) readonly boolShowDialog!: boolean
|
||||
@Prop({ required: true }) readonly repo!: ServerUpdateManagerStateGitRepo
|
||||
|
||||
doUpdate() {
|
||||
this.$emit('do-update')
|
||||
}
|
||||
|
||||
openCommitHistory() {
|
||||
this.$emit('open-commit-history')
|
||||
}
|
||||
|
||||
closeDialog() {
|
||||
this.$emit('close-dialog')
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,91 @@
|
||||
<template>
|
||||
<v-alert text dense border="left" color="orange" :icon="mdiAlertCircle">
|
||||
<template v-if="boolTitle">
|
||||
<strong>{{ $t('Machine.UpdatePanel.UpdateWarning', { name: formatName }) }}</strong>
|
||||
<br />
|
||||
</template>
|
||||
<p v-if="description1">{{ description1 }}</p>
|
||||
<p v-if="description2">{{ description2 }}</p>
|
||||
<div class="text-center">
|
||||
<v-btn
|
||||
v-if="configured_type === 'git_repo' && repo.commits_behind?.length"
|
||||
class="mx-2 mt-3 mt-sm-0"
|
||||
@click="openCommitHistory">
|
||||
<v-icon left small>{{ mdiEye }}</v-icon>
|
||||
{{ $t('Machine.UpdatePanel.CommitHistory') }}
|
||||
</v-btn>
|
||||
<v-btn v-if="externalLink" class="mx-2 mt-3 mt-sm-0" :href="externalLink" target="_blank">
|
||||
<v-icon left small>{{ mdiOpenInNew }}</v-icon>
|
||||
{{ externalLinkText }}
|
||||
</v-btn>
|
||||
</div>
|
||||
</v-alert>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { Component, Mixins, Prop } from 'vue-property-decorator'
|
||||
import BaseMixin from '@/components/mixins/base'
|
||||
import { ServerUpdateManagerStateGitRepo } from '@/store/server/updateManager/types'
|
||||
import { mdiCloseThick, mdiAlertCircle, mdiEye, mdiOpenInNew } from '@mdi/js'
|
||||
import Panel from '@/components/ui/Panel.vue'
|
||||
import GitCommitsListDay from '@/components/panels/Machine/UpdatePanel/GitCommitsListDay.vue'
|
||||
import { capitalize } from '@/plugins/helpers'
|
||||
|
||||
@Component({
|
||||
components: { GitCommitsListDay, Panel },
|
||||
})
|
||||
export default class UpdateHintAlert extends Mixins(BaseMixin) {
|
||||
mdiCloseThick = mdiCloseThick
|
||||
mdiAlertCircle = mdiAlertCircle
|
||||
mdiEye = mdiEye
|
||||
mdiOpenInNew = mdiOpenInNew
|
||||
|
||||
@Prop({ required: true }) readonly repo!: ServerUpdateManagerStateGitRepo
|
||||
@Prop({ required: false, default: false }) readonly boolTitle!: boolean
|
||||
|
||||
get name() {
|
||||
return this.repo?.name ?? 'UNKNOWN'
|
||||
}
|
||||
|
||||
get formatName() {
|
||||
return capitalize(this.name)
|
||||
}
|
||||
|
||||
get configured_type() {
|
||||
return this.repo?.configured_type ?? 'UNKNOWN'
|
||||
}
|
||||
|
||||
get description1() {
|
||||
if (this.name === 'klipper') return this.$t('Machine.UpdatePanel.KlipperUpdateQuestionFirmware')
|
||||
if (this.name === 'moonraker') return this.$t('Machine.UpdatePanel.MoonrakerUpdateQuestion')
|
||||
if (this.configured_type === 'web') return this.$t('Machine.UpdatePanel.WebClientUpdateQuestion')
|
||||
|
||||
return this.$t('Machine.UpdatePanel.GenericUpdateQuestion')
|
||||
}
|
||||
|
||||
get description2() {
|
||||
if (this.name === 'klipper') return this.$t('Machine.UpdatePanel.KlipperUpdateQuestionConfig')
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
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}`
|
||||
}
|
||||
|
||||
get externalLinkText() {
|
||||
if (['klipper', 'moonraker'].includes(this.name)) return this.$t('Machine.UpdatePanel.ConfigChanges')
|
||||
|
||||
return this.$t('Machine.UpdatePanel.GitHubPage')
|
||||
}
|
||||
|
||||
openCommitHistory() {
|
||||
this.$emit('open-commit-history')
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,105 @@
|
||||
<template>
|
||||
<v-dialog v-model="boolShowDialog" persistent max-width="600">
|
||||
<panel
|
||||
:title="$t('Machine.UpdatePanel.AreYouSure')"
|
||||
:icon="mdiProgressQuestion"
|
||||
:margin-bottom="false"
|
||||
card-class="machine-update-hint-dialog">
|
||||
<template #buttons>
|
||||
<v-btn icon tile @click="closeDialog">
|
||||
<v-icon>{{ mdiCloseThick }}</v-icon>
|
||||
</v-btn>
|
||||
</template>
|
||||
<v-card-text>
|
||||
<v-row>
|
||||
<v-col>
|
||||
<update-hint-alert
|
||||
v-for="repo of filteredModules"
|
||||
:key="repo.name"
|
||||
:repo="repo.data"
|
||||
:bool-title="true"
|
||||
@open-commit-history="openCommitHistory(repo.data)" />
|
||||
<div>
|
||||
<v-checkbox
|
||||
v-model="checkboxUpdateQuestion"
|
||||
:label="$t('Machine.UpdatePanel.IUnderstandTheRisks')"
|
||||
hide-details />
|
||||
</div>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-card-text>
|
||||
<v-divider />
|
||||
<v-card-actions>
|
||||
<v-spacer />
|
||||
<v-btn text @click="closeDialog">{{ $t('Machine.UpdatePanel.Abort') }}</v-btn>
|
||||
<v-btn text color="primary" :disabled="!checkboxUpdateQuestion" @click="updateAll">
|
||||
{{ $t('Machine.UpdatePanel.StartUpdate') }}
|
||||
</v-btn>
|
||||
</v-card-actions>
|
||||
</panel>
|
||||
<git-commits-list
|
||||
:bool-show-dialog="boolShowCommitHistory"
|
||||
:repo="showCommitsRepo"
|
||||
@close-dialog="boolShowCommitHistory = false" />
|
||||
</v-dialog>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { Component, Mixins, Prop } from 'vue-property-decorator'
|
||||
import BaseMixin from '@/components/mixins/base'
|
||||
import { ServerUpdateManagerStateGitRepo, ServerUpdateManagerStateGuiList } from '@/store/server/updateManager/types'
|
||||
import { mdiProgressQuestion, mdiCloseThick } from '@mdi/js'
|
||||
import Panel from '@/components/ui/Panel.vue'
|
||||
import GitCommitsListDay from '@/components/panels/Machine/UpdatePanel/GitCommitsListDay.vue'
|
||||
import UpdateHintAlert from '@/components/panels/Machine/UpdatePanel/UpdateHintAlert.vue'
|
||||
import semver from 'semver'
|
||||
|
||||
@Component({
|
||||
components: { GitCommitsListDay, Panel, UpdateHintAlert },
|
||||
})
|
||||
export default class UpdateHintAll extends Mixins(BaseMixin) {
|
||||
mdiCloseThick = mdiCloseThick
|
||||
mdiProgressQuestion = mdiProgressQuestion
|
||||
|
||||
checkboxUpdateQuestion = false
|
||||
boolShowCommitHistory = false
|
||||
showCommitsRepo: ServerUpdateManagerStateGitRepo | null = null
|
||||
|
||||
@Prop({ required: true }) readonly boolShowDialog!: boolean
|
||||
|
||||
get modules() {
|
||||
return this.$store.getters['server/updateManager/getUpdateManagerList'] ?? []
|
||||
}
|
||||
|
||||
get filteredModules() {
|
||||
return this.modules.filter((module: ServerUpdateManagerStateGuiList) => {
|
||||
// check git repos for updates
|
||||
if (module.type === 'git' && module.data?.commits_behind?.length) return true
|
||||
|
||||
// check client web for updates
|
||||
if (
|
||||
module.type === 'web' &&
|
||||
semver.valid(module.data?.remote_version) &&
|
||||
semver.valid(module.data?.version) &&
|
||||
semver.gt(module.data?.remote_version, module.data?.version)
|
||||
)
|
||||
return true
|
||||
|
||||
return false
|
||||
})
|
||||
}
|
||||
|
||||
openCommitHistory(repo: ServerUpdateManagerStateGitRepo) {
|
||||
this.showCommitsRepo = repo
|
||||
this.boolShowCommitHistory = true
|
||||
}
|
||||
|
||||
closeDialog() {
|
||||
this.$emit('close-dialog')
|
||||
}
|
||||
|
||||
updateAll() {
|
||||
this.$emit('update-all')
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -195,6 +195,13 @@
|
||||
:step="1"
|
||||
:label="tempchartHeight + 'px'" />
|
||||
</settings-row>
|
||||
<v-divider class="my-2" />
|
||||
<settings-row
|
||||
:title="$t('Settings.UiSettingsTab.HideUpdateWarnings').toString()"
|
||||
:sub-title="$t('Settings.UiSettingsTab.HideUpdateWarningsDescription').toString()"
|
||||
:dynamic-slot-width="true">
|
||||
<v-switch v-model="hideUpdateWarnings" hide-details class="mt-0" />
|
||||
</settings-row>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
</div>
|
||||
@@ -401,6 +408,14 @@ export default class SettingsUiSettingsTab extends Mixins(BaseMixin) {
|
||||
this.$store.dispatch('gui/saveSetting', { name: 'uiSettings.tempchartHeight', value: newVal })
|
||||
}
|
||||
|
||||
get hideUpdateWarnings() {
|
||||
return this.$store.state.gui.uiSettings.hideUpdateWarnings ?? false
|
||||
}
|
||||
|
||||
set hideUpdateWarnings(newVal) {
|
||||
this.$store.dispatch('gui/saveSetting', { name: 'uiSettings.hideUpdateWarnings', value: newVal })
|
||||
}
|
||||
|
||||
clearColorObject(color: any): string {
|
||||
if (typeof color === 'object' && 'hex' in color) color = color.hex
|
||||
if (color.length > 7) color = color.substr(0, 7)
|
||||
|
||||
+31
-5
@@ -478,27 +478,51 @@
|
||||
}
|
||||
},
|
||||
"UpdatePanel": {
|
||||
"CheckForUpdates": "auf aktualisierungen prüfen",
|
||||
"Abort": "abbrechen",
|
||||
"AreYouSure": "Bist du dir sicher?",
|
||||
"CheckForUpdates": "auf Aktualisierungen prüfen",
|
||||
"Close": "schließen",
|
||||
"CommitHistory": "Commit Verlauf",
|
||||
"Commits": "Commits",
|
||||
"CommitsAvailable": "keine Einreichung verfügbar | {count} Einreichung verfügbar | {count} Einreichungen verfügbar",
|
||||
"CommitsOnDate": "Engereicht am {date}",
|
||||
"CommitsOnDate": "Eingereicht am {date}",
|
||||
"CommittedDaysAgo": "eingereicht vor {days} Tagen",
|
||||
"CommittedHoursAgo": "eingereicht vor {hours} Stunden",
|
||||
"CommittedOnDate": "eingereicht am {date}",
|
||||
"CommittedYesterday": "eingereicht gestern",
|
||||
"ConfigChanges": "Konfigurationsänderungen",
|
||||
"CountPackagesCanBeUpgraded": "{count} Pakete können aktualisiert werden",
|
||||
"Detached": "abgetrennt",
|
||||
"Dirty": "kompromittiert",
|
||||
"ERROR": "FEHLER",
|
||||
"GenericUpdateQuestion": "Überprüfe den Commit-Verlauf (falls verfügbar) und die GitHub-Projektseite von diesem Projekt, um festzustellen, ob manuelle Anpassungen nach dieser Aktualisierung erforderlich sind.",
|
||||
"GitHubPage": "GitHub Projektseite",
|
||||
"HardRecovery": "Harte Wiederherstellung",
|
||||
"InitUpdateManager": "Der Update Manager ist noch nicht initialisiert. Dies ist normal, wenn das System zum ersten Mal gestartet wird. Bitte klicke auf die Aktualisierungsschaltfläche, um alle Komponenten zu initialisieren.",
|
||||
"Invalid": "ungültig",
|
||||
"IUnderstandTheRisks": "Ich habe die Risiken verstanden",
|
||||
"LinkToGithub": "Link zu GitHub",
|
||||
"KlipperUpdateQuestionFirmware": "Dadurch wird die Klipper-Host-Software aktualisiert. Steuerplatinen, auf denen die Klipper-Firmware läuft, müssen möglicherweise mit einer neu kompilierten Firmware geflasht werden, bevor die Maschine wieder in Betrieb genommen werden kann.",
|
||||
"KlipperUpdateQuestionConfig": "Dieses Update kann Änderungen an den Konfigurationsparametern enthalten, die in der Datei printer.cfg geändert werden müssen; Informationen hierzu findest du im Änderungsprotokoll.",
|
||||
"MoonrakerUpdateQuestion": "Dadurch wird die Moonraker-API aktualisiert. Möglicherweise sind Änderungen an der Datei moonraker.conf erforderlich, damit die Maschine wieder verwendet werden kann.",
|
||||
"MoreCommitsInfo": "Hier können maximal 30 Commits angezeigt werden. Um alle Commits zu sehen, klicke bitte auf den folgenden Link:",
|
||||
"Notification": {
|
||||
"Detached": "Ein abgetrennter Zustand ist weder ein Fehler noch ein Problem. Es bedeutet nur, dass im lokalen Repository zusätzliche Commits existieren, die im entfernten Repository nicht vorhanden sind.",
|
||||
"Dirty": "Das lokale Repository wurde geändert und kann in diesem Zustand nicht aktualisiert werden. Bitte stelle wieder ein saubers Repository her."
|
||||
},
|
||||
"OSPackages": "OS-Pakete",
|
||||
"PackagesCanBeUpgraded": "Paketupdates sind verfügbar",
|
||||
"SoftRecovery": "einfache Wiederherstellung",
|
||||
"StartUpdate": "Aktualisierung starten",
|
||||
"System": "System",
|
||||
"ThesePackagesCanBeUpgrade": "Diese Systempakete können aktualisiert werden:",
|
||||
"Unknown": "unbekannt",
|
||||
"Update": "update",
|
||||
"UpdateAll": "Alle Komponenten updaten",
|
||||
"UpdateManager": "Update Manager",
|
||||
"UpdateWarning": "Aktualisierungswarnung: {name}",
|
||||
"Upgrade": "upgrade",
|
||||
"UpToDate": "aktuell"
|
||||
"UpgradeableSystemPackages": "Aktualisierbare Systempakete",
|
||||
"UpToDate": "aktuell",
|
||||
"WebClientUpdateQuestion": "In einigen Fällen kann die Aktualisierung des Webclients Änderungen mit sich bringen, die zu Inkompatibilitäten führen können. Weitere Informationen sind in den Veröffentlichungshinweisen zu finden."
|
||||
}
|
||||
},
|
||||
"ManualProbe": {
|
||||
@@ -1045,6 +1069,8 @@
|
||||
"Guide": "Leitfaden",
|
||||
"HideSaveConfigButtonForBedMesh": "SAVE_CONFIG Schaltfläche ausblenden bei bed_mesh Änderungen",
|
||||
"HideSaveConfigButtonForBedMeshDescription": "SAVE_CONFIG nicht anzeigen, wenn nur das Speichern eines bed_mesh in Klipper aussteht.",
|
||||
"HideUpdateWarnings": "Aktualisierungswarnungen ausblenden",
|
||||
"HideUpdateWarningsDescription": "Mit dieser Option werden alle Aktualisierungswarnungen im Aktualisierungsmanager ausgeblendet.",
|
||||
"LockSliders": "Sperre Schieberegler auf Touchscreen Geräten",
|
||||
"LockSlidersDelay": "Verzögerung der Sperre für Schieberegler",
|
||||
"LockSlidersDelayDescription": "Schieberegler werden nach einer bestimmten Verzögerung gesperrt. Wenn 0 oder leer, dann sperren Schieberegler nur nach wechseln/neuladen der Seite.",
|
||||
|
||||
+29
-3
@@ -478,7 +478,11 @@
|
||||
}
|
||||
},
|
||||
"UpdatePanel": {
|
||||
"Abort": "Abort",
|
||||
"AreYouSure": "Are you sure?",
|
||||
"CheckForUpdates": "Check for updates",
|
||||
"Close": "Close",
|
||||
"CommitHistory": "Commit History",
|
||||
"Commits": "Commits",
|
||||
"CommitsAvailable": "no commits available | {count} commit available | {count} commits available",
|
||||
"CommitsOnDate": "Commits on {date}",
|
||||
@@ -486,19 +490,39 @@
|
||||
"CommittedHoursAgo": "committed {hours} hours ago",
|
||||
"CommittedOnDate": "committed on {date}",
|
||||
"CommittedYesterday": "committed yesterday",
|
||||
"ConfigChanges": "Config Changes",
|
||||
"CountPackagesCanBeUpgraded": "{count} packages can be upgraded",
|
||||
"Detached": "detached",
|
||||
"Dirty": "dirty",
|
||||
"ERROR": "ERROR",
|
||||
"GenericUpdateQuestion": "Check the commit history (if available) and the GitHub page for this project to see if any manual adjustments are necessary for this update.",
|
||||
"GitHubPage": "GitHub Page",
|
||||
"HardRecovery": "Hard Recovery",
|
||||
"InitUpdateManager": "The Update Manager has not been initialized yet. This is normal when you start the system for the first time. Please click on the refresh button to initialize all components.",
|
||||
"Invalid": "invalid",
|
||||
"IUnderstandTheRisks": "I understand the risks",
|
||||
"LinkToGithub": "Link to GitHub",
|
||||
"KlipperUpdateQuestionFirmware": "This will update the Klipper host software. Control boards running the Klipper firmware may need to be flashed with recompiled firmware before the machine can be put back into service.",
|
||||
"KlipperUpdateQuestionConfig": "This update may also contain changes to config parameters that would need to be modified in the printer.cfg file, see the change log for details.",
|
||||
"MoonrakerUpdateQuestion": "This will update the Moonraker API. Changes to the moonraker.conf file may be required to continue using the machine.",
|
||||
"MoreCommitsInfo": "A maximum of 30 commits can be displayed here. To see all commits, please click on the following link:",
|
||||
"Notification": {
|
||||
"Detached": "Detached state is not an error nor is it a problem. It only means that additional commits exist in the local repository that do not exist in the remote repository.",
|
||||
"Dirty": "The local repository has been modified and cannot be updated in this state. Please recover this repository."
|
||||
},
|
||||
"OSPackages": "OS-Packages",
|
||||
"PackagesCanBeUpgraded": "packages can be upgraded",
|
||||
"SoftRecovery": "Soft Recovery",
|
||||
"StartUpdate": "Start Update",
|
||||
"System": "System",
|
||||
"ThesePackagesCanBeUpgrade": "These system packages can be upgraded:",
|
||||
"Unknown": "unknown",
|
||||
"Update": "update",
|
||||
"UpdateAll": "Update all components",
|
||||
"UpdateManager": "Update Manager",
|
||||
"UpdateWarning": "Update warning: {name}",
|
||||
"Upgrade": "upgrade",
|
||||
"UpToDate": "up-to-date"
|
||||
"UpgradeableSystemPackages": "Upgradeable System Packages",
|
||||
"UpToDate": "up-to-date",
|
||||
"WebClientUpdateQuestion": "In some cases updating the web client could have changes that may cause incompatibility. See the release notes for more information."
|
||||
}
|
||||
},
|
||||
"ManualProbe": {
|
||||
@@ -1045,6 +1069,8 @@
|
||||
"Guide": "Guide",
|
||||
"HideSaveConfigButtonForBedMesh": "Hide SAVE_CONFIG button for bed_mesh changes",
|
||||
"HideSaveConfigButtonForBedMeshDescription": "Hide SAVE_CONFIG, if only bed_mesh changes are pending to be saved in Klipper.",
|
||||
"HideUpdateWarnings": "Hide Update Warnings",
|
||||
"HideUpdateWarningsDescription": "This option will hide all update warnings in the update manager.",
|
||||
"LockSliders": "Lock sliders on touchscreen devices",
|
||||
"LockSlidersDelay": "Slider lock delay",
|
||||
"LockSlidersDelayDescription": "Sliders will lock after a given delay. If set to 0 or left blank, sliders will only lock on page change/reload.",
|
||||
|
||||
@@ -165,6 +165,7 @@ export const getDefaultState = (): GuiState => {
|
||||
boolBedScrewsDialog: true,
|
||||
boolScrewsTiltAdjustDialog: true,
|
||||
tempchartHeight: 250,
|
||||
hideUpdateWarnings: false,
|
||||
},
|
||||
view: {
|
||||
blockFileUpload: false,
|
||||
|
||||
@@ -115,6 +115,7 @@ export interface GuiState {
|
||||
boolBedScrewsDialog: boolean
|
||||
boolScrewsTiltAdjustDialog: boolean
|
||||
tempchartHeight: number
|
||||
hideUpdateWarnings: boolean
|
||||
}
|
||||
view: {
|
||||
blockFileUpload: boolean
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { ServerPowerState } from '@/store/server/power/types'
|
||||
import { ServerUpdateMangerState } from '@/store/server/updateManager/types'
|
||||
import { ServerUpdateManagerState } from '@/store/server/updateManager/types'
|
||||
import { ServerHistoryState } from '@/store/server/history/types'
|
||||
import { ServerTimelapseState } from '@/store/server/timelapse/types'
|
||||
|
||||
@@ -58,7 +58,7 @@ export interface ServerState {
|
||||
console_cleared_this_session?: boolean
|
||||
|
||||
power?: ServerPowerState
|
||||
updateManager?: ServerUpdateMangerState
|
||||
updateManager?: ServerUpdateManagerState
|
||||
history?: ServerHistoryState
|
||||
timelapse?: ServerTimelapseState
|
||||
}
|
||||
|
||||
@@ -1,19 +1,39 @@
|
||||
import Vue from 'vue'
|
||||
import { ActionTree } from 'vuex'
|
||||
import { ServerUpdateMangerState } from '@/store/server/updateManager/types'
|
||||
import { ServerUpdateManagerState } from '@/store/server/updateManager/types'
|
||||
import { RootState } from '@/store/types'
|
||||
|
||||
export const actions: ActionTree<ServerUpdateMangerState, RootState> = {
|
||||
export const actions: ActionTree<ServerUpdateManagerState, RootState> = {
|
||||
reset({ commit }) {
|
||||
commit('reset')
|
||||
},
|
||||
|
||||
init() {
|
||||
Vue.$socket.emit('machine.update.status', {}, { action: 'server/updateManager/getStatus' })
|
||||
Vue.$socket.emit('machine.update.status', {}, { action: 'server/updateManager/onUpdateStatus' })
|
||||
},
|
||||
|
||||
async getStatus({ commit, dispatch }, payload) {
|
||||
await commit('setStatus', payload)
|
||||
async onUpdateStatus({ commit, dispatch }, payload) {
|
||||
await commit('resetRepos')
|
||||
|
||||
for (const key of Object.keys(payload.version_info)) {
|
||||
const module = payload.version_info[key] ?? {}
|
||||
const configured_type = module.configured_type ?? null
|
||||
|
||||
if (['git_repo', 'zip'].includes(configured_type)) {
|
||||
await commit('storeGitRepo', { ...module, name: key })
|
||||
continue
|
||||
}
|
||||
|
||||
if (['web', 'web_beta'].includes(configured_type)) {
|
||||
await commit('storeWebRepo', { ...module, name: key })
|
||||
continue
|
||||
}
|
||||
|
||||
if (key === 'system') {
|
||||
await commit('updateSystem', { ...module })
|
||||
}
|
||||
}
|
||||
|
||||
await dispatch('socket/removeInitModule', 'server/updateManager/init', { root: true })
|
||||
},
|
||||
}
|
||||
@@ -1,48 +1,28 @@
|
||||
import { GetterTree } from 'vuex'
|
||||
import { ServerUpdateMangerState } from '@/store/server/updateManager/types'
|
||||
import semver from 'semver'
|
||||
import { ServerUpdateManagerState, ServerUpdateManagerStateGuiList } from '@/store/server/updateManager/types'
|
||||
import { caseInsensitiveSort } from '@/plugins/helpers'
|
||||
|
||||
// eslint-disable-next-line
|
||||
export const getters: GetterTree<ServerUpdateMangerState, any> = {
|
||||
getUpdateableSoftwares(state) {
|
||||
// eslint-disable-next-line
|
||||
const output: any = {}
|
||||
const sortKeys = Object.keys(state.version_info).sort((a, b) => {
|
||||
if (a === 'klipper') return -1
|
||||
if (b === 'klipper') return 1
|
||||
if ('name' in state.version_info[a] && state.version_info[a].name === 'mainsail') return 1
|
||||
if ('name' in state.version_info[b] && state.version_info[b].name === 'mainsail') return -1
|
||||
if (a < b) return -1
|
||||
if (a > b) return 1
|
||||
export const getters: GetterTree<ServerUpdateManagerState, any> = {
|
||||
getUpdateManagerList(state): ServerUpdateManagerStateGuiList[] {
|
||||
const output: ServerUpdateManagerStateGuiList[] = []
|
||||
|
||||
return 0
|
||||
state.git_repos.forEach((repo) => {
|
||||
output.push({
|
||||
name: repo.name,
|
||||
type: 'git',
|
||||
data: { ...repo },
|
||||
})
|
||||
})
|
||||
|
||||
for (const key of sortKeys) {
|
||||
if ('system' !== key) {
|
||||
output[key] = state.version_info[key]
|
||||
}
|
||||
}
|
||||
state.web_repos.forEach((repo) => {
|
||||
output.push({
|
||||
name: repo.name,
|
||||
type: 'web',
|
||||
data: { ...repo },
|
||||
})
|
||||
})
|
||||
|
||||
return output
|
||||
},
|
||||
|
||||
isUpdateAvailable(state) {
|
||||
const keys = Object.keys(state.version_info).filter((key: string) => key !== 'system')
|
||||
|
||||
for (const key of keys) {
|
||||
const versionInfo = state.version_info[key]
|
||||
|
||||
if (
|
||||
'version' in versionInfo &&
|
||||
'remote_version' in versionInfo &&
|
||||
semver.valid(versionInfo.version) &&
|
||||
semver.valid(versionInfo.remote_version) &&
|
||||
semver.gt(versionInfo.remote_version, versionInfo.version)
|
||||
)
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
return caseInsensitiveSort(output, 'name')
|
||||
},
|
||||
}
|
||||
@@ -1,12 +1,21 @@
|
||||
import { Module } from 'vuex'
|
||||
import { ServerUpdateMangerState } from '@/store/server/updateManager/types'
|
||||
import { ServerUpdateManagerState } from '@/store/server/updateManager/types'
|
||||
import { actions } from '@/store/server/updateManager/actions'
|
||||
import { mutations } from '@/store/server/updateManager/mutations'
|
||||
import { getters } from '@/store/server/updateManager/getters'
|
||||
|
||||
export const getDefaultState = (): ServerUpdateMangerState => {
|
||||
export const getDefaultState = (): ServerUpdateManagerState => {
|
||||
return {
|
||||
version_info: {},
|
||||
busy: false,
|
||||
github_rate_limit: null,
|
||||
github_requests_remaining: null,
|
||||
github_limit_reset_time: null,
|
||||
git_repos: [],
|
||||
web_repos: [],
|
||||
system: {
|
||||
package_count: 0,
|
||||
package_list: [],
|
||||
},
|
||||
updateResponse: {
|
||||
application: '',
|
||||
complete: true,
|
||||
@@ -19,7 +28,7 @@ export const getDefaultState = (): ServerUpdateMangerState => {
|
||||
const state = getDefaultState()
|
||||
|
||||
// eslint-disable-next-line
|
||||
export const updateManager: Module<ServerUpdateMangerState, any> = {
|
||||
export const updateManager: Module<ServerUpdateManagerState, any> = {
|
||||
namespaced: true,
|
||||
state,
|
||||
getters,
|
||||
|
||||
@@ -1,21 +1,42 @@
|
||||
import { getDefaultState } from './index'
|
||||
import Vue from 'vue'
|
||||
import { MutationTree } from 'vuex'
|
||||
import { ServerUpdateMangerState } from '@/store/server/updateManager/types'
|
||||
import { ServerUpdateManagerState } from '@/store/server/updateManager/types'
|
||||
|
||||
export const mutations: MutationTree<ServerUpdateMangerState> = {
|
||||
export const mutations: MutationTree<ServerUpdateManagerState> = {
|
||||
reset(state) {
|
||||
Object.assign(state, getDefaultState())
|
||||
},
|
||||
|
||||
setStatus(state, payload) {
|
||||
if ('version_info' in payload) {
|
||||
Object.entries(payload.version_info).forEach(([key, value]) => {
|
||||
Vue.set(state.version_info, key, value)
|
||||
})
|
||||
}
|
||||
resetRepos(state) {
|
||||
Vue.set(state, 'git_repos', [])
|
||||
Vue.set(state, 'web_repos', [])
|
||||
Vue.set(state, 'system', {
|
||||
package_count: 0,
|
||||
package_list: [],
|
||||
})
|
||||
},
|
||||
|
||||
if (!payload.busy) Vue.set(state.updateResponse, 'complete', true)
|
||||
storeGitRepo(state, payload) {
|
||||
const newGitRepos = [...state.git_repos]
|
||||
newGitRepos.push({ ...payload })
|
||||
|
||||
Vue.set(state, 'git_repos', newGitRepos)
|
||||
},
|
||||
|
||||
storeWebRepo(state, payload) {
|
||||
const newWebRepos = [...state.web_repos]
|
||||
newWebRepos.push({ ...payload })
|
||||
|
||||
Vue.set(state, 'web_repos', newWebRepos)
|
||||
},
|
||||
|
||||
updateSystem(state, payload) {
|
||||
const newSystem = { ...state.system }
|
||||
newSystem.package_count = payload.package_count
|
||||
newSystem.package_list = payload.package_list
|
||||
|
||||
Vue.set(state, 'system', newSystem)
|
||||
},
|
||||
|
||||
addUpdateResponse(state, payload) {
|
||||
@@ -26,7 +47,11 @@ export const mutations: MutationTree<ServerUpdateMangerState> = {
|
||||
Vue.set(state.updateResponse, 'complete', payload.complete)
|
||||
|
||||
if ('complete' in payload && payload.complete)
|
||||
Vue.$socket.emit('machine.update.status', { refresh: false }, { action: 'server/updateManager/getStatus' })
|
||||
Vue.$socket.emit(
|
||||
'machine.update.status',
|
||||
{ refresh: false },
|
||||
{ action: 'server/updateManager/onUpdateStatus' }
|
||||
)
|
||||
|
||||
state.updateResponse.messages.push({
|
||||
date: new Date(),
|
||||
|
||||
@@ -1,21 +1,27 @@
|
||||
export interface ServerUpdateMangerState {
|
||||
version_info: {
|
||||
// eslint-disable-next-line
|
||||
[key: string]: any
|
||||
export interface ServerUpdateManagerState {
|
||||
busy: boolean
|
||||
github_rate_limit: number | null
|
||||
github_requests_remaining: number | null
|
||||
github_limit_reset_time: number | null
|
||||
git_repos: ServerUpdateManagerStateGitRepo[]
|
||||
web_repos: ServerUpdateManagerStateGitRepo[]
|
||||
system: {
|
||||
package_count: number
|
||||
package_list: string[]
|
||||
}
|
||||
updateResponse: {
|
||||
application: string
|
||||
complete: boolean
|
||||
messages: ServerUpdateMangerStateMessages[]
|
||||
messages: ServerUpdateManagerStateMessages[]
|
||||
}
|
||||
}
|
||||
|
||||
export interface ServerUpdateMangerStateMessages {
|
||||
export interface ServerUpdateManagerStateMessages {
|
||||
date: Date
|
||||
message: string
|
||||
}
|
||||
|
||||
export interface ServerUpdateMangerStateVersionInfoGitRepoCommits {
|
||||
export interface ServerUpdateManagerStateGitRepoCommit {
|
||||
sha: string
|
||||
author: string
|
||||
date: string
|
||||
@@ -24,38 +30,38 @@ export interface ServerUpdateMangerStateVersionInfoGitRepoCommits {
|
||||
tag: string | null
|
||||
}
|
||||
|
||||
export interface ServerUpdateMangerStateVersionInfoGitRepo {
|
||||
branch: string
|
||||
channel: string
|
||||
commits_behind: ServerUpdateMangerStateVersionInfoGitRepoCommits[]
|
||||
configured_type: string
|
||||
current_hash: string
|
||||
debug_enabled: boolean
|
||||
detached: boolean
|
||||
detected_type: string
|
||||
full_version_string: string
|
||||
git_messages: string[]
|
||||
is_dirty: boolean
|
||||
is_valid: boolean
|
||||
need_channel_update: boolean
|
||||
owner: string
|
||||
pristine: boolean
|
||||
remote_alias: string
|
||||
remote_hash: string
|
||||
remote_version: string
|
||||
version: string
|
||||
}
|
||||
|
||||
export interface ServerUpdateMangerStateVersionInfoWeb {
|
||||
channel: string
|
||||
configured_type: string
|
||||
export interface ServerUpdateManagerStateGitRepo {
|
||||
name: string
|
||||
configured_type: string
|
||||
detected_type?: string
|
||||
channel?: string
|
||||
need_channel_update?: boolean
|
||||
pristine?: boolean
|
||||
owner: string
|
||||
remote_version: string
|
||||
branch?: string
|
||||
remote_alias?: string
|
||||
version: string
|
||||
remote_version: string
|
||||
full_version_string?: string
|
||||
current_hash?: string
|
||||
remote_hash?: string
|
||||
is_valid?: boolean
|
||||
is_dirty?: boolean
|
||||
detached?: boolean
|
||||
debug_enabled?: boolean
|
||||
commits_behind?: ServerUpdateManagerStateGitRepoCommit[]
|
||||
git_messages?: string[]
|
||||
warnings?: string[]
|
||||
info_tags?: string[]
|
||||
}
|
||||
|
||||
export interface ServerUpdateMangerStateVersionInfoSystem {
|
||||
package_count: number
|
||||
package_list: string[]
|
||||
export interface ServerUpdateManagerStateGitRepoGroupedCommits {
|
||||
date: Date
|
||||
commits: ServerUpdateManagerStateGitRepoCommit[]
|
||||
}
|
||||
|
||||
export interface ServerUpdateManagerStateGuiList {
|
||||
name: string
|
||||
type: 'git' | 'web'
|
||||
data: ServerUpdateManagerStateGitRepo
|
||||
}
|
||||
@@ -93,7 +93,7 @@ export const actions: ActionTree<SocketState, RootState> = {
|
||||
break
|
||||
|
||||
case 'notify_update_refreshed':
|
||||
commit('server/updateManager/setStatus', payload.params[0], { root: true })
|
||||
dispatch('server/updateManager/onUpdateStatus', payload.params[0], { root: true })
|
||||
break
|
||||
|
||||
case 'notify_history_changed':
|
||||
|
||||
Reference in new issue
Block a user