mirror of
https://github.com/arcan1s/ahriman.git
synced 2026-04-13 05:13:38 +00:00
Compare commits
5 Commits
dec025b45a
...
c924699163
| Author | SHA1 | Date | |
|---|---|---|---|
| c924699163 | |||
| d7cee68cb7 | |||
| d6865dc363 | |||
| 1e3850464c | |||
| 59205b990c |
@@ -87,7 +87,7 @@
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
updateTable(table, payload, row => row.timestamp);
|
updateTable(table, payload);
|
||||||
table.bootstrapTable("hideLoading");
|
table.bootstrapTable("hideLoading");
|
||||||
},
|
},
|
||||||
onFailure,
|
onFailure,
|
||||||
|
|||||||
@@ -195,16 +195,16 @@
|
|||||||
return intervalId;
|
return intervalId;
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateTable(table, rows, rowChangedKey) {
|
function updateTable(table, rows) {
|
||||||
// instead of using load method here, we just update rows manually to avoid table reinitialization
|
// instead of using load method here, we just update rows manually to avoid table reinitialization
|
||||||
const currentData = table.bootstrapTable("getData").reduce((accumulator, row) => {
|
const currentData = table.bootstrapTable("getData").reduce((accumulator, row) => {
|
||||||
accumulator[row.id] = {state: row["0"], key: rowChangedKey(row)};
|
accumulator[row.id] = {state: row["0"], status: row.status};
|
||||||
return accumulator;
|
return accumulator;
|
||||||
}, {});
|
}, {});
|
||||||
// insert or update rows, skipping ones whose status hasn't changed
|
// insert or update rows, skipping ones whose status hasn't changed
|
||||||
rows.forEach(row => {
|
rows.forEach(row => {
|
||||||
if (Object.hasOwn(currentData, row.id)) {
|
if (Object.hasOwn(currentData, row.id)) {
|
||||||
if (rowChangedKey(row) === currentData[row.id].key) {
|
if (row.status === currentData[row.id].status) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
row["0"] = currentData[row.id].state; // copy checkbox state
|
row["0"] = currentData[row.id].state; // copy checkbox state
|
||||||
|
|||||||
Reference in New Issue
Block a user