From 9cf3fc873e6c5b7ad19512aff54054b2363383e2 Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Thu, 20 Oct 2022 20:53:14 +0200 Subject: [PATCH 01/42] refactor: fix typo Signed-off-by: Stefan Dej --- src/components/panels/Machine/UpdatePanel.vue | 8 ++++---- src/store/server/types.ts | 4 ++-- src/store/server/updateManager/actions.ts | 4 ++-- src/store/server/updateManager/getters.ts | 4 ++-- src/store/server/updateManager/index.ts | 6 +++--- src/store/server/updateManager/mutations.ts | 4 ++-- src/store/server/updateManager/types.ts | 14 +++++++------- 7 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/components/panels/Machine/UpdatePanel.vue b/src/components/panels/Machine/UpdatePanel.vue index ea786b893..cff32089a 100644 --- a/src/components/panels/Machine/UpdatePanel.vue +++ b/src/components/panels/Machine/UpdatePanel.vue @@ -317,7 +317,7 @@ 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 { ServerUpdateManagerStateVersionInfoGitRepoCommits } from '@/store/server/updateManager/types' import VueI18n from 'vue-i18n' import DateTimeFormatOptions = VueI18n.DateTimeFormatOptions import { @@ -336,7 +336,7 @@ import { interface groupedCommit { date: Date - commits: ServerUpdateMangerStateVersionInfoGitRepoCommits[] + commits: ServerUpdateManagerStateVersionInfoGitRepoCommits[] } interface commitsOverlay { @@ -344,7 +344,7 @@ interface commitsOverlay { owner: string modul: string repoName: string - commits: ServerUpdateMangerStateVersionInfoGitRepoCommits[] + commits: ServerUpdateManagerStateVersionInfoGitRepoCommits[] groupedCommits: groupedCommit[] } @@ -605,7 +605,7 @@ export default class UpdatePanel extends Mixins(BaseMixin) { this.commitsOverlay.groupedCommits = [] let lastDate: null | Date = null - let tmpCommits: ServerUpdateMangerStateVersionInfoGitRepoCommits[] = [] + let tmpCommits: ServerUpdateManagerStateVersionInfoGitRepoCommits[] = [] object.commits_behind.forEach((commit: any) => { const commitDate = new Date(commit.date * 1000) diff --git a/src/store/server/types.ts b/src/store/server/types.ts index 41a0a8e7a..d11c23c88 100644 --- a/src/store/server/types.ts +++ b/src/store/server/types.ts @@ -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 } diff --git a/src/store/server/updateManager/actions.ts b/src/store/server/updateManager/actions.ts index a3b347ead..6783407c6 100644 --- a/src/store/server/updateManager/actions.ts +++ b/src/store/server/updateManager/actions.ts @@ -1,9 +1,9 @@ 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 = { +export const actions: ActionTree = { reset({ commit }) { commit('reset') }, diff --git a/src/store/server/updateManager/getters.ts b/src/store/server/updateManager/getters.ts index 84611b24b..8d17525ad 100644 --- a/src/store/server/updateManager/getters.ts +++ b/src/store/server/updateManager/getters.ts @@ -1,9 +1,9 @@ import { GetterTree } from 'vuex' -import { ServerUpdateMangerState } from '@/store/server/updateManager/types' +import { ServerUpdateManagerState } from '@/store/server/updateManager/types' import semver from 'semver' // eslint-disable-next-line -export const getters: GetterTree = { +export const getters: GetterTree = { getUpdateableSoftwares(state) { // eslint-disable-next-line const output: any = {} diff --git a/src/store/server/updateManager/index.ts b/src/store/server/updateManager/index.ts index d10eab9ac..c45471dee 100644 --- a/src/store/server/updateManager/index.ts +++ b/src/store/server/updateManager/index.ts @@ -1,10 +1,10 @@ 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: {}, updateResponse: { @@ -19,7 +19,7 @@ export const getDefaultState = (): ServerUpdateMangerState => { const state = getDefaultState() // eslint-disable-next-line -export const updateManager: Module = { +export const updateManager: Module = { namespaced: true, state, getters, diff --git a/src/store/server/updateManager/mutations.ts b/src/store/server/updateManager/mutations.ts index ca939c49c..4ceb2cdcb 100644 --- a/src/store/server/updateManager/mutations.ts +++ b/src/store/server/updateManager/mutations.ts @@ -1,9 +1,9 @@ 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 = { +export const mutations: MutationTree = { reset(state) { Object.assign(state, getDefaultState()) }, diff --git a/src/store/server/updateManager/types.ts b/src/store/server/updateManager/types.ts index ae6aee648..5070e0683 100644 --- a/src/store/server/updateManager/types.ts +++ b/src/store/server/updateManager/types.ts @@ -1,4 +1,4 @@ -export interface ServerUpdateMangerState { +export interface ServerUpdateManagerState { version_info: { // eslint-disable-next-line [key: string]: any @@ -6,16 +6,16 @@ export interface ServerUpdateMangerState { updateResponse: { application: string complete: boolean - messages: ServerUpdateMangerStateMessages[] + messages: ServerUpdateManagerStateMessages[] } } -export interface ServerUpdateMangerStateMessages { +export interface ServerUpdateManagerStateMessages { date: Date message: string } -export interface ServerUpdateMangerStateVersionInfoGitRepoCommits { +export interface ServerUpdateManagerStateVersionInfoGitRepoCommits { sha: string author: string date: string @@ -27,7 +27,7 @@ export interface ServerUpdateMangerStateVersionInfoGitRepoCommits { export interface ServerUpdateMangerStateVersionInfoGitRepo { branch: string channel: string - commits_behind: ServerUpdateMangerStateVersionInfoGitRepoCommits[] + commits_behind: ServerUpdateManagerStateVersionInfoGitRepoCommits[] configured_type: string current_hash: string debug_enabled: boolean @@ -46,7 +46,7 @@ export interface ServerUpdateMangerStateVersionInfoGitRepo { version: string } -export interface ServerUpdateMangerStateVersionInfoWeb { +export interface ServerUpdateManagerStateVersionInfoWeb { channel: string configured_type: string name: string @@ -55,7 +55,7 @@ export interface ServerUpdateMangerStateVersionInfoWeb { version: string } -export interface ServerUpdateMangerStateVersionInfoSystem { +export interface ServerUpdateManagerStateVersionInfoSystem { package_count: number package_list: string[] } From 1ce87ff22e4c0cf1f4f0793113bc807ed4d9029d Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Thu, 20 Oct 2022 20:54:24 +0200 Subject: [PATCH 02/42] refactor: add last_error to ServerUpdateManagerStateVersionInfoWeb Signed-off-by: Stefan Dej --- src/store/server/updateManager/types.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/store/server/updateManager/types.ts b/src/store/server/updateManager/types.ts index 5070e0683..ea2352b41 100644 --- a/src/store/server/updateManager/types.ts +++ b/src/store/server/updateManager/types.ts @@ -53,6 +53,7 @@ export interface ServerUpdateManagerStateVersionInfoWeb { owner: string remote_version: string version: string + last_error: string } export interface ServerUpdateManagerStateVersionInfoSystem { From 58efed8ca2d0272c73273789cacdedd0b2cc8dd3 Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Sun, 23 Oct 2022 21:57:15 +0200 Subject: [PATCH 03/42] refactor: WIP Signed-off-by: Stefan Dej --- src/components/TheUpdateDialog.vue | 2 +- src/components/panels/Machine/UpdatePanel.vue | 612 +----------------- .../panels/Machine/UpdatePanelGit.vue | 270 ++++++++ src/locales/en.json | 7 + src/store/server/updateManager/actions.ts | 27 +- src/store/server/updateManager/getters.ts | 31 +- src/store/server/updateManager/index.ts | 11 +- src/store/server/updateManager/mutations.ts | 43 +- src/store/server/updateManager/types.ts | 58 +- src/store/socket/actions.ts | 2 +- 10 files changed, 439 insertions(+), 624 deletions(-) create mode 100644 src/components/panels/Machine/UpdatePanelGit.vue diff --git a/src/components/TheUpdateDialog.vue b/src/components/TheUpdateDialog.vue index fc45f2b06..8c5b107f1 100644 --- a/src/components/TheUpdateDialog.vue +++ b/src/components/TheUpdateDialog.vue @@ -164,7 +164,7 @@ export default class TheUpdateDialog extends Mixins(BaseMixin) { window.location.reload(true) 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' }) } } diff --git a/src/components/panels/Machine/UpdatePanel.vue b/src/components/panels/Machine/UpdatePanel.vue index cff32089a..b2dc32dc0 100644 --- a/src/components/panels/Machine/UpdatePanel.vue +++ b/src/components/panels/Machine/UpdatePanel.vue @@ -1,68 +1,8 @@ - - - - - -
- - - - {{ 'name' in value ? value.name : key }} -
- - - {{ mdiInformation }} - - {{ getVersionOutput(value) }} - -
- - - - -
-
- - -
+ +
- - - - - - - - - - - -

- {{ - $t('Machine.UpdatePanel.CommitsOnDate', { - date: new Date(group.date).toLocaleDateString( - language, - dateOptions - ), - }) - }} -

-
    -
  • - - -

    - {{ commit.subject }} - - {{ mdiDotsHorizontal }} - -

    -

    -

    - - {{ commit.author }} - - {{ convertCommitDate(commit.date) }} -

    -
    - - - {{ commit.sha.substr(0, 6) }} - - -
    -
  • -
-
-
-
-
-
-
-
-
-
-
diff --git a/src/components/panels/Machine/UpdatePanelGit.vue b/src/components/panels/Machine/UpdatePanelGit.vue new file mode 100644 index 000000000..58b264994 --- /dev/null +++ b/src/components/panels/Machine/UpdatePanelGit.vue @@ -0,0 +1,270 @@ + + + diff --git a/src/locales/en.json b/src/locales/en.json index f28ada510..fe5b36991 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -466,9 +466,16 @@ "Detached": "detached", "Dirty": "dirty", "ERROR": "ERROR", + "HardRecovery": "Hard Recovery", "Invalid": "invalid", + "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": "Your local repository has been modified and cannot be updated in this state. Please recovery your this repository. (Caution! Unsaved files in this directory will be deleted!)", + "Invalid": "Detached state is not an error nor is it a problem." + }, "OSPackages": "OS-Packages", "PackagesCanBeUpgraded": "packages can be upgraded", + "SoftRecovery": "Soft Recovery", "System": "System", "Unknown": "unknown", "Update": "update", diff --git a/src/store/server/updateManager/actions.ts b/src/store/server/updateManager/actions.ts index 6783407c6..cfc9286d4 100644 --- a/src/store/server/updateManager/actions.ts +++ b/src/store/server/updateManager/actions.ts @@ -9,11 +9,32 @@ export const actions: ActionTree = { }, 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 commit('setStatus', payload) await dispatch('socket/removeInitModule', 'server/updateManager/init', { root: true }) }, } diff --git a/src/store/server/updateManager/getters.ts b/src/store/server/updateManager/getters.ts index 8d17525ad..2f40e92c4 100644 --- a/src/store/server/updateManager/getters.ts +++ b/src/store/server/updateManager/getters.ts @@ -1,10 +1,33 @@ import { GetterTree } from 'vuex' -import { ServerUpdateManagerState } from '@/store/server/updateManager/types' -import semver from 'semver' +import { ServerUpdateManagerState, ServerUpdateManagerStateGuiList } from '@/store/server/updateManager/types' +import { caseInsensitiveSort } from '@/plugins/helpers' +//import semver from 'semver' // eslint-disable-next-line export const getters: GetterTree = { - getUpdateableSoftwares(state) { + getUpdateManagerList(state) { + const output: ServerUpdateManagerStateGuiList[] = [] + + state.git_repos.forEach((repo) => { + output.push({ + name: repo.name, + type: 'git', + data: { ...repo }, + }) + }) + + state.web_repos.forEach((repo) => { + output.push({ + name: repo.name, + type: 'web', + data: { ...repo }, + }) + }) + + return caseInsensitiveSort(output, 'name') + }, + + /*getUpdateableSoftwares(state) { // eslint-disable-next-line const output: any = {} const sortKeys = Object.keys(state.version_info).sort((a, b) => { @@ -44,5 +67,5 @@ export const getters: GetterTree = { } return false - }, + },*/ } diff --git a/src/store/server/updateManager/index.ts b/src/store/server/updateManager/index.ts index c45471dee..ed6cf3c1b 100644 --- a/src/store/server/updateManager/index.ts +++ b/src/store/server/updateManager/index.ts @@ -6,7 +6,16 @@ import { getters } from '@/store/server/updateManager/getters' 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, diff --git a/src/store/server/updateManager/mutations.ts b/src/store/server/updateManager/mutations.ts index 4ceb2cdcb..ad94b93c5 100644 --- a/src/store/server/updateManager/mutations.ts +++ b/src/store/server/updateManager/mutations.ts @@ -1,21 +1,46 @@ import { getDefaultState } from './index' import Vue from 'vue' import { MutationTree } from 'vuex' -import { ServerUpdateManagerState } from '@/store/server/updateManager/types' +import { + ServerUpdateManagerState, + ServerUpdateManagerStateGitRepo, + ServerUpdateManagerStateGitRepoCommits, +} from '@/store/server/updateManager/types' export const mutations: MutationTree = { 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: [], + }) + }, + + 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 - if (!payload.busy) Vue.set(state.updateResponse, 'complete', true) + Vue.set(state, 'system', newSystem) }, addUpdateResponse(state, payload) { @@ -26,7 +51,7 @@ export const mutations: MutationTree = { 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(), diff --git a/src/store/server/updateManager/types.ts b/src/store/server/updateManager/types.ts index ea2352b41..19a60d79e 100644 --- a/src/store/server/updateManager/types.ts +++ b/src/store/server/updateManager/types.ts @@ -1,7 +1,13 @@ export interface ServerUpdateManagerState { - version_info: { - // eslint-disable-next-line - [key: string]: any + busy: boolean + github_rate_limit: number | null + github_requests_remaining: number | null + github_limit_reset_time: number | null + git_repos: ServerUpdateManagerStateGitRepo[] + web_repos: ServerUpdateManagerStateWebRepo[] + system: { + package_count: 0 + package_list: string[] } updateResponse: { application: string @@ -15,7 +21,7 @@ export interface ServerUpdateManagerStateMessages { message: string } -export interface ServerUpdateManagerStateVersionInfoGitRepoCommits { +export interface ServerUpdateManagerStateGitRepoCommits { sha: string author: string date: string @@ -24,39 +30,43 @@ export interface ServerUpdateManagerStateVersionInfoGitRepoCommits { tag: string | null } -export interface ServerUpdateMangerStateVersionInfoGitRepo { - branch: string - channel: string - commits_behind: ServerUpdateManagerStateVersionInfoGitRepoCommits[] +export interface ServerUpdateManagerStateGitRepo { + name: string 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 + channel: string need_channel_update: boolean - owner: string pristine: boolean + owner: string + branch: string remote_alias: string - remote_hash: string - remote_version: 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: ServerUpdateManagerStateGitRepoCommits[] + git_messages: string[] + info_tags: string[] } -export interface ServerUpdateManagerStateVersionInfoWeb { +export interface ServerUpdateManagerStateWebRepo { channel: string - configured_type: string + configured_type: 'web' | 'web_beta' name: string owner: string - remote_version: string version: string + remote_version: string + info_tags: string[] last_error: string } -export interface ServerUpdateManagerStateVersionInfoSystem { - package_count: number - package_list: string[] +export interface ServerUpdateManagerStateGuiList { + name: string + type: 'git' | 'web' + data: ServerUpdateManagerStateGitRepo | ServerUpdateManagerStateWebRepo } diff --git a/src/store/socket/actions.ts b/src/store/socket/actions.ts index c2f399682..ca27b4e04 100644 --- a/src/store/socket/actions.ts +++ b/src/store/socket/actions.ts @@ -93,7 +93,7 @@ export const actions: ActionTree = { 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': From 08ae41caedde7960b7e026be413c71b041b9034c Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Wed, 2 Nov 2022 20:03:27 +0100 Subject: [PATCH 04/42] refactor: WIP Signed-off-by: Stefan Dej --- .../panels/Machine/UpdatePanelGit.vue | 22 ++++- .../Machine/UpdatePanelGitCommitsList.vue | 88 +++++++++++++++++++ .../Machine/UpdatePanelGitCommitsListDay.vue | 34 +++++++ src/store/server/updateManager/types.ts | 5 ++ 4 files changed, 145 insertions(+), 4 deletions(-) create mode 100644 src/components/panels/Machine/UpdatePanelGitCommitsList.vue create mode 100644 src/components/panels/Machine/UpdatePanelGitCommitsListDay.vue diff --git a/src/components/panels/Machine/UpdatePanelGit.vue b/src/components/panels/Machine/UpdatePanelGit.vue index 58b264994..321e91a2a 100644 --- a/src/components/panels/Machine/UpdatePanelGit.vue +++ b/src/components/panels/Machine/UpdatePanelGit.vue @@ -5,10 +5,10 @@ {{ repo.name }}
{{ versionOutput }} @@ -71,6 +71,10 @@ + @@ -88,13 +92,17 @@ import { mdiReload, } from '@mdi/js' import semver from 'semver' - -@Component +import UpdatePanelGitCommitsList from '@/components/panels/Machine/UpdatePanelGitCommitsList.vue' +@Component({ + components: { UpdatePanelGitCommitsList }, +}) export default class UpdatePanelGit extends Mixins(BaseMixin) { mdiInformation = mdiInformation mdiMenuDown = mdiMenuDown mdiReload = mdiReload + boolShowCommitList = false + @Prop({ required: true }) readonly repo!: ServerUpdateManagerStateGitRepo get name() { @@ -266,5 +274,11 @@ export default class UpdatePanelGit extends Mixins(BaseMixin) { doRecovery(hard: boolean) { this.$socket.emit('machine.update.recover', { name: this.repo.name, hard: hard }) } + + closeCommitList() { + this.boolShowCommitList = false + } } + + diff --git a/src/components/panels/Machine/UpdatePanelGitCommitsList.vue b/src/components/panels/Machine/UpdatePanelGitCommitsList.vue new file mode 100644 index 000000000..766969f34 --- /dev/null +++ b/src/components/panels/Machine/UpdatePanelGitCommitsList.vue @@ -0,0 +1,88 @@ + + + diff --git a/src/components/panels/Machine/UpdatePanelGitCommitsListDay.vue b/src/components/panels/Machine/UpdatePanelGitCommitsListDay.vue new file mode 100644 index 000000000..6b6c11817 --- /dev/null +++ b/src/components/panels/Machine/UpdatePanelGitCommitsListDay.vue @@ -0,0 +1,34 @@ + + + diff --git a/src/store/server/updateManager/types.ts b/src/store/server/updateManager/types.ts index 19a60d79e..53905152b 100644 --- a/src/store/server/updateManager/types.ts +++ b/src/store/server/updateManager/types.ts @@ -54,6 +54,11 @@ export interface ServerUpdateManagerStateGitRepo { info_tags: string[] } +export interface ServerUpdateManagerStateGitRepoGroupedCommit { + date: Date + commits: ServerUpdateManagerStateGitRepoCommits[] +} + export interface ServerUpdateManagerStateWebRepo { channel: string configured_type: 'web' | 'web_beta' From 28b6a849ffb16d958c6dc32c546291cf5ffdd70c Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Mon, 7 Nov 2022 00:03:50 +0100 Subject: [PATCH 05/42] refactor: WIP Signed-off-by: Stefan Dej --- .../Machine/UpdatePanelGitCommitsList.vue | 2 +- .../Machine/UpdatePanelGitCommitsListDay.vue | 32 ++++++++++--------- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/src/components/panels/Machine/UpdatePanelGitCommitsList.vue b/src/components/panels/Machine/UpdatePanelGitCommitsList.vue index 766969f34..4408294cc 100644 --- a/src/components/panels/Machine/UpdatePanelGitCommitsList.vue +++ b/src/components/panels/Machine/UpdatePanelGitCommitsList.vue @@ -18,7 +18,7 @@ v-for="group of groupedCommits" :key="group.date.getTime()" :repo="repo" - :grouped-commit="groupedCommits" /> + :commits="group" /> diff --git a/src/components/panels/Machine/UpdatePanelGitCommitsListDay.vue b/src/components/panels/Machine/UpdatePanelGitCommitsListDay.vue index 6b6c11817..5772769e0 100644 --- a/src/components/panels/Machine/UpdatePanelGitCommitsListDay.vue +++ b/src/components/panels/Machine/UpdatePanelGitCommitsListDay.vue @@ -1,18 +1,20 @@ From ccf6eeff0210cbee7b0aaed06d31db705d772119 Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Tue, 7 Feb 2023 22:47:39 +0100 Subject: [PATCH 06/42] WIP Signed-off-by: Stefan Dej --- .../panels/Machine/UpdatePanelGit.vue | 20 ++++++++++++++++++- src/locales/en.json | 3 +-- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/components/panels/Machine/UpdatePanelGit.vue b/src/components/panels/Machine/UpdatePanelGit.vue index 321e91a2a..7589fe41a 100644 --- a/src/components/panels/Machine/UpdatePanelGit.vue +++ b/src/components/panels/Machine/UpdatePanelGit.vue @@ -71,6 +71,20 @@ + + + + {{ message }} + + + Date: Sun, 12 Feb 2023 13:01:03 +0100 Subject: [PATCH 07/42] feat: WIP Signed-off-by: Stefan Dej --- .../panels/Machine/UpdatePanelGitCommitsList.vue | 14 +++++++------- .../Machine/UpdatePanelGitCommitsListDay.vue | 8 ++++---- src/store/server/updateManager/mutations.ts | 8 ++++++-- src/store/server/updateManager/types.ts | 8 ++++---- 4 files changed, 21 insertions(+), 17 deletions(-) diff --git a/src/components/panels/Machine/UpdatePanelGitCommitsList.vue b/src/components/panels/Machine/UpdatePanelGitCommitsList.vue index 4408294cc..0e3cf023e 100644 --- a/src/components/panels/Machine/UpdatePanelGitCommitsList.vue +++ b/src/components/panels/Machine/UpdatePanelGitCommitsList.vue @@ -1,7 +1,7 @@ @@ -114,8 +119,9 @@ import { } 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 }, + components: { GitCommitsList, UpdateHint }, }) export default class UpdatePanelEntry extends Mixins(BaseMixin) { mdiInformation = mdiInformation @@ -124,6 +130,7 @@ export default class UpdatePanelEntry extends Mixins(BaseMixin) { mdiAlertCircle = mdiAlertCircle boolShowCommitList = false + boolShowUpdateHint = false @Prop({ required: true }) readonly repo!: ServerUpdateManagerStateGitRepo @@ -318,6 +325,10 @@ export default class UpdatePanelEntry extends Mixins(BaseMixin) { closeCommitList() { this.boolShowCommitList = false } + + closeShowUpdateHint() { + this.boolShowUpdateHint = false + } } diff --git a/src/components/panels/Machine/UpdatePanel/EntryAll.vue b/src/components/panels/Machine/UpdatePanel/EntryAll.vue new file mode 100644 index 000000000..8d3f4d047 --- /dev/null +++ b/src/components/panels/Machine/UpdatePanel/EntryAll.vue @@ -0,0 +1,39 @@ + + + + + diff --git a/src/components/panels/Machine/UpdatePanel/GitCommitsList.vue b/src/components/panels/Machine/UpdatePanel/GitCommitsList.vue index 0a84d6a62..cf1624b40 100644 --- a/src/components/panels/Machine/UpdatePanel/GitCommitsList.vue +++ b/src/components/panels/Machine/UpdatePanel/GitCommitsList.vue @@ -66,10 +66,10 @@ export default class GitCommitsList extends Mixins(BaseMixin) { mdiCloseThick = mdiCloseThick @Prop({ required: true }) readonly boolShowDialog!: boolean - @Prop({ required: true }) readonly repo!: ServerUpdateManagerStateGitRepo + @Prop({ required: true }) readonly repo!: ServerUpdateManagerStateGitRepo | null get commitsBehind(): ServerUpdateManagerStateGitRepoCommit[] { - return this.repo.commits_behind ?? [] + return this.repo?.commits_behind ?? [] } get groupedCommits() { @@ -107,7 +107,7 @@ export default class GitCommitsList extends Mixins(BaseMixin) { } get linkToGithub() { - return `https://github.com/${this.repo.owner}/${this.repo.name}/commits/${this.repo.branch}/?after=${this.lastCommit?.sha}+0` + return `https://github.com/${this.repo?.owner}/${this.repo?.name}/commits/${this.repo?.branch}/?after=${this.lastCommit?.sha}+0` } closeDialog() { diff --git a/src/components/panels/Machine/UpdatePanel/UpdateHint.vue b/src/components/panels/Machine/UpdatePanel/UpdateHint.vue new file mode 100644 index 000000000..6a5f08749 --- /dev/null +++ b/src/components/panels/Machine/UpdatePanel/UpdateHint.vue @@ -0,0 +1,67 @@ + + + diff --git a/src/components/panels/Machine/UpdatePanel/UpdateHintAlert.vue b/src/components/panels/Machine/UpdatePanel/UpdateHintAlert.vue new file mode 100644 index 000000000..7821090dc --- /dev/null +++ b/src/components/panels/Machine/UpdatePanel/UpdateHintAlert.vue @@ -0,0 +1,91 @@ + + + diff --git a/src/components/panels/Machine/UpdatePanel/UpdateHintAll.vue b/src/components/panels/Machine/UpdatePanel/UpdateHintAll.vue new file mode 100644 index 000000000..829ddc9dd --- /dev/null +++ b/src/components/panels/Machine/UpdatePanel/UpdateHintAll.vue @@ -0,0 +1,101 @@ + + + diff --git a/src/locales/en.json b/src/locales/en.json index 95fdd756c..db602a2a1 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -478,8 +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}", @@ -487,29 +490,40 @@ "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", "Invalid": "invalid", + "IUnderstandTheRisks": "I understand the risks", "LinkToGithub": "Link to GitHub", + "KlipperUpdateQuestionFirmware": "This will update the host Klipper software. Control boards that you have flashed the Klipper firmware onto may need to be recompiled and reflashed before you can continue using your machine.", + "KlipperUpdateQuestionConfig": "This update may also contain changes to config parameters that would need to be modified in your printer.cfg file, see the change log for details.", + "MoonrakerUpdateQuestion": "This will update the Moonraker API. Changes to your moonraker.conf file may be required to continue using your 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": "Your local repository has been modified and cannot be updated in this state. Please recover this repository." }, "OSPackages": "OS-Packages", + "ReleaseNotes": "Release Notes", "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", "UpgradeableSystemPackages": "Upgradeable System Packages", - "UpToDate": "up-to-date" + "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": { From c202e17cf5b9fb5bd2c49a1ec84aeccd1f692907 Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Tue, 4 Jul 2023 23:49:32 +0200 Subject: [PATCH 21/42] refactor: add updateAll api call Signed-off-by: Stefan Dej --- src/components/panels/Machine/UpdatePanel/EntryAll.vue | 5 ++++- src/components/panels/Machine/UpdatePanel/UpdateHintAll.vue | 6 +++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/components/panels/Machine/UpdatePanel/EntryAll.vue b/src/components/panels/Machine/UpdatePanel/EntryAll.vue index 8d3f4d047..4085d6afa 100644 --- a/src/components/panels/Machine/UpdatePanel/EntryAll.vue +++ b/src/components/panels/Machine/UpdatePanel/EntryAll.vue @@ -13,7 +13,10 @@ - + diff --git a/src/components/panels/Machine/UpdatePanel/UpdateHintAll.vue b/src/components/panels/Machine/UpdatePanel/UpdateHintAll.vue index 829ddc9dd..87c3f7f27 100644 --- a/src/components/panels/Machine/UpdatePanel/UpdateHintAll.vue +++ b/src/components/panels/Machine/UpdatePanel/UpdateHintAll.vue @@ -32,7 +32,7 @@ {{ $t('Machine.UpdatePanel.Abort') }} - + {{ $t('Machine.UpdatePanel.StartUpdate') }} @@ -97,5 +97,9 @@ export default class UpdateHintAll extends Mixins(BaseMixin) { closeDialog() { this.$emit('close-dialog') } + + updateAll() { + this.$emit('update-all') + } } From 26d1911c41179dc60f57c1254574306107220ae6 Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Tue, 4 Jul 2023 23:52:54 +0200 Subject: [PATCH 22/42] refactor: add update api call Signed-off-by: Stefan Dej --- src/components/panels/Machine/UpdatePanel/Entry.vue | 1 + src/components/panels/Machine/UpdatePanel/UpdateHint.vue | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/components/panels/Machine/UpdatePanel/Entry.vue b/src/components/panels/Machine/UpdatePanel/Entry.vue index 14f758d56..de1a43b82 100644 --- a/src/components/panels/Machine/UpdatePanel/Entry.vue +++ b/src/components/panels/Machine/UpdatePanel/Entry.vue @@ -100,6 +100,7 @@ :bool-show-dialog="boolShowUpdateHint" :repo="repo" @open-commit-history="boolShowCommitList = true" + @do-update="doUpdate" @close-dialog="closeShowUpdateHint" /> diff --git a/src/components/panels/Machine/UpdatePanel/UpdateHint.vue b/src/components/panels/Machine/UpdatePanel/UpdateHint.vue index 6a5f08749..8720e2f77 100644 --- a/src/components/panels/Machine/UpdatePanel/UpdateHint.vue +++ b/src/components/panels/Machine/UpdatePanel/UpdateHint.vue @@ -27,7 +27,7 @@ {{ $t('Machine.UpdatePanel.Abort') }} - + {{ $t('Machine.UpdatePanel.StartUpdate') }} @@ -56,6 +56,10 @@ export default class UpdateHint extends Mixins(BaseMixin) { @Prop({ required: true }) readonly boolShowDialog!: boolean @Prop({ required: true }) readonly repo!: ServerUpdateManagerStateGitRepo + doUpdate() { + this.$emit('do-update') + } + openCommitHistory() { this.$emit('open-commit-history') } From e2b5713c90cc903ac7fb0296a7ac4b8b65340fd0 Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Wed, 5 Jul 2023 00:04:25 +0200 Subject: [PATCH 23/42] refactor: add hide all update warnings function Signed-off-by: Stefan Dej --- .../panels/Machine/UpdatePanel/Entry.vue | 15 ++++++++++++++- .../panels/Machine/UpdatePanel/EntryAll.vue | 15 ++++++++++++++- src/components/settings/SettingsUiSettingsTab.vue | 15 +++++++++++++++ src/locales/en.json | 2 ++ src/store/gui/index.ts | 1 + src/store/gui/types.ts | 1 + 6 files changed, 47 insertions(+), 2 deletions(-) diff --git a/src/components/panels/Machine/UpdatePanel/Entry.vue b/src/components/panels/Machine/UpdatePanel/Entry.vue index de1a43b82..9e9d6e568 100644 --- a/src/components/panels/Machine/UpdatePanel/Entry.vue +++ b/src/components/panels/Machine/UpdatePanel/Entry.vue @@ -64,7 +64,7 @@ :color="btnColor" :disabled="btnDisabled" class="minwidth-0 px-2 text-uppercase" - @click="boolShowUpdateHint = true"> + @click="clickUpdate"> {{ btnIcon }} {{ btnText }} @@ -310,6 +310,19 @@ export default class UpdatePanelEntry extends Mixins(BaseMixin) { 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, {}) diff --git a/src/components/panels/Machine/UpdatePanel/EntryAll.vue b/src/components/panels/Machine/UpdatePanel/EntryAll.vue index 4085d6afa..3f1dce834 100644 --- a/src/components/panels/Machine/UpdatePanel/EntryAll.vue +++ b/src/components/panels/Machine/UpdatePanel/EntryAll.vue @@ -7,7 +7,7 @@ color="primary" small :disabled="['printing', 'paused'].includes(printer_state)" - @click="boolShowDialog = true"> + @click="clickUpdate"> {{ mdiProgressUpload }} {{ $t('Machine.UpdatePanel.UpdateAll') }} @@ -33,6 +33,19 @@ export default class UpdatePanelEntryAll extends Mixins(BaseMixin) { 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', {}) } diff --git a/src/components/settings/SettingsUiSettingsTab.vue b/src/components/settings/SettingsUiSettingsTab.vue index 418775b66..91c24c80d 100644 --- a/src/components/settings/SettingsUiSettingsTab.vue +++ b/src/components/settings/SettingsUiSettingsTab.vue @@ -195,6 +195,13 @@ :step="1" :label="tempchartHeight + 'px'" /> + + + + @@ -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) diff --git a/src/locales/en.json b/src/locales/en.json index db602a2a1..6470722cf 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -1071,6 +1071,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.", diff --git a/src/store/gui/index.ts b/src/store/gui/index.ts index 74fa10046..248b2220c 100644 --- a/src/store/gui/index.ts +++ b/src/store/gui/index.ts @@ -165,6 +165,7 @@ export const getDefaultState = (): GuiState => { boolBedScrewsDialog: true, boolScrewsTiltAdjustDialog: true, tempchartHeight: 250, + hideUpdateWarnings: false, }, view: { blockFileUpload: false, diff --git a/src/store/gui/types.ts b/src/store/gui/types.ts index d818af047..e9a8e2bc5 100644 --- a/src/store/gui/types.ts +++ b/src/store/gui/types.ts @@ -115,6 +115,7 @@ export interface GuiState { boolBedScrewsDialog: boolean boolScrewsTiltAdjustDialog: boolean tempchartHeight: number + hideUpdateWarnings: boolean } view: { blockFileUpload: boolean From ef3653926bcf37b0ab629473961b47cd800055ed Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Wed, 5 Jul 2023 00:10:27 +0200 Subject: [PATCH 24/42] style: fix prettier issue Signed-off-by: Stefan Dej --- src/components/TheUpdateDialog.vue | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/components/TheUpdateDialog.vue b/src/components/TheUpdateDialog.vue index 8c5b107f1..946d9f374 100644 --- a/src/components/TheUpdateDialog.vue +++ b/src/components/TheUpdateDialog.vue @@ -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/onUpdateStatus' }) + this.$socket.emit( + 'machine.update.status', + { refresh: false }, + { action: 'server/updateManager/onUpdateStatus' } + ) } } From 0a32b830127e953e7e85b07cde32b560648f360c Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Tue, 11 Jul 2023 20:35:37 +0200 Subject: [PATCH 25/42] feat: add warnings output to each update_manager entry Signed-off-by: Stefan Dej --- .../panels/Machine/UpdatePanel/Entry.vue | 17 +++++++++++++++++ src/store/server/updateManager/types.ts | 1 + 2 files changed, 18 insertions(+) diff --git a/src/components/panels/Machine/UpdatePanel/Entry.vue b/src/components/panels/Machine/UpdatePanel/Entry.vue index 9e9d6e568..707199e96 100644 --- a/src/components/panels/Machine/UpdatePanel/Entry.vue +++ b/src/components/panels/Machine/UpdatePanel/Entry.vue @@ -85,6 +85,19 @@ text dense border="left" + type="info"> + {{ message }} + + + + + + {{ message }} @@ -299,6 +312,10 @@ export default class UpdatePanelEntry extends Mixins(BaseMixin) { return this.repo.git_messages ?? [] } + get warnings() { + return this.repo.warnings ?? [] + } + get webUpdatable() { if (!this.localVersion) return false if (!this.remoteVersion) return false diff --git a/src/store/server/updateManager/types.ts b/src/store/server/updateManager/types.ts index 3eecd36dc..991c51b43 100644 --- a/src/store/server/updateManager/types.ts +++ b/src/store/server/updateManager/types.ts @@ -51,6 +51,7 @@ export interface ServerUpdateManagerStateGitRepo { debug_enabled?: boolean commits_behind?: ServerUpdateManagerStateGitRepoCommit[] git_messages?: string[] + warnings?: string[] info_tags?: string[] last_error?: string } From 64cbea54509fb6afbf5f0fa1dd8b45f3d7709814 Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Tue, 11 Jul 2023 21:22:21 +0200 Subject: [PATCH 26/42] feat: add info when all components are "unknown" to init the update manager Signed-off-by: Stefan Dej --- src/components/panels/Machine/UpdatePanel.vue | 39 ++++++++++++++----- src/locales/en.json | 1 + 2 files changed, 30 insertions(+), 10 deletions(-) diff --git a/src/components/panels/Machine/UpdatePanel.vue b/src/components/panels/Machine/UpdatePanel.vue index af6c3c1f1..18645e19d 100644 --- a/src/components/panels/Machine/UpdatePanel.vue +++ b/src/components/panels/Machine/UpdatePanel.vue @@ -26,17 +26,28 @@ - -