-
Notifications
You must be signed in to change notification settings - Fork 127
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into feature/new-dashboard-load-ui
- Loading branch information
Showing
14 changed files
with
166 additions
and
35 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
export const hasCheckboxes = (actionsRules) => { | ||
let rules = actionsRules.filter((rule) => rule.condition && rule.condition == 'rowCheck'); | ||
return rules.length > 0; | ||
}; | ||
|
||
export const getCheckboxes = (actionsRules, rows, getGlobalParameter) => { | ||
let rules = actionsRules.filter((rule) => rule.condition && rule.condition == 'rowCheck'); | ||
const params = rules.map((rule) => `neodash_${rule.customizationValue}`); | ||
// See if any of the rows should be checked. This is the case when a parameter is already in the list of checked values. | ||
let selection: number[] = []; | ||
params.forEach((parameter, index) => { | ||
const fieldName = rules[index].value; | ||
const values = getGlobalParameter(parameter); | ||
|
||
// If the parameter is an array (to be expected), iterate over it to find the rows to check. | ||
if (Array.isArray(values)) { | ||
values.forEach((value) => { | ||
rows.forEach((row, index) => { | ||
if (row[fieldName] == value) { | ||
selection.push(index); | ||
} | ||
}); | ||
}); | ||
} else { | ||
// Else (special case), still check the row if it's a single value parameter. | ||
rows.forEach((row, index) => { | ||
if (row[fieldName] == values) { | ||
selection.push(index); | ||
} | ||
}); | ||
} | ||
}); | ||
return [...new Set(selection)]; | ||
}; | ||
|
||
export const updateCheckBoxes = (actionsRules, rows, selection, setGlobalParameter) => { | ||
if (hasCheckboxes(actionsRules)) { | ||
const selectedRows = rows.filter((_, i) => selection.includes(i)); | ||
let rules = actionsRules.filter((rule) => rule.condition && rule.condition == 'rowCheck'); | ||
rules.forEach((rule) => { | ||
const parameterValues = selectedRows.map((row) => row[rule.value]).filter((v) => v !== undefined); | ||
setGlobalParameter(`neodash_${rule.customizationValue}`, parameterValues); | ||
setGlobalParameter(`neodash_${rule.customizationValue}_display`, parameterValues); | ||
}); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters