mirror of
https://github.com/Lissy93/dashy.git
synced 2025-07-25 22:55:32 +02:00
🚧 Working on interactive editor, commiting to switch computer
This commit is contained in:
parent
f450094235
commit
f398a374e7
@ -171,7 +171,7 @@
|
|||||||
"workspace": "Workspace View",
|
"workspace": "Workspace View",
|
||||||
"options-section-title": "Options",
|
"options-section-title": "Options",
|
||||||
"edit-item": "Edit",
|
"edit-item": "Edit",
|
||||||
"move-item": "Move To",
|
"move-item": "Copy or Move",
|
||||||
"remove-item": "Remove"
|
"remove-item": "Remove"
|
||||||
},
|
},
|
||||||
"context-menus": {
|
"context-menus": {
|
||||||
@ -183,7 +183,7 @@
|
|||||||
"workspace": "Workspace View",
|
"workspace": "Workspace View",
|
||||||
"options-section-title": "Options",
|
"options-section-title": "Options",
|
||||||
"edit-item": "Edit",
|
"edit-item": "Edit",
|
||||||
"move-item": "Move To",
|
"move-item": "Copy or Move",
|
||||||
"remove-item": "Remove"
|
"remove-item": "Remove"
|
||||||
},
|
},
|
||||||
"section": {
|
"section": {
|
||||||
@ -213,7 +213,8 @@
|
|||||||
"edit-mode-name": "Edit Mode",
|
"edit-mode-name": "Edit Mode",
|
||||||
"edit-mode-subtitle": "You are in Edit Mode",
|
"edit-mode-subtitle": "You are in Edit Mode",
|
||||||
"edit-mode-description": "This means you can make modifications to your config, and preview the results, but until you save, none of your changes will be preserved.",
|
"edit-mode-description": "This means you can make modifications to your config, and preview the results, but until you save, none of your changes will be preserved.",
|
||||||
"save-stage-btn": "Save"
|
"save-stage-btn": "Save",
|
||||||
|
"cancel-stage-btn": "Cancel"
|
||||||
},
|
},
|
||||||
"edit-section": {
|
"edit-section": {
|
||||||
"edit-tooltip": "Click to Edit, or right-click for more options"
|
"edit-tooltip": "Click to Edit, or right-click for more options"
|
||||||
|
@ -40,7 +40,9 @@
|
|||||||
:id="`context-menu-${id}`"
|
:id="`context-menu-${id}`"
|
||||||
@launchItem="launchItem"
|
@launchItem="launchItem"
|
||||||
@openItemSettings="openItemSettings"
|
@openItemSettings="openItemSettings"
|
||||||
|
@openMoveItemMenu="openMoveItemMenu"
|
||||||
/>
|
/>
|
||||||
|
<MoveItemTo v-if="isEditMode" :itemId="id" />
|
||||||
<EditItem v-if="editMenuOpen" :itemId="id" @closeEditMenu="closeEditMenu" />
|
<EditItem v-if="editMenuOpen" :itemId="id" @closeEditMenu="closeEditMenu" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@ -52,6 +54,7 @@ import Icon from '@/components/LinkItems/ItemIcon.vue';
|
|||||||
import ItemOpenMethodIcon from '@/components/LinkItems/ItemOpenMethodIcon';
|
import ItemOpenMethodIcon from '@/components/LinkItems/ItemOpenMethodIcon';
|
||||||
import StatusIndicator from '@/components/LinkItems/StatusIndicator';
|
import StatusIndicator from '@/components/LinkItems/StatusIndicator';
|
||||||
import EditItem from '@/components/InteractiveEditor/EditItem';
|
import EditItem from '@/components/InteractiveEditor/EditItem';
|
||||||
|
import MoveItemTo from '@/components/InteractiveEditor/MoveItemTo';
|
||||||
import ContextMenu from '@/components/LinkItems/ItemContextMenu';
|
import ContextMenu from '@/components/LinkItems/ItemContextMenu';
|
||||||
import StoreKeys from '@/utils/StoreMutations';
|
import StoreKeys from '@/utils/StoreMutations';
|
||||||
import { targetValidator } from '@/utils/ConfigHelpers';
|
import { targetValidator } from '@/utils/ConfigHelpers';
|
||||||
@ -92,6 +95,7 @@ export default {
|
|||||||
ItemOpenMethodIcon,
|
ItemOpenMethodIcon,
|
||||||
StatusIndicator,
|
StatusIndicator,
|
||||||
ContextMenu,
|
ContextMenu,
|
||||||
|
MoveItemTo,
|
||||||
EditItem,
|
EditItem,
|
||||||
EditModeIcon,
|
EditModeIcon,
|
||||||
},
|
},
|
||||||
@ -289,6 +293,11 @@ export default {
|
|||||||
lastUsed[itemId] = new Date().getTime();
|
lastUsed[itemId] = new Date().getTime();
|
||||||
localStorage.setItem(localStorageKeys.LAST_USED, JSON.stringify(lastUsed));
|
localStorage.setItem(localStorageKeys.LAST_USED, JSON.stringify(lastUsed));
|
||||||
},
|
},
|
||||||
|
openMoveItemMenu() {
|
||||||
|
this.$modal.show(`${modalNames.MOVE_ITEM_TO}-${this.id}`);
|
||||||
|
this.$store.commit(StoreKeys.SET_MODAL_OPEN, true);
|
||||||
|
this.closeContextMenu();
|
||||||
|
},
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
// If ststus checking is enabled, then check service status
|
// If ststus checking is enabled, then check service status
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
<EditIcon />
|
<EditIcon />
|
||||||
<span>{{ $t('menu.edit-item') }}</span>
|
<span>{{ $t('menu.edit-item') }}</span>
|
||||||
</li>
|
</li>
|
||||||
<li v-if="isEditMode">
|
<li v-if="isEditMode" @click="openMoveMenu()">
|
||||||
<MoveIcon />
|
<MoveIcon />
|
||||||
<span>{{ $t('menu.move-item') }}</span>
|
<span>{{ $t('menu.move-item') }}</span>
|
||||||
</li>
|
</li>
|
||||||
@ -51,7 +51,6 @@
|
|||||||
import EditIcon from '@/assets/interface-icons/config-edit-json.svg';
|
import EditIcon from '@/assets/interface-icons/config-edit-json.svg';
|
||||||
import BinIcon from '@/assets/interface-icons/interactive-editor-remove.svg';
|
import BinIcon from '@/assets/interface-icons/interactive-editor-remove.svg';
|
||||||
import MoveIcon from '@/assets/interface-icons/interactive-editor-move-to.svg';
|
import MoveIcon from '@/assets/interface-icons/interactive-editor-move-to.svg';
|
||||||
|
|
||||||
import SameTabOpenIcon from '@/assets/interface-icons/open-current-tab.svg';
|
import SameTabOpenIcon from '@/assets/interface-icons/open-current-tab.svg';
|
||||||
import NewTabOpenIcon from '@/assets/interface-icons/open-new-tab.svg';
|
import NewTabOpenIcon from '@/assets/interface-icons/open-new-tab.svg';
|
||||||
import IframeOpenIcon from '@/assets/interface-icons/open-iframe.svg';
|
import IframeOpenIcon from '@/assets/interface-icons/open-iframe.svg';
|
||||||
@ -90,6 +89,9 @@ export default {
|
|||||||
openSettings() {
|
openSettings() {
|
||||||
this.$emit('openItemSettings');
|
this.$emit('openItemSettings');
|
||||||
},
|
},
|
||||||
|
openMoveMenu() {
|
||||||
|
this.$emit('openMoveItemMenu');
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div v-else
|
<div v-else
|
||||||
:class="`there-are-items ${isGridLayout? 'item-group-grid': ''} inner-size-${itemSize}`"
|
:class="`there-are-items ${isGridLayout? 'item-group-grid': ''} inner-size-${itemSize}`"
|
||||||
:style="gridStyle"
|
:style="gridStyle" :id="`section-${groupId}`"
|
||||||
>
|
>
|
||||||
<Item
|
<Item
|
||||||
v-for="(item) in sortedItems"
|
v-for="(item) in sortedItems"
|
||||||
@ -73,7 +73,11 @@ import EditSection from '@/components/InteractiveEditor/EditSection.vue';
|
|||||||
import ContextMenu from '@/components/LinkItems/SectionContextMenu.vue';
|
import ContextMenu from '@/components/LinkItems/SectionContextMenu.vue';
|
||||||
import ErrorHandler from '@/utils/ErrorHandler';
|
import ErrorHandler from '@/utils/ErrorHandler';
|
||||||
import StoreKeys from '@/utils/StoreMutations';
|
import StoreKeys from '@/utils/StoreMutations';
|
||||||
import { sortOrder as defaultSortOrder, localStorageKeys, modalNames } from '@/utils/defaults';
|
import {
|
||||||
|
sortOrder as defaultSortOrder,
|
||||||
|
localStorageKeys,
|
||||||
|
modalNames,
|
||||||
|
} from '@/utils/defaults';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'Section',
|
name: 'Section',
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
font-style: italic;
|
font-style: italic;
|
||||||
margin-right: 0.5rem;
|
margin-right: 0.5rem;
|
||||||
max-width: 20rem;
|
max-width: 20rem;
|
||||||
|
opacity: var(--dimming-factor);
|
||||||
}
|
}
|
||||||
input {
|
input {
|
||||||
min-width: 15rem;
|
min-width: 15rem;
|
||||||
|
@ -30,7 +30,7 @@ export const sanitize = (string) => {
|
|||||||
const makeItemId = (sectionStr, itemStr, index) => {
|
const makeItemId = (sectionStr, itemStr, index) => {
|
||||||
const charSum = sectionStr.split('').map((a) => a.charCodeAt(0)).reduce((x, y) => x + y);
|
const charSum = sectionStr.split('').map((a) => a.charCodeAt(0)).reduce((x, y) => x + y);
|
||||||
const itemTitleStr = itemStr.replace(/\s+/g, '-').replace(/[^a-zA-Z ]/g, '').toLowerCase();
|
const itemTitleStr = itemStr.replace(/\s+/g, '-').replace(/[^a-zA-Z ]/g, '').toLowerCase();
|
||||||
return `${index}_${charSum}_${itemTitleStr}`;
|
return `${index}_${charSum}_${itemTitleStr}_${Math.random()}`;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Given an array of sections, apply a unique ID to each item, and return modified array */
|
/* Given an array of sections, apply a unique ID to each item, and return modified array */
|
||||||
@ -40,6 +40,7 @@ export const applyItemId = (inputSections) => {
|
|||||||
if (sec.items) {
|
if (sec.items) {
|
||||||
sec.items.forEach((item, itemIdx) => {
|
sec.items.forEach((item, itemIdx) => {
|
||||||
sections[secIdx].items[itemIdx].id = makeItemId(sec.name, item.title, itemIdx);
|
sections[secIdx].items[itemIdx].id = makeItemId(sec.name, item.title, itemIdx);
|
||||||
|
// TODO: Check if ID already exists, and if so, modify it
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user