Skip to content

Commit

Permalink
Add data download
Browse files Browse the repository at this point in the history
  • Loading branch information
KlausSchaefers committed Feb 3, 2025
1 parent 37a506e commit ee507a5
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/page/QIconDropDown.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

<template>
<div :class="['MatcIconDropDown', {'MatcIconDropDownVisible': isVisible}]">
<div :class="['MatcIconDropDown', {'MatcIconDropDownVisible': isVisible}, {'MatcIconDropDownWide' : size == 'L'}]">
<QIcon @click.stop="open" :icon="icon"/>

<div class="MatcDropDownPopUp" role="menu" data-dojo-attach-point="popup" v-if="isVisible">
Expand All @@ -26,7 +26,7 @@
export default {
name: "QIconDropDown",
props: ['icon', 'options'],
props: ['icon', 'options', 'size'],
mixins: [],
data: function () {
return {
Expand Down
5 changes: 5 additions & 0 deletions src/style/components/icon_drop_down.scss
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,10 @@
}
}



}

.MatcIconDropDownWide .MatcDropDownPopUp {
width: 200px;
}
44 changes: 42 additions & 2 deletions src/views/apps/StudioOverview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
<a class="MatcButton MatcButtonXS MatcButtonSecondary MatcButtonIcon MatcRoundButton" @click="showShareDialog" ref="shareButton">
<QIcon icon="Share"></QIcon>
</a>
<QIconDropDown icon="Dots" :options="dotOptions"/>
<QIconDropDown size="L" icon="Dots" :options="dotOptions"/>
</div>

</div>
Expand Down Expand Up @@ -177,7 +177,8 @@ export default {
{label: 'Rename', callback: (o, e) => this.onRename(e), icon: "EventKeykoard"},
{label: 'Duplicate', callback: (o, e) => this.onDuplicate(e), icon: "Duplicate"},
{label: 'Change Test Link', callback: (o, e) => this.onChangeHash(e), icon: "Key"},
{label: 'Delete', callback: (o, e) => this.onDelete(e), icon: "Delete"}
{label: 'Delete', callback: (o, e) => this.onDelete(e), icon: "Delete"},
{label: 'Download Test Data', callback: (o, e) => this.onDownload(e), icon: "Download"}
],
testSettings: {},
events: [],
Expand Down Expand Up @@ -234,6 +235,45 @@ export default {
this.logger.info("onTestChange", "enter > ", testSettings);
this.testSettings = testSettings;
},
onDownload () {
this.logger.log(-1, "onDownload", "enter > ", this.events);
const events = structuredClone(this.events)
const id2Name = {}
Object.values(this.app.screens).forEach(s => {
id2Name[s.id] = s.name
})
Object.values(this.app.widgets).forEach(w => {
id2Name[w.id] = w.name
})
events.forEach(e => {
if (e.widget) {
const id = e.widget.split("@")[0]
e.widgetName = id2Name[id]
}
if (e.screen) {
e.screenName = id2Name[e.screen]
}
delete e.user
delete e.id
delete e._id
})
const contnet = JSON.stringify(events, null, 2)
const blob = new Blob([contnet], {
type: "application/json"
});
if (window.navigator.msSaveOrOpenBlob) {
window.navigator.msSaveBlob(blob, "events.json");
} else {
const elem = window.document.createElement("a");
elem.href = window.URL.createObjectURL(blob);
elem.download = "events.json";
document.body.appendChild(elem);
elem.click();
document.body.removeChild(elem);
}
},
onAnnotationChange(annos) {
this.logger.info("onAnnotationChange", "enter > ", annos);
/**
Expand Down

0 comments on commit ee507a5

Please sign in to comment.