@floless/app 0.158.0 → 0.159.0
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/dist/floless-server.cjs +92620 -75445
- package/dist/schemas/drawing-check.profile.v1.schema.json +33 -1
- package/dist/skills/floless-app-actions/SKILL.md +23 -5
- package/dist/skills/floless-app-bridge/SKILL.md +5 -3
- package/dist/skills/floless-app-onboarding/SKILL.md +67 -4
- package/dist/skills/floless-app-onboarding/references/floless-surfaces.md +7 -4
- package/dist/skills/floless-app-queue/SKILL.md +3 -1
- package/dist/skills/floless-app-steel-model/SKILL.md +11 -5
- package/dist/skills/floless-app-steel-takeoff/SKILL.md +28 -8
- package/dist/skills/floless-app-workflows/SKILL.md +6 -3
- package/dist/web/agents.js +12 -5
- package/dist/web/app.css +87 -13
- package/dist/web/app.js +6 -0
- package/dist/web/aware.js +29 -4
- package/dist/web/chat.css +42 -22
- package/dist/web/chat.js +181 -30
- package/dist/web/commands-shell.js +305 -4
- package/dist/web/commands-steel.js +1 -0
- package/dist/web/drawing-check-editor.html +10 -0
- package/dist/web/drawing-check-editor.js +44 -0
- package/dist/web/guide.js +4 -2
- package/dist/web/index.html +41 -9
- package/dist/web/instructor.js +20 -8
- package/dist/web/pages.js +71 -13
- package/dist/web/project-access.js +67 -8
- package/dist/web/project-modules.js +474 -0
- package/dist/web/project-workflows.js +274 -0
- package/dist/web/steel-3d-core.js +46 -0
- package/dist/web/steel-3d-view.js +8 -38
- package/dist/web/steel-editor.html +192 -49
- package/dist/web/workspace-root-recovery.js +119 -0
- package/dist/web/workspaces.js +358 -114
- package/launch-starting-page.mjs +5 -2
- package/launch.mjs +136 -78
- package/package.json +5 -1
package/dist/web/instructor.js
CHANGED
|
@@ -856,7 +856,7 @@
|
|
|
856
856
|
// #2046: the ways into the Guide on the empty pages, and its first-launch question.
|
|
857
857
|
'Getting started', 'In the Guide question',
|
|
858
858
|
'In the Workspace directory dialog', 'In Tekla source selection', 'In the new project dialog', 'In the project workspace', 'In the Revit workspace', 'In the Tekla Parser workspace', 'In the Drawing Checker profile', 'In Company knowledge',
|
|
859
|
-
'In the project History', 'In the revision note', 'In the Pages list',
|
|
859
|
+
'In the project History', 'In the revision note', 'In the Pages list', 'In a project’s Workflows step', 'In a project’s Modules step',
|
|
860
860
|
'On the workflow canvas', 'In workflow setup dialogs',
|
|
861
861
|
// The Informed by row sits at the top of the canvas column, so it is read right after the canvas.
|
|
862
862
|
// #1998: the approval notices sit above the canvas with the Informed by row.
|
|
@@ -1526,13 +1526,16 @@
|
|
|
1526
1526
|
|
|
1527
1527
|
function openSheet() {
|
|
1528
1528
|
if (!$sheet || sheetOpen || !enabled) return false;
|
|
1529
|
-
/* Requests
|
|
1529
|
+
/* Requests, the Page viewer and AI Chat's source viewers (`data-command-sheet-over`, #2582) have
|
|
1530
|
+
runtime-built controls to browse in this sheet.
|
|
1530
1531
|
It is covered (inert + aria-hidden) while the sheet owns the screen, and app.css gives the
|
|
1531
1532
|
sheet the explicit upper tier. Every other dialog still refuses stacking: its controls are
|
|
1532
1533
|
already explained in place and opening above it would obscure an unfinished decision. */
|
|
1533
1534
|
var shownDialogs = Array.prototype.slice.call(document.querySelectorAll('.modal-backdrop.show'))
|
|
1534
1535
|
.filter(function (modal) { return modal !== $sheet; });
|
|
1535
|
-
if (shownDialogs.some(function (modal) {
|
|
1536
|
+
if (shownDialogs.some(function (modal) {
|
|
1537
|
+
return modal.id !== 'requests-modal' && modal.id !== 'page-viewer' && !modal.hasAttribute('data-command-sheet-over');
|
|
1538
|
+
})) return false;
|
|
1536
1539
|
|
|
1537
1540
|
returnFocusTo = document.activeElement;
|
|
1538
1541
|
sheetOpen = true;
|
|
@@ -1895,8 +1898,7 @@
|
|
|
1895
1898
|
$askMenu.addEventListener('keydown', function (e) {
|
|
1896
1899
|
var items = Array.from($askMenu.querySelectorAll('button'));
|
|
1897
1900
|
var at = items.indexOf(document.activeElement);
|
|
1898
|
-
if (e.key === '
|
|
1899
|
-
else if (e.key === 'Tab') closeAskMenu(false);
|
|
1901
|
+
if (e.key === 'Tab') closeAskMenu(false);
|
|
1900
1902
|
else if (e.key === 'ArrowDown' || e.key === 'ArrowUp') {
|
|
1901
1903
|
e.preventDefault();
|
|
1902
1904
|
items[(at + (e.key === 'ArrowDown' ? 1 : -1) + items.length) % items.length].focus();
|
|
@@ -1953,10 +1955,20 @@
|
|
|
1953
1955
|
}
|
|
1954
1956
|
});
|
|
1955
1957
|
|
|
1956
|
-
//
|
|
1957
|
-
//
|
|
1958
|
-
// closes the sheet and clears the entry behind it.
|
|
1958
|
+
// The open Ask menu owns Escape even after focus leaves it. Capture the key
|
|
1959
|
+
// before it reaches a focused surface or the bubbling handler that clears the explanation.
|
|
1959
1960
|
document.addEventListener('keydown', function (e) {
|
|
1961
|
+
if (e.key === 'Escape' && !$askMenu.hidden) {
|
|
1962
|
+
e.preventDefault();
|
|
1963
|
+
e.stopPropagation();
|
|
1964
|
+
closeAskMenu(true);
|
|
1965
|
+
return;
|
|
1966
|
+
}
|
|
1967
|
+
}, true);
|
|
1968
|
+
// The sheet handles its own Escape and stops it here, so one press never
|
|
1969
|
+
// both closes the sheet and clears the entry behind it.
|
|
1970
|
+
document.addEventListener('keydown', function (e) {
|
|
1971
|
+
if (e.defaultPrevented) return;
|
|
1960
1972
|
if (e.key === 'Escape' && !sheetOpen && snapshot.focus) clearFocusEntry();
|
|
1961
1973
|
});
|
|
1962
1974
|
|
package/dist/web/pages.js
CHANGED
|
@@ -1051,7 +1051,11 @@
|
|
|
1051
1051
|
} else if (st.error) {
|
|
1052
1052
|
kind = 'blocked';
|
|
1053
1053
|
text = esc(st.error.message);
|
|
1054
|
-
if (st.error.code === 'quota')
|
|
1054
|
+
if (st.error.code === 'quota') {
|
|
1055
|
+
actions = `<button type="button" class="ghost" data-command-id="shell.shared-links-open" data-share-act="mine">${esc('My shared links')}</button>`;
|
|
1056
|
+
// More space is a plan away, except on Enterprise (already the largest); an unknown plan is offered it too.
|
|
1057
|
+
if (st.error.quota?.plan !== 'enterprise') actions += `<button type="button" class="ghost" data-command-id="shell.page-share-plans" data-share-act="plans">${esc('See plans')}</button>`;
|
|
1058
|
+
}
|
|
1055
1059
|
else if (st.error.code === 'no_subscription') actions = `<button type="button" class="ghost" data-command-id="shell.page-share-plans" data-share-act="plans">${esc('See plans')}</button>`;
|
|
1056
1060
|
else if (st.error.code === 'share-too-large' && st.error.path) actions = `<button type="button" class="ghost" data-command-id="shell.page-share-reveal" data-share-act="reveal">${esc('Reveal in folder')}</button>`;
|
|
1057
1061
|
else if (['offline', 'rate_limited', 'in_progress', 'signed_out'].includes(st.error.code)) actions = `<button type="button" class="ghost" data-command-id="shell.page-share-retry" data-share-act="retry">${esc('Try again')}</button>`;
|
|
@@ -1120,7 +1124,18 @@
|
|
|
1120
1124
|
}
|
|
1121
1125
|
|
|
1122
1126
|
/** The words for a failure the server answered with, in the person's terms. */
|
|
1123
|
-
|
|
1127
|
+
// #2262 5e: the space for shared files depends on the plan (Trial 50 MB, Solo 200 MB, Enterprise 1 GB), so every
|
|
1128
|
+
// figure comes from floless.io's answer; nothing here knows a limit. An older floless.io names no plan.
|
|
1129
|
+
const PLAN_NAME = { trial: 'Trial', solo: 'Solo', enterprise: 'Enterprise' };
|
|
1130
|
+
const spaceSize = (b) => (b >= 1024 ** 3 ? `${+(b / 1024 ** 3).toFixed(1)} GB` : b > 0 && b < 1024 ** 2 / 2 ? 'under 1 MB' : `${Math.round(b / 1024 ** 2)} MB`);
|
|
1131
|
+
const spaceUsed = (q) => `${spaceSize(q.usedBytes)} of ${spaceSize(q.quotaBytes)}`;
|
|
1132
|
+
function quotaSentence(quota) {
|
|
1133
|
+
const numbers = quota ? ` (${spaceUsed(quota)}${PLAN_NAME[quota.plan] ? ` on your ${PLAN_NAME[quota.plan]} plan` : ''})` : '';
|
|
1134
|
+
const more = quota?.plan === 'enterprise' ? '' : ', or see plans for more space';
|
|
1135
|
+
return `floless.io’s space for your shared links’ files is full${numbers}, so this link wasn’t published. Revoke links you no longer need in My shared links${more}, then share again.`;
|
|
1136
|
+
}
|
|
1137
|
+
|
|
1138
|
+
function outcomeSentence(code, quota = null) {
|
|
1124
1139
|
return ({
|
|
1125
1140
|
signed_out: 'You’re signed out of FloLess, so the link wasn’t published. Sign in, then try again; FloLess keeps the request until then.',
|
|
1126
1141
|
no_subscription: 'Sharing a link needs a FloLess plan, so this Page wasn’t shared. Your Page is unchanged.',
|
|
@@ -1134,7 +1149,7 @@
|
|
|
1134
1149
|
revoked: 'This link was revoked from somewhere else, so it can’t show new versions. Share the Page again to make a new link.',
|
|
1135
1150
|
not_found: 'floless.io no longer has this link. Share the Page again to make a new link.',
|
|
1136
1151
|
damaged: 'One of this version’s files is damaged on this computer, so nothing was published. Share another version, or save this one again with its files.',
|
|
1137
|
-
quota:
|
|
1152
|
+
quota: quotaSentence(quota),
|
|
1138
1153
|
})[code] || '';
|
|
1139
1154
|
}
|
|
1140
1155
|
|
|
@@ -1164,6 +1179,7 @@
|
|
|
1164
1179
|
view.shareSeq += 1;
|
|
1165
1180
|
adoptShare(body.page);
|
|
1166
1181
|
view.share = { ...(view.share || {}), share: body.share, error: null };
|
|
1182
|
+
view.shareQuota = body.quota || null;
|
|
1167
1183
|
return body.outcome;
|
|
1168
1184
|
} catch (err) {
|
|
1169
1185
|
if (!current()) { if (view.page?.id === id && isOpen()) void loadShare(); return null; }
|
|
@@ -1172,11 +1188,13 @@
|
|
|
1172
1188
|
if (answer?.outcome && answer.page) {
|
|
1173
1189
|
// An answer, not a failure: the share published nothing and says why (needs a plan, too large, …), with the Page's record.
|
|
1174
1190
|
adoptShare(answer.page);
|
|
1191
|
+
view.shareQuota = answer.quota || null;
|
|
1175
1192
|
view.share = { ...(view.share || {}), share: answer.share,
|
|
1176
1193
|
error: answer.outcome === 'share-too-large' ? { code: 'share-too-large', message: answer.reason, path: answer.path || null } : null };
|
|
1177
1194
|
return answer.outcome;
|
|
1178
1195
|
}
|
|
1179
1196
|
const code = err?.body?.code || 'offline';
|
|
1197
|
+
view.shareQuota = err?.body?.quota || null;
|
|
1180
1198
|
const path = code === 'share-too-large' && (payload?.version ?? latestN()) === latestN() ? view.share?.eligibility?.path || null : null;
|
|
1181
1199
|
view.share = { ...(view.share || {}), error: { code, message: err?.body?.error || outcomeSentence('offline'), path } };
|
|
1182
1200
|
return null;
|
|
@@ -1261,9 +1279,10 @@
|
|
|
1261
1279
|
} else if (outcome === 'revoke-pending') {
|
|
1262
1280
|
toast('This link is being revoked, so the new version wasn’t published.', 'warn');
|
|
1263
1281
|
} else if (outcome && outcome !== 'published') {
|
|
1264
|
-
const
|
|
1282
|
+
const quota = outcome === 'quota' ? view.shareQuota || null : null;
|
|
1283
|
+
const sentence = outcomeSentence(outcome, quota);
|
|
1265
1284
|
if (['no_subscription', 'too_large', 'quota', 'damaged', 'cancelled', 'reused', 'unsupported', 'revoked', 'not_found'].includes(outcome)) {
|
|
1266
|
-
view.share = { ...(view.share || {}), error: { code: outcome, message: sentence, path: null } };
|
|
1285
|
+
view.share = { ...(view.share || {}), error: { code: outcome, message: sentence, path: null, quota } };
|
|
1267
1286
|
paintBanner();
|
|
1268
1287
|
} else if (sentence) toast(sentence, 'warn');
|
|
1269
1288
|
}
|
|
@@ -1347,7 +1366,39 @@
|
|
|
1347
1366
|
const $slNote = document.getElementById('sl-note');
|
|
1348
1367
|
const $slMore = document.getElementById('sl-more');
|
|
1349
1368
|
const $slClose = document.getElementById('sl-close');
|
|
1350
|
-
const
|
|
1369
|
+
const $slUsage = document.getElementById('sl-usage');
|
|
1370
|
+
const $slUsageValue = document.getElementById('sl-usage-value');
|
|
1371
|
+
const $slMeter = document.getElementById('sl-meter');
|
|
1372
|
+
const $slMeterFill = document.getElementById('sl-meter-fill');
|
|
1373
|
+
const $slUsageStatus = document.getElementById('sl-usage-status');
|
|
1374
|
+
const $slPlans = document.getElementById('sl-plans');
|
|
1375
|
+
// `gen` numbers each list request: a refresh (after a revoke) supersedes any older answer still in flight, so a
|
|
1376
|
+
// late "Show more" can never repaint the space as it was before the revoke.
|
|
1377
|
+
const sl = { next: null, rows: [], local: [], returnFocus: null, loading: false, gen: 0 };
|
|
1378
|
+
|
|
1379
|
+
/** The space block: what is used of the plan's limit, a meter, and the way to more space (#2262 5e). */
|
|
1380
|
+
function slPaintUsage(usage) {
|
|
1381
|
+
if (!$slUsage) return;
|
|
1382
|
+
$slUsage.hidden = !usage;
|
|
1383
|
+
if (!usage) return;
|
|
1384
|
+
const plan = PLAN_NAME[usage.plan] || '';
|
|
1385
|
+
const ratio = usage.quotaBytes > 0 ? usage.usedBytes / usage.quotaBytes : 1;
|
|
1386
|
+
const level = ratio >= 1 ? 'full' : ratio >= 0.9 ? 'almost' : 'ok';
|
|
1387
|
+
const value = `${spaceUsed(usage)}${plan ? ` · ${plan} plan` : ''}`;
|
|
1388
|
+
const enterprise = usage.plan === 'enterprise';
|
|
1389
|
+
$slUsageValue.textContent = value;
|
|
1390
|
+
$slUsage.dataset.level = level;
|
|
1391
|
+
$slMeter.setAttribute('aria-valuemax', String(Math.max(usage.quotaBytes, 1)));
|
|
1392
|
+
$slMeter.setAttribute('aria-valuenow', String(Math.min(usage.usedBytes, Math.max(usage.quotaBytes, 1))));
|
|
1393
|
+
$slMeter.setAttribute('aria-valuetext', `${spaceUsed(usage)} used${plan ? `, ${plan} plan` : ''}`);
|
|
1394
|
+
// A little usage still shows: at least 2% of the bar once anything is stored.
|
|
1395
|
+
$slMeterFill.style.width = `${usage.usedBytes > 0 ? Math.max(2, Math.min(100, ratio * 100)) : 0}%`;
|
|
1396
|
+
$slUsageStatus.textContent = level === 'full'
|
|
1397
|
+
? (enterprise ? 'Full. Revoke links you no longer need to publish again.' : 'Full. New links can’t be published until you free space or move to a larger plan.')
|
|
1398
|
+
: level === 'almost' ? (enterprise ? 'Almost full. Revoke links you no longer need.' : 'Almost full. Revoke links you no longer need, or see plans for more space.') : '';
|
|
1399
|
+
$slUsageStatus.hidden = level === 'ok';
|
|
1400
|
+
$slPlans.hidden = enterprise || level === 'ok';
|
|
1401
|
+
}
|
|
1351
1402
|
|
|
1352
1403
|
const CHIP = { live: 'Live', 'pending-publish': 'Publishing', 'pending-revoke': 'Revoke waiting', revoked: 'Revoked' };
|
|
1353
1404
|
|
|
@@ -1394,12 +1445,14 @@
|
|
|
1394
1445
|
}
|
|
1395
1446
|
|
|
1396
1447
|
async function slLoad(more) {
|
|
1397
|
-
if (sl.loading) return;
|
|
1448
|
+
if (more && sl.loading) return;
|
|
1449
|
+
const gen = ++sl.gen;
|
|
1398
1450
|
sl.loading = true;
|
|
1399
1451
|
$slMore.setAttribute('aria-busy', 'true');
|
|
1400
1452
|
try {
|
|
1401
1453
|
const q = more && sl.next ? `?before=${encodeURIComponent(sl.next)}` : '';
|
|
1402
1454
|
const body = await api(`/api/pages/shared-links${q}`);
|
|
1455
|
+
if (gen !== sl.gen) return;
|
|
1403
1456
|
if (!more) { sl.rows = []; sl.local = body.local || []; }
|
|
1404
1457
|
const remote = body.remote?.ok ? body.remote.links : [];
|
|
1405
1458
|
sl.next = body.remote?.ok ? body.remote.next : null;
|
|
@@ -1407,10 +1460,10 @@
|
|
|
1407
1460
|
const tokens = new Set(sl.rows.map((r) => r.token));
|
|
1408
1461
|
const localOnly = !body.remote?.ok || !sl.next ? slLocalOnly(sl.local, tokens) : [];
|
|
1409
1462
|
// Slice 5: how much of the person's space for shared files is used (revoking a link frees what only it used).
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
$slNote.hidden = !!body.remote?.ok
|
|
1413
|
-
$slNote.textContent = body.remote?.ok ?
|
|
1463
|
+
// Signed out or offline: the note says so and no space is shown, rather than an old figure.
|
|
1464
|
+
slPaintUsage(body.remote?.ok ? body.remote.usage || null : null);
|
|
1465
|
+
$slNote.hidden = !!body.remote?.ok;
|
|
1466
|
+
$slNote.textContent = body.remote?.ok ? '' : (body.remote?.error === 'signed_out'
|
|
1414
1467
|
? 'You’re signed out, so FloLess can’t check floless.io. This shows the links this computer knows about. Sign in to see all of them.'
|
|
1415
1468
|
: 'FloLess couldn’t reach floless.io, so this shows the links this computer knows about.');
|
|
1416
1469
|
const all = [...sl.rows, ...localOnly];
|
|
@@ -1418,11 +1471,15 @@
|
|
|
1418
1471
|
: '<p class="pg-empty sl-empty">No shared links yet. Share a Page from its viewer with the Share button.</p>';
|
|
1419
1472
|
$slMore.hidden = !sl.next;
|
|
1420
1473
|
} catch (err) {
|
|
1474
|
+
if (gen !== sl.gen) return;
|
|
1475
|
+
slPaintUsage(null);
|
|
1421
1476
|
$slNote.hidden = false;
|
|
1422
1477
|
$slNote.textContent = `FloLess couldn’t list your shared links. ${err?.body?.error || 'Try again in a moment.'}`;
|
|
1423
1478
|
} finally {
|
|
1424
|
-
sl.
|
|
1425
|
-
|
|
1479
|
+
if (gen === sl.gen) {
|
|
1480
|
+
sl.loading = false;
|
|
1481
|
+
$slMore.removeAttribute('aria-busy');
|
|
1482
|
+
}
|
|
1426
1483
|
}
|
|
1427
1484
|
}
|
|
1428
1485
|
|
|
@@ -1445,6 +1502,7 @@
|
|
|
1445
1502
|
if ($sl) {
|
|
1446
1503
|
$slClose.addEventListener('click', closeSharedLinks);
|
|
1447
1504
|
$slMore.addEventListener('click', () => { void slLoad(true); });
|
|
1505
|
+
$slPlans?.addEventListener('click', () => { window.open(PLANS_URL, '_blank', 'noopener'); });
|
|
1448
1506
|
if (typeof window.onBackdropDismiss === 'function') window.onBackdropDismiss($sl, closeSharedLinks);
|
|
1449
1507
|
$sl.addEventListener('keydown', (event) => {
|
|
1450
1508
|
if (event.key === 'Escape') { event.stopPropagation(); closeSharedLinks(); return; }
|
|
@@ -217,6 +217,23 @@
|
|
|
217
217
|
</li>`;
|
|
218
218
|
}
|
|
219
219
|
|
|
220
|
+
/**
|
|
221
|
+
* The workflows that only belong to this project, as a note after the lists (not a list of its own): the project's
|
|
222
|
+
* Workflows step lists them, with their state and last run.
|
|
223
|
+
*/
|
|
224
|
+
function ownedSummaryHtml(owned) {
|
|
225
|
+
if (!owned.length) return '';
|
|
226
|
+
const archived = owned.filter((w) => w.archived).length;
|
|
227
|
+
const active = owned.length - archived;
|
|
228
|
+
const what = active
|
|
229
|
+
? `${plural(active, 'workflow belongs', 'workflows belong')} to this project${archived ? ` (and ${archived} archived)` : ''}. `
|
|
230
|
+
+ `${active === 1 ? 'It is' : 'They are'} listed with ${active === 1 ? 'its' : 'their'} last run on the project’s Workflows step.`
|
|
231
|
+
: `${plural(archived, 'archived workflow belongs', 'archived workflows belong')} to this project. `
|
|
232
|
+
+ `${archived === 1 ? 'It is' : 'They are'} under Archived on the project’s Workflows step.`;
|
|
233
|
+
return `<div class="pa-owned"><p class="pa-owned-line">${esc(what)}</p>
|
|
234
|
+
<button type="button" class="pa-btn" data-pa-go="workflows" data-command-id="shell.project-access-go-workflows">Show on the Workflows step</button></div>`;
|
|
235
|
+
}
|
|
236
|
+
|
|
220
237
|
function group(id, title, rows, renderRow, selectable) {
|
|
221
238
|
if (!rows.length) return '';
|
|
222
239
|
const keys = selectable ? rows.map(selectable).filter(Boolean) : [];
|
|
@@ -257,6 +274,16 @@
|
|
|
257
274
|
return lines.length ? `<div class="pa-note" role="status">${lines.map((line) => `<p>${esc(line)}</p>`).join('')}</div>` : '';
|
|
258
275
|
}
|
|
259
276
|
|
|
277
|
+
// #2470 R6.7: the General projects that list this one on their Modules step. Information only: a link reaches nothing
|
|
278
|
+
// and gives nothing, so there is no switch — Open goes to that project.
|
|
279
|
+
function linkedFromHtml() {
|
|
280
|
+
const rows = state.data?.linkedFrom || [];
|
|
281
|
+
// Said when it could not be checked: no line must never be read as "no General project links this one".
|
|
282
|
+
if (state.data?.linkedFromUnchecked) return '<div class="pa-note pa-linked" role="note"><p>FloLess couldn’t check which General projects list this one just now. Try again in a moment.</p></div>';
|
|
283
|
+
if (!rows.length) return '';
|
|
284
|
+
return '<div class="pa-note pa-linked" role="note">' + rows.map((p) => `<p>Linked from the General project “${esc(p.name)}” <button type="button" class="pa-btn" data-pa-linked-open="${esc(p.id)}" data-command-id="shell.project-access-linked-open#${esc(p.id)}" data-command-instance-label="${esc(p.name)}" data-tip="Opens that General project on its Modules step">Open</button></p>`).join('') + '</div>';
|
|
285
|
+
}
|
|
286
|
+
|
|
260
287
|
function paint() {
|
|
261
288
|
$sub.textContent = `Agents, schedules and workflows that reach into “${state.project?.name || 'this project'}”.`;
|
|
262
289
|
if (state.loading && !state.data) { $body.innerHTML = skeleton(); $body.setAttribute('aria-busy', 'true'); paintBar(); return; }
|
|
@@ -268,14 +295,20 @@
|
|
|
268
295
|
}
|
|
269
296
|
const agents = agentRows();
|
|
270
297
|
const schedules = state.data?.schedules || [];
|
|
271
|
-
const
|
|
298
|
+
const all = state.data?.workflows || [];
|
|
299
|
+
// #2470 R6.2: where the project has a Workflows step, the workflows that only belong to it are listed there; this
|
|
300
|
+
// sheet says how many and links to it, and keeps listing in full what the step does not show (an Agent step on this
|
|
301
|
+
// project, a workflow built from its Knowledge). Without that step (the other project kinds, for now) all are listed.
|
|
302
|
+
const stepped = window.flolessWorkspaces?.projectHasStep?.('workflows') === true;
|
|
303
|
+
const ownedOnly = stepped ? all.filter((w) => w.bindings.length === 1 && w.bindings[0] === 'owner') : [];
|
|
304
|
+
const workflows = stepped ? all.filter((w) => !ownedOnly.includes(w)) : all;
|
|
272
305
|
const notes = staleHtml() + uncheckedHtml();
|
|
273
|
-
if (!agents.length && !schedules.length && !
|
|
306
|
+
if (!agents.length && !schedules.length && !all.length && notes) {
|
|
274
307
|
// Nothing listed, but something could not be read: say that, never "nothing has access".
|
|
275
|
-
$body.innerHTML = notes; paintBar(); return;
|
|
308
|
+
$body.innerHTML = linkedFromHtml() + notes; paintBar(); return;
|
|
276
309
|
}
|
|
277
|
-
if (!agents.length && !schedules.length && !
|
|
278
|
-
$body.innerHTML = `<div class="pa-empty"><p class="pa-empty-title">Nothing has access to this project yet.</p>
|
|
310
|
+
if (!agents.length && !schedules.length && !all.length) {
|
|
311
|
+
$body.innerHTML = linkedFromHtml() + `<div class="pa-empty"><p class="pa-empty-title">Nothing has access to this project yet.</p>
|
|
279
312
|
<p>Add it to an Agent’s “Where it works” on the Agents tab, or schedule a workflow on it.</p>
|
|
280
313
|
<div class="pa-empty-actions">
|
|
281
314
|
<button type="button" class="pa-btn" data-pa-go="agents" data-command-id="shell.project-access-go-agents">Open Agents</button>
|
|
@@ -283,10 +316,11 @@
|
|
|
283
316
|
</div></div>`;
|
|
284
317
|
paintBar(); return;
|
|
285
318
|
}
|
|
286
|
-
$body.innerHTML = staleHtml() + uncheckedHtml()
|
|
319
|
+
$body.innerHTML = linkedFromHtml() + staleHtml() + uncheckedHtml()
|
|
287
320
|
+ group('agents', 'Agents that can work here', agents, agentRow, (r) => (switchable(r) ? keyOf('agent', r.agentId) : null))
|
|
288
321
|
+ group('schedules', 'Schedules that run on this project', schedules, scheduleRow, (s) => (s.broken ? null : keyOf('schedule', s.routineId)))
|
|
289
|
-
+ group('workflows', 'Workflows that use it', workflows, workflowRow, null)
|
|
322
|
+
+ group('workflows', 'Workflows that use it', workflows, workflowRow, null)
|
|
323
|
+
+ ownedSummaryHtml(ownedOnly);
|
|
290
324
|
paintBar();
|
|
291
325
|
// A repaint replaces the control that had focus; keep focus inside the sheet so Escape and Tab still work there.
|
|
292
326
|
if (isOpen() && (!document.activeElement || document.activeElement === document.body)) $panel?.focus();
|
|
@@ -431,7 +465,12 @@
|
|
|
431
465
|
state.selected.clear(); state.confirm = null; state.rowError.clear(); state.turnedOff.clear();
|
|
432
466
|
const target = state.returnFocus;
|
|
433
467
|
state.returnFocus = null;
|
|
434
|
-
|
|
468
|
+
// The control that opened the sheet may have been redrawn meanwhile (a list re-read): find it again by its Instructor
|
|
469
|
+
// id, else the chip, so focus never drops to the page.
|
|
470
|
+
const id = target?.getAttribute?.('data-command-id');
|
|
471
|
+
const again = target && document.contains(target) ? target
|
|
472
|
+
: (id && [...document.querySelectorAll('[data-command-id]')].find((el) => el.getAttribute('data-command-id') === id)) || ($chip.hidden ? null : $chip);
|
|
473
|
+
again?.focus?.();
|
|
435
474
|
}
|
|
436
475
|
|
|
437
476
|
async function openItem(key) {
|
|
@@ -522,8 +561,28 @@
|
|
|
522
561
|
if (el.hasAttribute('data-pa-clear')) { state.selected.clear(); state.confirm = null; paint(); return; }
|
|
523
562
|
if (el.dataset.paOpen) { void openItem(el.dataset.paOpen); return; }
|
|
524
563
|
if (el.hasAttribute('data-pa-retry')) { void load(); return; }
|
|
564
|
+
if (el.dataset.paLinkedOpen) {
|
|
565
|
+
const generalId = el.dataset.paLinkedOpen;
|
|
566
|
+
close();
|
|
567
|
+
void Promise.resolve(window.flolessWorkspaces?.openModulesStep?.(generalId)).catch((error) => {
|
|
568
|
+
console.warn('[project-access] the General project could not be opened', error);
|
|
569
|
+
toast('FloLess couldn’t open that General project. Open it from Workspaces.', 'warn');
|
|
570
|
+
});
|
|
571
|
+
return;
|
|
572
|
+
}
|
|
525
573
|
if (el.dataset.paGo === 'agents') { close(); void window.flolessWorkspaces?.setMode?.('agents'); return; }
|
|
526
574
|
if (el.dataset.paGo === 'routines') { close(); if (typeof openRoutines === 'function') openRoutines(); }
|
|
575
|
+
if (el.dataset.paGo === 'workflows') {
|
|
576
|
+
const projectId = state.project?.id;
|
|
577
|
+
close();
|
|
578
|
+
void Promise.resolve(window.flolessWorkspaces?.openWorkflowsStep?.(projectId)).then(() => {
|
|
579
|
+
// The keyboard lands where the person was sent: the step's heading.
|
|
580
|
+
document.querySelector('#ws-workflows [data-pw-heading]')?.focus?.();
|
|
581
|
+
}).catch((error) => {
|
|
582
|
+
console.warn('[project-access] the Workflows step could not be opened', error);
|
|
583
|
+
toast('FloLess couldn’t open this project’s Workflows step. Open the project and choose Workflows.', 'warn');
|
|
584
|
+
});
|
|
585
|
+
}
|
|
527
586
|
});
|
|
528
587
|
|
|
529
588
|
// Something else changed the projects or the workflows: the chip (and an open sheet) read again.
|