Widget: DCTList: Difference between revisions
From LINKS Community Center
Eschmidt (talk | contribs) No edit summary |
Eschmidt (talk | contribs) No edit summary |
||
Line 124: | Line 124: | ||
let table; | let table; | ||
// This defines how sources are grouped in the filter. | |||
// Any source not listed here will be added to the last group entitled "More platforms". | |||
const sourcesLayout = [ | const sourcesLayout = [ | ||
{ | { | ||
Line 154: | Line 137: | ||
]; | ]; | ||
// Helpers | |||
const escapeAttr = text => text ? text.replace(/\s/g, '-') : text; | const escapeAttr = text => text ? text.replace(/\s/g, '-') : text; | ||
const getFilePath = title => title ? '/index.php/Special:FilePath/' + title : title; | const getFilePath = title => title ? '/index.php/Special:FilePath/' + title : title; | ||
Line 159: | Line 143: | ||
const removePrefix = str => str.substring(str.indexOf(':') + 1); | const removePrefix = str => str.substring(str.indexOf(':') + 1); | ||
// Fetches platform / data source information. | |||
async function getSources() { | async function getSources() { | ||
const sourceResponse = await fetch( | const sourceResponse = await fetch( | ||
Line 174: | Line 159: | ||
} | } | ||
// Fetches DCTs and their functions. | |||
async function getDcts() { | async function getDcts() { | ||
const FUNC_KEY = 'functions'; | const FUNC_KEY = 'functions'; | ||
Line 281: | Line 267: | ||
const dataSources = data[0]; | const dataSources = data[0]; | ||
const dcts = data[1]; | const dcts = data[1]; | ||
// The keys of this object must match function category names EXACTLY. | |||
const fnImages = { | |||
'Search and Monitor': '/index.php/Special:FilePath/File:Func_search.svg', | |||
'Post and Schedule': '/index.php/Special:FilePath/File:Func_post.svg', | |||
'Analysis': '/index.php/Special:FilePath/File:Func_analysis.svg', | |||
'Metrics': '/index.php/Special:FilePath/File:Func_metrics.svg', | |||
'Report': '/index.php/Special:FilePath/File:Func_report.svg', | |||
'Collaboration': '/index.php/Special:FilePath/File:Func_collaboration.svg', | |||
'Interoperability': '/index.php/Special:FilePath/File:Func_interoperability.svg', | |||
'Meta': '/index.php/Special:FilePath/File:Func_meta.svg', | |||
}; | |||
// Set up filters. | // Set up filters. |
Revision as of 15:37, 30 August 2022
Development verstion of the DCT List.
Not ready for production!