Widget: DCTList: Difference between revisions

From LINKS Community Center
Jump to: navigation, search
Eschmidt (talk | contribs)
No edit summary
Eschmidt (talk | contribs)
No edit summary
Line 124: Line 124:
     let table;
     let table;


     const FN_SEARCH  = 'Search and Monitor';
     // This defines how sources are grouped in the filter.
    const FN_POST    = 'Post and Schedule';
     // Any source not listed here will be added to the last group entitled "More platforms".
    const FN_ANALYSIS = 'Analysis';
    const FN_METRICS  = 'Metrics';
    const FN_REPORT  = 'Report';
    const FN_COLLAB  = 'Collaboration';
    const FN_INTEROP  = 'Interoperability';
    const FN_META    = 'Meta';
 
    const fnImages = {};
    fnImages[FN_SEARCH]  = '/index.php/Special:FilePath/File:Func_search.svg';
    fnImages[FN_POST]    = '/index.php/Special:FilePath/File:Func_post.svg';
    fnImages[FN_ANALYSIS] = '/index.php/Special:FilePath/File:Func_analysis.svg';
    fnImages[FN_METRICS]  = '/index.php/Special:FilePath/File:Func_metrics.svg';
     fnImages[FN_REPORT]  = '/index.php/Special:FilePath/File:Func_report.svg';
    fnImages[FN_COLLAB]  = '/index.php/Special:FilePath/File:Func_collaboration.svg';
    fnImages[FN_INTEROP]  = '/index.php/Special:FilePath/File:Func_interoperability.svg';
    fnImages[FN_META]    = '/index.php/Special:FilePath/File:Func_meta.svg';
 
     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!