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 5: Line 5:


     <script>
     <script>
    'use strict';
     /**
     /**
     * @param {string[]} imageTitles - Array of image titles, e.g, ['File:Image1.png', 'File:Image2.png']
     * @param {string[]} imageTitles - Array of image titles, e.g, ['File:Image1.png', 'File:Image2.png']
Line 47: Line 49:
             const dct = {};
             const dct = {};
             dct.name = dctKey;
             dct.name = dctKey;
            /** @type {string} */
             dct.url = dctResponse.query.results[dctKey].fullurl;
             dct.url = dctResponse.query.results[dctKey].fullurl;
            /** @type {string[]} */
             dct.dataSources = dctResponse.query.results[dctKey].printouts['Data Sources'].map(src => src.fulltext);
             dct.dataSources = dctResponse.query.results[dctKey].printouts['Data Sources'].map(src => src.fulltext);
            /** @type {string} */
             dct.logo = dctResponse.query.results[dctKey].printouts['Image'][0] ? dctResponse.query.results[dctKey].printouts['Image'][0].fulltext : void 0;
             dct.logo = dctResponse.query.results[dctKey].printouts['Image'][0] ? dctResponse.query.results[dctKey].printouts['Image'][0].fulltext : void 0;
             return dct;
             return dct;
Line 63: Line 68:
     }
     }


     // const table = new Tabulator("#dct-tabulator", {
     const table = new Tabulator("#dct-tabulator", {
    //    data: dctList,
        autoColumns: true,
    //    autoColumns: true,
     });
     // });


     Promise.all([getSources(), getDcts()]).then(data => {
     Promise.all([getSources(), getDcts()]).then(data => {
        const sources = data[0];
        const dcts = data[1];
         console.log('OUTPUT', data);
         console.log('OUTPUT', data);
        table.on("tableBuilt", () => {
            table.setData(dcts);
        });
     })
     })



Revision as of 13:17, 7 June 2022

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