diff --git a/src/components/mixins/navigation.ts b/src/components/mixins/navigation.ts index 4c13ff8be..a74c8af91 100644 --- a/src/components/mixins/navigation.ts +++ b/src/components/mixins/navigation.ts @@ -9,6 +9,7 @@ import { GuiNavigationStateEntry } from '@/store/gui/navigation/types' export interface NaviPoint { type: 'link' | 'route' title: string + orgTitle?: string to?: string href?: string target?: string @@ -53,6 +54,7 @@ export default class NavigationMixin extends Mixins(BaseMixin) { points.push({ type: 'route', title: this.$t(`Router.${element.title}`), + orgTitle: element.title, icon: element.icon, to: element.path, position, diff --git a/src/components/panels/Machine/UpdatePanel/GitCommitsListDayCommit.vue b/src/components/panels/Machine/UpdatePanel/GitCommitsListDayCommit.vue index c29bf675e..68854fbc9 100644 --- a/src/components/panels/Machine/UpdatePanel/GitCommitsListDayCommit.vue +++ b/src/components/panels/Machine/UpdatePanel/GitCommitsListDayCommit.vue @@ -67,7 +67,7 @@ export default class GitCommitsListDayCommit extends Mixins(BaseMixin) { 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) + 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)) diff --git a/src/components/settings/SettingsNavigationTab.vue b/src/components/settings/SettingsNavigationTab.vue index bb4d727cd..d3f23d0ef 100644 --- a/src/components/settings/SettingsNavigationTab.vue +++ b/src/components/settings/SettingsNavigationTab.vue @@ -34,7 +34,7 @@ export default class SettingsNavigationTab extends Mixins(NavigationMixin, BaseM newVal.forEach((naviPoint, index) => { this.$store.dispatch('gui/navigation/updatePos', { type: naviPoint.type, - title: naviPoint.title, + title: naviPoint.orgTitle ?? naviPoint.title, visible: naviPoint.visible, position: index + 1, }) diff --git a/src/store/gui/navigation/actions.ts b/src/store/gui/navigation/actions.ts index da60b2010..4fa84b25d 100644 --- a/src/store/gui/navigation/actions.ts +++ b/src/store/gui/navigation/actions.ts @@ -2,6 +2,7 @@ import { ActionTree } from 'vuex' import { RootState } from '@/store/types' import Vue from 'vue' import { GuiNavigationState, GuiNavigationStateEntry } from '@/store/gui/navigation/types' +import { NaviPoint } from '@/components/mixins/navigation' export const actions: ActionTree = { reset({ commit }) { @@ -20,7 +21,7 @@ export const actions: ActionTree = { commit('updatePos', payload) }, - changeVisibility({ commit, dispatch }, payload: GuiNavigationStateEntry) { + changeVisibility({ commit, dispatch }, payload: NaviPoint) { commit('changeVisibility', payload) dispatch('upload') }, diff --git a/src/store/gui/navigation/mutations.ts b/src/store/gui/navigation/mutations.ts index 57afc98e5..cf81a2001 100644 --- a/src/store/gui/navigation/mutations.ts +++ b/src/store/gui/navigation/mutations.ts @@ -2,6 +2,7 @@ import { getDefaultState } from './index' import { MutationTree } from 'vuex' import { GuiNavigationState, GuiNavigationStateEntry } from './types' import Vue from 'vue' +import { NaviPoint } from '@/components/mixins/navigation' export const mutations: MutationTree = { reset(state) { @@ -34,9 +35,11 @@ export const mutations: MutationTree = { Vue.set(state, 'entries', entries) }, - changeVisibility(state, payload: GuiNavigationStateEntry) { + changeVisibility(state, payload: NaviPoint) { + const title = payload.orgTitle ?? payload.title + const index = state.entries.findIndex((entry) => { - return entry.type === payload.type && entry.title === payload.title + return entry.type === payload.type && entry.title === title }) // update existing entry @@ -48,7 +51,7 @@ export const mutations: MutationTree = { // create new entry const newEntry: GuiNavigationStateEntry = { type: payload.type, - title: payload.title, + title, visible: !payload.visible, position: payload.position, }