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:
Roland 2025-12-06 18:07:20 -07:00
parent c1e318cafc
commit c6df730dcc
No known key found for this signature in database
GPG key ID: 1BA620CE6C9A4680
10 changed files with 1023 additions and 1 deletions

View file

@ -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;
}