Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 29 additions & 4 deletions src/views/portfolio/projects/ProjectComponents.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,14 @@
}}</b-tooltip>
<b-dropdown
variant="outline-primary"
:disabled="isDownloadingBom"
v-permission="PERMISSIONS.VIEW_PORTFOLIO"
>
<template #button-content>
<span class="fa fa-download"></span>
<span
class="fa"
:class="isDownloadingBom ? 'fa-spinner fa-spin' : 'fa-download'"
></span>
{{ $t('message.download_bom') }}
</template>
<b-dropdown-item @click="downloadBom('inventory')" href="#">{{
Expand All @@ -52,10 +56,14 @@
</b-dropdown>
<b-dropdown
variant="outline-primary"
:disabled="isDownloadingTable"
v-permission="PERMISSIONS.VIEW_PORTFOLIO"
>
<template #button-content>
<span class="fa fa-download"></span>
<span
class="fa"
:class="isDownloadingTable ? 'fa-spinner fa-spin' : 'fa-download'"
></span>
{{ $t('message.download_component') }}
</template>
<b-dropdown-item @click="downloadTable('csv')" href="#">{{
Expand Down Expand Up @@ -151,6 +159,8 @@ export default {
},
data() {
return {
isDownloadingBom: false,
isDownloadingTable: false,
labelIcon: {
dataOn: '\u2713',
dataOff: '\u2715',
Expand Down Expand Up @@ -410,6 +420,10 @@ export default {
this.$refs.table.uncheckAll();
},
downloadBom: function (data) {
if (this.isDownloadingBom) {
return;
}
this.isDownloadingBom = true;
let url = `${this.$api.BASE_URL}/${this.$api.URL_BOM}/cyclonedx/project/${this.uuid}`;
this.axios
.request({
Expand Down Expand Up @@ -438,6 +452,9 @@ export default {
link.setAttribute('download', filename);
document.body.appendChild(link);
link.click();
})
.finally(() => {
this.isDownloadingBom = false;
});
},
buildTableFile: function (json, fileType) {
Expand Down Expand Up @@ -469,8 +486,16 @@ export default {
}
},
downloadTable: async function (fileType) {
const result = await this.downloadTableJson();
this.buildTableFile(result, fileType);
if (this.isDownloadingTable) {
return;
}
this.isDownloadingTable = true;
try {
const result = await this.downloadTableJson();
this.buildTableFile(result, fileType);
} finally {
this.isDownloadingTable = false;
}
},
downloadTableJson: async function () {
let url = `${this.$api.BASE_URL}/${this.$api.URL_COMPONENT}/project/${this.uuid}?limit=1000000&offset=0`;
Expand Down
30 changes: 28 additions & 2 deletions src/views/portfolio/projects/ProjectFindings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,18 @@
id="export-vex-button"
size="md"
variant="outline-primary"
:disabled="isExportingVex"
@click="downloadVex()"
v-permission:or="[
PERMISSIONS.VIEW_VULNERABILITY,
PERMISSIONS.VULNERABILITY_ANALYSIS,
]"
>
<span class="fa fa-download"></span> {{ $t('message.export_vex') }}
<span
class="fa"
:class="isExportingVex ? 'fa-spinner fa-spin' : 'fa-download'"
></span>
{{ $t('message.export_vex') }}
</b-button>
<b-tooltip target="export-vex-button" triggers="hover focus">{{
$t('message.export_vex_tooltip')
Expand All @@ -41,13 +46,18 @@
id="export-vdr-button"
size="md"
variant="outline-primary"
:disabled="isExportingVdr"
@click="downloadVdr()"
v-permission:or="[
PERMISSIONS.VIEW_VULNERABILITY,
PERMISSIONS.VULNERABILITY_ANALYSIS,
]"
>
<span class="fa fa-download"></span> {{ $t('message.export_vdr') }}
<span
class="fa"
:class="isExportingVdr ? 'fa-spinner fa-spin' : 'fa-download'"
></span>
{{ $t('message.export_vdr') }}
</b-button>
<b-tooltip target="export-vdr-button" triggers="hover focus">{{
$t('message.export_vdr_tooltip')
Expand Down Expand Up @@ -149,6 +159,8 @@ export default {
data() {
return {
showSuppressedFindings: this.showSuppressedFindings,
isExportingVex: false,
isExportingVdr: false,
labelIcon: {
dataOn: '\u2713',
dataOff: '\u2715',
Expand Down Expand Up @@ -438,6 +450,10 @@ export default {
return url;
},
downloadVex: function () {
if (this.isExportingVex) {
return;
}
this.isExportingVex = true;
let url = `${this.$api.BASE_URL}/${this.$api.URL_VEX}/cyclonedx/project/${this.uuid}`;
this.axios
.request({
Expand All @@ -464,9 +480,16 @@ export default {
link.setAttribute('download', filename);
document.body.appendChild(link);
link.click();
})
.finally(() => {
this.isExportingVex = false;
});
},
downloadVdr: function () {
if (this.isExportingVdr) {
return;
}
this.isExportingVdr = true;
let url = `${this.$api.BASE_URL}/${this.$api.URL_BOM}/cyclonedx/project/${this.uuid}`;
this.axios
.request({
Expand Down Expand Up @@ -495,6 +518,9 @@ export default {
link.setAttribute('download', filename);
document.body.appendChild(link);
link.click();
})
.finally(() => {
this.isExportingVdr = false;
});
},
reAnalyze: function (data) {
Expand Down
Loading