mirror of
https://github.com/Lissy93/dashy.git
synced 2025-07-03 03:44:45 +02:00
⚡ If in edit mode, open item-edit instead of launching, onclick
This commit is contained in:
parent
e78bd07ced
commit
87bf9263db
Before Width: | Height: | Size: 875 B After Width: | Height: | Size: 875 B |
@ -30,6 +30,7 @@
|
|||||||
:statusSuccess="statusResponse ? statusResponse.successStatus : undefined"
|
:statusSuccess="statusResponse ? statusResponse.successStatus : undefined"
|
||||||
:statusText="statusResponse ? statusResponse.message : undefined"
|
:statusText="statusResponse ? statusResponse.message : undefined"
|
||||||
/>
|
/>
|
||||||
|
<EditModeIcon v-if="isEditMode" class="edit-mode-item" @click="openItemSettings()" />
|
||||||
</a>
|
</a>
|
||||||
<ContextMenu
|
<ContextMenu
|
||||||
:show="contextMenuOpen"
|
:show="contextMenuOpen"
|
||||||
@ -54,6 +55,7 @@ import EditItem from '@/components/InteractiveEditor/EditItem';
|
|||||||
import ContextMenu from '@/components/LinkItems/ContextMenu';
|
import ContextMenu from '@/components/LinkItems/ContextMenu';
|
||||||
import StoreKeys from '@/utils/StoreMutations';
|
import StoreKeys from '@/utils/StoreMutations';
|
||||||
import { targetValidator } from '@/utils/ConfigHelpers';
|
import { targetValidator } from '@/utils/ConfigHelpers';
|
||||||
|
import EditModeIcon from '@/assets/interface-icons/interactive-editor-edit-mode.svg';
|
||||||
import {
|
import {
|
||||||
localStorageKeys,
|
localStorageKeys,
|
||||||
serviceEndpoints,
|
serviceEndpoints,
|
||||||
@ -85,15 +87,27 @@ export default {
|
|||||||
statusCheckInterval: Number,
|
statusCheckInterval: Number,
|
||||||
statusCheckAllowInsecure: Boolean,
|
statusCheckAllowInsecure: Boolean,
|
||||||
},
|
},
|
||||||
|
components: {
|
||||||
|
Icon,
|
||||||
|
ItemOpenMethodIcon,
|
||||||
|
StatusIndicator,
|
||||||
|
ContextMenu,
|
||||||
|
EditItem,
|
||||||
|
EditModeIcon,
|
||||||
|
},
|
||||||
computed: {
|
computed: {
|
||||||
appConfig() {
|
appConfig() {
|
||||||
return this.$store.getters.appConfig;
|
return this.$store.getters.appConfig;
|
||||||
},
|
},
|
||||||
|
isEditMode() {
|
||||||
|
return this.$store.state.editMode;
|
||||||
|
},
|
||||||
accumulatedTarget() {
|
accumulatedTarget() {
|
||||||
return this.target || this.appConfig.defaultOpeningMethod || defaultOpeningMethod;
|
return this.target || this.appConfig.defaultOpeningMethod || defaultOpeningMethod;
|
||||||
},
|
},
|
||||||
/* Convert config target value, into HTML anchor target attribute */
|
/* Convert config target value, into HTML anchor target attribute */
|
||||||
anchorTarget() {
|
anchorTarget() {
|
||||||
|
if (this.isEditMode) return '_self';
|
||||||
const target = this.accumulatedTarget;
|
const target = this.accumulatedTarget;
|
||||||
switch (target) {
|
switch (target) {
|
||||||
case 'sametab': return '_self';
|
case 'sametab': return '_self';
|
||||||
@ -103,10 +117,12 @@ export default {
|
|||||||
default: return undefined;
|
default: return undefined;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
/* Get the href value for the anchor, if not opening in modal/ workspace */
|
/* Get href for anchor, if not in edit mode, or opening in modal/ workspace */
|
||||||
hyperLinkHref() {
|
hyperLinkHref() {
|
||||||
|
const nothing = '#';
|
||||||
|
if (this.isEditMode) return nothing;
|
||||||
const noAnchorNeeded = ['modal', 'workspace'];
|
const noAnchorNeeded = ['modal', 'workspace'];
|
||||||
return noAnchorNeeded.includes(this.accumulatedTarget) ? '#' : this.url;
|
return noAnchorNeeded.includes(this.accumulatedTarget) ? nothing : this.url;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
@ -125,16 +141,14 @@ export default {
|
|||||||
editMenuOpen: false,
|
editMenuOpen: false,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
components: {
|
|
||||||
Icon,
|
|
||||||
ItemOpenMethodIcon,
|
|
||||||
StatusIndicator,
|
|
||||||
ContextMenu,
|
|
||||||
EditItem,
|
|
||||||
},
|
|
||||||
methods: {
|
methods: {
|
||||||
/* Called when an item is clicked, manages the opening of modal & resets the search field */
|
/* Called when an item is clicked, manages the opening of modal & resets the search field */
|
||||||
itemOpened(e) {
|
itemOpened(e) {
|
||||||
|
if (this.isEditMode) {
|
||||||
|
// If in edit mode, open settings, and don't launch app
|
||||||
|
this.openItemSettings();
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (e.altKey || this.accumulatedTarget === 'modal') {
|
if (e.altKey || this.accumulatedTarget === 'modal') {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
this.$emit('triggerModal', this.url);
|
this.$emit('triggerModal', this.url);
|
||||||
@ -380,6 +394,15 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Edit Mode Icon */
|
||||||
|
.item .edit-mode-item {
|
||||||
|
width: 1rem;
|
||||||
|
height: 1rem;
|
||||||
|
position: absolute;
|
||||||
|
top: 0.2rem;
|
||||||
|
right: 0.2rem;
|
||||||
|
}
|
||||||
|
|
||||||
/* Specify layout for alternate sized icons */
|
/* Specify layout for alternate sized icons */
|
||||||
.item {
|
.item {
|
||||||
/* Small Tile Specific Themes */
|
/* Small Tile Specific Themes */
|
||||||
|
@ -53,7 +53,7 @@ import LanguageSwitcher from '@/components/Settings/LanguageSwitcher';
|
|||||||
import { topLevelConfKeys, localStorageKeys, modalNames } from '@/utils/defaults';
|
import { topLevelConfKeys, localStorageKeys, modalNames } from '@/utils/defaults';
|
||||||
import Keys from '@/utils/StoreMutations';
|
import Keys from '@/utils/StoreMutations';
|
||||||
import IconSpanner from '@/assets/interface-icons/config-editor.svg';
|
import IconSpanner from '@/assets/interface-icons/config-editor.svg';
|
||||||
import IconInteractiveEditor from '@/assets/interface-icons/interactive-editor-start-editing.svg';
|
import IconInteractiveEditor from '@/assets/interface-icons/interactive-editor-edit-mode.svg';
|
||||||
import IconViewMode from '@/assets/interface-icons/application-change-view.svg';
|
import IconViewMode from '@/assets/interface-icons/application-change-view.svg';
|
||||||
import IconHome from '@/assets/interface-icons/application-home.svg';
|
import IconHome from '@/assets/interface-icons/application-home.svg';
|
||||||
import IconWorkspaceView from '@/assets/interface-icons/open-workspace.svg';
|
import IconWorkspaceView from '@/assets/interface-icons/open-workspace.svg';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user