From 79777b6778b2e383c6621658623902007a4f36da Mon Sep 17 00:00:00 2001 From: Kaden Emley Date: Tue, 13 Aug 2024 09:11:09 -0400 Subject: [PATCH] force the sbom component columns to have consistent ordering Signed-off-by: Kaden Emley --- .../src/components/cards/sbomview/ComponentTable.vue | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/apps/frontend/src/components/cards/sbomview/ComponentTable.vue b/apps/frontend/src/components/cards/sbomview/ComponentTable.vue index 52b0ed1014..afeb1393d6 100644 --- a/apps/frontend/src/components/cards/sbomview/ComponentTable.vue +++ b/apps/frontend/src/components/cards/sbomview/ComponentTable.vue @@ -193,7 +193,14 @@ export default class ComponentTable extends Vue { }); } + headerIndex(str: string) { + return this.headerOptions.findIndex((option) => option.key === str); + } + get headers() { + // ensure that the header columns are in a consistent order and not determined by + // the order in which they are selected + this.headerColumns.sort((a, b) => this.headerIndex(a) - this.headerIndex(b)) let h = this.headerColumns.map((v) => { return {value: v, class: 'header-box', text: _.startCase(v)}; });