Badge indicator showing whether an opportunity has an associated Workload Workbench Action

This commit is contained in:
2026-09-24 17:00:32 -03:00
parent f9595b94e0
commit f74071e39e
30 changed files with 1625 additions and 68 deletions

View File

@@ -0,0 +1,29 @@
function createSpaWorkloadActions({ fetchJson }) {
async function requestWlActions(message) {
const debugRequests = [];
try {
const revnId = String(message.revnId ?? "").trim();
const token = message.authorization?.value;
if (!/^\d+$/.test(revnId)) throw new Error("A numeric RevnId is required.");
if (typeof token !== "string" || !token.trim()) throw new Error("WWB-TS uiaasHeader.value is unavailable.");
const url = `https://spa.oracle.com/oalcrm/web/api/provider-proxy/wwb-provider/service/workbench-proxy/wwb/mgmt/actions?parentType=WORKLOAD&parentId=${encodeURIComponent(revnId)}`;
const result = await fetchJson(url, {
method: "GET", credentials: "include",
headers: { Accept: "application/json", "Wwb-Provider-Authorization": token.trim() }
}, "requestWlActions", debugRequests);
if (!result || !Array.isArray(result.actions) || typeof result.hasNext !== "boolean"
|| result.actions.some(item => !item || typeof item !== "object" || Array.isArray(item))) {
throw new Error("requestWlActions returned an invalid collection.");
}
return { ok: true, actions: result.actions, hasNext: result.hasNext, debugRequests };
} catch (error) {
error.debugRequests = debugRequests;
throw error;
} finally {
for (const entry of debugRequests) {
if (entry.requestHeaders?.["Wwb-Provider-Authorization"]) entry.requestHeaders["Wwb-Provider-Authorization"] = "(present)";
}
}
}
return { requestWlActions };
}