ui: traffic-control edit: simpler unique timeframe logic

still just a heuristic, i.e., it does the same as previously but in
one line..

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2021-11-22 10:25:38 +01:00
parent c450a3cafd
commit 77d8c593b3

View File

@ -204,14 +204,7 @@ Ext.define('PBS.window.TrafficControlEdit', {
delete values.timeframe;
}
if (values.timeframe && !Ext.isArray(values.timeframe)) {
let timeframe = [], seen = {};
values.timeframe.split(';').forEach(tf => {
if (!seen[tf]) {
timeframe.push(tf);
seen[tf] = true;
}
});
values.timeframe = timeframe;
values.timeframe = [...new Set(values.timeframe.split(';'))];
}
if (!isCreate) {