Skip to content

Commit

Permalink
Add support for project and component suppliers
Browse files Browse the repository at this point in the history
Signed-off-by: nscuro <[email protected]>
  • Loading branch information
nscuro committed Nov 8, 2023
1 parent 9b44da7 commit 3c6192f
Show file tree
Hide file tree
Showing 3 changed files with 202 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,10 @@
"service_details": "Service Details",
"provider": "Provider",
"provider_name": "Provider name",
"supplier": "Supplier",
"supplier_name": "Supplier name",
"component_supplier_name_desc": "The organization that supplied the component",
"project_supplier_name_desc": "The organization that supplied the project that the BOM describes",
"endpoints": "Endpoints",
"data": "Data",
"url": "URL",
Expand Down
99 changes: 99 additions & 0 deletions src/views/portfolio/projects/ComponentDetailsModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,32 @@
:readonly="this.isNotPermitted(PERMISSIONS.PORTFOLIO_MANAGEMENT)" />
</b-card>
</b-tab>
<b-tab class="body-bg-color" style="border:0;padding:0" v-if="component.supplier">
<template v-slot:title><i class="fa fa-building-o"></i> {{ $t('message.supplier') }}</template>
<b-card>
<b-input-group-form-input id="component-supplier-name-input" input-group-size="mb-3" type="text" v-model="component.supplier.name"
required="false" readonly :label="$t('message.supplier_name')"
:tooltip="this.$t('message.component_supplier_name_desc')"/>
<b-form-group id="supplierUrlsTable-Fieldset" :label="this.$t('message.urls')" label-for="supplierUrlsTable">
<bootstrap-table
id="supplierUrlsTable"
ref="supplierUrlsTable"
:columns="supplierUrlsTableColumns"
:data="component.supplier.urls"
:options="supplierUrlsTableOptions">
</bootstrap-table>
</b-form-group>
<b-form-group id="supplierContactsTable-Fieldset" :label="this.$t('message.contacts')" label-for="contactsTable">
<bootstrap-table
id="supplierContactsTable"
ref="supplierContactsTable"
:columns="supplierContactsTableColumns"
:data="component.supplier.contacts"
:options="supplierContactsTableOptions">
</bootstrap-table>
</b-form-group>
</b-card>
</b-tab>
<b-tab>
<template v-slot:title><i class="fa fa-external-link"></i> {{ $t('message.external_references') }}</template>
<b-card>
Expand Down Expand Up @@ -167,6 +193,78 @@
],
selectableLicenses: [],
selectedLicense: '',
supplierUrlsTableColumns: [
{
title: this.$t('message.urls'),
sortable: false,
formatter(value, row, index) {
return xssFilters.inHTMLData(common.valueWithDefault(row, ""));
}
}
],
supplierUrlsTableOptions: {
search: false,
showHeader: false,
showColumns: false,
showRefresh: false,
pagination: true,
silentSort: false,
sidePagination: 'client',
queryParamsType: 'pageSize',
pageList: '[5, 10, 25]',
pageSize: 5,
icons: {
refresh: 'fa-refresh'
},
responseHandler: function (res, xhr) {
res.total = xhr.getResponseHeader("X-Total-Count");
return res;
}
},
supplierContactsTableColumns: [
{
title: this.$t('message.name'),
field: "name",
sortable: false,
formatter(value, row, index) {
return xssFilters.inHTMLData(common.valueWithDefault(value, ""));
}
},
{
title: this.$t('message.email'),
field: "email",
sortable: false,
formatter(value, row, index) {
return xssFilters.inHTMLData(common.valueWithDefault(value, ""));
}
},
{
title: this.$t('message.phone'),
field: "phone",
sortable: false,
formatter(value, row, index) {
return xssFilters.inHTMLData(common.valueWithDefault(value, ""));
}
}
],
supplierContactsTableOptions: {
search: false,
showColumns: false,
showRefresh: false,
pagination: true,
silentSort: false,
sidePagination: 'client',
queryParamsType: 'pageSize',
pageList: '[5, 10, 25]',
pageSize: 5,
icons: {
refresh: 'fa-refresh'
},
responseHandler: function (res, xhr) {
res.total = xhr.getResponseHeader("X-Total-Count");
return res;
}
},
referencesTableColumns: [
{
title: this.$t('message.url'),
Expand Down Expand Up @@ -218,6 +316,7 @@
let url = `${this.$api.BASE_URL}/${this.$api.URL_COMPONENT}`;
this.axios.post(url, {
uuid: this.component.uuid,
supplier: this.component.supplier,
name: this.component.name,
version: this.component.version,
group: this.component.group,
Expand Down
99 changes: 99 additions & 0 deletions src/views/portfolio/projects/ProjectDetailsModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,32 @@
:readonly="this.isNotPermitted(PERMISSIONS.PORTFOLIO_MANAGEMENT)" />
</b-card>
</b-tab>
<b-tab class="body-bg-color" style="border:0;padding:0" v-if="project.supplier">
<template v-slot:title><i class="fa fa-building-o"></i> {{ $t('message.supplier') }}</template>
<b-card>
<b-input-group-form-input id="project-supplier-name-input" input-group-size="mb-3" type="text" v-model="project.supplier.name"
required="false" readonly :label="$t('message.supplier_name')"
:tooltip="this.$t('message.project_supplier_name_desc')"/>
<b-form-group id="supplierUrlsTable-Fieldset" :label="this.$t('message.urls')" label-for="supplierUrlsTable">
<bootstrap-table
id="supplierUrlsTable"
ref="supplierUrlsTable"
:columns="supplierUrlsTableColumns"
:data="project.supplier.urls"
:options="supplierUrlsTableOptions">
</bootstrap-table>
</b-form-group>
<b-form-group id="supplierContactsTable-Fieldset" :label="this.$t('message.contacts')" label-for="contactsTable">
<bootstrap-table
id="supplierContactsTable"
ref="supplierContactsTable"
:columns="supplierContactsTableColumns"
:data="project.supplier.contacts"
:options="supplierContactsTableOptions">
</bootstrap-table>
</b-form-group>
</b-card>
</b-tab>
<b-tab>
<template v-slot:title><i class="fa fa-external-link"></i> {{ $t('message.external_references') }}</template>
<b-card>
Expand Down Expand Up @@ -149,6 +175,78 @@
dataOff: '\u2715'
},
isLoading: false,
supplierUrlsTableColumns: [
{
title: this.$t('message.urls'),
sortable: false,
formatter(value, row, index) {
return xssFilters.inHTMLData(common.valueWithDefault(row, ""));
}
}
],
supplierUrlsTableOptions: {
search: false,
showHeader: false,
showColumns: false,
showRefresh: false,
pagination: true,
silentSort: false,
sidePagination: 'client',
queryParamsType: 'pageSize',
pageList: '[5, 10, 25]',
pageSize: 5,
icons: {
refresh: 'fa-refresh'
},
responseHandler: function (res, xhr) {
res.total = xhr.getResponseHeader("X-Total-Count");
return res;
}
},
supplierContactsTableColumns: [
{
title: this.$t('message.name'),
field: "name",
sortable: false,
formatter(value, row, index) {
return xssFilters.inHTMLData(common.valueWithDefault(value, ""));
}
},
{
title: this.$t('message.email'),
field: "email",
sortable: false,
formatter(value, row, index) {
return xssFilters.inHTMLData(common.valueWithDefault(value, ""));
}
},
{
title: this.$t('message.phone'),
field: "phone",
sortable: false,
formatter(value, row, index) {
return xssFilters.inHTMLData(common.valueWithDefault(value, ""));
}
}
],
supplierContactsTableOptions: {
search: false,
showColumns: false,
showRefresh: false,
pagination: true,
silentSort: false,
sidePagination: 'client',
queryParamsType: 'pageSize',
pageList: '[5, 10, 25]',
pageSize: 5,
icons: {
refresh: 'fa-refresh'
},
responseHandler: function (res, xhr) {
res.total = xhr.getResponseHeader("X-Total-Count");
return res;
}
},
referencesTableColumns: [
{
title: this.$t('message.url'),
Expand Down Expand Up @@ -225,6 +323,7 @@
uuid: this.project.uuid,
author: this.project.author,
publisher: this.project.publisher,
supplier: this.project.supplier,
group: this.project.group,
name: this.project.name,
version: this.project.version,
Expand Down

0 comments on commit 3c6192f

Please sign in to comment.