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


             const dctResponse = await fetch(getQueryUrl(dctQuery)).then(response => response.json());
             const dctResponse = await fetch(getQueryUrl(dctQuery)).then(response => response.json());
            console.dir(dctResponse)


             const dctList = Object.keys(dctResponse.query.results).map(dctName => {
             const dctList = Object.keys(dctResponse.query.results).map(dctName => {
Line 455: Line 453:
                 ? filterState.hasUC === dct.hasUC
                 ? filterState.hasUC === dct.hasUC
                 : true;
                 : true;
            const archivedCheck = filterState.showArchived
                ? true
                : dct.archived !== 'yes';


             return sourcesCheck && functionsCheck && businessModelCheck && dmUseCheck && ucCheck;
             return sourcesCheck && functionsCheck && businessModelCheck && dmUseCheck && ucCheck && archivedCheck;
         }
         }


Line 468: Line 469:
             }
             }


            /** @type {Partial<Omit<DCT, 'usedByDmo'> & { usedByDmo: string[]>}} */
             const filterState = {};
             const filterState = {};


Line 475: Line 475:
                 const funcOpts = new Map();
                 const funcOpts = new Map();
                 functionFilterBlocks.forEach(block => {
                 functionFilterBlocks.forEach(block => {
                    // This is still valid, since function blocks still have whole-category checkboxes.
                    // They have simply been hidden.
                     const cat = block.querySelector('input.func-cat');
                     const cat = block.querySelector('input.func-cat');
                     if (cat.checked) {
                     if (cat.checked) {
Line 499: Line 497:
             if (document.getElementById('used-by-practitioners').checked) filterState.usedByDmo = 'yes';
             if (document.getElementById('used-by-practitioners').checked) filterState.usedByDmo = 'yes';
             if (document.getElementById('has-use-case').checked) filterState.hasUC = 'yes';
             if (document.getElementById('has-use-case').checked) filterState.hasUC = 'yes';
            if (document.getElementById('show-archived').checked) filterState.showArchived = 'yes';


             table.setFilter(dctFilter, filterState);
             table.setFilter(dctFilter, filterState);
Line 995: Line 994:
                         <input type="checkbox" id="has-use-case" value="yes">
                         <input type="checkbox" id="has-use-case" value="yes">
                         <label for="has-use-case">Use case available</label>
                         <label for="has-use-case">Use case available</label>
                    </div>
                    <div>
                        <input type="checkbox" id="show-archived" value="yes">
                        <label for="show-archived">Show archived</label>
                     </div>
                     </div>
                 </div>
                 </div>

Revision as of 10:58, 3 August 2023

DCT list widget.
Currently in use – do not modify!