Skip to content

Commit

Permalink
Allow exporting any cockpit view
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaellehmkuhl committed Sep 27, 2023
1 parent 20844df commit c1163ed
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/components/EditMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
>
<p class="overflow-hidden text-sm text-ellipsis ml-7 whitespace-nowrap">{{ view.name }}</p>
<div class="grow" />
<div class="icon-btn mdi mdi-download" @click.stop="store.exportView(view)" />
<div class="icon-btn mdi mdi-cog" @click.stop="renameView(view)" />
<div class="icon-btn mdi mdi-trash-can" @click.stop="store.deleteView(view)" />
</Button>
Expand All @@ -78,7 +79,6 @@
<span class="mdi mdi-upload" />
</label>
</div>
<div class="icon-btn mdi mdi-download" @click="store.exportCurrentView" />
<div />
</div>
<div class="w-full h-px my-2 sm bg-slate-800/40" />
Expand Down
6 changes: 3 additions & 3 deletions src/stores/widgetManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -259,8 +259,8 @@ export const useWidgetManagerStore = defineStore('widget-manager', () => {
currentViewIndex.value = index
}

const exportCurrentView = (): void => {
const blob = new Blob([JSON.stringify(currentView.value)], { type: 'text/plain;charset=utf-8' })
const exportView = (view: View): void => {
const blob = new Blob([JSON.stringify(view)], { type: 'text/plain;charset=utf-8' })
saveAs(blob, `cockpit-widget-view.json`)
}

Expand Down Expand Up @@ -449,7 +449,7 @@ export const useWidgetManagerStore = defineStore('widget-manager', () => {
deleteView,
renameView,
selectView,
exportCurrentView,
exportView,
importView,
addWidget,
deleteWidget,
Expand Down

0 comments on commit c1163ed

Please sign in to comment.