Wanted Monitor/Unmonitor Selected button fixed (#528)
* the button was not changing based on the filter selection
nor was it properly carrying out its function.
It should now work.
this code was ported from Sonarr:
979fc436ab
* indents/spaces/formtting
pull/529/head
parent
f8ce2334c6
commit
875e1aedcb
@ -1,5 +1,11 @@
|
||||
export default function getFilterValue(filters, filterKey) {
|
||||
export default function getFilterValue(filters, filterKey, filterValueKey, defaultValue) {
|
||||
const filter = filters.find((f) => f.key === filterKey);
|
||||
|
||||
return filter && filter.value;
|
||||
if (!filter) {
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
const filterValue = filter.filters.find((f) => f.key === filterValueKey);
|
||||
|
||||
return filterValue ? filterValue.value : defaultValue;
|
||||
}
|
||||
|
@ -1,17 +1,27 @@
|
||||
let currentPopulator = null;
|
||||
let currentReasons = [];
|
||||
|
||||
export function registerPagePopulator(populator) {
|
||||
export function registerPagePopulator(populator, reasons = []) {
|
||||
currentPopulator = populator;
|
||||
currentReasons = reasons;
|
||||
}
|
||||
|
||||
export function unregisterPagePopulator(populator) {
|
||||
if (currentPopulator === populator) {
|
||||
currentPopulator = null;
|
||||
currentReasons = [];
|
||||
}
|
||||
}
|
||||
|
||||
export function repopulatePage() {
|
||||
if (currentPopulator) {
|
||||
export function repopulatePage(reason) {
|
||||
if (!currentPopulator) {
|
||||
return;
|
||||
}
|
||||
if (!reason) {
|
||||
currentPopulator();
|
||||
}
|
||||
|
||||
if (reason && currentReasons.includes(reason)) {
|
||||
currentPopulator();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in new issue