Release 0.0.5
This commit is contained in:
@@ -7,8 +7,7 @@ export class StorageAuditReportApp extends foundry.applications.api.ApplicationV
|
||||
runAnalysis: StorageAuditReportApp.#onRunAnalysis,
|
||||
toggleShowAll: StorageAuditReportApp.#onToggleShowAll,
|
||||
toggleRaw: StorageAuditReportApp.#onToggleRaw,
|
||||
exportReport: StorageAuditReportApp.#onExportReport,
|
||||
openSource: StorageAuditReportApp.#onOpenSource
|
||||
exportReport: StorageAuditReportApp.#onExportReport
|
||||
},
|
||||
window: {
|
||||
title: "Kosmos Storage Audit",
|
||||
@@ -88,6 +87,13 @@ export class StorageAuditReportApp extends foundry.applications.api.ApplicationV
|
||||
|
||||
_replaceHTML(result, content) {
|
||||
content.replaceChildren(result);
|
||||
for (const link of content.querySelectorAll(".content-link[data-uuid]")) {
|
||||
link.addEventListener("click", event => {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
void openSourceUuid(link.dataset.uuid);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
async runAnalysis() {
|
||||
@@ -199,20 +205,6 @@ export class StorageAuditReportApp extends foundry.applications.api.ApplicationV
|
||||
return this.exportReport();
|
||||
}
|
||||
|
||||
static async #onOpenSource(_event, button) {
|
||||
const uuid = button?.dataset?.uuid;
|
||||
if (!uuid) return;
|
||||
const document = await fromUuid(uuid);
|
||||
if (document?.sheet) {
|
||||
document.sheet.render(true, { focus: true });
|
||||
return;
|
||||
}
|
||||
if (document?.parent?.sheet) {
|
||||
document.parent.sheet.render(true, { focus: true });
|
||||
return;
|
||||
}
|
||||
ui.notifications.warn(format("KSA.Notify.OpenSourceFailed", { uuid }));
|
||||
}
|
||||
}
|
||||
|
||||
function renderProgress(progress, loading) {
|
||||
@@ -558,5 +550,19 @@ function renderLocalizedCodeText(key, data, codeValues) {
|
||||
function renderSourceLink(source) {
|
||||
const label = source.sourceName ? `${source.sourceLabel} (${source.sourceName})` : source.sourceLabel;
|
||||
if (!source.sourceUuid) return escapeHtml(label);
|
||||
return `<a href="#" data-action="openSource" data-uuid="${escapeHtml(source.sourceUuid)}"><code>${escapeHtml(source.sourceUuid)}</code></a>${label ? ` <span>${escapeHtml(label)}</span>` : ""}`;
|
||||
return `<a class="content-link" draggable="true" data-link data-uuid="${escapeHtml(source.sourceUuid)}" data-tooltip="${escapeHtml(label)}"><i class="fa-solid fa-file-lines"></i><code>${escapeHtml(source.sourceUuid)}</code></a>${label ? ` <span>${escapeHtml(label)}</span>` : ""}`;
|
||||
}
|
||||
|
||||
async function openSourceUuid(uuid) {
|
||||
if (!uuid) return;
|
||||
const document = await fromUuid(uuid);
|
||||
if (document?.sheet) {
|
||||
document.sheet.render(true, { focus: true });
|
||||
return;
|
||||
}
|
||||
if (document?.parent?.sheet) {
|
||||
document.parent.sheet.render(true, { focus: true });
|
||||
return;
|
||||
}
|
||||
ui.notifications.warn(format("KSA.Notify.OpenSourceFailed", { uuid }));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user