filegrc 0.6.1 → 0.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/web.js +14 -30
package/package.json
CHANGED
package/src/web.js
CHANGED
|
@@ -482,7 +482,7 @@ function openCollectionReviewDialog(type) {
|
|
|
482
482
|
const dialog = document.createElement("dialog");
|
|
483
483
|
dialog.className = "commit-dialog event-dialog collection-review-dialog";
|
|
484
484
|
dialog.setAttribute("aria-labelledby", "collection-review-dialog-title");
|
|
485
|
-
dialog.innerHTML = '<form><div class="dialog-head"><div><p class="kicker">Scope confirmation</p><h2 id="collection-review-dialog-title">Confirm ' + esc(configuration.title.toLowerCase()) + '</h2></div><button type="button" class="icon-button" aria-label="Close">×</button></div><p>' + esc(configuration.description) + '</p><section class="event-dialog-steps collection-review-checks"><strong>Before confirming</strong><ul>' + configuration.reviewPoints.map((point) => '<li>' + esc(point) + '</li>').join("") + '</ul></section><div class="form-grid"><label><span>Conclusion</span><select name="decision" required>' + decisions + '</select></label><label><span>Reviewer</span><select name="reviewerId" required><option value="">Select</option>' + people.map(({ record }) => '<option value="' + esc(record.id) + '" ' + ((assessment.review?.reviewedByIds || []).includes(record.id) ? "selected" : "") + '>' + esc(record.title) + '</option>').join("") + '</select></label><label><span>Reviewed on</span><input name="reviewedOn" type="date" required value="' + esc(assessment.review?.reviewedOn || currentDate()) + '"></label><label data-authoritative-system><span>Authoritative ' + (v4 ? "Component" : "System") + '</span><select name="authoritativeSourceId"><option value="">Select</option>' + systems.map(({ record }) => '<option value="' + esc(record.id) + '" ' + ((assessment.review?.authoritativeComponentId || assessment.review?.authoritativeSystemId) === record.id ? "selected" : "") + '>' + esc(record.title) + '</option>').join("") + '</select></label><label class="full"><span>Review notes</span><textarea name="rationale" rows="3" required placeholder="Note what you confirmed and any scope decision that needs context.">' + esc(assessment.review?.rationale || "") + '</textarea></label></div><div class="workflow-preview"
|
|
485
|
+
dialog.innerHTML = '<form><div class="dialog-head"><div><p class="kicker">Scope confirmation</p><h2 id="collection-review-dialog-title">Confirm ' + esc(configuration.title.toLowerCase()) + '</h2></div><button type="button" class="icon-button" aria-label="Close">×</button></div><p>' + esc(configuration.description) + '</p><section class="event-dialog-steps collection-review-checks"><strong>Before confirming</strong><ul>' + configuration.reviewPoints.map((point) => '<li>' + esc(point) + '</li>').join("") + '</ul></section><div class="form-grid"><label><span>Conclusion</span><select name="decision" required>' + decisions + '</select></label><label><span>Reviewer</span><select name="reviewerId" required><option value="">Select</option>' + people.map(({ record }) => '<option value="' + esc(record.id) + '" ' + ((assessment.review?.reviewedByIds || []).includes(record.id) ? "selected" : "") + '>' + esc(record.title) + '</option>').join("") + '</select></label><label><span>Reviewed on</span><input name="reviewedOn" type="date" required value="' + esc(assessment.review?.reviewedOn || currentDate()) + '"></label><label data-authoritative-system><span>Authoritative ' + (v4 ? "Component" : "System") + '</span><select name="authoritativeSourceId"><option value="">Select</option>' + systems.map(({ record }) => '<option value="' + esc(record.id) + '" ' + ((assessment.review?.authoritativeComponentId || assessment.review?.authoritativeSystemId) === record.id ? "selected" : "") + '>' + esc(record.title) + '</option>').join("") + '</select></label><label class="full"><span>Review notes</span><textarea name="rationale" rows="3" required placeholder="Note what you confirmed and any scope decision that needs context.">' + esc(assessment.review?.rationale || "") + '</textarea></label></div><div class="workflow-preview"><strong>What this saves</strong><p>Confirm ' + assessment.recordCount + ' current ' + esc(pluralize("record", assessment.recordCount)) + '. If the collection or material scope changes, FileGRC will ask for another review.</p></div><div class="dialog-error" role="alert"></div><div class="dialog-actions"><span class="save-status review-save-status" role="status" aria-live="polite"></span><button type="button" class="button" data-event="cancel">Cancel</button><button type="submit" class="button primary">Confirm and save</button></div></form>';
|
|
486
486
|
document.body.append(dialog);
|
|
487
487
|
dialog.showModal();
|
|
488
488
|
const form = dialog.querySelector("form");
|
|
@@ -498,12 +498,8 @@ function openCollectionReviewDialog(type) {
|
|
|
498
498
|
dialog.querySelector(".icon-button").addEventListener("click", () => dialog.close());
|
|
499
499
|
dialog.querySelector('[data-event="cancel"]').addEventListener("click", () => dialog.close());
|
|
500
500
|
dialog.addEventListener("close", () => dialog.remove());
|
|
501
|
-
let previewedPayload = null;
|
|
502
501
|
form.addEventListener("input", () => {
|
|
503
|
-
previewedPayload = null;
|
|
504
502
|
syncDecision();
|
|
505
|
-
dialog.querySelector(".workflow-preview").innerHTML = "";
|
|
506
|
-
dialog.querySelector("[data-preview-collection-review]").textContent = "Preview confirmation";
|
|
507
503
|
});
|
|
508
504
|
form.addEventListener("submit", async (event) => {
|
|
509
505
|
event.preventDefault();
|
|
@@ -521,32 +517,20 @@ function openCollectionReviewDialog(type) {
|
|
|
521
517
|
};
|
|
522
518
|
form.querySelectorAll("button,input,select,textarea").forEach((control) => { control.disabled = true; });
|
|
523
519
|
try {
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
})
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
saveStatus.textContent = "Validating and saving…";
|
|
537
|
-
const prefetch = await repositoryPrefetch;
|
|
538
|
-
const response = await localFetch("/api/collection-review", {
|
|
539
|
-
method: "POST",
|
|
540
|
-
headers: { "content-type": "application/json", prefer: "respond-async" },
|
|
541
|
-
body: JSON.stringify({ ...previewedPayload, confirmed: true, prefetchToken: prefetch?.token })
|
|
542
|
-
});
|
|
543
|
-
if (!response.ok) throw new Error(await responseMessage(response));
|
|
544
|
-
saveStatus.textContent = "Saved locally. Refreshing page…";
|
|
545
|
-
applyMutationState(await response.json());
|
|
546
|
-
dialog.close();
|
|
547
|
-
render();
|
|
548
|
-
}
|
|
520
|
+
saveStatus.textContent = "Validating and saving…";
|
|
521
|
+
const prefetch = await repositoryPrefetch;
|
|
522
|
+
const response = await localFetch("/api/collection-review", {
|
|
523
|
+
method: "POST",
|
|
524
|
+
headers: { "content-type": "application/json", prefer: "respond-async" },
|
|
525
|
+
body: JSON.stringify({ ...payload, confirmed: true, prefetchToken: prefetch?.token })
|
|
526
|
+
});
|
|
527
|
+
if (!response.ok) throw new Error(await responseMessage(response));
|
|
528
|
+
saveStatus.textContent = "Saved locally. Refreshing page…";
|
|
529
|
+
applyMutationState(await response.json());
|
|
530
|
+
dialog.close();
|
|
531
|
+
render();
|
|
549
532
|
} catch (requestError) {
|
|
533
|
+
saveStatus.textContent = "Not saved";
|
|
550
534
|
error.textContent = requestError.message;
|
|
551
535
|
} finally {
|
|
552
536
|
form.querySelectorAll("button,input,select,textarea").forEach((control) => { control.disabled = false; });
|