Widget: DCTList: Difference between revisions
From LINKS Community Center
Eschmidt (talk | contribs) No edit summary |
Eschmidt (talk | contribs) No edit summary |
||
Line 226: | Line 226: | ||
const dcts = data[1]; | const dcts = data[1]; | ||
dataSources.unshift(dataSources.splice(dataSources.findIndex(src => src.name === 'Web'), 1)[0]); | // dataSources.unshift(dataSources.splice(dataSources.findIndex(src => src.name === 'Web'), 1)[0]); | ||
dataSources.unshift(dataSources.splice(dataSources.findIndex(src => src.name === 'Crowd'), 1)[0]); | // dataSources.unshift(dataSources.splice(dataSources.findIndex(src => src.name === 'Crowd'), 1)[0]); | ||
// Set up filters. | // Set up filters. | ||
const groupedSources = []; | const groupedSources = []; | ||
const sourcesCopy = Array.from(dataSources); | |||
for (const layoutGroup of sourcesLayout) { | for (const layoutGroup of sourcesLayout) { | ||
const group = []; | const group = []; | ||
for (const source of layoutGroup) { | for (const source of layoutGroup) { | ||
let idx = | let idx = sourcesCopy.findIndex(src => src.name === source); | ||
if (idx !== -1) { | if (idx !== -1) { | ||
group.push( | group.push(sourcesCopy.splice(idx, 1)[0]); | ||
} | } | ||
} | } | ||
if (group.length > 0) groupedSources.push(group); | if (group.length > 0) groupedSources.push(group); | ||
} | } | ||
groupedSources.push( | groupedSources.push(sourcesCopy); | ||
Revision as of 14:52, 13 June 2022
Development verstion of the DCT List.
Not ready for production!