feat: allow deleting via the ui.
This commit is contained in:
parent
7a590ade7e
commit
5944686d1d
4 changed files with 43 additions and 0 deletions
|
@ -37,6 +37,9 @@
|
|||
<button is="emby-button" type="submit" class="raised button-submit block emby-button">
|
||||
<span>Save</span>
|
||||
</button>
|
||||
<button is="emby-button" type="reset" class="raised button-reset block emby-button">
|
||||
<span>Delete</span>
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
|
|
@ -73,6 +73,15 @@ ApiClient.setSmartCollection = function (c) {
|
|||
data: JSON.stringify(c),
|
||||
});
|
||||
}
|
||||
|
||||
ApiClient.deleteSmartCollection = function (id) {
|
||||
const url = ApiClient.getUrl(`SmartCollection/${id}`)
|
||||
return this.ajax({
|
||||
type: 'DELETE',
|
||||
url: url,
|
||||
});
|
||||
}
|
||||
|
||||
function initial_load(selectedId) {
|
||||
Dashboard.showLoadingMsg();
|
||||
ApiClient.getSmartCollections().then(function (collections) {
|
||||
|
@ -112,4 +121,14 @@ export default function (view, params) {
|
|||
});
|
||||
e.preventDefault();
|
||||
});
|
||||
document.querySelector('#SmartCollectionConfigForm')
|
||||
.addEventListener('reset', function (e) {
|
||||
Dashboard.showLoadingMsg();
|
||||
const selection = document.querySelector('#SmartcollectionSelection');
|
||||
const selectedId = COLLECTIONS[selection.selectedIndex].Id;
|
||||
ApiClient.deleteSmartCollection(selectedId).then(function () {
|
||||
initial_load(null);
|
||||
});
|
||||
e.preventDefault();
|
||||
});
|
||||
}
|
||||
|
|
|
@ -43,6 +43,9 @@
|
|||
<button is="emby-button" type="submit" class="raised button-submit block emby-button">
|
||||
<span>Save</span>
|
||||
</button>
|
||||
<button is="emby-button" type="reset" class="raised button-reset block emby-button">
|
||||
<span>Delete</span>
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
|
|
@ -97,6 +97,14 @@ ApiClient.setSmartPlaylist = function (p) {
|
|||
});
|
||||
}
|
||||
|
||||
ApiClient.deleteSmartPlaylist = function (id) {
|
||||
const url = ApiClient.getUrl(`SmartPlaylist/${id}`)
|
||||
return this.ajax({
|
||||
type: 'DELETE',
|
||||
url: url,
|
||||
});
|
||||
}
|
||||
|
||||
function initial_load(selectedId) {
|
||||
Dashboard.showLoadingMsg();
|
||||
ApiClient.getSmartPlaylists().then(function (playlists) {
|
||||
|
@ -139,4 +147,14 @@ export default function (view, params) {
|
|||
});
|
||||
e.preventDefault();
|
||||
});
|
||||
document.querySelector('#SmartPlaylistConfigForm')
|
||||
.addEventListener('reset', function (e) {
|
||||
Dashboard.showLoadingMsg();
|
||||
const selection = document.querySelector('#SmartplaylistSelection');
|
||||
const selectedId = PLAYLISTS[selection.selectedIndex].Id;
|
||||
ApiClient.deleteSmartPlaylist(selectedId).then(function () {
|
||||
initial_load(null);
|
||||
});
|
||||
e.preventDefault();
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue