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 & Monitor';
     const FN_SEARCH  = 'Search and Monitor';
     const FN_POST    = 'Post & Schedule';
     const FN_POST    = 'Post and Schedule';
     const FN_ANALYSIS = 'Analysis';
     const FN_ANALYSIS = 'Analysis';
     const FN_METRICS  = 'Metrics';
     const FN_METRICS  = 'Metrics';
Line 180: Line 180:
         /** @type Map<string, { [DESC_KEY]: string, [FUNC_KEY]: string[] } */
         /** @type Map<string, { [DESC_KEY]: string, [FUNC_KEY]: string[] } */
         const functionsData = new Map();
         const functionsData = new Map();
        const hasFunction = (dctResult, subfunctions) => subfunctions.some(func => {
            const printoutResult = dctResult.printouts[func];
            return printoutResult && printoutResult[0] && printoutResult[0].fulltext.toLowerCase() === 'yes'
        });


         const functionsQuery = '[[Category:Function_category]]' +
         const functionsQuery = '[[Category:Function_category]]' +
Line 196: Line 191:
             const functionCategory = functionsQueryResults[key];
             const functionCategory = functionsQueryResults[key];
             functionsData.set(
             functionsData.set(
                // Key: Name of the Function Category.
                 removePrefix(functionCategory.fulltext),
                 removePrefix(functionCategory.fulltext),
                // Value: Description and subfunctions.
                 {
                 {
                     [DESC_KEY]: functionCategory.printouts[DESC_KEY][0],
                     [DESC_KEY]: functionCategory.printouts[DESC_KEY][0],
Line 216: Line 209:


         const dctResponse = await fetch(getQueryUrl(dctQuery)).then(response => response.json());
         const dctResponse = await fetch(getQueryUrl(dctQuery)).then(response => response.json());
        console.log(dctResponse.query.results)
         const dctList = Object.keys(dctResponse.query.results).map(dctKey => {
         const dctList = Object.keys(dctResponse.query.results).map(dctKey => {
             const dctResult = dctResponse.query.results[dctKey];
             const dctResult = dctResponse.query.results[dctKey];
Line 235: Line 227:
                 }
                 }
             });
             });
            // if (hasFunction(dctResult, searchFunctions)) dct.functions.push(FN_SEARCH);
            // if (hasFunction(dctResult, postFunctions)) dct.functions.push(FN_POST);
            // if (hasFunction(dctResult, analysisFunctions)) dct.functions.push(FN_ANALYSIS);
            // if (hasFunction(dctResult, metricsFunctions)) dct.functions.push(FN_METRICS);
            // if (hasFunction(dctResult, reportFunctions)) dct.functions.push(FN_REPORT);
            // if (hasFunction(dctResult, collaborationFunctions)) dct.functions.push(FN_COLLAB);
            // if (hasFunction(dctResult, interoperabilityFunctions)) dct.functions.push(FN_INTEROP);
            // if (hasFunction(dctResult, metaFunctions)) dct.functions.push(FN_META);


             return dct;
             return dct;

Revision as of 15:11, 30 August 2022

Development verstion of the DCT List.
Not ready for production!