@@ -271,7 +269,7 @@ async function buildFieldScopes(scopeTypeId, scopes, block) {
if (scope == null || scope == undefined || scope == '') return;
const tag = document.createElement('div');
tag.classList.add('scope-tag');
- tag.textContent = await lookupType(scope);
+ tag.textContent = await lookupType(scope, scopeTypeId);
scopesParent.appendChild(tag);
});
}
@@ -460,10 +458,10 @@ function dateSort(parent) {
})
}
-async function lookupType(rawType) {
- const mappings = await deliverableMappings;
- const typeMatch = mappings.filter(item => item.value === rawType);
- const typeText = typeMatch.length > 0 ? typeMatch[0].text : rawType;
+async function lookupType(rawText, mappingType) {
+ const mappings = (mappingType === 'deliverable-type') ? await deliverableMappings : await platformMappings;
+ const typeMatch = mappings.filter(item => item.value === rawText);
+ const typeText = typeMatch.length > 0 ? typeMatch[0].text : rawText;
return typeText;
}
@@ -475,7 +473,7 @@ async function lookupType(rawType) {
*/
async function buildHeaderRow(category, headerType, isInactive, matchCount) {
//look up friendly name for deliverable type
- const typeLabel = await lookupType(category);
+ const typeLabel = await lookupType(category, 'deliverable-type');
const headerRow = document.createElement('div');
headerRow.classList.add('row', 'collapsible', 'header');
let divopen;
@@ -497,21 +495,16 @@ async function buildHeaderRow(category, headerType, isInactive, matchCount) {
async function buildTableRow(deliverableJson, kpi, createHidden) {
//look up friendly name for deliverable type
- const typeLabel = await lookupType(deliverableJson.deliverableType);
+ const typeLabel = await lookupType(deliverableJson.deliverableType, 'deliverable-type');
const dataRow = document.createElement('div');
dataRow.classList.add('row', 'datarow');
if (createHidden) dataRow.classList.add('inactive');
const status = (deliverableJson.deliverableStatusUpdate == null) ? "Not Available" : deliverableJson.deliverableStatusUpdate + "%";
const statusPct = (deliverableJson.deliverableStatusUpdate == null) ? "0%" : deliverableJson.deliverableStatusUpdate + "%";
- let platformString = '';
- deliverableJson.platforms?.forEach((platform) => {
- platformString = platformString + platform + ', ';
- })
- platformString = platformString.slice(0, -2);
dataRow.innerHTML = `
${deliverableJson.deliverableName}
${typeLabel}
-
${platformString}
+
@@ -544,9 +537,24 @@ async function buildTableRow(deliverableJson, kpi, createHidden) {
finalAssetLink.textContent = "Final Asset";
dataRow.querySelector('.column5').appendChild(finalAssetLink);
}
+ createPlatformString(deliverableJson.platforms, dataRow);
return dataRow;
}
+async function createPlatformString(platforms, htmlElem) {
+ let platformString = '';
+ if (platforms && platforms.length > 0) {
+ for (const rawPlatform of platforms) {
+ const platform = await lookupType(rawPlatform, 'platform');
+ platformString += platform + ', ';
+ }
+ platformString = platformString.slice(0, -2);
+ } else {
+ platformString = 'Not Available'
+ }
+ htmlElem.querySelector('.column3.platforms').textContent = platformString;
+}
+
function sortRows(rows) {
const rowParent = rows;
const nodes = Array.from(rowParent.childNodes);
diff --git a/scripts/shared-mappings.js b/scripts/shared-mappings.js
index a44c6816..1adeb011 100644
--- a/scripts/shared-mappings.js
+++ b/scripts/shared-mappings.js
@@ -14,46 +14,6 @@ export function filterArray(array, key, value) {
const arrayMatch = array.filter(match => match[key] === value);
return arrayMatch.length > 0 ? arrayMatch : null;
}
-/*
-async function buildProduct(product) {
- const configPath = getBaseConfigPath();
- const defaultIcon = configPath + '/logo/products/default-app-icon.svg';
- const iconMapping = await getProductIconMapping();
- const iconMatch = filterArray(iconMapping, 'Product-offering', product);
- const icon = iconMatch ? configPath + iconMatch[0]['Icon-path'] : defaultIcon;
-
- const nameMapping = await resolveMappings("getProductList");
- const nameMatch = filterArray(nameMapping, 'value', product);
- const productName = nameMatch ? nameMatch[0].text : product;
-
- const productEl = document.createElement('div');
- productEl.classList.add('product-entry');
- productEl.innerHTML = `
-
-
${productName}
- `;
-
- return productEl;
-}
-async function buildProductList(program) {
- const configPath = getBaseConfigPath();
- const defaultIcon = configPath + '/logo/products/default-app-icon.svg';
- const iconMapping = await getProductIconMapping();
- const iconMatch = filterArray(iconMapping, 'Product-offering', product);
- const icon = iconMatch ? configPath + iconMatch[0]['Icon-path'] : defaultIcon;
-
- const productsMatch = filterArray(await resolveMappings("getProductList"), 'value', product);
- const productsText = productsMatch ? productsMatch[0].text : product;
-
- const productList = document.createElement('div');
- productList.classList.add('product', 'card-content');
- productList.innerHTML = `
-
- ${productsText}
- `
- document.querySelector('.card.products').appendChild(productList);
-}
-*/
export async function getProductMapping(product) {
const configPath = getBaseConfigPath();