π A self-hostable personal dashboard built for you. Includes status-checking, widgets, themes, icon packs, a UI editor and tons more!
Vue awesomedashboarddockerhomelabhomepagemitnodejsorganizationproductivitypwaself-hostedstartpagevue
π Merge branch 'master' of github.com:lissy93/dashy into ref/small-upgrades
Alicia Sykescc94f223a7f6
diff --cc src/components/LinkItems/Section.vueindex 508c91c1,ab8134e4..0eabf9c0--- a/src/components/LinkItems/Section.vue+++ b/src/components/LinkItems/Section.vue@@@ -323,6 -352,32 +351,32 @@@ export default});this.pendingRemoveWidgetIndex = -1;},+ /* Commits a drag-and-drop move of items or widgets, within or between sections */+ handleMoved(key, { oldIndex, newIndex, from, to }) {+ const { sections } = this.$store.state.config;+ const fromSection = sections[from?.sectionIndex];+ const toSection = sections[to?.sectionIndex];+ if (!fromSection || !toSection) {+ ErrorHandler('Unable to move, section not found');+ return;+ }+ if (fromSection === toSection) {+ this.$store.commit(StoreKeys.UPDATE_SECTION, {- sectionIndex: from.sectionIndex,++ sectionName: fromSection.name,+ sectionData: { ...fromSection, [key]: reorder(fromSection[key] || [], oldIndex, newIndex) },+ });+ return;+ }+ const fromEntries = [...(fromSection[key] || [])];+ const [moved] = fromEntries.splice(oldIndex, 1);+ const toEntries = [...(toSection[key] || [])];+ toEntries.splice(newIndex, 0, moved);+ this.$store.commit(StoreKeys.SET_SECTIONS, sections.map((section, i) => {+ if (i === from.sectionIndex) return { ...section, [key]: fromEntries };+ if (i === to.sectionIndex) return { ...section, [key]: toEntries };+ return section;+ }));+ },/* Calculate width of section, used to dynamically set number of columns */calculateSectionWidth() {const secElem = this.$refs[this.sectionRef];diff --cc src/store.jsindex 53e1b519,4369b2e7..6cd2bbe4--- a/src/store.js+++ b/src/store.js@@@ -5,7 -5,7 +5,7 @@@ import Keys from '@/utils/StoreMutationimport {makePageName, formatConfigPath, componentVisibility, configScope, stripRootOwnedFields,} from '@/utils/config/ConfigHelpers';- import { applyItemId, mapSectionByName } from '@/utils/config/SectionHelpers';-import { applyItemId, stripItemIds } from '@/utils/config/SectionHelpers';++import { applyItemId, mapSectionByName, stripItemIds } from '@/utils/config/SectionHelpers';import filterUserSections from '@/utils/CheckSectionVisibility';import ErrorHandler, { InfoHandler, InfoKeys } from '@/utils/logging/ErrorHandler';import {@@@ -252,9 -252,8 +252,11 @@@ const store = createStore(return getUserState();},+ getSectionByName: (state, getters) => (name) => (+ getters.sections.find((section) => (section.name || '') === name)+ ),+ /* Index is the section's position in the raw config, not the filtered view */+ getSectionByIndex: (state) => (index) => (state.config.sections || [])[index],getItemById: (state, getters) => (id) => {if (!id) return undefined;let item;diff --cc src/utils/config/SectionHelpers.jsindex 62afe0ea,1867f1b5..9adf42d1--- a/src/utils/config/SectionHelpers.js+++ b/src/utils/config/SectionHelpers.js@@@ -22,6 -22,19 +22,18 @@@ const makeItemId = (sectionStr, itemStrreturn `${index}_${charSum}_${itemTitleStr}`;};-/* Return a new array of sections with runtime ids removed from items and widgets,- * so they don't end up in the persisted config */++/* Return a new array of sections, without item/widget ids so they don't get saved */+ export const stripItemIds = (inputSections) => (inputSections || []).map((section) => {+ const next = { ...section };+ if (Array.isArray(section.items)) {+ next.items = section.items.map(({ id: _id, ...item }) => item);+ }+ if (Array.isArray(section.widgets)) {+ next.widgets = section.widgets.map(({ id: _id, ...widget }) => widget);+ }+ return next;+ });+/* Return a new array of sections with a unique id on each item and widget */export const applyItemId = (inputSections) => (inputSections || []).map((section) => {const next = { ...section };