@digital-realty/ui-launchpad 12.0.9 → 12.0.11-IXUAT-11025.543132

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/README.md CHANGED
@@ -22,9 +22,67 @@ npm init @open-wc
22
22
  - `build` builds your app and outputs it in your `dist` directory
23
23
  - `test` runs your test suite with Web Test Runner
24
24
  - `lint` runs the linter for your project
25
+ - `npm run test:acceptance:ui` run acceptance tests
26
+ - `npx playwright test --config=playwright.config.ts --ui` run acceptance checks in playwright ui mode
25
27
 
26
28
  ## Tooling configs
27
29
 
28
30
  For most of the tools, the configuration is in the `package.json` to reduce the amount of files in your project.
29
31
 
30
- If you customize the configuration a lot, you can consider moving them to individual files.
32
+ If you customize the configuration a lot, you can consider moving them to individual files.
33
+
34
+ ## Permissions
35
+
36
+ The launchpad gates widgets and nav items via `validatePermission()` in
37
+ [`src/helpers/permissions-helper.ts`](src/helpers/permissions-helper.ts),
38
+ which compares the user's privilege against
39
+ [`PrivilegeLevelEnum`](src/enums/permissions-enum.ts):
40
+
41
+ ```ts
42
+ APPROVE = 5
43
+ CREATE = 4
44
+ DELETE = 3
45
+ UPDATE = 2
46
+ READ = 1
47
+ ```
48
+
49
+ The check is `userLevel >= requiredPermission`, so the levels form a strict
50
+ hierarchy — a higher privilege automatically satisfies every check at or below
51
+ it:
52
+
53
+ | User has | Passes a check for |
54
+ | -------- | ------------------------------------- |
55
+ | APPROVE | APPROVE, CREATE, DELETE, UPDATE, READ |
56
+ | CREATE | CREATE, DELETE, UPDATE, READ |
57
+ | DELETE | DELETE, UPDATE, READ |
58
+ | UPDATE | UPDATE, READ |
59
+ | READ | READ only |
60
+
61
+ Two things worth knowing when writing tests or new gated UI:
62
+
63
+ - **The ordering is a domain choice, not a JS convention.** This codebase
64
+ treats `CREATE` as stronger than `DELETE` and `APPROVE` as the top of the
65
+ pile. If you're integrating with an API that uses the same words with a
66
+ different precedence, the numbers will not agree.
67
+ - **The hierarchy is enforced client-side only.** It controls which UI is
68
+ rendered; the server still applies its own authorisation rules.
69
+
70
+ ### How the permissions list is collapsed
71
+
72
+ `getPermissions()` in [`src/launchpad/api-client.js`](src/launchpad/api-client.js)
73
+ fetches `/usermanagement/my-permissions` and reduces the array into a flat
74
+ `{ permission_name: privilege }` map. The reducer is **last-write-wins** by
75
+ `permission_name` — `account_number` is ignored. If the same permission name
76
+ appears for multiple accounts, only the entry that comes last in the response
77
+ survives.
78
+
79
+ The two exceptions are `Visitor Access` and `Permanent Badge`, which use
80
+ `keepHighestPrivilege` and so retain the strongest privilege across
81
+ duplicates.
82
+
83
+ ### User permission (single, was External/Internal)
84
+
85
+ The legacy `External User` / `Internal User` pair has been retired from the
86
+ test fixtures in favour of a single `User` permission. New tests should seed
87
+ only `User`; the deprecated names are still defined in `app-constants.js`
88
+ because the upstream API may still emit them, but acceptance specs should not.
package/dist/index.html CHANGED
@@ -1 +1 @@
1
- <!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1,viewport-fit=cover"><base href="/"><script>window.process={env:{NODE_ENV:"production"}}</script><script>!function(){var n=new XMLHttpRequest;n.open("GET","/config.json",!1),n.send(),n.status>=200&&n.status<300&&(window.gpConfig={"ui-launchpad":JSON.parse(n.responseText)})}()</script><title>ui-launchpad</title></head><body data-theme="ix-theme"><script type="module" src="./ui-launchpad.js"></script><script inject-service-worker="">"serviceWorker"in navigator&&window.addEventListener("load",function(){navigator.serviceWorker.register("sw.js").then(function(){console.log('ServiceWorker registered from "sw.js".')}).catch(function(e){console.log("ServiceWorker registration failed: ",e)})})</script></body></html>
1
+ <!doctype html><html lang="en"><head><meta charset="utf-8"><script async="" src="https://cdn.jsdelivr.net/npm/es-module-shims@1.6.0/dist/es-module-shims.js"></script><script>!function(){const n=new XMLHttpRequest;n.open("GET","/config.json",!1),n.send(),n.status>=200&&n.status<300&&(window.gpConfig={"ui-launchpad":JSON.parse(n.responseText)})}()</script><meta name="viewport" content="width=device-width,initial-scale=1"><meta name="description" content="DLR Portal"><link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200&amp;display=block"><link rel="preconnect" href="https://fonts.googleapis.com"><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin=""><link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Red+Hat+Display:wght@400;700&amp;display=swap"><link href="https://fonts.googleapis.com/css2?family=Open+Sans:ital,wght@0,300;0,400;1,500&amp;display=swap" rel="stylesheet"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/toastify-js@^1.12.0/src/toastify.min.css"><meta name="msapplication-TileColor" content="#0099cc"><meta name="msapplication-config" content="./assets/images/app-icons/browserconfig.xml"><meta name="theme-color" content="#ffffff"><meta name="format-detection" content="telephone=no"><base href="/"><script>window.process={env:{NODE_ENV:"production"}}</script><style>body,html{background-color:#f5f7ff}:host :root [data-theme=ix-theme],:host [data-theme=ix-theme],:root [data-theme=ix-theme]{--md-sys-color-on-surface-variant:#B8BFC8}vaadin-date-picker-overlay,vaadin-time-picker-overlay{z-index:99999}</style><title>ui-launchpad</title></head><body data-theme="ix-theme"><ui-launchpad></ui-launchpad><noscript>Please enable JavaScript to view this website.</noscript><script type="module" src="./ui-launchpad.js"></script><script inject-service-worker="">"serviceWorker"in navigator&&window.addEventListener("load",function(){navigator.serviceWorker.register("sw.js").then(function(){console.log('ServiceWorker registered from "sw.js".')}).catch(function(e){console.log("ServiceWorker registration failed: ",e)})})</script></body></html>
package/dist/sw.js CHANGED
@@ -1,2 +1,2 @@
1
- if(!self.define){let e,i={};const n=(n,t)=>(n=new URL(n+".js",t).href,i[n]||new Promise(i=>{if("document"in self){const e=document.createElement("script");e.src=n,e.onload=i,document.head.appendChild(e)}else e=n,importScripts(n),i()}).then(()=>{let e=i[n];if(!e)throw new Error(`Module ${n} didn’t register its module`);return e}));self.define=(t,o)=>{const r=e||("document"in self?document.currentScript.src:"")||location.href;if(i[r])return;let s={};const c=e=>n(e,r),f={module:{uri:r},exports:s,require:c};i[r]=Promise.all(t.map(e=>f[e]||c(e))).then(e=>(o(...e),s))}}define(["./workbox-a523fd56"],function(e){"use strict";self.skipWaiting(),e.clientsClaim(),e.precacheAndRoute([{url:"index.html",revision:"fcd3c98e7d960dcf13ed3fcfb6ca4bfd"},{url:"ui-launchpad.js",revision:"34139cf0128f4fba468b70b42105907b"}],{}),e.registerRoute(new e.NavigationRoute(e.createHandlerBoundToURL("/index.html"))),e.registerRoute("polyfills/*.js",new e.CacheFirst,"GET")});
1
+ if(!self.define){let e,i={};const n=(n,t)=>(n=new URL(n+".js",t).href,i[n]||new Promise(i=>{if("document"in self){const e=document.createElement("script");e.src=n,e.onload=i,document.head.appendChild(e)}else e=n,importScripts(n),i()}).then(()=>{let e=i[n];if(!e)throw new Error(`Module ${n} didn’t register its module`);return e}));self.define=(t,o)=>{const r=e||("document"in self?document.currentScript.src:"")||location.href;if(i[r])return;let s={};const c=e=>n(e,r),l={module:{uri:r},exports:s,require:c};i[r]=Promise.all(t.map(e=>l[e]||c(e))).then(e=>(o(...e),s))}}define(["./workbox-b865b753"],function(e){"use strict";self.skipWaiting(),e.clientsClaim(),e.precacheAndRoute([{url:"index.html",revision:"2c69eb2da85c9b2ee93b0c537cf41d78"},{url:"ui-launchpad.js",revision:"95d0785b63d5ee44254858ecc54ddc55"}],{}),e.registerRoute(new e.NavigationRoute(e.createHandlerBoundToURL("/index.html"))),e.registerRoute("polyfills/*.js",new e.CacheFirst,"GET")});
2
2
  //# sourceMappingURL=sw.js.map
package/dist/sw.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"sw.js","sources":["../../../../../../private/var/folders/6x/bw25zx1s3p5655vw5gd7c8j40000gn/T/9a998c0621023347429b9b612925f079/sw.js"],"sourcesContent":["import {registerRoute as workbox_routing_registerRoute} from '/Users/runner/work/1/s/ui-launchpad/node_modules/workbox-routing/registerRoute.mjs';\nimport {CacheFirst as workbox_strategies_CacheFirst} from '/Users/runner/work/1/s/ui-launchpad/node_modules/workbox-strategies/CacheFirst.mjs';\nimport {clientsClaim as workbox_core_clientsClaim} from '/Users/runner/work/1/s/ui-launchpad/node_modules/workbox-core/clientsClaim.mjs';\nimport {precacheAndRoute as workbox_precaching_precacheAndRoute} from '/Users/runner/work/1/s/ui-launchpad/node_modules/workbox-precaching/precacheAndRoute.mjs';\nimport {NavigationRoute as workbox_routing_NavigationRoute} from '/Users/runner/work/1/s/ui-launchpad/node_modules/workbox-routing/NavigationRoute.mjs';\nimport {createHandlerBoundToURL as workbox_precaching_createHandlerBoundToURL} from '/Users/runner/work/1/s/ui-launchpad/node_modules/workbox-precaching/createHandlerBoundToURL.mjs';/**\n * Welcome to your Workbox-powered service worker!\n *\n * You'll need to register this file in your web app.\n * See https://goo.gl/nhQhGp\n *\n * The rest of the code is auto-generated. Please don't update this file\n * directly; instead, make changes to your Workbox build configuration\n * and re-run your build process.\n * See https://goo.gl/2aRDsh\n */\n\n\n\n\n\n\n\n\nself.skipWaiting();\n\nworkbox_core_clientsClaim();\n\n\n/**\n * The precacheAndRoute() method efficiently caches and responds to\n * requests for URLs in the manifest.\n * See https://goo.gl/S9QRab\n */\nworkbox_precaching_precacheAndRoute([\n {\n \"url\": \"index.html\",\n \"revision\": \"fcd3c98e7d960dcf13ed3fcfb6ca4bfd\"\n },\n {\n \"url\": \"ui-launchpad.js\",\n \"revision\": \"34139cf0128f4fba468b70b42105907b\"\n }\n], {});\n\nworkbox_routing_registerRoute(new workbox_routing_NavigationRoute(workbox_precaching_createHandlerBoundToURL(\"/index.html\")));\n\n\nworkbox_routing_registerRoute(\"polyfills/*.js\", new workbox_strategies_CacheFirst(), 'GET');\n\n\n\n\n"],"names":["self","skipWaiting","workbox_core_clientsClaim","workbox_precaching_precacheAndRoute","url","revision","workbox","registerRoute","workbox_routing_NavigationRoute","workbox_precaching_createHandlerBoundToURL","workbox_strategies_CacheFirst"],"mappings":"inBAwBAA,KAAKC,cAELC,EAAAA,eAQAC,EAAAA,iBAAoC,CAClC,CACEC,IAAO,aACPC,SAAY,oCAEd,CACED,IAAO,kBACPC,SAAY,qCAEb,CAAE,GAEwBC,EAAAC,cAAC,IAAIC,EAAAA,gBAAgCC,EAAAA,wBAA2C,iBAGhFH,EAAAC,cAAC,iBAAkB,IAAIG,aAAiC"}
1
+ {"version":3,"file":"sw.js","sources":["../../../../../../private/var/folders/6x/bw25zx1s3p5655vw5gd7c8j40000gn/T/000c9726573c5ed7243cadd1aecf9504/sw.js"],"sourcesContent":["import {registerRoute as workbox_routing_registerRoute} from '/Users/runner/work/1/s/ui-launchpad/node_modules/.pnpm/workbox-routing@6.6.0/node_modules/workbox-routing/registerRoute.mjs';\nimport {CacheFirst as workbox_strategies_CacheFirst} from '/Users/runner/work/1/s/ui-launchpad/node_modules/.pnpm/workbox-strategies@6.6.0/node_modules/workbox-strategies/CacheFirst.mjs';\nimport {clientsClaim as workbox_core_clientsClaim} from '/Users/runner/work/1/s/ui-launchpad/node_modules/.pnpm/workbox-core@6.6.0/node_modules/workbox-core/clientsClaim.mjs';\nimport {precacheAndRoute as workbox_precaching_precacheAndRoute} from '/Users/runner/work/1/s/ui-launchpad/node_modules/.pnpm/workbox-precaching@6.6.0/node_modules/workbox-precaching/precacheAndRoute.mjs';\nimport {NavigationRoute as workbox_routing_NavigationRoute} from '/Users/runner/work/1/s/ui-launchpad/node_modules/.pnpm/workbox-routing@6.6.0/node_modules/workbox-routing/NavigationRoute.mjs';\nimport {createHandlerBoundToURL as workbox_precaching_createHandlerBoundToURL} from '/Users/runner/work/1/s/ui-launchpad/node_modules/.pnpm/workbox-precaching@6.6.0/node_modules/workbox-precaching/createHandlerBoundToURL.mjs';/**\n * Welcome to your Workbox-powered service worker!\n *\n * You'll need to register this file in your web app.\n * See https://goo.gl/nhQhGp\n *\n * The rest of the code is auto-generated. Please don't update this file\n * directly; instead, make changes to your Workbox build configuration\n * and re-run your build process.\n * See https://goo.gl/2aRDsh\n */\n\n\n\n\n\n\n\n\nself.skipWaiting();\n\nworkbox_core_clientsClaim();\n\n\n/**\n * The precacheAndRoute() method efficiently caches and responds to\n * requests for URLs in the manifest.\n * See https://goo.gl/S9QRab\n */\nworkbox_precaching_precacheAndRoute([\n {\n \"url\": \"index.html\",\n \"revision\": \"2c69eb2da85c9b2ee93b0c537cf41d78\"\n },\n {\n \"url\": \"ui-launchpad.js\",\n \"revision\": \"95d0785b63d5ee44254858ecc54ddc55\"\n }\n], {});\n\nworkbox_routing_registerRoute(new workbox_routing_NavigationRoute(workbox_precaching_createHandlerBoundToURL(\"/index.html\")));\n\n\nworkbox_routing_registerRoute(\"polyfills/*.js\", new workbox_strategies_CacheFirst(), 'GET');\n\n\n\n\n"],"names":["self","skipWaiting","workbox_core_clientsClaim","workbox_precaching_precacheAndRoute","url","revision","workbox","registerRoute","workbox_routing_NavigationRoute","workbox_precaching_createHandlerBoundToURL","workbox_strategies_CacheFirst"],"mappings":"inBAwBAA,KAAKC,cAELC,EAAAA,eAQAC,EAAAA,iBAAoC,CAClC,CACEC,IAAO,aACPC,SAAY,oCAEd,CACED,IAAO,kBACPC,SAAY,qCAEb,CAAE,GAEwBC,EAAAC,cAAC,IAAIC,EAAAA,gBAAgCC,EAAAA,wBAA2C,iBAGhFH,EAAAC,cAAC,iBAAkB,IAAIG,aAAiC"}