Difference between revisions of "Widget:DCTList"

From LINKS Community Center
Jump to: navigation, search
m (Protected "Widget:DCTList" ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite)))
Line 1: Line 1:
<noinclude>Widget to display a filtered list of available Disaster Community Technologies (DCTs).<br><span style="color: red; font-weight: bold;">Do not modify!</span></noinclude>
+
<noinclude>Development verstion of the DCT List.<br><span style="color: red; font-weight: bold;">Not ready for production!</span></noinclude>
 
<includeonly>
 
<includeonly>
 
     <link href="/resources/assets/tabulator.min.css" rel="stylesheet">
 
     <link href="/resources/assets/tabulator.min.css" rel="stylesheet">
Line 167: Line 167:
 
         const functionsData = new Map();
 
         const functionsData = new Map();
  
         const functionsQuery = '[[Category:Function_category]]' +
+
         const functionsQuery = '[[Category:Function_category]]'
                              '|?-Subproperty_of=' + FUNC_KEY +
+
                            + '|?-Subproperty_of=' + FUNC_KEY
                              '|?Has_description=' + DESC_KEY;
+
                            + '|?Has_description=' + DESC_KEY;
 
         const functionsQueryResponse = await fetch(getQueryUrl(functionsQuery)).then(response => response.json());
 
         const functionsQueryResponse = await fetch(getQueryUrl(functionsQuery)).then(response => response.json());
 
          
 
          
Line 188: Line 188:
 
         const DATASRC_PROP = 'Data Sources';
 
         const DATASRC_PROP = 'Data Sources';
 
         const IMG_PROP = 'Image';
 
         const IMG_PROP = 'Image';
         const dctQuery = '[[Category:Disaster Community Technology]]' +
+
         const dctQuery = '[[Category:Disaster Community Technology]]'
                        '[[Is Archived::No]]' +
+
                      + '[[Is Archived::No]]'
                        '|limit=500' +
+
                      + '|limit=500'
                        '|?' + IMG_PROP +
+
                      + '|?' + IMG_PROP
                        '|?' + DATASRC_PROP +
+
                      + '|?' + DATASRC_PROP
                        '|?' + allFunctions.join('|?');
+
                      + '|?' + allFunctions.join('|?');
  
 
         const dctResponse = await fetch(getQueryUrl(dctQuery)).then(response => response.json());
 
         const dctResponse = await fetch(getQueryUrl(dctQuery)).then(response => response.json());
Line 218: Line 218:
 
         });
 
         });
  
         return dctList;
+
         return [dctList, functionsData];
 
     }
 
     }
  
Line 267: Line 267:
 
     Promise.all([getSources(), getDcts()]).then(data => {
 
     Promise.all([getSources(), getDcts()]).then(data => {
 
         const dataSources = data[0];
 
         const dataSources = data[0];
         const dcts = data[1];
+
         const [dcts, functions] = data[1];
 +
 
 +
        console.log(functions)
  
 
         // The keys of this object must match function category names EXACTLY.
 
         // The keys of this object must match function category names EXACTLY.

Revision as of 16:15, 1 September 2022

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