@@ -161,8 +161,7 @@ export default {
161161 cnaContainer: {},
162162 cveProgramContainer: {},
163163 adpContainers: {},
164- orgIdAndLongNameMap: usePartnerStore ().partnerShortLongNameMap ,
165- short2FullNameMap: this .createShort2FullNameMap (),
164+ partnerStore: usePartnerStore (),
166165 };
167166 },
168167 methods: {
@@ -192,9 +191,9 @@ export default {
192191 const assignerName = this .cnaContainer .providerMetadata ? .shortName ;
193192 const assignerUUID = this .cnaContainer .providerMetadata .orgId ;
194193
195- const cnaName = this .getOrganizationName (assignerName,
196- assignerUUID,
197- ownerName);
194+ const cnaName = this .partnerStore . getOrganizationName (assignerName,
195+ assignerUUID,
196+ ownerName);
198197
199198 onPageMenu[headingLabel].items [' CNA' ] = {
200199 label: ` CNA: ${ cnaName} ` ,
@@ -205,7 +204,8 @@ export default {
205204
206205 if (Object .keys (this .cveProgramContainer ).length > 0 ) {
207206 onPageMenu[headingLabel].items [' CVE Program' ] = {
208- label: this .getOrganizationName (this .cveProgramContainer .providerMetadata ? .shortName , this .cveProgramContainer .providerMetadata .orgId ),
207+ label: this .partnerStore .getOrganizationName (this .cveProgramContainer .providerMetadata ? .shortName ,
208+ this .cveProgramContainer .providerMetadata .orgId ),
209209 anchorId: ` cve-program-${ this .cveProgramContainer .providerMetadata .orgId } `
210210 }
211211 this .cveProgramContainer .onPageMenu = onPageMenu[headingLabel].items [' CVE Program' ];
@@ -215,7 +215,8 @@ export default {
215215
216216 Object .keys (this .adpContainers ).forEach ( (containerName ) => {
217217 adpContainersMenu[` ADP-${ this .adpContainers [containerName].providerMetadata .orgId } ` ] = {
218- label: this .getOrganizationName (this .adpContainers [containerName].providerMetadata .shortName , this .adpContainers [containerName].providerMetadata .orgId ),
218+ label: this .partnerStore .getOrganizationName (this .adpContainers [containerName].providerMetadata .shortName ,
219+ this .adpContainers [containerName].providerMetadata .orgId ),
219220 anchorId: ` adp-${ this .adpContainers [containerName].providerMetadata .orgId } `
220221 }
221222 this .adpContainers [containerName].onPageMenu = adpContainersMenu[` ADP-${ this .adpContainers [containerName].providerMetadata .orgId } ` ];
@@ -241,7 +242,7 @@ export default {
241242
242243 if (this .originalRecordData ? .containers ? .adp ) {
243244 this .originalRecordData .containers .adp .forEach ((adp ) => {
244- if (adp .providerMetadata .shortName .toLowerCase () === this .cveRecordStore .cveProgramShortName ) {
245+ if (adp .providerMetadata .shortName .toLowerCase () === this .partnerStore .cveProgramShortName ) {
245246 this .cveProgramContainer = adp;
246247 this .cveRecordStore .accordionState [` cve-program-${ adp .providerMetadata .orgId } ` ] = true ;
247248 }
@@ -259,51 +260,6 @@ export default {
259260 this .getContentForField (field);
260261 });
261262 },
262- getOrganizationName (assignerName , assignerUUID , ownerName ) {
263-
264- // Given the assigner name and UUID, as well as the owner name (optional),
265- // return the appropriate name string to display as the CNA for the
266- // published record. In almost all cases, this will be the long name
267- // obtained by using the UUID to get the name from the map. When the
268- // assigner and owner name are different, the owner's name is displayed
269- // (it's assumed the ownership has changed and the assigner name does NOT
270- // reflect the change).
271-
272- const assignerNameLower = assignerName .toLowerCase ();
273- const ownerNameLower = ownerName? .toLowerCase ();
274-
275- if (ownerName && assignerNameLower !== ownerNameLower) {
276-
277- // Display the owner name - try to get the full name using the
278- // static CNA list. Otherwise, the owner's short name is displayed.
279-
280- return this .short2FullNameMap .get (ownerNameLower)
281- || this .short2DisplayName (ownerName);
282- }
283-
284- // The displayed name is based on the assigner.
285-
286- return this .orgIdAndLongNameMap ? .[assignerUUID]
287- || (assignerNameLower === this .cveRecordStore .cveProgramShortName )
288- ? ' CVE Program' : this .short2FullNameMap .get (assignerNameLower)
289- || this .short2DisplayName (assignerName);
290- },
291- short2DisplayName (shortName ) {
292-
293- // Modify a given "short name" for display - replace any underscores
294- // with a space and capitalize each word.
295-
296- return this .capitalize (shortName .replace (' _' , ' ' ));
297- },
298- capitalize (str ) {
299-
300- // Capitalize each word in the given string. The 3rd part of the "OR"
301- // in the regular expression allows for the word starting with various
302- // "openings", which isn't really needed, but left for possible use
303- // elsewhere.
304-
305- return str .replace (/ (?:^ | \s | ["'([{] )+ \S / g , match => match .toUpperCase ());
306- },
307263 getCredits () {
308264 // schema: https://github.com/CVEProject/cve-schema/blob/master/schema/v5.0/CVE_JSON_5.0_schema.json#L971-L1015
309265 const value = this .originalRecordData .containers ? .cna ? .credits ;
@@ -622,21 +578,6 @@ export default {
622578 });
623579 return tableWithHeaders;
624580 },
625- createShort2FullNameMap() {
626-
627- // This creates a mapping of **lowercased** short names to long names,
628- // based on the static CNA list data stored locally. At present,
629- // there is no other way to get a long name given a short name.
630-
631- const short2FullNameMap = new Map();
632-
633- CNAData.forEach((entry) => {
634- short2FullNameMap.set(entry.shortName.toLowerCase(),
635- entry.organizationName);
636- });
637-
638- return short2FullNameMap;
639- }
640581 },
641582 beforeMount() {
642583
0 commit comments