From 1c9b824d307259b7f12478c9e3b82b541b56d586 Mon Sep 17 00:00:00 2001 From: Sahiba Mittal Date: Mon, 23 Mar 2026 15:19:57 +0000 Subject: [PATCH 1/7] Use TokenPaginatedTable for Component Search Replace the legacy bootstrap-table with TokenPaginatedTable and update table props/behaviour to use token-based pagination. --- .../portfolio/components/ComponentSearch.vue | 101 +++++------------- 1 file changed, 28 insertions(+), 73 deletions(-) diff --git a/src/views/portfolio/components/ComponentSearch.vue b/src/views/portfolio/components/ComponentSearch.vue index da58b7208..d1b869073 100644 --- a/src/views/portfolio/components/ComponentSearch.vue +++ b/src/views/portfolio/components/ComponentSearch.vue @@ -52,14 +52,12 @@ - - + :options="tableOptions" + /> @@ -73,6 +71,7 @@ import BInputGroupFormSelect from '../../../forms/BInputGroupFormSelect'; import BInputGroupFormInput from '../../../forms/BInputGroupFormInput'; import xssFilters from 'xss-filters'; import SeverityProgressBar from '@/views/components/SeverityProgressBar'; +import TokenPaginatedTable from '@/views/components/TokenPaginatedTable.vue'; import { loadUserPreferencesForBootstrapTable } from '@/shared/utils'; export default { @@ -82,6 +81,7 @@ export default { PortfolioWidgetRow, BInputGroupFormSelect, BInputGroupFormInput, + TokenPaginatedTable, }, beforeCreate() { this.subject = @@ -122,6 +122,9 @@ export default { } }, }, + mounted() { + this.changeSearchUrl = true; + }, methods: { createQueryParams: function () { if (this.subject === 'COORDINATES') { @@ -147,15 +150,19 @@ export default { } }, performSearch: function () { + let url; if (this.subject === 'HASH') { let hash = encodeURIComponent(common.trimToNull(this.value)); - this.options.url = `${this.$api.BASE_URL}/${this.$api.URL_COMPONENT}/hash/${hash}`; - this.$refs.table.refresh({ silent: true }); + url = `${this.$api.BASE_URL}/${this.$api.URL_COMPONENT}/hash/${hash}`; } else { let queryParams = this.createQueryParams(); - this.options.url = `${this.$api.BASE_URL}/${this.$api.URL_COMPONENT}/identity?${queryParams}`; - this.$refs.table.refresh({ silent: true }); + url = `${this.$api.BASE_URL}/api/v2/components?${queryParams}`; } + this.tableBaseUrl = url; + this.$nextTick(() => { + this.$refs.table.refresh({ silent: true }); + }); + if (this.changeSearchUrl) { if (this.subject === 'COORDINATES') { let urlCoordinatesGroup = this.coordinatesGroup @@ -194,10 +201,6 @@ export default { 'ComponentSearch', this.$refs.table.columns, ); - if (!this.changeSearchUrl) { - this.performSearch(); - this.changeSearchUrl = true; - } }, }, data() { @@ -228,7 +231,7 @@ export default { '/dependencyGraph/' + row.uuid, ); - return row.project.directDependencies + return row.project.direct_dependencies ? ` ` + `${xssFilters.inHTMLData(value)}` : `${xssFilters.inHTMLData(value)}`; @@ -261,7 +264,7 @@ export default { }, { title: this.$t('message.internal'), - field: 'isInternal', + field: 'internal', sortable: false, align: 'center', class: 'tight', @@ -279,7 +282,7 @@ export default { }, { title: this.$t('message.swid_tagid'), - field: 'swid', + field: 'swid_tag_id', sortable: true, formatter(value, row, index) { return xssFilters.inHTMLData(common.valueWithDefault(value, '')); @@ -303,24 +306,24 @@ export default { }, { title: this.$t('message.license_name'), - field: 'resolvedLicense.licenseId', + field: 'resolved_license.license_id', sortable: true, visible: false, - formatter(resolvedLicense, row, index) { - if (typeof resolvedLicense === 'undefined') { + formatter(resolved_license, row, index) { + if (typeof resolved_license === 'undefined') { return '-'; // No resolvedLicense info available } let url = xssFilters.uriInUnQuotedAttr( '../licenses/' + - encodeURIComponent(row.resolvedLicense.licenseId), + encodeURIComponent(row.resolved_license.license_id), ); - return `${xssFilters.inHTMLData(row.resolvedLicense.name)}`; + return `${xssFilters.inHTMLData(row.resolved_license.name)}`; }, }, { title: this.$t('message.risk_score'), - field: 'lastInheritedRiskScore', + field: 'last_inherited_risk_score', sortable: true, visible: false, class: 'tight', @@ -353,62 +356,14 @@ export default { }.bind(this), }, ], - data: [], - options: { - onPostBody: this.initializeTooltips, - search: false, + tableOptions: { showColumns: true, showRefresh: true, - pagination: true, - silentSort: false, - toolbar: '#componentSearchToolbar', - sidePagination: 'server', - queryParamsType: 'pageSize', - pageList: '[10, 25, 50, 100]', - pageSize: - localStorage && - localStorage.getItem('ComponentSearchPageSize') !== null - ? Number(localStorage.getItem('ComponentSearchPageSize')) - : 10, - sortName: - localStorage && - localStorage.getItem('ComponentSearchSortName') !== null - ? localStorage.getItem('ComponentSearchSortName') - : undefined, - sortOrder: - localStorage && - localStorage.getItem('ComponentSearchSortOrder') !== null - ? localStorage.getItem('ComponentSearchSortOrder') - : undefined, icons: { refresh: 'fa-refresh', }, - //toolbar: '#componentSearchToolbar', - responseHandler: function (res, xhr) { - res.total = xhr.getResponseHeader('X-Total-Count'); - return res; - }, - url: `${this.$api.BASE_URL}/${this.$api.URL_COMPONENT}/identity`, - onPageChange: (number, size) => { - if (localStorage) { - localStorage.setItem('ComponentSearchPageSize', size.toString()); - } - }, - onColumnSwitch: (field, checked) => { - if (localStorage) { - localStorage.setItem( - 'ComponentSearchShow' + common.capitalize(field), - checked.toString(), - ); - } - }, - onSort: (name, order) => { - if (localStorage) { - localStorage.setItem('ComponentSearchSortName', name); - localStorage.setItem('ComponentSearchSortOrder', order); - } - }, }, + tableBaseUrl: null, }; }, }; From 5e37743e2a4723ed45cb16aa4d4b402988e88487 Mon Sep 17 00:00:00 2001 From: Sahiba Mittal Date: Thu, 26 Mar 2026 14:33:37 +0000 Subject: [PATCH 2/7] Use v2 endpoint for HASH search --- src/views/portfolio/components/ComponentSearch.vue | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/views/portfolio/components/ComponentSearch.vue b/src/views/portfolio/components/ComponentSearch.vue index d1b869073..717a5bd1e 100644 --- a/src/views/portfolio/components/ComponentSearch.vue +++ b/src/views/portfolio/components/ComponentSearch.vue @@ -147,17 +147,14 @@ export default { } else if (this.subject === 'SWID_TAGID') { let v = common.trimToNull(this.value); return v != null ? 'swidTagId=' + encodeURIComponent(v) : ''; + } else if (this.subject === 'HASH') { + let v = common.trimToNull(this.value); + return v != null ? 'hash=' + encodeURIComponent(v) : ''; } }, performSearch: function () { - let url; - if (this.subject === 'HASH') { - let hash = encodeURIComponent(common.trimToNull(this.value)); - url = `${this.$api.BASE_URL}/${this.$api.URL_COMPONENT}/hash/${hash}`; - } else { - let queryParams = this.createQueryParams(); - url = `${this.$api.BASE_URL}/api/v2/components?${queryParams}`; - } + let queryParams = this.createQueryParams(); + let url = `${this.$api.BASE_URL}/api/v2/components?${queryParams}`; this.tableBaseUrl = url; this.$nextTick(() => { this.$refs.table.refresh({ silent: true }); From b62dc220fa5d1b27ca90441c8b25a7f4c2516900 Mon Sep 17 00:00:00 2001 From: Sahiba Mittal Date: Fri, 27 Mar 2026 15:15:12 +0000 Subject: [PATCH 3/7] Fix sorting for component search --- .../portfolio/components/ComponentSearch.vue | 94 +++++++++---------- 1 file changed, 42 insertions(+), 52 deletions(-) diff --git a/src/views/portfolio/components/ComponentSearch.vue b/src/views/portfolio/components/ComponentSearch.vue index 717a5bd1e..b95240a61 100644 --- a/src/views/portfolio/components/ComponentSearch.vue +++ b/src/views/portfolio/components/ComponentSearch.vue @@ -54,7 +54,7 @@ @@ -126,71 +126,37 @@ export default { this.changeSearchUrl = true; }, methods: { - createQueryParams: function () { + createQueryParams() { + let params = {}; + if (this.subject === 'COORDINATES') { - let params = { - group: common.trimToNull(this.coordinatesGroup), - name: common.trimToNull(this.coordinatesName), - version: common.trimToNull(this.coordinatesVersion), - }; - let esc = encodeURIComponent; - return Object.keys(params) - .filter((k) => params[k]) - .map((k) => esc(k) + '=' + esc(params[k])) - .join('&'); + if (this.coordinatesGroup) + params.group = common.trimToNull(this.coordinatesGroup); + if (this.coordinatesName) + params.name = common.trimToNull(this.coordinatesName); + if (this.coordinatesVersion) + params.version = common.trimToNull(this.coordinatesVersion); } else if (this.subject === 'PACKAGE_URL') { let v = common.trimToNull(this.value); - return v != null ? 'purl=' + encodeURIComponent(v) : ''; + if (v) params.purl = v; } else if (this.subject === 'CPE') { let v = common.trimToNull(this.value); - return v != null ? 'cpe=' + encodeURIComponent(v) : ''; + if (v) params.cpe = v; } else if (this.subject === 'SWID_TAGID') { let v = common.trimToNull(this.value); - return v != null ? 'swidTagId=' + encodeURIComponent(v) : ''; + if (v) params.swidTagId = v; } else if (this.subject === 'HASH') { let v = common.trimToNull(this.value); - return v != null ? 'hash=' + encodeURIComponent(v) : ''; + if (v) params.hash = v; } + + return params; }, performSearch: function () { - let queryParams = this.createQueryParams(); - let url = `${this.$api.BASE_URL}/api/v2/components?${queryParams}`; - this.tableBaseUrl = url; + this.appliedFilters = this.createQueryParams(); this.$nextTick(() => { this.$refs.table.refresh({ silent: true }); }); - - if (this.changeSearchUrl) { - if (this.subject === 'COORDINATES') { - let urlCoordinatesGroup = this.coordinatesGroup - ? encodeURIComponent(this.coordinatesGroup) - : ''; - let urlCoordinatesName = this.coordinatesName - ? encodeURIComponent(this.coordinatesName) - : ''; - let urlCoordinatesVersion = this.coordinatesVersion - ? encodeURIComponent(this.coordinatesVersion) - : ''; - this.$router.replace({ - path: 'components', - hash: - '#/search/' + - this.subject + - '/group=' + - urlCoordinatesGroup + - '/name=' + - urlCoordinatesName + - '/version=' + - urlCoordinatesVersion, - }); - } else { - let urlValue = this.value ? encodeURIComponent(this.value) : ''; - this.$router.replace({ - path: 'components', - hash: '#/search/' + this.subject + '/' + urlValue, - }); - } - } }, onPreBody: function () { loadUserPreferencesForBootstrapTable( @@ -200,6 +166,20 @@ export default { ); }, }, + computed: { + tableDataBaseUrl() { + if (!this.appliedFilters) return null; + const url = `${this.$api.BASE_URL}/api/v2/components`; + const queryParams = { ...this.appliedFilters }; + if (this.sortBy) { + queryParams.sort_by = this.sortBy; + } + if (this.sortDirection) { + queryParams.sort_direction = this.sortDirection.toUpperCase(); + } + return common.setQueryParams(url, queryParams); + }, + }, data() { return { subject: this.subject, @@ -207,6 +187,9 @@ export default { coordinatesGroup: null, coordinatesName: null, coordinatesVersion: null, + sortBy: null, + sortDirection: null, + appliedFilters: null, subjects: [ { value: 'COORDINATES', text: this.$t('message.coordinates') }, { value: 'PACKAGE_URL', text: this.$t('message.package_url') }, @@ -304,7 +287,7 @@ export default { { title: this.$t('message.license_name'), field: 'resolved_license.license_id', - sortable: true, + sortable: false, visible: false, formatter(resolved_license, row, index) { if (typeof resolved_license === 'undefined') { @@ -359,6 +342,13 @@ export default { icons: { refresh: 'fa-refresh', }, + sortName: 'id', + sortOrder: 'desc', + customSort: () => {}, + onSort: (name, order) => { + this.sortBy = name; + this.sortDirection = order; + }, }, tableBaseUrl: null, }; From 11938b09bd6bac23427065085b73d22e933fb112 Mon Sep 17 00:00:00 2001 From: Sahiba Mittal Date: Tue, 31 Mar 2026 17:14:51 +0100 Subject: [PATCH 4/7] Add hash type search for components --- src/i18n/locales/de.json | 2 +- src/i18n/locales/en.json | 2 +- src/i18n/locales/es.json | 2 +- src/i18n/locales/fr.json | 2 +- src/i18n/locales/hi.json | 2 +- src/i18n/locales/it.json | 2 +- src/i18n/locales/ja.json | 2 +- src/i18n/locales/pl.json | 2 +- src/i18n/locales/pt-BR.json | 2 +- src/i18n/locales/pt.json | 2 +- src/i18n/locales/ru.json | 2 +- src/i18n/locales/uk-UA.json | 2 +- src/i18n/locales/zh.json | 2 +- .../portfolio/components/ComponentSearch.vue | 96 +++++++++++++++---- 14 files changed, 91 insertions(+), 31 deletions(-) diff --git a/src/i18n/locales/de.json b/src/i18n/locales/de.json index 9f477f5b7..e5192057f 100644 --- a/src/i18n/locales/de.json +++ b/src/i18n/locales/de.json @@ -543,7 +543,7 @@ "group_name": "Gruppenname", "grouped_vulnerabilities": "Gruppierte Schwachstellen", "hashes": "Hashwerte", - "hashes_short_desc": "Hash (MD5, SHA, SHA3, Blake2b, Blake3)", + "hashes_short_desc": "Hash", "home": "Heim", "id": "ID", "identifier": "Kennung", diff --git a/src/i18n/locales/en.json b/src/i18n/locales/en.json index 1b9014eb3..9277b9bac 100644 --- a/src/i18n/locales/en.json +++ b/src/i18n/locales/en.json @@ -543,7 +543,7 @@ "group_name": "Group Name", "grouped_vulnerabilities": "Grouped Vulnerabilities", "hashes": "Hashes", - "hashes_short_desc": "Hash (MD5, SHA, SHA3, Blake2b, Blake3)", + "hashes_short_desc": "Hash", "home": "Home", "id": "ID", "identifier": "Identifier", diff --git a/src/i18n/locales/es.json b/src/i18n/locales/es.json index ff693e65d..557c0a6eb 100644 --- a/src/i18n/locales/es.json +++ b/src/i18n/locales/es.json @@ -543,7 +543,7 @@ "group_name": "Nombre del grupo", "grouped_vulnerabilities": "Vulnerabilidades agrupadas", "hashes": "hashes", - "hashes_short_desc": "Hash (MD5, SHA, SHA3, Blake2b, Blake3)", + "hashes_short_desc": "Hash", "home": "Hogar", "id": "ID", "identifier": "Identificador", diff --git a/src/i18n/locales/fr.json b/src/i18n/locales/fr.json index 06e5efebb..3a2987400 100644 --- a/src/i18n/locales/fr.json +++ b/src/i18n/locales/fr.json @@ -543,7 +543,7 @@ "group_name": "Nom de groupe", "grouped_vulnerabilities": "Vulnérabilités groupées", "hashes": "Condensats", - "hashes_short_desc": "Condensat (MD5, SHA, SHA3, Blake2b, Blake3)", + "hashes_short_desc": "Condensat", "home": "Accueil", "id": "ID", "identifier": "Identifiant", diff --git a/src/i18n/locales/hi.json b/src/i18n/locales/hi.json index 308e33c75..b5d658c96 100644 --- a/src/i18n/locales/hi.json +++ b/src/i18n/locales/hi.json @@ -543,7 +543,7 @@ "group_name": "समूह नाम", "grouped_vulnerabilities": "समूहीकृत कमज़ोरियाँ", "hashes": "हैश", - "hashes_short_desc": "हैश (MD5, SHA, SHA3, ब्लेक2b, ब्लेक3)", + "hashes_short_desc": "हैश", "home": "घर", "id": "आईडी", "identifier": "पहचानकर्ता", diff --git a/src/i18n/locales/it.json b/src/i18n/locales/it.json index 065342c10..e120969d2 100644 --- a/src/i18n/locales/it.json +++ b/src/i18n/locales/it.json @@ -543,7 +543,7 @@ "group_name": "Nome del gruppo", "grouped_vulnerabilities": "Vulnerabilità raggruppate", "hashes": "Hash", - "hashes_short_desc": "Hash (MD5, SHA, SHA3, Blake2b, Blake3)", + "hashes_short_desc": "Hash", "home": "Casa", "id": "ID", "identifier": "Identificatore", diff --git a/src/i18n/locales/ja.json b/src/i18n/locales/ja.json index 1e934abed..5b27308ba 100644 --- a/src/i18n/locales/ja.json +++ b/src/i18n/locales/ja.json @@ -543,7 +543,7 @@ "group_name": "グループ名", "grouped_vulnerabilities": "グループ化された脆弱性", "hashes": "ハッシュ", - "hashes_short_desc": "ハッシュ (MD5、SHA、SHA3、Blake2b、Blake3)", + "hashes_short_desc": "ハッシュ", "home": "ホーム", "id": "ID", "identifier": "識別子", diff --git a/src/i18n/locales/pl.json b/src/i18n/locales/pl.json index 24a2ae3b2..e9ca59023 100644 --- a/src/i18n/locales/pl.json +++ b/src/i18n/locales/pl.json @@ -543,7 +543,7 @@ "group_name": "Nazwa grupy", "grouped_vulnerabilities": "Zgrupowane luki w zabezpieczeniach", "hashes": "Hasze", - "hashes_short_desc": "Hash (MD5, SHA, SHA3, Blake2b, Blake3)", + "hashes_short_desc": "Hash", "home": "Dom", "id": "ID", "identifier": "Identyfikator", diff --git a/src/i18n/locales/pt-BR.json b/src/i18n/locales/pt-BR.json index e9e237071..9cc909cbf 100644 --- a/src/i18n/locales/pt-BR.json +++ b/src/i18n/locales/pt-BR.json @@ -543,7 +543,7 @@ "group_name": "Nome do grupo", "grouped_vulnerabilities": "Vulnerabilidades agrupadas", "hashes": "Hashes", - "hashes_short_desc": "Hash (MD5, SHA, SHA3, Blake2b, Blake3)", + "hashes_short_desc": "Hash", "home": "Lar", "id": "ID", "identifier": "Identificador", diff --git a/src/i18n/locales/pt.json b/src/i18n/locales/pt.json index 94f739c85..eddf92f5b 100644 --- a/src/i18n/locales/pt.json +++ b/src/i18n/locales/pt.json @@ -543,7 +543,7 @@ "group_name": "Nome do grupo", "grouped_vulnerabilities": "Vulnerabilidades agrupadas", "hashes": "Hashes", - "hashes_short_desc": "Hash (MD5, SHA, SHA3, Blake2b, Blake3)", + "hashes_short_desc": "Hash", "home": "Lar", "id": "ID", "identifier": "Identificador", diff --git a/src/i18n/locales/ru.json b/src/i18n/locales/ru.json index 0cb8680da..cb5ea094a 100644 --- a/src/i18n/locales/ru.json +++ b/src/i18n/locales/ru.json @@ -543,7 +543,7 @@ "group_name": "Имя группы", "grouped_vulnerabilities": "Группированные уязвимости", "hashes": "Хэши", - "hashes_short_desc": "Хэш (MD5, SHA, SHA3, Blake2b, Blake3)", + "hashes_short_desc": "Хэш", "home": "Главная", "id": "ID", "identifier": "Идентификатор", diff --git a/src/i18n/locales/uk-UA.json b/src/i18n/locales/uk-UA.json index a3901a647..218c6d217 100644 --- a/src/i18n/locales/uk-UA.json +++ b/src/i18n/locales/uk-UA.json @@ -543,7 +543,7 @@ "group_name": "Назва групи", "grouped_vulnerabilities": "Згруповані вразливості", "hashes": "Хеші", - "hashes_short_desc": "Хеш (MD5, SHA, SHA3, Blake2b, Blake3)", + "hashes_short_desc": "Хеш", "home": "додому", "id": "ID", "identifier": "Ідентифікатор", diff --git a/src/i18n/locales/zh.json b/src/i18n/locales/zh.json index 203c3aaac..de5084c06 100644 --- a/src/i18n/locales/zh.json +++ b/src/i18n/locales/zh.json @@ -543,7 +543,7 @@ "group_name": "组名称", "grouped_vulnerabilities": "分组漏洞", "hashes": "哈希", - "hashes_short_desc": "哈希(MD5、SHA、SHA3、Blake2b、Blake3)", + "hashes_short_desc": "哈希", "home": "首页", "id": "ID", "identifier": "标识符", diff --git a/src/views/portfolio/components/ComponentSearch.vue b/src/views/portfolio/components/ComponentSearch.vue index b95240a61..3a7dde6b9 100644 --- a/src/views/portfolio/components/ComponentSearch.vue +++ b/src/views/portfolio/components/ComponentSearch.vue @@ -13,7 +13,7 @@ + + + + - {{ - $t('message.search') - }} + {{ $t('message.search') }} @@ -119,6 +137,13 @@ export default { subject() { if (localStorage) { localStorage.setItem('ComponentSearchSubject', this.subject); + // Reset ALL inputs when subject changes. + this.value = null; + this.hashType = null; + this.coordinatesGroup = null; + this.coordinatesName = null; + this.coordinatesVersion = null; + this.appliedFilters = null; } }, }, @@ -144,10 +169,15 @@ export default { if (v) params.cpe = v; } else if (this.subject === 'SWID_TAGID') { let v = common.trimToNull(this.value); - if (v) params.swidTagId = v; + if (v) params.swid_tag_id = v; } else if (this.subject === 'HASH') { let v = common.trimToNull(this.value); - if (v) params.hash = v; + if (v) { + params.hash = v; + if (this.hashType) { + params.hash_type = this.hashType; + } + } } return params; @@ -167,16 +197,29 @@ export default { }, }, computed: { + isSearchDisabled() { + if (this.subject === 'COORDINATES') { + return !( + this.coordinatesGroup || + this.coordinatesName || + this.coordinatesVersion + ); + } + + if (this.subject === 'HASH') { + return !(this.value && this.hashType); + } + + return !this.value; + }, tableDataBaseUrl() { if (!this.appliedFilters) return null; const url = `${this.$api.BASE_URL}/api/v2/components`; const queryParams = { ...this.appliedFilters }; - if (this.sortBy) { - queryParams.sort_by = this.sortBy; - } - if (this.sortDirection) { - queryParams.sort_direction = this.sortDirection.toUpperCase(); - } + const sortBy = this.sortBy || 'name'; + const sortDirection = this.sortDirection || 'asc'; + queryParams.sort_by = sortBy; + queryParams.sort_direction = sortDirection.toUpperCase(); return common.setQueryParams(url, queryParams); }, }, @@ -190,6 +233,21 @@ export default { sortBy: null, sortDirection: null, appliedFilters: null, + hashType: null, + hashTypes: [ + { value: 'MD5', text: 'MD5' }, + { value: 'SHA1', text: 'SHA1' }, + { value: 'SHA_256', text: 'SHA_256' }, + { value: 'SHA_384', text: 'SHA_256' }, + { value: 'SHA_512', text: 'SHA_512' }, + { value: 'SHA3_256', text: 'SHA3_256' }, + { value: 'SHA3_384', text: 'SHA3_256' }, + { value: 'SHA3_512', text: 'SHA3_512' }, + { value: 'BLAKE2B_256', text: 'BLAKE2B_256' }, + { value: 'BLAKE2B_384', text: 'BLAKE2B_256' }, + { value: 'BLAKE2B_512', text: 'BLAKE2B_512' }, + { value: 'BLAKE3', text: 'BLAKE3' }, + ], subjects: [ { value: 'COORDINATES', text: this.$t('message.coordinates') }, { value: 'PACKAGE_URL', text: this.$t('message.package_url') }, @@ -211,10 +269,10 @@ export default { '/dependencyGraph/' + row.uuid, ); - return row.project.direct_dependencies - ? ` ` + - `${xssFilters.inHTMLData(value)}` - : `${xssFilters.inHTMLData(value)}`; + return ( + ` ` + + `${xssFilters.inHTMLData(value)}` + ); }, }, { @@ -339,11 +397,13 @@ export default { tableOptions: { showColumns: true, showRefresh: true, + silentSort: false, + toolbar: '#componentSearchToolbar', icons: { refresh: 'fa-refresh', }, - sortName: 'id', - sortOrder: 'desc', + sortName: 'name', + sortOrder: 'asc', customSort: () => {}, onSort: (name, order) => { this.sortBy = name; From 541add5095703f005ff8dd0813aa70b393ac232b Mon Sep 17 00:00:00 2001 From: Sahiba Mittal Date: Tue, 14 Apr 2026 13:06:17 +0100 Subject: [PATCH 5/7] Update ComponentSearch.vue --- .../portfolio/components/ComponentSearch.vue | 27 +++++++++---------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/src/views/portfolio/components/ComponentSearch.vue b/src/views/portfolio/components/ComponentSearch.vue index 3a7dde6b9..b977c7e7e 100644 --- a/src/views/portfolio/components/ComponentSearch.vue +++ b/src/views/portfolio/components/ComponentSearch.vue @@ -184,9 +184,6 @@ export default { }, performSearch: function () { this.appliedFilters = this.createQueryParams(); - this.$nextTick(() => { - this.$refs.table.refresh({ silent: true }); - }); }, onPreBody: function () { loadUserPreferencesForBootstrapTable( @@ -235,18 +232,18 @@ export default { appliedFilters: null, hashType: null, hashTypes: [ - { value: 'MD5', text: 'MD5' }, - { value: 'SHA1', text: 'SHA1' }, - { value: 'SHA_256', text: 'SHA_256' }, - { value: 'SHA_384', text: 'SHA_256' }, - { value: 'SHA_512', text: 'SHA_512' }, - { value: 'SHA3_256', text: 'SHA3_256' }, - { value: 'SHA3_384', text: 'SHA3_256' }, - { value: 'SHA3_512', text: 'SHA3_512' }, - { value: 'BLAKE2B_256', text: 'BLAKE2B_256' }, - { value: 'BLAKE2B_384', text: 'BLAKE2B_256' }, - { value: 'BLAKE2B_512', text: 'BLAKE2B_512' }, - { value: 'BLAKE3', text: 'BLAKE3' }, + { value: 'MD5', text: this.$t('hashes.md5') }, + { value: 'SHA-1', text: this.$t('hashes.sha_1') }, + { value: 'SHA-256', text: this.$t('hashes.sha_256') }, + { value: 'SHA-384', text: this.$t('hashes.sha_384') }, + { value: 'SHA-512', text: this.$t('hashes.sha_512') }, + { value: 'SHA3-256', text: this.$t('hashes.sha3_256') }, + { value: 'SHA3-384', text: this.$t('hashes.sha3_384') }, + { value: 'SHA3-512', text: this.$t('hashes.sha3_512') }, + { value: 'BLAKE2b-256', text: this.$t('hashes.blake_256') }, + { value: 'BLAKE2b-384', text: this.$t('hashes.blake_384') }, + { value: 'BLAKE2b-512', text: this.$t('hashes.blake_512') }, + { value: 'BLAKE3', text: this.$t('hashes.blake3') }, ], subjects: [ { value: 'COORDINATES', text: this.$t('message.coordinates') }, From 24d53c34b56356abb29e125c476e1ca86aba7c3d Mon Sep 17 00:00:00 2001 From: Sahiba Mittal Date: Wed, 15 Apr 2026 11:50:51 +0100 Subject: [PATCH 6/7] Refactor ComponentSearch & fix hash types --- .../portfolio/components/ComponentSearch.vue | 56 +++++++++++-------- 1 file changed, 32 insertions(+), 24 deletions(-) diff --git a/src/views/portfolio/components/ComponentSearch.vue b/src/views/portfolio/components/ComponentSearch.vue index b977c7e7e..7f54db0d9 100644 --- a/src/views/portfolio/components/ComponentSearch.vue +++ b/src/views/portfolio/components/ComponentSearch.vue @@ -23,11 +23,12 @@ /> + > + Select hash type + { + if (!this.isSearchDisabled) { + this.performSearch(); + } + }); } }, watch: { + baseUrl(newVal) { + if (!newVal) return; + this.loadPage(newVal); + }, subject() { if (localStorage) { localStorage.setItem('ComponentSearchSubject', this.subject); @@ -143,12 +153,13 @@ export default { this.coordinatesGroup = null; this.coordinatesName = null; this.coordinatesVersion = null; - this.appliedFilters = null; } }, }, mounted() { - this.changeSearchUrl = true; + if (this.baseUrl) { + this.loadPage(this.baseUrl); + } }, methods: { createQueryParams() { @@ -183,15 +194,11 @@ export default { return params; }, performSearch: function () { + if (this.isSearchDisabled) { + return; + } this.appliedFilters = this.createQueryParams(); }, - onPreBody: function () { - loadUserPreferencesForBootstrapTable( - this, - 'ComponentSearch', - this.$refs.table.columns, - ); - }, }, computed: { isSearchDisabled() { @@ -210,7 +217,9 @@ export default { return !this.value; }, tableDataBaseUrl() { - if (!this.appliedFilters) return null; + if (!this.appliedFilters || Object.keys(this.appliedFilters).length === 0) { + return null; + } const url = `${this.$api.BASE_URL}/api/v2/components`; const queryParams = { ...this.appliedFilters }; const sortBy = this.sortBy || 'name'; @@ -233,16 +242,16 @@ export default { hashType: null, hashTypes: [ { value: 'MD5', text: this.$t('hashes.md5') }, - { value: 'SHA-1', text: this.$t('hashes.sha_1') }, - { value: 'SHA-256', text: this.$t('hashes.sha_256') }, - { value: 'SHA-384', text: this.$t('hashes.sha_384') }, - { value: 'SHA-512', text: this.$t('hashes.sha_512') }, - { value: 'SHA3-256', text: this.$t('hashes.sha3_256') }, - { value: 'SHA3-384', text: this.$t('hashes.sha3_384') }, - { value: 'SHA3-512', text: this.$t('hashes.sha3_512') }, - { value: 'BLAKE2b-256', text: this.$t('hashes.blake_256') }, - { value: 'BLAKE2b-384', text: this.$t('hashes.blake_384') }, - { value: 'BLAKE2b-512', text: this.$t('hashes.blake_512') }, + { value: 'SHA1', text: this.$t('hashes.sha_1') }, + { value: 'SHA_256', text: this.$t('hashes.sha_256') }, + { value: 'SHA_384', text: this.$t('hashes.sha_384') }, + { value: 'SHA_512', text: this.$t('hashes.sha_512') }, + { value: 'SHA3_256', text: this.$t('hashes.sha3_256') }, + { value: 'SHA3_384', text: this.$t('hashes.sha3_384') }, + { value: 'SHA3_512', text: this.$t('hashes.sha3_512') }, + { value: 'BLAKE2b_256', text: this.$t('hashes.blake_256') }, + { value: 'BLAKE2b_384', text: this.$t('hashes.blake_384') }, + { value: 'BLAKE2b_512', text: this.$t('hashes.blake_512') }, { value: 'BLAKE3', text: this.$t('hashes.blake3') }, ], subjects: [ @@ -267,7 +276,7 @@ export default { row.uuid, ); return ( - ` ` + + ` ` + `${xssFilters.inHTMLData(value)}` ); }, @@ -407,7 +416,6 @@ export default { this.sortDirection = order; }, }, - tableBaseUrl: null, }; }, }; From 08063df99c5463feee811c223bafdd500fdf1d9e Mon Sep 17 00:00:00 2001 From: Sahiba Mittal Date: Wed, 15 Apr 2026 11:52:37 +0100 Subject: [PATCH 7/7] Update ComponentSearch.vue --- .../portfolio/components/ComponentSearch.vue | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/views/portfolio/components/ComponentSearch.vue b/src/views/portfolio/components/ComponentSearch.vue index 7f54db0d9..fbe34edca 100644 --- a/src/views/portfolio/components/ComponentSearch.vue +++ b/src/views/portfolio/components/ComponentSearch.vue @@ -22,12 +22,10 @@ v-on:keyup.enter="performSearch" /> - - Select hash type + + Select hash type