Skip to content

Commit 3885974

Browse files
authored
Merge pull request #253 from tmehnert/fix-init-selected-license-in-component-details
Fix Component View Details not initialize license
2 parents 09e4c18 + eb1b2da commit 3885974

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

src/views/portfolio/projects/ComponentDetailsModal.vue

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<b-modal id="componentDetailsModal" size="lg" hide-header-close no-stacking :title="$t('message.component_details')">
2+
<b-modal id="componentDetailsModal" size="lg" hide-header-close no-stacking :title="$t('message.component_details')" @show="initializeSelectedLicense">
33
<b-tabs class="body-bg-color" style="border:0;padding:0">
44
<b-tab class="body-bg-color" style="border:0;padding:0" active>
55
<template v-slot:title><i class="fa fa-cube"></i> {{ $t('message.identity') }}</template>
@@ -253,14 +253,22 @@
253253
this.axios.get(url).then((response) => {
254254
for (let i = 0; i < response.data.length; i++) {
255255
let license = response.data[i];
256-
this.selectableLicenses.push({value: license.licenseId, text: license.name});
257-
if (this.component.resolvedLicense && this.component.resolvedLicense.uuid === license.uuid ) {
258-
this.selectedLicense = license.licenseId;
259-
}
256+
this.selectableLicenses.push({value: license.licenseId, text: license.name, uuid: license.uuid});
260257
}
261258
}).catch((error) => {
262259
this.$toastr.w(this.$t('condition.unsuccessful_action'));
263260
});
261+
},
262+
initializeSelectedLicense: function () {
263+
const resolvedLicense = this.component.resolvedLicense;
264+
if (!resolvedLicense) {
265+
this.selectedLicense = null;
266+
return;
267+
}
268+
this.selectedLicense = this.selectableLicenses
269+
.filter(license => license.uuid == resolvedLicense.uuid)
270+
.map(license => license.value)
271+
.find(() => true) || null;
264272
}
265273
}
266274
}

0 commit comments

Comments
 (0)