mirror of
https://github.com/napnap75/multiarch-docker-images.git
synced 2026-11-12 00:52:11 +01:00
Add configurable document columns and allow bulk metadata editing (#14)
This commit is contained in:
@@ -28,6 +28,7 @@ saveButton.disabled = true;
|
||||
let currentFileId = null;
|
||||
let fieldSuggestionState = { names: [], values: {} };
|
||||
let initialDocumentState = null;
|
||||
let isSaving = false;
|
||||
|
||||
const canonicalizeState = (value) => {
|
||||
if (value === null || value === undefined) return '';
|
||||
@@ -53,13 +54,7 @@ const getCurrentDocumentState = () => ({
|
||||
});
|
||||
|
||||
const updateSaveButtonState = () => {
|
||||
if (!currentFileId || !initialDocumentState) {
|
||||
saveButton.disabled = true;
|
||||
return;
|
||||
}
|
||||
const currentState = canonicalizeState(getCurrentDocumentState());
|
||||
const baselineState = canonicalizeState(initialDocumentState);
|
||||
saveButton.disabled = JSON.stringify(currentState) === JSON.stringify(baselineState);
|
||||
saveButton.disabled = !currentFileId || !initialDocumentState || isSaving;
|
||||
};
|
||||
|
||||
const openNeighbor = (neighborId) => {
|
||||
@@ -576,7 +571,8 @@ const saveDocument = async (event) => {
|
||||
emissionDateInput.setCustomValidity(emissionDate ? '' : 'Enter a valid date in dd/mm/yyyy format.');
|
||||
if (!editForm.reportValidity()) return;
|
||||
|
||||
saveButton.disabled = true;
|
||||
isSaving = true;
|
||||
updateSaveButtonState();
|
||||
editStatus.textContent = 'Recalculating document name and saving...';
|
||||
const payload = {
|
||||
template_name: templateSelect.value,
|
||||
@@ -603,7 +599,8 @@ const saveDocument = async (event) => {
|
||||
editStatus.textContent = `Unable to save changes: ${error.message}`;
|
||||
console.error(error);
|
||||
} finally {
|
||||
saveButton.disabled = false;
|
||||
isSaving = false;
|
||||
updateSaveButtonState();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user