|
5 | 5 | dropdown for version is changes, the table will not update. For whatever reason, adding the toolbar fixes it. |
6 | 6 | --> |
7 | 7 | <div id="findingsToolbar" class="bs-table-custom-toolbar"> |
8 | | - <b-button size="md" variant="outline-primary" |
| 8 | + <b-button id="apply-vex-button" size="md" variant="outline-primary" |
9 | 9 | v-b-modal.projectUploadVexModal |
10 | 10 | v-permission:or="[PERMISSIONS.VIEW_VULNERABILITY, PERMISSIONS.VULNERABILITY_ANALYSIS]"> |
11 | 11 | <span class="fa fa-upload"></span> {{ $t('message.apply_vex') }} |
12 | 12 | </b-button> |
| 13 | + <b-tooltip target="apply-vex-button" triggers="hover focus">{{ $t('message.apply_vex_tooltip') }}</b-tooltip> |
13 | 14 |
|
14 | | - <b-button size="md" variant="outline-primary" |
| 15 | + <b-button id="export-vex-button" size="md" variant="outline-primary" |
15 | 16 | @click="downloadVex()" |
16 | 17 | v-permission:or="[PERMISSIONS.VIEW_VULNERABILITY, PERMISSIONS.VULNERABILITY_ANALYSIS]"> |
17 | 18 | <span class="fa fa-download"></span> {{ $t('message.export_vex') }} |
18 | 19 | </b-button> |
| 20 | + <b-tooltip target="export-vex-button" triggers="hover focus">{{ $t('message.export_vex_tooltip') }}</b-tooltip> |
| 21 | + |
| 22 | + <b-button id="export-vdr-button" size="md" variant="outline-primary" |
| 23 | + @click="downloadVdr()" |
| 24 | + v-permission:or="[PERMISSIONS.VIEW_VULNERABILITY, PERMISSIONS.VULNERABILITY_ANALYSIS]"> |
| 25 | + <span class="fa fa-download"></span> {{ $t('message.export_vdr') }} |
| 26 | + </b-button> |
| 27 | + <b-tooltip target="export-vdr-button" triggers="hover focus">{{ $t('message.export_vdr_tooltip') }}</b-tooltip> |
19 | 28 |
|
20 | 29 | <b-button id="reanalyze-button" size="md" variant="outline-primary" |
21 | 30 | @click="reAnalyze()" |
|
450 | 459 | } |
451 | 460 | return url; |
452 | 461 | }, |
453 | | - downloadVex: function (data) { |
| 462 | + downloadVex: function () { |
454 | 463 | let url = `${this.$api.BASE_URL}/${this.$api.URL_VEX}/cyclonedx/project/${this.uuid}`; |
455 | 464 | this.axios.request({ |
456 | 465 | responseType: 'blob', |
|
477 | 486 | link.click(); |
478 | 487 | }); |
479 | 488 | }, |
| 489 | + downloadVdr: function () { |
| 490 | + let url = `${this.$api.BASE_URL}/${this.$api.URL_BOM}/cyclonedx/project/${this.uuid}`; |
| 491 | + this.axios.request({ |
| 492 | + responseType: 'blob', |
| 493 | + url: url, |
| 494 | + method: 'get', |
| 495 | + params: { |
| 496 | + format: 'json', |
| 497 | + variant: 'vdr', |
| 498 | + download: 'true' |
| 499 | + } |
| 500 | + }).then((response) => { |
| 501 | + const url = window.URL.createObjectURL(new Blob([response.data])); |
| 502 | + const link = document.createElement('a'); |
| 503 | + link.href = url; |
| 504 | + let filename = "bom.json"; |
| 505 | + let disposition = response.headers["content-disposition"] |
| 506 | + if (disposition && disposition.indexOf('attachment') !== -1) { |
| 507 | + let filenameRegex = /filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/; |
| 508 | + let matches = filenameRegex.exec(disposition); |
| 509 | + if (matches != null && matches[1]) { |
| 510 | + filename = matches[1].replace(/['"]/g, ''); |
| 511 | + } |
| 512 | + } |
| 513 | + link.setAttribute('download', filename); |
| 514 | + document.body.appendChild(link); |
| 515 | + link.click(); |
| 516 | + }); |
| 517 | + }, |
480 | 518 | reAnalyze: function (data) { |
481 | 519 | let analyzeUrl = `${this.$api.BASE_URL}/${this.$api.URL_FINDING}/project/${this.uuid}/analyze` |
482 | 520 | this.axios.post(analyzeUrl).then((response) => { |
|
0 commit comments