Remove playlist items with their group
Publish Docker Image / build-and-push-existing-registry (./build/Dockerfile, web, pulse-signage-web) (push) Successful in 1m11s
Publish Docker Image / build-and-push-existing-registry (./build/Dockerfile.player, player, pulse-signage-player) (push) Successful in 30s

This commit is contained in:
lzstealth committed 2026-10-15 02:23:26 +01:00
1 parent 40f0892262
commit 64aeb1b47e
3 files changed
+30 -16

No files matched your search

+1
View File
@@ -10,6 +10,7 @@ All notable changes to this project will be documented in this file.
### Changed
- Removing a playlist group now removes all of its member slides.
- Replaced the canvas-size duplicate action with reversible disable/enable controls. Disabled sizes remain assigned to existing templates and playlists but cannot be selected for new ones.
## 2.15.2 - 2026-10-15
@@ -2895,22 +2895,7 @@
}
var groupKey = String(header.getAttribute('data-group-key') || '');
getGroupRows(groupKey).forEach(function (row) {
var keyField = row.querySelector('[data-playlist-group-key]');
var nameField = row.querySelector('[data-playlist-group-name-value]');
var pickField = row.querySelector('[data-playlist-group-pick-count-value]');
var rulesField = row.querySelector('[data-playlist-group-schedule-rules]');
if (keyField) keyField.value = '';
if (nameField) nameField.value = '';
if (pickField) pickField.value = '1';
var shuffleField = row.querySelector('[data-playlist-group-shuffle-value]');
if (shuffleField) shuffleField.value = '0';
var modeField = row.querySelector('[data-playlist-group-mode-value]');
var repeatField = row.querySelector('[data-playlist-group-repeat-count-value]');
if (modeField) modeField.value = 'select';
if (repeatField) repeatField.value = '1';
if (rulesField) rulesField.value = '[]';
row.setAttribute('data-group-key', '');
row.classList.remove('playlist-group-child');
row.remove();
});
header.remove();
updateRowOrder(true);
+28
View File
@@ -105,6 +105,34 @@ test('playlist group colours differ, survive reorder, and clear on ungrouped sli
assert.equal(firstMember.style['--playlist-group-bg'], undefined);
});
test('removing a playlist group removes all of its member rows', () => {
const source = fs.readFileSync(path.join(__dirname, '..', 'src', 'web', 'public', 'js', 'playlists', 'playlist-schedule.js'), 'utf8');
const functionSource = source.match(/function removePlaylistGroup\(header\) \{[\s\S]*?\n \}/)[0];
const removedRows = [];
let removedHeader = false;
let refreshedOrder = false;
const rows = [0, 1, 2].map((index) => ({ remove() { removedRows.push(index); } }));
const header = {
getAttribute(name) { return name === 'data-group-key' ? 'group-1' : null; },
remove() { removedHeader = true; }
};
const removeGroup = require('node:vm').runInNewContext('(' + functionSource + ')', {
getGroupRows(groupKey) {
assert.equal(groupKey, 'group-1');
return rows;
},
updateRowOrder(refresh) {
refreshedOrder = refresh;
}
});
removeGroup(header);
assert.deepEqual(removedRows, [0, 1, 2]);
assert.equal(removedHeader, true);
assert.equal(refreshedOrder, true);
});
test('empty playlist groups keep a drop area until a member is added', () => {
const source = fs.readFileSync(path.join(__dirname, '..', 'src', 'web', 'public', 'js', 'playlists', 'playlist-schedule.js'), 'utf8');
const functionSource = source.match(/function updatePlaylistGroupEmptyRows\(\) \{[\s\S]*?\n \}/)[0];