Updated the calendar to improve opportunity display and navigation

This commit is contained in:
2026-10-27 03:22:10 -03:00
parent 7606643ff4
commit 1d5b28e95b
51 changed files with 1486 additions and 1237 deletions

View File

@@ -8,6 +8,7 @@ function createFusionOpportunities({
maskToken,
getOpportunityTypeValues,
readResponseBodyForDebug,
resetDebugRequests = () => {},
environment
}) {
const { fetch } = environment;
@@ -35,6 +36,8 @@ function createFusionOpportunities({
if (!isCurrentPeriodRequest(requestVersion)) return null;
const payload = createOpportunitiesQueryPayload(dateRange, offset, savedSearchNumber);
const requestBody = JSON.stringify(payload);
// One history per query, preserving all pages of the same result set.
if (page === 1) resetDebugRequests();
const requestEntry = logRequestStart({
name: "requestOpportunities",
method: "POST",

View File

@@ -85,7 +85,7 @@ function createFusionSrDetails({ fetchJson, tabsCreate, tabsRemove, supportsFire
let session = sessions.get(key);
if (!session) {
const details = {
url: "https://comcipapic-oalprod.integration.ocp.oraclecloud.com/ic/builder/rt/SeaaS_initiation/live/webApps/external/",
url: "https://comcipapic-oalprod.integration.ocp.oraclecloud.com/ic/builder/rt/oalset_semc/live/webApps/Dashboard/?page=shell&shell=main&main=manageresourcerequests",
active: false
};
if (Number.isInteger(sender?.tab?.windowId)) details.windowId = sender.tab.windowId;
@@ -102,8 +102,8 @@ function createFusionSrDetails({ fetchJson, tabsCreate, tabsRemove, supportsFire
let tab;
try {
tab = await session.tab;
const deadline = Date.now() + 60000;
for (let attempt = 0; attempt < 240 && Date.now() < deadline; attempt += 1) {
const deadline = Date.now() + 70000;
for (let attempt = 0; attempt < 280 && Date.now() < deadline; attempt += 1) {
const pendingCookies = initialize && attempt === 0
? sessionCookies(sender) : waitForSessionCookies(session, sender);
const cookies = await (initialize ? Promise.race([session.cookieReady, pendingCookies]) : pendingCookies);
@@ -122,7 +122,7 @@ function createFusionSrDetails({ fetchJson, tabsCreate, tabsRemove, supportsFire
if (error.httpStatus !== 401) throw error;
}
}
throw new Error("Service Request session could not be established after 60 seconds. Sign in to Oracle and retry.");
throw new Error("Service Request session could not be established after 70 seconds. Sign in to Oracle and retry.");
} catch (error) {
error.debugRequests = logs;
throw error;

View File

@@ -1,9 +1,26 @@
function createSpaCurrentUser({ fetchJson, fetchInTab, openSessionTab, waitForSession, closeSessionTab, sessionUrl }) {
function createSpaCurrentUser({ fetchJson, fetchInTab, openSessionTab, waitForSession, closeSessionTab, sessionUrl, sessionStorage }) {
const pending = new Map();
const identities = new Map();
function requestCurrentUser(sender) {
const key = JSON.stringify([sender?.tab?.windowId ?? null, sender?.tab?.cookieStoreId ?? "", Boolean(sender?.tab?.incognito)]);
// Windows share cookies; Firefox containers and private sessions do not.
const key = JSON.stringify([sender?.tab?.cookieStoreId ?? "", Boolean(sender?.tab?.incognito)]);
if (identities.has(key)) return Promise.resolve({ ok: true, user: identities.get(key), debugRequests: [] });
if (!pending.has(key)) {
pending.set(key, loadCurrentUser(sender).finally(() => pending.delete(key)));
pending.set(key, (async () => {
const storageKey = `opportunities-extension-current-user:${key}`;
try {
const stored = (await sessionStorage?.get(storageKey))?.[storageKey];
if (stored && typeof stored.id === "string" && stored.id.trim() && typeof stored.name === "string" && stored.name.trim()
&& Array.isArray(stored.roles) && stored.roles.every(role => typeof role === "string" && role.trim())) {
identities.set(key, stored);
return { ok: true, user: stored, debugRequests: [] };
}
} catch { /* Memory cache still works if session storage is unavailable. */ }
const result = await loadCurrentUser(sender);
identities.set(key, result.user);
try { await sessionStorage?.set({ [storageKey]: result.user }); } catch { /* Keep the successful in-memory identity. */ }
return result;
})().finally(() => pending.delete(key)));
}
return pending.get(key);
}