mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-12-02 12:56:24 -05:00
Adding bulk tag button to the file browser. User can add tags to many files, but can only remove tags if all files share the tags to be removed.
This commit is contained in:
parent
c1e318cafc
commit
c6df730dcc
10 changed files with 1023 additions and 1 deletions
|
|
@ -1684,3 +1684,37 @@ export async function triggerUpgrade() {
|
|||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
export async function getBulkTagPreview(paths) {
|
||||
const body = {paths};
|
||||
const response = await apiPost(`${API_URI}/files/bulk_tag/preview`, body);
|
||||
if (response.ok) {
|
||||
return await response.json();
|
||||
} else {
|
||||
const message = await getErrorMessage(response, 'Failed to get bulk tag preview.');
|
||||
toast({type: 'error', title: 'Bulk Tag Error', description: message, time: 5000});
|
||||
}
|
||||
}
|
||||
|
||||
export async function applyBulkTags(paths, addTagNames, removeTagNames) {
|
||||
const body = {
|
||||
paths,
|
||||
add_tag_names: addTagNames || [],
|
||||
remove_tag_names: removeTagNames || [],
|
||||
};
|
||||
const response = await apiPost(`${API_URI}/files/bulk_tag/apply`, body);
|
||||
if (!response.ok) {
|
||||
const message = await getErrorMessage(response, 'Failed to apply bulk tags.');
|
||||
toast({type: 'error', title: 'Bulk Tag Error', description: message, time: 5000});
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
export async function getBulkTagProgress() {
|
||||
const response = await apiGet(`${API_URI}/files/bulk_tag/progress`);
|
||||
if (response.ok) {
|
||||
return await response.json();
|
||||
}
|
||||
// Not toasting because this happens often during polling.
|
||||
return null;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue