|
72 | 72 | </ol> |
73 | 73 | {{ project.version }} |
74 | 74 | <i |
75 | | - v-if="isCollectionProject()" |
| 75 | + v-if="isCollectionProject" |
76 | 76 | class="fa fa-calculator fa-fw collectionlogic-icon" |
77 | 77 | v-b-tooltip.hover="{ |
78 | 78 | title: getCollectionLogicText(project), |
|
233 | 233 | <b-tab |
234 | 234 | ref="components" |
235 | 235 | @click="routeTo('components')" |
236 | | - v-if="isShowComponents()" |
| 236 | + v-if="isShowComponents" |
237 | 237 | > |
238 | 238 | <template v-slot:title |
239 | 239 | ><i class="fa fa-cubes"></i> {{ $t('message.components') }} |
|
249 | 249 | <b-tab |
250 | 250 | ref="collectionprojects" |
251 | 251 | @click="routeTo('collectionprojects')" |
252 | | - v-if="isShowCollectionProjects()" |
| 252 | + v-if="isShowCollectionProjects" |
253 | 253 | lazy |
254 | 254 | > |
255 | 255 | <template v-slot:title |
|
262 | 262 | :project="this.project" |
263 | 263 | /> |
264 | 264 | </b-tab> |
265 | | - <b-tab |
266 | | - ref="services" |
267 | | - @click="routeTo('services')" |
268 | | - v-if="isShowServices()" |
269 | | - > |
| 265 | + <b-tab ref="services" @click="routeTo('services')" v-if="isShowServices"> |
270 | 266 | <template v-slot:title |
271 | 267 | ><i class="fa fa-exchange"></i> {{ $t('message.services') }} |
272 | 268 | <b-badge variant="tab-total">{{ totalServices }}</b-badge></template |
|
280 | 276 | <b-tab |
281 | 277 | ref="dependencygraph" |
282 | 278 | @click="routeTo('dependencyGraph')" |
283 | | - v-if="isShowDependencyGraph()" |
| 279 | + v-if="isShowDependencyGraph" |
284 | 280 | > |
285 | 281 | <template v-slot:title |
286 | 282 | ><i class="fa fa-sitemap"></i> {{ $t('message.dependency_graph') }} |
|
295 | 291 | v-on:total="totalDependencyGraphs = $event" |
296 | 292 | /> |
297 | 293 | </b-tab> |
298 | | - <b-tab |
299 | | - ref="findings" |
300 | | - v-if="isShowFindings()" |
301 | | - @click="routeTo('findings')" |
302 | | - > |
| 294 | + <b-tab ref="findings" v-if="isShowFindings" @click="routeTo('findings')"> |
303 | 295 | <template v-slot:title> |
304 | 296 | <i class="fa fa-tasks"></i> {{ $t('message.audit_vulnerabilities') }} |
305 | 297 | <b-badge |
|
321 | 313 | v-on:total="totalFindingsIncludingAliases = $event" |
322 | 314 | /> |
323 | 315 | </b-tab> |
324 | | - <b-tab ref="epss" v-if="isShowFindings()" @click="routeTo('epss')"> |
| 316 | + <b-tab ref="epss" v-if="isShowFindings" @click="routeTo('epss')"> |
325 | 317 | <template v-slot:title |
326 | 318 | ><i class="fa fa-tasks"></i> {{ $t('message.exploit_predictions') }} |
327 | 319 | <b-badge variant="tab-total">{{ totalEpss }}</b-badge></template |
|
334 | 326 | </b-tab> |
335 | 327 | <b-tab |
336 | 328 | ref="policyviolations" |
337 | | - v-if="isShowPolicyViolations()" |
| 329 | + v-if="isShowPolicyViolations" |
338 | 330 | @click="routeTo('policyViolations')" |
339 | 331 | > |
340 | 332 | <template v-slot:title |
@@ -461,6 +453,33 @@ export default { |
461 | 453 | inactiveProjectVersions() { |
462 | 454 | return this.project.versions.filter((version) => !version.active); |
463 | 455 | }, |
| 456 | + isCollectionProject() { |
| 457 | + return this.project.collectionLogic !== 'NONE'; |
| 458 | + }, |
| 459 | + isShowComponents() { |
| 460 | + return !this.isCollectionProject; |
| 461 | + }, |
| 462 | + isShowCollectionProjects() { |
| 463 | + return this.isCollectionProject; |
| 464 | + }, |
| 465 | + isShowServices() { |
| 466 | + return !this.isCollectionProject; |
| 467 | + }, |
| 468 | + isShowDependencyGraph() { |
| 469 | + return !this.isCollectionProject; |
| 470 | + }, |
| 471 | + isShowFindings() { |
| 472 | + return ( |
| 473 | + !this.isCollectionProject && |
| 474 | + this.isPermitted(this.PERMISSIONS.VIEW_VULNERABILITY) |
| 475 | + ); |
| 476 | + }, |
| 477 | + isShowPolicyViolations() { |
| 478 | + return ( |
| 479 | + !this.isCollectionProject && |
| 480 | + this.isPermitted(this.PERMISSIONS.VIEW_POLICY_VIOLATION) |
| 481 | + ); |
| 482 | + }, |
464 | 483 | }, |
465 | 484 | data() { |
466 | 485 | return { |
@@ -514,7 +533,7 @@ export default { |
514 | 533 | }, |
515 | 534 | initialize: function () { |
516 | 535 | let projectUrl = `${this.$api.BASE_URL}/${this.$api.URL_PROJECT}/${this.uuid}`; |
517 | | - this.axios |
| 536 | + return this.axios |
518 | 537 | .get(projectUrl) |
519 | 538 | .catch((error) => { |
520 | 539 | if (error.response.status === 403) { |
@@ -642,50 +661,25 @@ export default { |
642 | 661 | } |
643 | 662 | return ''; |
644 | 663 | }, |
645 | | - isCollectionProject: function () { |
646 | | - return this.project.collectionLogic !== 'NONE'; |
647 | | - }, |
648 | | - isShowComponents: function () { |
649 | | - return !this.isCollectionProject(); |
650 | | - }, |
651 | | - isShowCollectionProjects: function () { |
652 | | - return this.isCollectionProject(); |
653 | | - }, |
654 | | - isShowServices: function () { |
655 | | - return !this.isCollectionProject(); |
656 | | - }, |
657 | | - isShowDependencyGraph: function () { |
658 | | - return !this.isCollectionProject(); |
659 | | - }, |
660 | | - isShowFindings: function () { |
661 | | - return ( |
662 | | - !this.isCollectionProject() && |
663 | | - this.isPermitted(this.PERMISSIONS.VIEW_VULNERABILITY) |
664 | | - ); |
665 | | - }, |
666 | | - isShowPolicyViolations: function () { |
667 | | - return ( |
668 | | - !this.isCollectionProject() && |
669 | | - this.isPermitted(this.PERMISSIONS.VIEW_POLICY_VIOLATION) |
670 | | - ); |
671 | | - }, |
672 | 664 | }, |
673 | 665 | beforeMount() { |
674 | 666 | this.uuid = this.$route.params.uuid; |
675 | | - this.initialize(); |
676 | | - }, |
677 | | - mounted() { |
678 | | - try { |
679 | | - if (this.$route.params.componentUuids) { |
680 | | - this.$refs.dependencygraph.active = true; |
681 | | - } else { |
682 | | - this.getTabFromRoute().active = true; |
683 | | - } |
684 | | - } catch (e) { |
685 | | - this.$toastr.e(this.$t('condition.forbidden')); |
686 | | - this.$router.replace({ path: '/projects/' + this.uuid }); |
687 | | - this.$refs.overview.active = true; |
688 | | - } |
| 667 | + this.initialize() |
| 668 | + .then(() => { |
| 669 | + this.$nextTick(() => { |
| 670 | + if (this.$route.params.componentUuids) { |
| 671 | + this.$refs.dependencygraph.active = true; |
| 672 | + } else { |
| 673 | + this.getTabFromRoute().active = true; |
| 674 | + } |
| 675 | + }); |
| 676 | + }) |
| 677 | + .catch((e) => { |
| 678 | + console.error(e); |
| 679 | + this.$toastr.e(this.$t('condition.forbidden')); |
| 680 | + this.$router.replace({ path: '/projects/' + this.uuid }); |
| 681 | + this.$refs.overview.active = true; |
| 682 | + }); |
689 | 683 | }, |
690 | 684 | watch: { |
691 | 685 | $route(to, from) { |
|
0 commit comments