identityscope 0.0.0-stage → 0.28.3
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/LICENSE +21 -0
- package/README.md +917 -3
- package/SECURITY.md +56 -0
- package/dist/core/audit-readiness.d.ts +158 -0
- package/dist/core/audit-readiness.js +357 -0
- package/dist/core/audit-readiness.js.map +1 -0
- package/dist/core/certs.d.ts +68 -0
- package/dist/core/certs.js +132 -0
- package/dist/core/certs.js.map +1 -0
- package/dist/core/checks.d.ts +133 -0
- package/dist/core/checks.js +512 -0
- package/dist/core/checks.js.map +1 -0
- package/dist/core/cloud-rules.d.ts +20 -0
- package/dist/core/cloud-rules.js +44 -0
- package/dist/core/cloud-rules.js.map +1 -0
- package/dist/core/compare.d.ts +45 -0
- package/dist/core/compare.js +372 -0
- package/dist/core/compare.js.map +1 -0
- package/dist/core/conditions.d.ts +10 -0
- package/dist/core/conditions.js +201 -0
- package/dist/core/conditions.js.map +1 -0
- package/dist/core/credentials.d.ts +71 -0
- package/dist/core/credentials.js +211 -0
- package/dist/core/credentials.js.map +1 -0
- package/dist/core/datasets.d.ts +53 -0
- package/dist/core/datasets.js +596 -0
- package/dist/core/datasets.js.map +1 -0
- package/dist/core/definition.d.ts +32 -0
- package/dist/core/definition.js +301 -0
- package/dist/core/definition.js.map +1 -0
- package/dist/core/discover.d.ts +32 -0
- package/dist/core/discover.js +105 -0
- package/dist/core/discover.js.map +1 -0
- package/dist/core/engine.d.ts +18 -0
- package/dist/core/engine.js +290 -0
- package/dist/core/engine.js.map +1 -0
- package/dist/core/fields.d.ts +16 -0
- package/dist/core/fields.js +132 -0
- package/dist/core/fields.js.map +1 -0
- package/dist/core/governance-trail.d.ts +211 -0
- package/dist/core/governance-trail.js +557 -0
- package/dist/core/governance-trail.js.map +1 -0
- package/dist/core/http-transport.d.ts +66 -0
- package/dist/core/http-transport.js +247 -0
- package/dist/core/http-transport.js.map +1 -0
- package/dist/core/index.d.ts +13 -0
- package/dist/core/index.js +16 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/insights.d.ts +176 -0
- package/dist/core/insights.js +417 -0
- package/dist/core/insights.js.map +1 -0
- package/dist/core/joiner-evidence.d.ts +98 -0
- package/dist/core/joiner-evidence.js +254 -0
- package/dist/core/joiner-evidence.js.map +1 -0
- package/dist/core/lab/credential-map.d.ts +50 -0
- package/dist/core/lab/credential-map.js +163 -0
- package/dist/core/lab/credential-map.js.map +1 -0
- package/dist/core/lab/javadate.d.ts +7 -0
- package/dist/core/lab/javadate.js +307 -0
- package/dist/core/lab/javadate.js.map +1 -0
- package/dist/core/lab/jsonpath.d.ts +11 -0
- package/dist/core/lab/jsonpath.js +273 -0
- package/dist/core/lab/jsonpath.js.map +1 -0
- package/dist/core/lab/policy-preview.d.ts +43 -0
- package/dist/core/lab/policy-preview.js +78 -0
- package/dist/core/lab/policy-preview.js.map +1 -0
- package/dist/core/lab/rfc5646.d.ts +2 -0
- package/dist/core/lab/rfc5646.js +421 -0
- package/dist/core/lab/rfc5646.js.map +1 -0
- package/dist/core/lab/transform-impact.d.ts +63 -0
- package/dist/core/lab/transform-impact.js +138 -0
- package/dist/core/lab/transform-impact.js.map +1 -0
- package/dist/core/lab/transform-people.d.ts +61 -0
- package/dist/core/lab/transform-people.js +132 -0
- package/dist/core/lab/transform-people.js.map +1 -0
- package/dist/core/lab/transforms.d.ts +79 -0
- package/dist/core/lab/transforms.js +738 -0
- package/dist/core/lab/transforms.js.map +1 -0
- package/dist/core/lab/velocity.d.ts +33 -0
- package/dist/core/lab/velocity.js +874 -0
- package/dist/core/lab/velocity.js.map +1 -0
- package/dist/core/lab/workflow-health.d.ts +80 -0
- package/dist/core/lab/workflow-health.js +234 -0
- package/dist/core/lab/workflow-health.js.map +1 -0
- package/dist/core/lab/workflows.d.ts +87 -0
- package/dist/core/lab/workflows.js +568 -0
- package/dist/core/lab/workflows.js.map +1 -0
- package/dist/core/lifecycle-gaps.d.ts +192 -0
- package/dist/core/lifecycle-gaps.js +389 -0
- package/dist/core/lifecycle-gaps.js.map +1 -0
- package/dist/core/logs.d.ts +145 -0
- package/dist/core/logs.js +342 -0
- package/dist/core/logs.js.map +1 -0
- package/dist/core/lookup.d.ts +129 -0
- package/dist/core/lookup.js +289 -0
- package/dist/core/lookup.js.map +1 -0
- package/dist/core/model-insights.d.ts +247 -0
- package/dist/core/model-insights.js +474 -0
- package/dist/core/model-insights.js.map +1 -0
- package/dist/core/narrow.d.ts +23 -0
- package/dist/core/narrow.js +137 -0
- package/dist/core/narrow.js.map +1 -0
- package/dist/core/nerm.d.ts +154 -0
- package/dist/core/nerm.js +397 -0
- package/dist/core/nerm.js.map +1 -0
- package/dist/core/operations-watch.d.ts +232 -0
- package/dist/core/operations-watch.js +491 -0
- package/dist/core/operations-watch.js.map +1 -0
- package/dist/core/output/csv.d.ts +6 -0
- package/dist/core/output/csv.js +22 -0
- package/dist/core/output/csv.js.map +1 -0
- package/dist/core/output/html.d.ts +11 -0
- package/dist/core/output/html.js +66 -0
- package/dist/core/output/html.js.map +1 -0
- package/dist/core/output/xlsx.d.ts +3 -0
- package/dist/core/output/xlsx.js +130 -0
- package/dist/core/output/xlsx.js.map +1 -0
- package/dist/core/output/zip.d.ts +16 -0
- package/dist/core/output/zip.js +106 -0
- package/dist/core/output/zip.js.map +1 -0
- package/dist/core/ownership.d.ts +39 -0
- package/dist/core/ownership.js +100 -0
- package/dist/core/ownership.js.map +1 -0
- package/dist/core/patterns.d.ts +11 -0
- package/dist/core/patterns.js +31 -0
- package/dist/core/patterns.js.map +1 -0
- package/dist/core/preview.d.ts +96 -0
- package/dist/core/preview.js +173 -0
- package/dist/core/preview.js.map +1 -0
- package/dist/core/roles.d.ts +125 -0
- package/dist/core/roles.js +420 -0
- package/dist/core/roles.js.map +1 -0
- package/dist/core/tenant.d.ts +67 -0
- package/dist/core/tenant.js +194 -0
- package/dist/core/tenant.js.map +1 -0
- package/dist/core/threat-signals.d.ts +112 -0
- package/dist/core/threat-signals.js +250 -0
- package/dist/core/threat-signals.js.map +1 -0
- package/dist/core/threat-watch.d.ts +144 -0
- package/dist/core/threat-watch.js +282 -0
- package/dist/core/threat-watch.js.map +1 -0
- package/dist/core/transport.d.ts +82 -0
- package/dist/core/transport.js +312 -0
- package/dist/core/transport.js.map +1 -0
- package/dist/core/types.d.ts +137 -0
- package/dist/core/types.js +10 -0
- package/dist/core/types.js.map +1 -0
- package/dist/core/warnings.d.ts +236 -0
- package/dist/core/warnings.js +504 -0
- package/dist/core/warnings.js.map +1 -0
- package/dist/demo/tenant.d.ts +1572 -0
- package/dist/demo/tenant.js +1023 -0
- package/dist/demo/tenant.js.map +1 -0
- package/dist/node/attribute-history.d.ts +22 -0
- package/dist/node/attribute-history.js +86 -0
- package/dist/node/attribute-history.js.map +1 -0
- package/dist/node/changes.d.ts +20 -0
- package/dist/node/changes.js +78 -0
- package/dist/node/changes.js.map +1 -0
- package/dist/node/cli.d.ts +2 -0
- package/dist/node/cli.js +291 -0
- package/dist/node/cli.js.map +1 -0
- package/dist/node/config.d.ts +72 -0
- package/dist/node/config.js +203 -0
- package/dist/node/config.js.map +1 -0
- package/dist/node/credentials.d.ts +13 -0
- package/dist/node/credentials.js +24 -0
- package/dist/node/credentials.js.map +1 -0
- package/dist/node/delivery.d.ts +10 -0
- package/dist/node/delivery.js +105 -0
- package/dist/node/delivery.js.map +1 -0
- package/dist/node/doctor.d.ts +2 -0
- package/dist/node/doctor.js +151 -0
- package/dist/node/doctor.js.map +1 -0
- package/dist/node/drift.d.ts +31 -0
- package/dist/node/drift.js +56 -0
- package/dist/node/drift.js.map +1 -0
- package/dist/node/evidence.d.ts +42 -0
- package/dist/node/evidence.js +129 -0
- package/dist/node/evidence.js.map +1 -0
- package/dist/node/exceptions.d.ts +30 -0
- package/dist/node/exceptions.js +83 -0
- package/dist/node/exceptions.js.map +1 -0
- package/dist/node/history.d.ts +35 -0
- package/dist/node/history.js +74 -0
- package/dist/node/history.js.map +1 -0
- package/dist/node/index.d.ts +7 -0
- package/dist/node/index.js +8 -0
- package/dist/node/index.js.map +1 -0
- package/dist/node/keep.d.ts +9 -0
- package/dist/node/keep.js +39 -0
- package/dist/node/keep.js.map +1 -0
- package/dist/node/loader.d.ts +7 -0
- package/dist/node/loader.js +35 -0
- package/dist/node/loader.js.map +1 -0
- package/dist/node/log-files.d.ts +16 -0
- package/dist/node/log-files.js +93 -0
- package/dist/node/log-files.js.map +1 -0
- package/dist/node/monthly.d.ts +41 -0
- package/dist/node/monthly.js +108 -0
- package/dist/node/monthly.js.map +1 -0
- package/dist/node/oauth-login.d.ts +45 -0
- package/dist/node/oauth-login.js +121 -0
- package/dist/node/oauth-login.js.map +1 -0
- package/dist/node/packs.d.ts +32 -0
- package/dist/node/packs.js +43 -0
- package/dist/node/packs.js.map +1 -0
- package/dist/node/privileged-seen.d.ts +11 -0
- package/dist/node/privileged-seen.js +41 -0
- package/dist/node/privileged-seen.js.map +1 -0
- package/dist/node/recipients.d.ts +17 -0
- package/dist/node/recipients.js +51 -0
- package/dist/node/recipients.js.map +1 -0
- package/dist/node/runner.d.ts +51 -0
- package/dist/node/runner.js +298 -0
- package/dist/node/runner.js.map +1 -0
- package/dist/node/runtime.d.ts +12 -0
- package/dist/node/runtime.js +13 -0
- package/dist/node/runtime.js.map +1 -0
- package/dist/node/schedules.d.ts +87 -0
- package/dist/node/schedules.js +141 -0
- package/dist/node/schedules.js.map +1 -0
- package/dist/node/secrets.d.ts +37 -0
- package/dist/node/secrets.js +219 -0
- package/dist/node/secrets.js.map +1 -0
- package/dist/node/support.d.ts +14 -0
- package/dist/node/support.js +133 -0
- package/dist/node/support.js.map +1 -0
- package/dist/node/tenants.d.ts +93 -0
- package/dist/node/tenants.js +255 -0
- package/dist/node/tenants.js.map +1 -0
- package/dist/node/ui-page.d.ts +1 -0
- package/dist/node/ui-page.js +3 -0
- package/dist/node/ui-page.js.map +1 -0
- package/dist/node/ui-server.d.ts +48 -0
- package/dist/node/ui-server.js +2665 -0
- package/dist/node/ui-server.js.map +1 -0
- package/dist/node/write.d.ts +9 -0
- package/dist/node/write.js +53 -0
- package/dist/node/write.js.map +1 -0
- package/dist/reports/builtin.generated.d.ts +1 -0
- package/dist/reports/builtin.generated.js +49 -0
- package/dist/reports/builtin.generated.js.map +1 -0
- package/dist/reports/library.d.ts +6 -0
- package/dist/reports/library.js +18 -0
- package/dist/reports/library.js.map +1 -0
- package/launcher/IdentityScope.cmd +11 -0
- package/package.json +69 -4
- package/reports/access-profile-members.yaml +29 -0
- package/reports/access-profile-membership-counts.yaml +17 -0
- package/reports/access-profiles-without-owner.yaml +16 -0
- package/reports/access-request-audit-trail.yaml +36 -0
- package/reports/accounts-by-source.yaml +19 -0
- package/reports/active-identities-without-manager.yaml +22 -0
- package/reports/aggregation-failures.yaml +29 -0
- package/reports/aggregation-history.yaml +27 -0
- package/reports/all-sources.yaml +16 -0
- package/reports/application-accounts.yaml +32 -0
- package/reports/application-entitlements.yaml +31 -0
- package/reports/campaign-progress.yaml +23 -0
- package/reports/certification-decisions.yaml +31 -0
- package/reports/direct-reports-per-manager.yaml +20 -0
- package/reports/disabled-accounts-of-active-people.yaml +33 -0
- package/reports/duplicate-emails.yaml +16 -0
- package/reports/entitlement-holders.yaml +35 -0
- package/reports/entitlements-held-by-inactive-identities.yaml +31 -0
- package/reports/entitlements-without-owner.yaml +28 -0
- package/reports/identities-by-lifecycle-state.yaml +15 -0
- package/reports/identities-missing-key-attributes.yaml +27 -0
- package/reports/identities-with-processing-errors.yaml +19 -0
- package/reports/identity-attribute-mappings.yaml +27 -0
- package/reports/machine-accounts.yaml +28 -0
- package/reports/managers-and-direct-reports.yaml +23 -0
- package/reports/most-access.yaml +18 -0
- package/reports/new-identities.yaml +24 -0
- package/reports/old-passwords.yaml +35 -0
- package/reports/pending-reviews-by-reviewer.yaml +20 -0
- package/reports/person-access.yaml +31 -0
- package/reports/privileged-access.yaml +29 -0
- package/reports/provisioning-error-causes.yaml +27 -0
- package/reports/provisioning-errors.yaml +32 -0
- package/reports/provisioning-failures.yaml +28 -0
- package/reports/recent-access-requests.yaml +22 -0
- package/reports/recent-activity.yaml +32 -0
- package/reports/recent-leavers.yaml +34 -0
- package/reports/role-members.yaml +29 -0
- package/reports/role-membership-counts.yaml +18 -0
- package/reports/roles-without-owner.yaml +17 -0
- package/reports/sources-needing-attention.yaml +23 -0
- package/reports/stuck-access-requests.yaml +29 -0
- package/reports/team-access.yaml +30 -0
- package/reports/terminated-users-with-active-accounts.yaml +46 -0
- package/reports/uncorrelated-accounts.yaml +38 -0
- package/ui/js/00-setup.js +6 -0
- package/ui/js/01-small-helpers.js +143 -0
- package/ui/js/02-connection.js +150 -0
- package/ui/js/03-health-check.js +17 -0
- package/ui/js/04-library.js +135 -0
- package/ui/js/05-pickers.js +163 -0
- package/ui/js/06-report-view.js +157 -0
- package/ui/js/07-fields.js +85 -0
- package/ui/js/08-designer.js +360 -0
- package/ui/js/09-yaml.js +22 -0
- package/ui/js/10-instant-check.js +171 -0
- package/ui/js/11-lookup.js +161 -0
- package/ui/js/12-tenant.js +115 -0
- package/ui/js/13-source-configuration-and-diagnostics.js +64 -0
- package/ui/js/14-certifications.js +68 -0
- package/ui/js/15-monthly-report.js +24 -0
- package/ui/js/16-ownership.js +39 -0
- package/ui/js/17-compare-tenants.js +102 -0
- package/ui/js/18-audit.js +181 -0
- package/ui/js/19-insights.js +108 -0
- package/ui/js/20-role-mining.js +35 -0
- package/ui/js/21-share-reports.js +45 -0
- package/ui/js/22-partner-overview-all-customer-tenants.js +228 -0
- package/ui/js/23-in-app-guidance.js +217 -0
- package/ui/js/24-role-tools.js +220 -0
- package/ui/js/25-schedules.js +264 -0
- package/ui/js/26-start.js +7 -0
- package/ui/js/27-warnings.js +224 -0
- package/ui/js/28-audit-readiness.js +99 -0
- package/ui/js/29-lifecycle.js +182 -0
- package/ui/js/30-labs.js +265 -0
- package/ui/js/31-build.js +203 -0
- package/ui/js/32-lab-examples.js +148 -0
- package/ui/js/33-finder.js +89 -0
- package/ui/js/34-governance.js +129 -0
- package/ui/js/35-watch.js +266 -0
- package/ui/js/36-model.js +247 -0
- package/ui/js/37-logs-and-watch.js +224 -0
- package/ui/shell.html +112 -0
- package/ui/style.css +350 -0
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
// ---------- library ----------
|
|
2
|
+
function loadLibrary(selectId) {
|
|
3
|
+
return Promise.all([api('/api/reports'), state.catalog ? Promise.resolve(state.catalog) : api('/api/catalog')]).then(function (r) {
|
|
4
|
+
state.reports = r[0];
|
|
5
|
+
state.catalog = r[1];
|
|
6
|
+
var pick = selectId && state.reports.filter(function (x) { return x.definition.id === selectId; })[0];
|
|
7
|
+
if (pick) select(pick);
|
|
8
|
+
else { renderLibrary(); if (!state.current) renderHome(); }
|
|
9
|
+
}).catch(function (e) { $('main').textContent = ''; $('main').appendChild(el('div', { className: 'wrap' }, el('div', { className: 'error', text: errorText(e) }))); });
|
|
10
|
+
}
|
|
11
|
+
function matches(r, q) {
|
|
12
|
+
var d = r.definition;
|
|
13
|
+
return !q || (d.name + ' ' + (d.description || '') + ' ' + d.id + ' ' + (d.tags || []).join(' ') + ' ' + (d.category || '')).toLowerCase().indexOf(q) >= 0;
|
|
14
|
+
}
|
|
15
|
+
function grouped(q) {
|
|
16
|
+
var groups = {};
|
|
17
|
+
state.reports.forEach(function (r) {
|
|
18
|
+
if (!matches(r, q)) return;
|
|
19
|
+
var g = catOf(r);
|
|
20
|
+
(groups[g] = groups[g] || []).push(r);
|
|
21
|
+
});
|
|
22
|
+
var order = Object.keys(groups).sort(function (a, b) {
|
|
23
|
+
var ia = CAT_ORDER.indexOf(a), ib = CAT_ORDER.indexOf(b);
|
|
24
|
+
return (ia < 0 ? 99 : ia) - (ib < 0 ? 99 : ib) || a.localeCompare(b);
|
|
25
|
+
});
|
|
26
|
+
return { groups: groups, order: order };
|
|
27
|
+
}
|
|
28
|
+
function renderLibrary() {
|
|
29
|
+
var q = $('search').value.trim().toLowerCase();
|
|
30
|
+
var g = grouped(q);
|
|
31
|
+
var box = $('library');
|
|
32
|
+
box.textContent = '';
|
|
33
|
+
box.appendChild(el('button', { className: 'entry' + (!state.current ? ' active' : ''), onclick: goHome }, icon('grid'), ' All reports'));
|
|
34
|
+
g.order.forEach(function (name) {
|
|
35
|
+
box.appendChild(el('div', { className: 'group' },
|
|
36
|
+
el('div', { className: 'group-h' }, el('span', { text: name }), el('span', { className: 'count', text: String(g.groups[name].length) })),
|
|
37
|
+
g.groups[name].map(function (r) {
|
|
38
|
+
var active = state.current && state.current.source === r;
|
|
39
|
+
return el('button', { className: 'entry' + (active ? ' active' : ''), title: r.definition.description || '', text: r.definition.name, onclick: function () { select(r); } });
|
|
40
|
+
})));
|
|
41
|
+
});
|
|
42
|
+
if (!g.order.length) box.appendChild(el('div', { className: 'muted small', style: 'padding:10px', text: 'No report matches.' }));
|
|
43
|
+
}
|
|
44
|
+
$('search').addEventListener('input', function () { renderLibrary(); if (!state.current) renderHome(); });
|
|
45
|
+
function goHome() { state.current = null; renderLibrary(); renderHome(); }
|
|
46
|
+
|
|
47
|
+
function reportCard(r) {
|
|
48
|
+
var d = r.definition;
|
|
49
|
+
var params = Object.keys(d.params || {});
|
|
50
|
+
return el('button', { className: 'rcard', onclick: function () { select(r); } },
|
|
51
|
+
el('div', { className: 'top' }, catIcon(catOf(r)), el('h3', { text: d.name })),
|
|
52
|
+
el('p', { text: d.description || '' }),
|
|
53
|
+
el('div', { className: 'foot' }, el('span', { text: catOf(r) }), params.length ? el('span', { text: '· ' + params.length + (params.length === 1 ? ' option' : ' options') }) : null));
|
|
54
|
+
}
|
|
55
|
+
function renderHome() {
|
|
56
|
+
var m = $('main');
|
|
57
|
+
m.textContent = '';
|
|
58
|
+
var w = el('div', { className: 'wrap' });
|
|
59
|
+
m.appendChild(w);
|
|
60
|
+
var q = $('search').value.trim().toLowerCase();
|
|
61
|
+
var big = el('input', { className: 'input', placeholder: 'Search reports: orphan accounts, leavers, roles, passwords...', value: $('search').value });
|
|
62
|
+
big.addEventListener('input', function () { $('search').value = big.value; renderLibrary(); drawCards(); });
|
|
63
|
+
var builtins = state.reports.filter(function (r) { return !r.custom; }).length;
|
|
64
|
+
var mine = state.reports.length - builtins;
|
|
65
|
+
w.appendChild(el('div', { className: 'hero' },
|
|
66
|
+
el('h2', { text: 'What do you want to know about your tenant?' }),
|
|
67
|
+
el('p', { text: 'Pick a ready-made report, or build your own with point-and-click filters. Everything is read-only.' }),
|
|
68
|
+
el('div', { className: 'searchbox' }, icon('search'), big),
|
|
69
|
+
el('div', { className: 'hero-stats' },
|
|
70
|
+
el('div', {}, el('b', { text: String(builtins) }), 'ready-made reports'),
|
|
71
|
+
el('div', {}, el('b', { text: String(mine) }), 'my reports'),
|
|
72
|
+
el('div', {}, el('b', { text: String((state.catalog.datasets || []).length) }), 'kinds of data'),
|
|
73
|
+
el('button', { className: 'btn sm', style: 'align-self:center;margin-left:auto', onclick: sharePanel }, icon('copy'), 'Share reports: import / export'))));
|
|
74
|
+
var chips = el('div', { className: 'chips' });
|
|
75
|
+
var cards = el('div');
|
|
76
|
+
var glanceBox = el('div');
|
|
77
|
+
w.appendChild(glanceBox);
|
|
78
|
+
glance(glanceBox);
|
|
79
|
+
w.appendChild(el('div', { className: 'cards', style: 'margin-bottom:18px' },
|
|
80
|
+
el('button', { className: 'rcard', style: 'min-height:0', onclick: function () { showPage('checks'); } },
|
|
81
|
+
el('div', { className: 'top' }, catIcon('Operations'), el('h3', { text: 'Instant check' })), el('p', { text: 'Provisioning errors, failed aggregations, sources, leavers and more: every daily check in one click.' })),
|
|
82
|
+
el('button', { className: 'rcard', style: 'min-height:0', onclick: function () { state.lk.tab = 'person'; showPage('lookup'); } },
|
|
83
|
+
el('div', { className: 'top' }, catIcon('People'), el('h3', { text: 'Look up a person or source' })), el('p', { text: 'Accounts, access, recent failures and hints on one page: "why can\u2019t this person log in?"' })),
|
|
84
|
+
el('button', { className: 'rcard', style: 'min-height:0', onclick: function () { state.roleTab = 'compare'; showPage('roles'); } },
|
|
85
|
+
el('div', { className: 'top' }, catIcon('Access model'), el('h3', { text: 'Compare roles' })), el('p', { text: 'Side by side: shared and different access, overlap of members, how similar they are.' })),
|
|
86
|
+
el('button', { className: 'rcard', style: 'min-height:0', onclick: function () { state.roleTab = 'impact'; showPage('roles'); } },
|
|
87
|
+
el('div', { className: 'top' }, catIcon('Lifecycle'), el('h3', { text: 'Preview a role change' })), el('p', { text: 'Change membership criteria and see who would gain or lose the role, before you save it in ISC.' }))));
|
|
88
|
+
w.appendChild(chips);
|
|
89
|
+
w.appendChild(cards);
|
|
90
|
+
function drawCards() {
|
|
91
|
+
var qq = $('search').value.trim().toLowerCase();
|
|
92
|
+
var g = grouped(qq);
|
|
93
|
+
chips.textContent = '';
|
|
94
|
+
chips.appendChild(el('button', { className: 'chip' + (!state.homeCat ? ' active' : ''), text: 'All', onclick: function () { state.homeCat = ''; drawCards(); } }));
|
|
95
|
+
g.order.forEach(function (c) {
|
|
96
|
+
chips.appendChild(el('button', { className: 'chip' + (state.homeCat === c ? ' active' : ''), onclick: function () { state.homeCat = c; drawCards(); } }, c, el('span', { className: 'muted', text: String(g.groups[c].length) })));
|
|
97
|
+
});
|
|
98
|
+
cards.textContent = '';
|
|
99
|
+
if (!qq && !state.homeCat) {
|
|
100
|
+
var pop = POPULAR.map(function (id) { return state.reports.filter(function (r) { return r.definition.id === id; })[0]; }).filter(Boolean);
|
|
101
|
+
if (pop.length) {
|
|
102
|
+
cards.appendChild(el('div', { className: 'sec-h' }, el('h3', { text: 'Most used' }), el('span', { className: 'muted small', text: 'what IAM teams ask for most' })));
|
|
103
|
+
cards.appendChild(el('div', { className: 'cards' }, pop.map(reportCard)));
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
g.order.filter(function (c) { return !state.homeCat || c === state.homeCat; }).forEach(function (c) {
|
|
107
|
+
cards.appendChild(el('div', { className: 'sec-h' }, el('h3', { text: c }), el('span', { className: 'muted small', text: g.groups[c].length + ' reports' })));
|
|
108
|
+
cards.appendChild(el('div', { className: 'cards' }, g.groups[c].map(reportCard)));
|
|
109
|
+
});
|
|
110
|
+
if (!g.order.length) cards.appendChild(el('div', { className: 'empty' }, el('b', { text: 'No report matches "' + qq + '".' }), 'Try another word, or build it yourself with ', el('button', { className: 'btn link', text: 'New report', onclick: function () { $('btn-new').click(); } }), '.'));
|
|
111
|
+
}
|
|
112
|
+
drawCards();
|
|
113
|
+
if (q) big.focus();
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function select(r) {
|
|
117
|
+
state.current = { source: r, def: clone(r.definition), custom: r.custom, yaml: r.yaml };
|
|
118
|
+
state.result = null;
|
|
119
|
+
state.job = null;
|
|
120
|
+
state.dirty = false;
|
|
121
|
+
state.tab = 'run';
|
|
122
|
+
state.groupBy = '';
|
|
123
|
+
state.runError = null;
|
|
124
|
+
state.running = false;
|
|
125
|
+
state.paramValues = {};
|
|
126
|
+
var p = r.definition.params || {};
|
|
127
|
+
Object.keys(p).forEach(function (k) {
|
|
128
|
+
var d = p[k].default;
|
|
129
|
+
state.paramValues[k] = d === undefined ? (p[k].type === 'list' ? [] : '') : d;
|
|
130
|
+
});
|
|
131
|
+
renderLibrary();
|
|
132
|
+
renderMain();
|
|
133
|
+
$('main').scrollTop = 0;
|
|
134
|
+
}
|
|
135
|
+
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
// ---------- pickers ----------
|
|
2
|
+
function loadPick(kind) {
|
|
3
|
+
if (!state.picks[kind]) state.picks[kind] = api('/api/pick/' + kind).then(function (r) { return r.options; }).catch(function (e) { delete state.picks[kind]; throw e; });
|
|
4
|
+
return state.picks[kind];
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* A drop-down with search. opts: { options: Promise<[{value,label,hint}]> | array, multiple, value, onChange, placeholder, valueKey }
|
|
8
|
+
* valueKey 'label' stores the names instead of the IDs.
|
|
9
|
+
*/
|
|
10
|
+
function picker(opts) {
|
|
11
|
+
var multiple = !!opts.multiple;
|
|
12
|
+
var key = opts.valueKey || 'value';
|
|
13
|
+
var selected = multiple ? (Array.isArray(opts.value) ? opts.value.slice() : opts.value ? String(opts.value).split(',').map(function (s) { return s.trim(); }).filter(Boolean) : []) : (opts.value ? [String(opts.value)] : []);
|
|
14
|
+
var all = null, failed = null;
|
|
15
|
+
var wrap = el('div', { className: 'picker' });
|
|
16
|
+
var btn = el('button', { type: 'button', className: 'picker-btn' });
|
|
17
|
+
wrap.appendChild(btn);
|
|
18
|
+
var pop = null;
|
|
19
|
+
function labelOf(v) {
|
|
20
|
+
if (!all) return v;
|
|
21
|
+
var o = all.filter(function (x) { return x[key] === v; })[0];
|
|
22
|
+
return o ? o.label : v;
|
|
23
|
+
}
|
|
24
|
+
function emit() { opts.onChange(multiple ? selected.slice() : (selected[0] || '')); }
|
|
25
|
+
function drawBtn() {
|
|
26
|
+
btn.textContent = '';
|
|
27
|
+
if (!selected.length) btn.appendChild(el('span', { className: 'ph', text: opts.placeholder || (multiple ? 'All (pick to narrow)' : 'Choose...') }));
|
|
28
|
+
selected.forEach(function (v) {
|
|
29
|
+
btn.appendChild(el('span', { className: 'tok' }, el('span', { text: labelOf(v) }), el('button', { type: 'button', title: 'Remove', text: '×', onclick: function (e) {
|
|
30
|
+
e.stopPropagation();
|
|
31
|
+
selected = selected.filter(function (x) { return x !== v; });
|
|
32
|
+
drawBtn(); emit(); if (pop) drawList();
|
|
33
|
+
} })));
|
|
34
|
+
});
|
|
35
|
+
btn.appendChild(el('span', { className: 'chev' }, icon('chev')));
|
|
36
|
+
}
|
|
37
|
+
var search, list, foot;
|
|
38
|
+
function drawList() {
|
|
39
|
+
list.textContent = '';
|
|
40
|
+
if (failed) { list.appendChild(el('div', { className: 'error', text: failed })); return; }
|
|
41
|
+
if (!all) { list.appendChild(el('div', { className: 'progress' }, el('span', { className: 'spinner' }), 'Loading from your tenant...')); return; }
|
|
42
|
+
var q = search.value.trim().toLowerCase();
|
|
43
|
+
var shown = all.filter(function (o) { return !q || (o.label + ' ' + (o.hint || '')).toLowerCase().indexOf(q) >= 0; });
|
|
44
|
+
shown.slice(0, 300).forEach(function (o) {
|
|
45
|
+
var on = selected.indexOf(o[key]) >= 0;
|
|
46
|
+
var row = el('label', { className: 'opt' });
|
|
47
|
+
if (multiple) row.appendChild(el('input', { type: 'checkbox', checked: on }));
|
|
48
|
+
row.appendChild(el('span', { text: o.label, style: on && !multiple ? 'font-weight:600;color:var(--accent)' : '' }));
|
|
49
|
+
if (o.hint) row.appendChild(el('span', { className: 'hint', text: o.hint }));
|
|
50
|
+
row.addEventListener('click', function (e) {
|
|
51
|
+
e.preventDefault();
|
|
52
|
+
if (multiple) {
|
|
53
|
+
if (on) selected = selected.filter(function (x) { return x !== o[key]; }); else selected.push(o[key]);
|
|
54
|
+
drawList();
|
|
55
|
+
} else { selected = [o[key]]; close(); }
|
|
56
|
+
drawBtn(); emit();
|
|
57
|
+
});
|
|
58
|
+
list.appendChild(row);
|
|
59
|
+
});
|
|
60
|
+
if (!shown.length) list.appendChild(el('div', { className: 'muted small', style: 'padding:8px', text: 'Nothing matches.' }));
|
|
61
|
+
if (shown.length > 300) list.appendChild(el('div', { className: 'muted small', style: 'padding:8px', text: 'Showing 300 of ' + shown.length + '. Type to narrow.' }));
|
|
62
|
+
foot.textContent = '';
|
|
63
|
+
foot.appendChild(el('span', { text: all.length + ' in your tenant' + (multiple ? ' · ' + selected.length + ' picked' : '') }));
|
|
64
|
+
if (selected.length) foot.appendChild(el('button', { type: 'button', className: 'btn link', text: 'Clear', onclick: function () { selected = []; drawBtn(); emit(); drawList(); } }));
|
|
65
|
+
}
|
|
66
|
+
function open() {
|
|
67
|
+
if (pop) return;
|
|
68
|
+
search = el('input', { className: 'input', placeholder: 'Search...' });
|
|
69
|
+
list = el('div', { className: 'pop-list' });
|
|
70
|
+
foot = el('div', { className: 'pop-foot' });
|
|
71
|
+
pop = el('div', { className: 'pop' }, search, list, foot);
|
|
72
|
+
wrap.appendChild(pop);
|
|
73
|
+
search.addEventListener('input', drawList);
|
|
74
|
+
search.addEventListener('keydown', function (e) { if (e.key === 'Escape') close(); });
|
|
75
|
+
drawList();
|
|
76
|
+
setTimeout(function () { search.focus(); document.addEventListener('mousedown', outside); }, 0);
|
|
77
|
+
}
|
|
78
|
+
function close() { if (pop) { pop.remove(); pop = null; document.removeEventListener('mousedown', outside); } }
|
|
79
|
+
function outside(e) { if (!wrap.contains(e.target)) close(); }
|
|
80
|
+
btn.addEventListener('click', function () { if (pop) close(); else open(); });
|
|
81
|
+
Promise.resolve(opts.options).then(function (o) { all = o; drawBtn(); if (pop) drawList(); }, function (e) { failed = errorText(e); if (pop) drawList(); });
|
|
82
|
+
drawBtn();
|
|
83
|
+
return wrap;
|
|
84
|
+
}
|
|
85
|
+
/** Free-text list with suggestions: type and press Enter or comma. */
|
|
86
|
+
function tokenInput(opts) {
|
|
87
|
+
var values = Array.isArray(opts.value) ? opts.value.slice() : opts.value ? String(opts.value).split(',').map(function (s) { return s.trim(); }).filter(Boolean) : [];
|
|
88
|
+
var id = 'dl' + Math.random().toString(36).slice(2);
|
|
89
|
+
var input = el('input', { placeholder: values.length ? '' : (opts.placeholder || 'Type and press Enter'), 'aria-label': opts.label || opts.placeholder || 'Add a value (press Enter)', list: opts.suggestions && opts.suggestions.length ? id : null });
|
|
90
|
+
var box = el('div', { className: 'tokinput' });
|
|
91
|
+
function draw() {
|
|
92
|
+
box.textContent = '';
|
|
93
|
+
values.forEach(function (v) {
|
|
94
|
+
box.appendChild(el('span', { className: 'tok' }, el('span', { text: v }), el('button', { type: 'button', text: '×', 'aria-label': 'Remove ' + v, onclick: function () { values = values.filter(function (x) { return x !== v; }); draw(); opts.onChange(values.slice()); } })));
|
|
95
|
+
});
|
|
96
|
+
input.placeholder = values.length ? '' : (opts.placeholder || 'Type and press Enter');
|
|
97
|
+
box.appendChild(input);
|
|
98
|
+
if (opts.suggestions && opts.suggestions.length) box.appendChild(el('datalist', { id: id }, opts.suggestions.map(function (s) { return el('option', { value: s }); })));
|
|
99
|
+
}
|
|
100
|
+
function commit() {
|
|
101
|
+
input.value.split(',').map(function (s) { return s.trim(); }).filter(Boolean).forEach(function (v) { if (values.indexOf(v) < 0) values.push(v); });
|
|
102
|
+
input.value = '';
|
|
103
|
+
draw(); opts.onChange(values.slice()); input.focus();
|
|
104
|
+
}
|
|
105
|
+
input.addEventListener('keydown', function (e) {
|
|
106
|
+
if (e.key === 'Enter' || e.key === ',') { e.preventDefault(); commit(); }
|
|
107
|
+
else if (e.key === 'Backspace' && !input.value && values.length) { values.pop(); draw(); opts.onChange(values.slice()); input.focus(); }
|
|
108
|
+
});
|
|
109
|
+
input.addEventListener('change', function () { if (input.value.trim()) commit(); });
|
|
110
|
+
input.addEventListener('blur', function () { if (input.value.trim()) commit(); });
|
|
111
|
+
box.addEventListener('click', function (e) { if (e.target === box) input.focus(); });
|
|
112
|
+
draw();
|
|
113
|
+
return box;
|
|
114
|
+
}
|
|
115
|
+
/** Values seen in the tenant for the field a parameter filters on (for suggestions). */
|
|
116
|
+
function suggestionsFor(d, name) {
|
|
117
|
+
if (!d || !state.catalog) return [];
|
|
118
|
+
var field = null;
|
|
119
|
+
(function walk(c) {
|
|
120
|
+
if (!c || field) return;
|
|
121
|
+
if (c.all || c.any) (c.all || c.any).forEach(walk);
|
|
122
|
+
else if (c.not) walk(c.not);
|
|
123
|
+
else if (c.value === '${' + name + '}') field = c.field;
|
|
124
|
+
})({ all: [d.where, d.filter, d.expand && d.expand.where].filter(Boolean) });
|
|
125
|
+
if (!field) return [];
|
|
126
|
+
var disc = state.disc[d.from.dataset];
|
|
127
|
+
if (!disc || !disc.fields) { ensureDisc(d.from.dataset); return []; }
|
|
128
|
+
return fieldInfo(d, field).values || [];
|
|
129
|
+
}
|
|
130
|
+
/** The input for one report parameter. */
|
|
131
|
+
function paramInput(p, value, onChange, suggestions) {
|
|
132
|
+
if (p.pick) return picker({ options: loadPick(p.pick), multiple: p.type === 'list', value: value, onChange: onChange, placeholder: p.type === 'list' ? (p.required ? 'Pick one or more' : 'All (pick to narrow)') : 'Choose...' });
|
|
133
|
+
if (p.options) {
|
|
134
|
+
if (p.type === 'list') return picker({ options: p.options.map(function (o) { return { value: o, label: o }; }), multiple: true, value: value, onChange: onChange });
|
|
135
|
+
var s = el('select', { className: 'input' }, el('option', { value: '', text: p.required ? 'Choose...' : '(any)' }), p.options.map(function (o) { return el('option', { value: o, text: o }); }));
|
|
136
|
+
s.value = value || '';
|
|
137
|
+
s.addEventListener('change', function () { onChange(s.value); });
|
|
138
|
+
return s;
|
|
139
|
+
}
|
|
140
|
+
if (p.type === 'list') return tokenInput({ value: value, onChange: onChange, suggestions: suggestions, placeholder: suggestions && suggestions.length ? 'e.g. ' + suggestions.slice(0, 3).join(', ') : 'Type a value and press Enter' });
|
|
141
|
+
if (p.type === 'boolean') {
|
|
142
|
+
var b = el('select', { className: 'input' }, el('option', { value: '', text: '(default)' }), el('option', { value: 'true', text: 'Yes' }), el('option', { value: 'false', text: 'No' }));
|
|
143
|
+
b.value = value === true ? 'true' : value === false ? 'false' : String(value || '');
|
|
144
|
+
b.addEventListener('change', function () { onChange(b.value); });
|
|
145
|
+
return b;
|
|
146
|
+
}
|
|
147
|
+
var dlId = suggestions && suggestions.length && p.type !== 'number' ? 'pv' + Math.random().toString(36).slice(2) : null;
|
|
148
|
+
var i = el('input', { className: 'input', type: p.type === 'number' ? 'number' : 'text', value: value === undefined || value === null ? '' : String(value), list: dlId });
|
|
149
|
+
i.addEventListener('input', function () { onChange(i.value); });
|
|
150
|
+
if (!dlId) return i;
|
|
151
|
+
return el('div', {}, i, el('datalist', { id: dlId }, suggestions.map(function (v) { return el('option', { value: v }); })));
|
|
152
|
+
}
|
|
153
|
+
function paramsGrid(params, values, onChange, def) {
|
|
154
|
+
var names = Object.keys(params || {});
|
|
155
|
+
if (!names.length) return null;
|
|
156
|
+
return el('div', { className: 'grid' }, names.map(function (k) {
|
|
157
|
+
var p = params[k];
|
|
158
|
+
return el('label', { className: 'field', onclick: function (e) { if (e.target.tagName === 'LABEL') e.preventDefault(); } },
|
|
159
|
+
el('span', { className: 'lbl' }, p.description || k, p.required ? el('span', { className: 'req', text: '*' }) : null),
|
|
160
|
+
paramInput(p, values[k], function (v) { values[k] = v; if (onChange) onChange(k, v); }, def ? suggestionsFor(def, k) : null));
|
|
161
|
+
}));
|
|
162
|
+
}
|
|
163
|
+
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
// ---------- report view ----------
|
|
2
|
+
function renderMain() {
|
|
3
|
+
var m = $('main');
|
|
4
|
+
var keep = m.scrollTop;
|
|
5
|
+
m.textContent = '';
|
|
6
|
+
var c = state.current;
|
|
7
|
+
if (!c) { renderHome(); return; }
|
|
8
|
+
var d = c.def;
|
|
9
|
+
var w = el('div', { className: 'wrap' });
|
|
10
|
+
m.appendChild(w);
|
|
11
|
+
var cat = c.custom ? 'My reports' : (d.category || 'Other');
|
|
12
|
+
w.appendChild(el('div', { className: 'crumbs' }, el('button', { text: 'All reports', onclick: goHome }), '/', el('span', { text: cat })));
|
|
13
|
+
w.appendChild(el('div', { className: 'rhead' }, catIcon(cat), el('div', { style: 'flex:1' },
|
|
14
|
+
el('h2', { text: d.name || 'New report' }),
|
|
15
|
+
d.description ? el('p', { className: 'desc', text: d.description }) : null,
|
|
16
|
+
(d.tags && d.tags.length) ? el('div', { style: 'margin-top:8px' }, d.tags.map(function (t) { return el('span', { className: 'tag', text: t }); })) : null)));
|
|
17
|
+
var tabs = el('div', { className: 'tabs' });
|
|
18
|
+
[['run', 'Run', 'play'], ['design', c.custom ? 'Design' : 'Customize', 'sliders'], ['yaml', 'YAML', 'code']].forEach(function (t) {
|
|
19
|
+
tabs.appendChild(el('button', { className: 'tab' + (state.tab === t[0] ? ' active' : ''), onclick: function () { state.tab = t[0]; renderMain(); } }, icon(t[2]), t[1]));
|
|
20
|
+
});
|
|
21
|
+
w.appendChild(tabs);
|
|
22
|
+
if (state.tab === 'run') renderRun(w);
|
|
23
|
+
else if (state.tab === 'design') renderDesign(w);
|
|
24
|
+
else renderYaml(w);
|
|
25
|
+
m.scrollTop = keep;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function renderRun(w) {
|
|
29
|
+
var c = state.current, d = c.def;
|
|
30
|
+
var card = el('section', { className: 'card' });
|
|
31
|
+
var grid = paramsGrid(d.params, state.paramValues, null, d);
|
|
32
|
+
if (grid) card.appendChild(el('div', { className: 'card-h' }, el('h3', {}, icon('sliders'), 'Options')));
|
|
33
|
+
if (grid) card.appendChild(grid);
|
|
34
|
+
var groupSel = el('select', { className: 'input' }, el('option', { value: '', text: 'Every row' }), fieldChoices(d, true).map(function (g) {
|
|
35
|
+
return el('optgroup', { label: g.label }, g.fields.map(function (o) { return el('option', { value: o.value, text: 'Count by ' + o.label }); }));
|
|
36
|
+
}));
|
|
37
|
+
groupSel.value = state.groupBy || '';
|
|
38
|
+
groupSel.addEventListener('change', function () { state.groupBy = groupSel.value; });
|
|
39
|
+
card.appendChild(el('div', { className: 'runbar', style: grid ? '' : 'margin-top:0;padding-top:0;border-top:none' },
|
|
40
|
+
el('label', { className: 'field' }, el('span', { className: 'lbl', text: 'Show' }), groupSel),
|
|
41
|
+
el('button', { className: 'btn', title: 'Reads only the first 500 records, to check the report quickly', onclick: function () { run(500); } }, icon('eye'), 'Preview'),
|
|
42
|
+
el('button', { className: 'btn primary', onclick: function () { run(); } }, icon('play'), 'Run report'),
|
|
43
|
+
el('span', { className: 'spacer' }),
|
|
44
|
+
c.isNew ? null : el('button', { className: 'btn ghost', title: 'Send it by email or Teams on a schedule', onclick: function () {
|
|
45
|
+
state.editing = { isNew: true, report: d.id, params: clone(state.paramValues || {}) };
|
|
46
|
+
showPage('schedules');
|
|
47
|
+
} }, icon('clock'), 'Schedule this report')));
|
|
48
|
+
w.appendChild(card);
|
|
49
|
+
var out = el('div', { id: 'run-out' });
|
|
50
|
+
w.appendChild(out);
|
|
51
|
+
renderResult();
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function paramsForRun() {
|
|
55
|
+
var out = {};
|
|
56
|
+
Object.keys(state.paramValues || {}).forEach(function (k) {
|
|
57
|
+
var v = state.paramValues[k];
|
|
58
|
+
if (v === '' || v === null || v === undefined || (Array.isArray(v) && !v.length)) return;
|
|
59
|
+
out[k] = v;
|
|
60
|
+
});
|
|
61
|
+
return out;
|
|
62
|
+
}
|
|
63
|
+
function run(preview) {
|
|
64
|
+
var c = state.current;
|
|
65
|
+
var params = paramsForRun();
|
|
66
|
+
Object.keys(params).forEach(function (k) { if (!c.def.params || !c.def.params[k]) delete params[k]; });
|
|
67
|
+
var body = { definition: c.def, params: params, preview: preview, groupBy: state.groupBy && state.tab === 'run' ? [state.groupBy] : [] };
|
|
68
|
+
state.result = null;
|
|
69
|
+
state.runError = null;
|
|
70
|
+
state.progress = 'Starting...';
|
|
71
|
+
state.running = true;
|
|
72
|
+
state.sortCol = null;
|
|
73
|
+
state.quick = '';
|
|
74
|
+
renderResult();
|
|
75
|
+
api('/api/run', 'POST', body).then(function (r) {
|
|
76
|
+
state.job = r.job;
|
|
77
|
+
poll(r.job);
|
|
78
|
+
}).catch(function (e) { state.running = false; state.runError = errorText(e); renderResult(); });
|
|
79
|
+
}
|
|
80
|
+
function poll(job) {
|
|
81
|
+
state.activeJob = job;
|
|
82
|
+
api('/api/jobs/' + job).then(function (s) {
|
|
83
|
+
if (state.job !== job) return;
|
|
84
|
+
if (s.state === 'running') {
|
|
85
|
+
state.progress = s.progress + ' · ' + s.seconds + 's';
|
|
86
|
+
renderResult();
|
|
87
|
+
setTimeout(function () { poll(job); }, 700);
|
|
88
|
+
} else {
|
|
89
|
+
state.running = false;
|
|
90
|
+
if (s.state === 'error') state.runError = s.error;
|
|
91
|
+
else state.result = s.result;
|
|
92
|
+
renderResult();
|
|
93
|
+
}
|
|
94
|
+
}).catch(function (e) { state.running = false; state.runError = errorText(e); renderResult(); });
|
|
95
|
+
}
|
|
96
|
+
function cellText(v) { return v === null || v === undefined ? '' : typeof v === 'boolean' ? (v ? 'Yes' : 'No') : typeof v === 'number' ? fmtNum(v) : String(v); }
|
|
97
|
+
function renderResult() {
|
|
98
|
+
var out = $('run-out');
|
|
99
|
+
if (!out) return;
|
|
100
|
+
out.textContent = '';
|
|
101
|
+
if (state.running) {
|
|
102
|
+
out.appendChild(el('section', { className: 'card' }, el('div', { className: 'progress', style: 'margin:0' }, el('span', { className: 'spinner' }), el('span', { text: state.progress, style: 'flex:1' }), stopButton())));
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
if (state.runError) { out.appendChild(el('div', { className: 'error', text: state.runError })); return; }
|
|
106
|
+
var r = state.result;
|
|
107
|
+
if (!r) {
|
|
108
|
+
out.appendChild(el('div', { className: 'empty' }, el('b', { text: 'Ready when you are' }), 'Press Preview for a quick look at the first 500 records, or Run report for the full result.'));
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
var dl = function (f, label, primary) {
|
|
112
|
+
return el('a', { className: 'btn sm' + (primary ? ' primary' : ''), href: '/api/jobs/' + state.job + '/download?format=' + f + '&k=' + encodeURIComponent(KEY), download: '' }, icon('download'), label);
|
|
113
|
+
};
|
|
114
|
+
var quick = el('input', { className: 'input', placeholder: 'Filter these rows...', value: state.quick || '', style: 'width:230px;padding:6px 10px' });
|
|
115
|
+
var card = el('section', { className: 'card', style: 'padding:16px' });
|
|
116
|
+
card.appendChild(el('div', { className: 'stats' },
|
|
117
|
+
el('div', { className: 'stat' }, el('b', { text: fmtNum(r.total) }), el('span', { text: r.total === 1 ? 'row' : 'rows' })),
|
|
118
|
+
el('div', { className: 'stat' }, el('b', { text: (r.durationMs / 1000).toFixed(1) + 's' }), el('span', { text: 'to run' })),
|
|
119
|
+
el('span', { className: 'spacer', style: 'flex:1' }),
|
|
120
|
+
r.total ? quick : null,
|
|
121
|
+
dl('xlsx', 'Excel', true), dl('csv', 'CSV'), dl('html', 'HTML')));
|
|
122
|
+
r.warnings.forEach(function (x) { card.appendChild(el('div', { className: 'note', text: x })); });
|
|
123
|
+
if (r.total > r.shown) card.appendChild(el('div', { className: 'note', text: 'Showing the first ' + fmtNum(r.shown) + ' rows here. Downloads contain all ' + fmtNum(r.total) + '.' }));
|
|
124
|
+
out.appendChild(card);
|
|
125
|
+
if (!r.total) { card.appendChild(el('div', { className: 'empty' }, el('b', { text: 'No rows' }), 'Nothing in the tenant matches this report. That can be good news.')); return; }
|
|
126
|
+
var tableBox = el('div', { className: 'table-wrap' });
|
|
127
|
+
card.appendChild(tableBox);
|
|
128
|
+
function drawTable() {
|
|
129
|
+
var q = (state.quick || '').toLowerCase();
|
|
130
|
+
var rows = r.rows.filter(function (row) { return !q || row.some(function (v) { return cellText(v).toLowerCase().indexOf(q) >= 0; }); });
|
|
131
|
+
if (state.sortCol !== null && state.sortCol !== undefined) {
|
|
132
|
+
var i = state.sortCol, dir = state.sortDir;
|
|
133
|
+
rows = rows.slice().sort(function (a, b) {
|
|
134
|
+
var x = a[i], y = b[i];
|
|
135
|
+
if (x === null || x === '') return 1; if (y === null || y === '') return -1;
|
|
136
|
+
if (typeof x === 'number' && typeof y === 'number') return (x - y) * dir;
|
|
137
|
+
return String(x).localeCompare(String(y), 'en', { numeric: true, sensitivity: 'base' }) * dir;
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
tableBox.textContent = '';
|
|
141
|
+
tableBox.appendChild(el('table', {},
|
|
142
|
+
el('thead', {}, el('tr', {}, r.columns.map(function (col, i) {
|
|
143
|
+
return el('th', { title: 'Sort', onclick: function () { state.sortDir = state.sortCol === i ? -state.sortDir : 1; state.sortCol = i; drawTable(); } },
|
|
144
|
+
col.label, state.sortCol === i ? el('span', { className: 'arrow', text: state.sortDir > 0 ? '▲' : '▼' }) : null);
|
|
145
|
+
}))),
|
|
146
|
+
el('tbody', {}, rows.map(function (row) {
|
|
147
|
+
return el('tr', {}, row.map(function (v) {
|
|
148
|
+
if (typeof v === 'boolean') return el('td', {}, el('span', { className: v ? 'yes' : 'no', text: v ? 'Yes' : 'No' }));
|
|
149
|
+
return el('td', { className: typeof v === 'number' ? 'num' : v === null || v === '' ? 'empty-cell' : '', text: v === null || v === '' ? '—' : cellText(v) });
|
|
150
|
+
}));
|
|
151
|
+
}))));
|
|
152
|
+
if (!rows.length) tableBox.appendChild(el('div', { className: 'empty', text: 'No shown row contains "' + state.quick + '".' }));
|
|
153
|
+
}
|
|
154
|
+
quick.addEventListener('input', function () { state.quick = quick.value; drawTable(); });
|
|
155
|
+
drawTable();
|
|
156
|
+
}
|
|
157
|
+
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
// ---------- fields ----------
|
|
2
|
+
var ALIAS_LABEL = { profile: 'Identity profile', mapping: 'Mapping', identity: 'Person', account: 'Account', access: 'Access item', entitlement: 'Entitlement', source: 'Source', role: 'Role', accessProfile: 'Access profile', event: 'Audit event', activity: 'Account activity', campaign: 'Campaign', item: 'Review item', request: 'Access request', request2: 'Request' };
|
|
3
|
+
function datasetOf(name) { return state.catalog.datasets.filter(function (d) { return d.name === name; })[0]; }
|
|
4
|
+
function ensureDisc(dataset) {
|
|
5
|
+
if (state.disc[dataset]) return;
|
|
6
|
+
state.disc[dataset] = { loading: true };
|
|
7
|
+
api('/api/discover/' + dataset).then(function (r) { state.disc[dataset] = r; }, function (e) { state.disc[dataset] = { error: errorText(e) }; })
|
|
8
|
+
.then(function () {
|
|
9
|
+
if (state.page === 'build' && state.bt && state.bt.tab === 'roles' && dataset === 'identities' && !state.imp.busy) { renderBuild(); return; }
|
|
10
|
+
if (!$('roles').classList.contains('hidden')) { if (dataset === 'identities' && ((state.roleTab === 'impact' && !state.imp.busy) || (state.roleTab === 'mining' && !state.mn.busy))) renderRoles(); return; }
|
|
11
|
+
if (state.current && !state.running && state.tab !== 'yaml' && state.current.def.from.dataset === dataset) renderMain();
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
/** Field choices grouped by alias. Each field: { value, label, type, values, path }. */
|
|
15
|
+
function fieldChoices(d, forCounting) {
|
|
16
|
+
var ds = datasetOf(d.from.dataset);
|
|
17
|
+
if (!ds) return [];
|
|
18
|
+
var disc = state.disc[d.from.dataset];
|
|
19
|
+
var discOk = disc && disc.fields;
|
|
20
|
+
var groups = [];
|
|
21
|
+
function addGroup(alias, label, catalog, found) {
|
|
22
|
+
var byPath = {};
|
|
23
|
+
(found || []).forEach(function (f) { byPath[f.path] = f; });
|
|
24
|
+
var known = [], extra = [];
|
|
25
|
+
(catalog || []).forEach(function (f) {
|
|
26
|
+
if (f.type === 'object' || (forCounting && f.type === 'list' && !f.expandable && f.path !== 'tags')) return;
|
|
27
|
+
if (f.expandable) return;
|
|
28
|
+
var df = byPath[f.path];
|
|
29
|
+
known.push({ value: alias + '.' + f.path, label: f.label, type: f.type, values: df ? df.values : [], path: f.path });
|
|
30
|
+
});
|
|
31
|
+
(found || []).forEach(function (f) {
|
|
32
|
+
if (f.known || f.type === 'object') return;
|
|
33
|
+
if ((catalog || []).some(function (c) { return c.path === f.path || f.path.indexOf(c.path + '.') === 0 && c.expandable; })) return;
|
|
34
|
+
extra.push({ value: alias + '.' + f.path, label: f.label, type: f.type, values: f.values, path: f.path });
|
|
35
|
+
});
|
|
36
|
+
if (known.length) groups.push({ label: label, fields: known });
|
|
37
|
+
if (extra.length) groups.push({ label: label + ': more found in your tenant', fields: extra });
|
|
38
|
+
}
|
|
39
|
+
var root = d.from.as || ds.alias;
|
|
40
|
+
addGroup(root, ALIAS_LABEL[root] || ds.label, ds.fields, discOk ? disc.fields : null);
|
|
41
|
+
if (d.expand) {
|
|
42
|
+
var key = d.expand.path.split('.').slice(1).join('.');
|
|
43
|
+
var items = ds.itemFields && ds.itemFields[key];
|
|
44
|
+
if (items) addGroup(d.expand.as, ALIAS_LABEL[d.expand.as] || d.expand.as, items, discOk && disc.items ? disc.items[key] : null);
|
|
45
|
+
}
|
|
46
|
+
(d.joins || []).forEach(function (j) {
|
|
47
|
+
var jd = datasetOf(j.dataset);
|
|
48
|
+
if (jd) addGroup(j.as, (ALIAS_LABEL[j.as] || jd.label) + ' (looked up)', jd.fields, null);
|
|
49
|
+
});
|
|
50
|
+
return groups;
|
|
51
|
+
}
|
|
52
|
+
function flatFields(d) { return [].concat.apply([], fieldChoices(d).map(function (g) { return g.fields; })); }
|
|
53
|
+
function fieldInfo(d, value) {
|
|
54
|
+
var f = flatFields(d).filter(function (x) { return x.value === value; })[0];
|
|
55
|
+
return f || { value: value, label: value, type: 'string', values: [] };
|
|
56
|
+
}
|
|
57
|
+
function fieldSelect(d, value, onChange, opts) {
|
|
58
|
+
opts = opts || {};
|
|
59
|
+
var s = el('select', { className: 'input' });
|
|
60
|
+
if (opts.empty) s.appendChild(el('option', { value: '', text: opts.empty }));
|
|
61
|
+
var found = false;
|
|
62
|
+
fieldChoices(d, opts.counting).forEach(function (g) {
|
|
63
|
+
s.appendChild(el('optgroup', { label: g.label }, g.fields.map(function (f) { if (f.value === value) found = true; return el('option', { value: f.value, text: f.label }); })));
|
|
64
|
+
});
|
|
65
|
+
if (value && !found) s.insertBefore(el('option', { value: value, text: value }), s.firstChild);
|
|
66
|
+
s.value = value || '';
|
|
67
|
+
s.addEventListener('change', function () { onChange(s.value); });
|
|
68
|
+
return s;
|
|
69
|
+
}
|
|
70
|
+
function isSourceId(path) { return /(^|\.)source\.id$|(^|\.)sourceId$/.test(path); }
|
|
71
|
+
function isSourceName(path) { return /(^|\.)source\.name$|(^|\.)sourceName$|(^|\.)source\.displayableName$/.test(path); }
|
|
72
|
+
function formatFor(type) { return type === 'date' ? 'date' : type === 'boolean' ? 'boolean' : type === 'number' ? 'number' : type === 'list' ? 'list' : undefined; }
|
|
73
|
+
|
|
74
|
+
// operators shown for each kind of field
|
|
75
|
+
var OPS_BY_TYPE = {
|
|
76
|
+
string: [['eq', 'is'], ['ne', 'is not'], ['in', 'is one of'], ['notIn', 'is none of'], ['contains', 'contains'], ['notContains', 'does not contain'], ['startsWith', 'starts with'], ['endsWith', 'ends with'], ['exists', 'has a value'], ['missing', 'is empty'], ['matches', 'matches pattern']],
|
|
77
|
+
list: [['eq', 'includes'], ['in', 'includes one of'], ['notIn', 'includes none of'], ['contains', 'has an item containing'], ['exists', 'is not empty'], ['missing', 'is empty']],
|
|
78
|
+
boolean: [['isTrue', 'is Yes'], ['isFalse', 'is No'], ['missing', 'is empty']],
|
|
79
|
+
number: [['eq', '='], ['ne', '≠'], ['gt', '>'], ['gte', '≥'], ['lt', '<'], ['lte', '≤'], ['exists', 'has a value'], ['missing', 'is empty']],
|
|
80
|
+
date: [['newerThanDays', 'in the last (days)'], ['olderThanDays', 'more than (days) ago'], ['exists', 'has a value'], ['missing', 'is empty']]
|
|
81
|
+
};
|
|
82
|
+
function opsFor(type) { return OPS_BY_TYPE[type] || OPS_BY_TYPE.string; }
|
|
83
|
+
function needsValue(op) { var o = state.catalog.operators.filter(function (x) { return x.op === op; })[0]; return o ? o.needsValue : true; }
|
|
84
|
+
var ASK = /^\$\{([A-Za-z_][A-Za-z0-9_]*)\}$/;
|
|
85
|
+
|