Skip to content

Commit

Permalink
fix: #407
Browse files Browse the repository at this point in the history
  • Loading branch information
khansadaoudi committed Oct 15, 2024
1 parent 3c71ace commit 8082592
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/api/backend-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,11 @@ export default {
getRelationTable(projectName: string, data: any) {
return API.post(`projects/${projectName}/relation-table`, data);
},
exportGrewResults(projectName: string, data: any) {
return API.post(`/projects/${projectName}/export-results`, data, {
responseType: 'arraybuffer',
});
},
// -------------------------------------------------------- //
// --------------- Constructicon --------------- //
// -------------------------------------------------------- //
Expand Down
26 changes: 25 additions & 1 deletion src/components/grewSearch/ResultView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</q-bar>
<div class="q-pa-md row q-gutter-md custom-frame1">
<q-select
class="col-9"
class="col-7"
outlined
dense
v-model="selectedSample"
Expand Down Expand Up @@ -39,6 +39,7 @@
{{ pendingModifications.size }}
</q-badge>
</q-btn>
<q-btn class="col-2" color="primary" label="Export results" @click="exportResults()" />
</div>
<div>
<template v-if="samplesFrozen.list.length > 0">
Expand Down Expand Up @@ -142,6 +143,7 @@ export default defineComponent({
samples,
all: false,
toSaveCounter: 0,
users: new Set(),
};
},
computed: {
Expand Down Expand Up @@ -201,6 +203,9 @@ export default defineComponent({
selectedIndex[index] = false;
this.searchResultsCopy[sampleId][sentId].sample_name = sampleId;
index += 1;
for (const user in this.searchResults[sampleId][sentId].conlls) {
this.users.add(user);
}
}
}
Object.freeze(listIds);
Expand Down Expand Up @@ -289,6 +294,25 @@ export default defineComponent({
return selectedResults;
},
exportResults() {
const data = { searchResults: this.searchResults, users: [...this.users] };
api
.exportGrewResults(this.name, data)
.then((response) => {
const url = window.URL.createObjectURL(new Blob([response.data], { type: 'application/zip' }));
const link = document.createElement('a');
link.href = url;
link.setAttribute('download', `dump_${this.projectName}.zip`);
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
notifyMessage({ message: 'Grew results are exported' });
})
.catch((error) => {
notifyError({ error: error });
})
},
saveAppliedRule() {
const historyRecord = {
type: 'rewrite',
Expand Down

0 comments on commit 8082592

Please sign in to comment.