dash-button-web 0.0.16 → 0.0.18-beta.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/cjs/dash-button.cjs.entry.js +9 -7
- package/dist/cjs/dash-button.cjs.entry.js.map +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/web-compnont.cjs.js +1 -1
- package/dist/collection/components/my-component/dash-button.js +45 -7
- package/dist/collection/components/my-component/dash-button.js.map +1 -1
- package/dist/components/dash-button.js +11 -7
- package/dist/components/dash-button.js.map +1 -1
- package/dist/esm/dash-button.entry.js +9 -7
- package/dist/esm/dash-button.entry.js.map +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/web-compnont.js +1 -1
- package/dist/types/components/my-component/dash-button.d.ts +2 -0
- package/dist/types/components.d.ts +4 -0
- package/dist/web-compnont/{p-b7387964.entry.js → p-92bc7cf5.entry.js} +2 -2
- package/dist/web-compnont/p-92bc7cf5.entry.js.map +1 -0
- package/dist/web-compnont/web-compnont.esm.js +1 -1
- package/dist/web-compnont/web-compnont.esm.js.map +1 -1
- package/package.json +1 -1
- package/readme.md +54 -46
- package/dist/web-compnont/p-b7387964.entry.js.map +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{p as e,b as
|
|
1
|
+
import{p as e,b as t}from"./p-db53c3e9.js";export{s as setNonce}from"./p-db53c3e9.js";const i=()=>{const t=import.meta.url;const i={};if(t!==""){i.resourcesUrl=new URL(".",t).href}return e(i)};i().then((e=>t([["p-92bc7cf5",[[1,"dash-button",{showPostLoginText:[4,"show-post-login-text"],silentCheckSso:[4,"silent-check-sso"],silentCheckSsoHtmlPath:[1,"silent-check-sso-html-path"],redirectUri:[1,"redirect-uri"],authMethod:[1,"auth-method"],keycloakUri:[1,"keycloak-uri"],realm:[1],clientId:[1,"client-id"],appId:[1,"app-id"],portalUrl:[1,"portal-url"],portalApiUrl:[1,"portal-api-url"],plmUrl:[1,"plm-url"],usageTrackingUrl:[1,"usage-tracking-url"],showUnauthorizedModal:[4,"show-unauthorized-modal"],postTextDelayDuration:[2,"post-text-delay-duration"],primaryColor:[1,"primary-color"],accentColor:[1,"accent-color"],otherLinkType:[1,"other-link-type"],otherLinkDisplayName:[1,"other-link-display-name"],applicationDisplayName:[1,"application-display-name"],disableApplicationTab:[4,"disable-application-tab"],menuViewType:[1,"menu-view-type"],keycloak:[32],isAuth:[32],givenUserName:[32],silentCheckSsoRedirectUri:[32],appList:[32],menuLinkList:[32],mainMenuLinkList:[32],showPostLoginLoadingSpinner:[32],avatarSvg:[32],dummyAppList:[32]}]]]],e)));
|
|
2
2
|
//# sourceMappingURL=web-compnont.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["patchBrowser","importMeta","url","opts","resourcesUrl","URL","href","promiseResolve","then","options","bootstrapLazy","showPostLoginText","silentCheckSso","redirectUri","authMethod","keycloakUri","realm","clientId","appId","portalUrl","plmUrl","usageTrackingUrl","showUnauthorizedModal","postTextDelayDuration","primaryColor","accentColor","otherLinkType","otherLinkDisplayName","applicationDisplayName","disableApplicationTab","menuViewType","keycloak","isAuth","givenUserName","silentCheckSsoRedirectUri","appList","menuLinkList","mainMenuLinkList","showPostLoginLoadingSpinner","avatarSvg","dummyAppList"],"sources":["node_modules/@stencil/core/internal/client/patch-browser.js","@lazy-browser-entrypoint?app-data=conditional"],"sourcesContent":["/*\n Stencil Client Patch Browser v4.12.0 | MIT Licensed | https://stenciljs.com\n */\nimport { BUILD, NAMESPACE } from '@stencil/core/internal/app-data';\nimport { consoleDevInfo, doc, promiseResolve, H } from '@stencil/core';\nconst patchBrowser = () => {\n // NOTE!! This fn cannot use async/await!\n if (BUILD.isDev && !BUILD.isTesting) {\n consoleDevInfo('Running in development mode.');\n }\n if (BUILD.cloneNodeFix) {\n // opted-in to polyfill cloneNode() for slot polyfilled components\n patchCloneNodeFix(H.prototype);\n }\n const scriptElm = BUILD.scriptDataOpts\n ? Array.from(doc.querySelectorAll('script')).find((s) => new RegExp(`\\/${NAMESPACE}(\\\\.esm)?\\\\.js($|\\\\?|#)`).test(s.src) ||\n s.getAttribute('data-stencil-namespace') === NAMESPACE)\n : null;\n const importMeta = import.meta.url;\n const opts = BUILD.scriptDataOpts ? (scriptElm || {})['data-opts'] || {} : {};\n if (importMeta !== '') {\n opts.resourcesUrl = new URL('.', importMeta).href;\n }\n return promiseResolve(opts);\n};\nconst patchCloneNodeFix = (HTMLElementPrototype) => {\n const nativeCloneNodeFn = HTMLElementPrototype.cloneNode;\n HTMLElementPrototype.cloneNode = function (deep) {\n if (this.nodeName === 'TEMPLATE') {\n return nativeCloneNodeFn.call(this, deep);\n }\n const clonedNode = nativeCloneNodeFn.call(this, false);\n const srcChildNodes = this.childNodes;\n if (deep) {\n for (let i = 0; i < srcChildNodes.length; i++) {\n // Node.ATTRIBUTE_NODE === 2, and checking because IE11\n if (srcChildNodes[i].nodeType !== 2) {\n clonedNode.appendChild(srcChildNodes[i].cloneNode(true));\n }\n }\n }\n return clonedNode;\n };\n};\nexport { patchBrowser };\n","export { setNonce } from '@stencil/core';\nimport { bootstrapLazy } from '@stencil/core';\nimport { patchBrowser } from '@stencil/core/internal/client/patch-browser';\nimport { globalScripts } from '@stencil/core/internal/app-globals';\npatchBrowser().then(options => {\n globalScripts();\n return bootstrapLazy([/*!__STENCIL_LAZY_DATA__*/], options);\n});\n"],"mappings":"sFAKA,MAAMA,EAAe,KAajB,MAAMC,cAAyBC,IAC/B,MAAMC,EAAqE,GAC3E,GAAIF,IAAe,GAAI,CACnBE,EAAKC,aAAe,IAAIC,IAAI,IAAKJ,GAAYK,IACrD,CACI,OAAOC,EAAeJ,EAAK,ECnB/BH,IAAeQ,MAAKC,GAEXC,EAAc,iCAA8B,CAAAC,kBAAS,2BAAAC,eAAA,uBAAAC,YAAA,mBAAAC,WAAA,kBAAAC,YAAA,mBAAAC,MAAA,IAAAC,SAAA,gBAAAC,MAAA,aAAAC,UAAA,iBAAAC,OAAA,cAAAC,iBAAA,yBAAAC,sBAAA,8BAAAC,sBAAA,+BAAAC,aAAA,oBAAAC,YAAA,mBAAAC,cAAA,sBAAAC,qBAAA,8BAAAC,uBAAA,+BAAAC,sBAAA,8BAAAC,aAAA,qBAAAC,SAAA,KAAAC,OAAA,KAAAC,cAAA,KAAAC,0BAAA,KAAAC,QAAA,KAAAC,aAAA,KAAAC,iBAAA,KAAAC,4BAAA,KAAAC,UAAA,KAAAC,aAAA,
|
|
1
|
+
{"version":3,"names":["patchBrowser","importMeta","url","opts","resourcesUrl","URL","href","promiseResolve","then","options","bootstrapLazy","showPostLoginText","silentCheckSso","silentCheckSsoHtmlPath","redirectUri","authMethod","keycloakUri","realm","clientId","appId","portalUrl","portalApiUrl","plmUrl","usageTrackingUrl","showUnauthorizedModal","postTextDelayDuration","primaryColor","accentColor","otherLinkType","otherLinkDisplayName","applicationDisplayName","disableApplicationTab","menuViewType","keycloak","isAuth","givenUserName","silentCheckSsoRedirectUri","appList","menuLinkList","mainMenuLinkList","showPostLoginLoadingSpinner","avatarSvg","dummyAppList"],"sources":["node_modules/@stencil/core/internal/client/patch-browser.js","@lazy-browser-entrypoint?app-data=conditional"],"sourcesContent":["/*\n Stencil Client Patch Browser v4.12.0 | MIT Licensed | https://stenciljs.com\n */\nimport { BUILD, NAMESPACE } from '@stencil/core/internal/app-data';\nimport { consoleDevInfo, doc, promiseResolve, H } from '@stencil/core';\nconst patchBrowser = () => {\n // NOTE!! This fn cannot use async/await!\n if (BUILD.isDev && !BUILD.isTesting) {\n consoleDevInfo('Running in development mode.');\n }\n if (BUILD.cloneNodeFix) {\n // opted-in to polyfill cloneNode() for slot polyfilled components\n patchCloneNodeFix(H.prototype);\n }\n const scriptElm = BUILD.scriptDataOpts\n ? Array.from(doc.querySelectorAll('script')).find((s) => new RegExp(`\\/${NAMESPACE}(\\\\.esm)?\\\\.js($|\\\\?|#)`).test(s.src) ||\n s.getAttribute('data-stencil-namespace') === NAMESPACE)\n : null;\n const importMeta = import.meta.url;\n const opts = BUILD.scriptDataOpts ? (scriptElm || {})['data-opts'] || {} : {};\n if (importMeta !== '') {\n opts.resourcesUrl = new URL('.', importMeta).href;\n }\n return promiseResolve(opts);\n};\nconst patchCloneNodeFix = (HTMLElementPrototype) => {\n const nativeCloneNodeFn = HTMLElementPrototype.cloneNode;\n HTMLElementPrototype.cloneNode = function (deep) {\n if (this.nodeName === 'TEMPLATE') {\n return nativeCloneNodeFn.call(this, deep);\n }\n const clonedNode = nativeCloneNodeFn.call(this, false);\n const srcChildNodes = this.childNodes;\n if (deep) {\n for (let i = 0; i < srcChildNodes.length; i++) {\n // Node.ATTRIBUTE_NODE === 2, and checking because IE11\n if (srcChildNodes[i].nodeType !== 2) {\n clonedNode.appendChild(srcChildNodes[i].cloneNode(true));\n }\n }\n }\n return clonedNode;\n };\n};\nexport { patchBrowser };\n","export { setNonce } from '@stencil/core';\nimport { bootstrapLazy } from '@stencil/core';\nimport { patchBrowser } from '@stencil/core/internal/client/patch-browser';\nimport { globalScripts } from '@stencil/core/internal/app-globals';\npatchBrowser().then(options => {\n globalScripts();\n return bootstrapLazy([/*!__STENCIL_LAZY_DATA__*/], options);\n});\n"],"mappings":"sFAKA,MAAMA,EAAe,KAajB,MAAMC,cAAyBC,IAC/B,MAAMC,EAAqE,GAC3E,GAAIF,IAAe,GAAI,CACnBE,EAAKC,aAAe,IAAIC,IAAI,IAAKJ,GAAYK,IACrD,CACI,OAAOC,EAAeJ,EAAK,ECnB/BH,IAAeQ,MAAKC,GAEXC,EAAc,iCAA8B,CAAAC,kBAAS,2BAAAC,eAAA,uBAAAC,uBAAA,iCAAAC,YAAA,mBAAAC,WAAA,kBAAAC,YAAA,mBAAAC,MAAA,IAAAC,SAAA,gBAAAC,MAAA,aAAAC,UAAA,iBAAAC,aAAA,qBAAAC,OAAA,cAAAC,iBAAA,yBAAAC,sBAAA,8BAAAC,sBAAA,+BAAAC,aAAA,oBAAAC,YAAA,mBAAAC,cAAA,sBAAAC,qBAAA,8BAAAC,uBAAA,+BAAAC,sBAAA,8BAAAC,aAAA,qBAAAC,SAAA,KAAAC,OAAA,KAAAC,cAAA,KAAAC,0BAAA,KAAAC,QAAA,KAAAC,aAAA,KAAAC,iBAAA,KAAAC,4BAAA,KAAAC,UAAA,KAAAC,aAAA,UAAAjC"}
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -6,38 +6,43 @@ Developing a dash button web component based on the [Stencil.js](https://stencil
|
|
|
6
6
|
|
|
7
7
|
To install the dash-button web component, copy and paste it into your frontend application.
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
> **Note:** Please refer to the [npm package page](https://www.npmjs.com/package/dash-button-web) to find the latest version, and replace `X.X.X` in the import script accordingly:
|
|
10
|
+
```html
|
|
11
|
+
<script type="module" src="https://unpkg.com/dash-button-web@X.X.X/dist/esm/web-compnont.js"></script>
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
> Note: Starting from v0.0.16, you need to add the FontAwesome stylesheet file to your application. If your application is already using this package, you can ignore this.
|
|
15
|
+
|
|
16
|
+
```html
|
|
17
|
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.7.2/css/all.min.css" />
|
|
11
18
|
```
|
|
12
19
|
|
|
13
20
|
You can find the NPM package named [dash-button-web](https://www.npmjs.com/package/dash-button-web "dash-button-web").
|
|
14
21
|
|
|
15
22
|
If it is a framework, you wll need to configure more options. Therefore, follow the [Stencil.js](https://stenciljs.com/ "Stencil.js") documentation.
|
|
16
23
|
|
|
24
|
+
## Prerequisites
|
|
25
|
+
- To integrate DashButton into your application, you need to have a running Keycloak server.
|
|
26
|
+
|
|
17
27
|
## Installation Guide
|
|
18
28
|
|
|
19
|
-
|
|
29
|
+
Here, we show how to integrate DashButton into your frontend application.
|
|
20
30
|
|
|
21
31
|
#### Step 1 - Setup Keycloak Server Application
|
|
22
32
|
|
|
23
|
-
First, you need to start
|
|
24
|
-
|
|
25
|
-
```sh
|
|
26
|
-
docker run -p 8080:8080 -e KEYCLOAK_ADMIN=admin -e KEYCLOAK_ADMIN_PASSWORD=admin quay.io/keycloak/keycloak:23.0.4 start-dev
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
If you need additional installation guidelines, please refer to the [Keycloak documentation](https://www.keycloak.org/guides#getting-started).
|
|
33
|
+
First, you need to start your own **Keycloak instance** or use the **DS2 version**. We recommend using the DS2-based Keycloak instance.
|
|
30
34
|
|
|
31
|
-
|
|
35
|
+
##### Option 1 – Use DS2 Keycloak details
|
|
36
|
+
You can use predefined Keycloak credentials to configure DashButton. The required details are summarized below.
|
|
32
37
|
|
|
33
|
-
|
|
38
|
+
- Keyclaok URL: **https://keycloak.ds2.icelab.cloud**
|
|
39
|
+
- Realm: **ds2**
|
|
40
|
+
- Client ID: **dashbtn**
|
|
34
41
|
|
|
35
|
-
Next, create a client and configure URLs. For development purposes, set valid redirect URLs and set web origins as '*' as follows.
|
|
36
|
-
|
|
37
|
-
<!--  -->
|
|
38
|
-
|
|
39
|
-
Next, create a user with credentials for testing purposes.
|
|
40
42
|
|
|
43
|
+
##### Option 2 – Configure your own Keycloak client
|
|
44
|
+
If you use your own version, you need to configure the realm, client, and test users.
|
|
45
|
+
Make sure the client is set up with a **client ID** and that **client authentication is disabled**.
|
|
41
46
|
|
|
42
47
|
### Step 2 - Configure frontend application
|
|
43
48
|
|
|
@@ -65,28 +70,15 @@ import { CUSTOM_ELEMENTS_SCHEMA} from '@angular/core';
|
|
|
65
70
|
Next, you need to put the script file path in the **src/index.html** file header section as follows.
|
|
66
71
|
|
|
67
72
|
|
|
68
|
-
```sh
|
|
69
|
-
<script type='module' src='https://unpkg.com/dash-button-web@0.0.16/dist/esm/web-compnont.js'></script>
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
```sh
|
|
74
|
-
Note: Starting from v0.0.16, you need to add the FontAwesome stylesheet file to your application. If your application is already using this package, you can ignore this.
|
|
75
|
-
|
|
76
|
-
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.7.2/css/all.min.css" />
|
|
77
|
-
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
Therefore, the header section of your index file should look like this:
|
|
81
|
-
|
|
82
73
|
```sh
|
|
83
74
|
<head>
|
|
84
75
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
85
76
|
<link rel="icon" type="image/x-icon" href="favicon.ico">
|
|
77
|
+
|
|
78
|
+
<script type='module' src='https://unpkg.com/dash-button-web@X.X.X/dist/esm/web-compnont.js'></script>
|
|
79
|
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.7.2/css/all.min.css" />
|
|
86
80
|
|
|
87
|
-
|
|
88
|
-
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.7.2/css/all.min.css" />
|
|
89
|
-
...
|
|
81
|
+
...
|
|
90
82
|
```
|
|
91
83
|
|
|
92
84
|
After that, you can pass configuration options as follows using the web component.
|
|
@@ -103,35 +95,42 @@ After that, you can pass configuration options as follows using the web componen
|
|
|
103
95
|
| `auth-method` | `Authentication method` | `string` | `check-sso`, `(login-required)` |
|
|
104
96
|
| `app-id` | `Application unique ID` | `string` | `` |
|
|
105
97
|
| `portal-url` | `Portal URL` | `string` | `` |
|
|
106
|
-
| `
|
|
98
|
+
| `portal-api-url` | `Portal API URL` | `string` | `` |
|
|
107
99
|
| `show-unauthorized-modal` | `Show unauthorized modal` | `boolean` | `false` |
|
|
108
100
|
| `other-link-type` | `Add new links for the menu` | `string` | `local or global` |
|
|
109
101
|
| `application-display-name` | `Menu application display name` | `string` | `Applications` |
|
|
110
102
|
| `disable-application-tab` | `disable application tab` | `boolean` | `false` |
|
|
111
103
|
| `menu-view-type` | `the style of the menu` | `string` | `grid/list` |
|
|
112
104
|
|
|
105
|
+
|
|
113
106
|
#### Theme Configuration options
|
|
114
107
|
|
|
115
108
|
| Attribute | Description | Type | Default |
|
|
116
109
|
| ----------------- | ----------- | --------- | ------------------------- |
|
|
117
|
-
|
|
|
110
|
+
| `primary-color` | `Set primary colour` | `string` | `` |
|
|
118
111
|
| `accent-color` | `Set secondary or accent color` | `string` | `` |
|
|
119
112
|
|
|
120
113
|
|
|
121
|
-
**AuthMethod**
|
|
114
|
+
> **AuthMethod**
|
|
122
115
|
Using the auth-method attribute updates the application's authentication workflow.
|
|
123
|
-
|
|
124
116
|
`login-required`: User is forced to the login screen if they are not logged in.
|
|
125
|
-
|
|
126
117
|
`check-sso`: User is not forced to the login screen; instead, when the user clicks the login button, they are redirected to the login screen.
|
|
127
118
|
|
|
128
119
|
Now, you are almost done. In the final stage, you can place the web-component button tag at the top of the navigation bar using the following code block.
|
|
129
120
|
|
|
121
|
+
> Note: Replace DashButton configuration with actual values.
|
|
122
|
+
|
|
123
|
+
To get the module link for the Dashbutton, use the **portal-api-url** attribute and provide the Portal backend API endpoint URL.
|
|
124
|
+
For the DS2 platform, you can use **https://portal-api.ds2.icelab.cloud** as the Portal API URL..
|
|
125
|
+
|
|
130
126
|
```sh
|
|
131
|
-
<dash-button keycloak-uri="http://localhost:8080" realm="demo" client-id="testapp" auth-method="login-required" show-post-login-text="false"></dash-button>
|
|
127
|
+
<dash-button keycloak-uri="http://localhost:8080" realm="demo" client-id="testapp" portal-api-url="replace_url" auth-method="login-required" show-post-login-text="false"></dash-button>
|
|
132
128
|
```
|
|
133
129
|
After that test your application can be test with user credentials and then you can get an output similar to this.
|
|
134
130
|
|
|
131
|
+
> Note: You need to create a new user. Please access the portal and create an account associated with your organization.
|
|
132
|
+
|
|
133
|
+
<img src="../../dash-button/screenshots/screenshot_web_01.png" width="400">
|
|
135
134
|
|
|
136
135
|
#### 2. Set up and install an HTML-based application
|
|
137
136
|
|
|
@@ -143,10 +142,10 @@ First, you need to import the script tag into the header section of your main HT
|
|
|
143
142
|
<head>
|
|
144
143
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
145
144
|
<link rel="icon" type="image/x-icon" href="favicon.ico">
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
...
|
|
145
|
+
|
|
146
|
+
<script type='module' src='https://unpkg.com/dash-button-web@X.X.X/dist/esm/web-compnont.js'></script>
|
|
147
|
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.7.2/css/all.min.css" />
|
|
148
|
+
...
|
|
150
149
|
```
|
|
151
150
|
|
|
152
151
|
After that, all you need to do is place the dash button in your preferred location on the web page. To do so, use the following web component button tag and place it in your application with preferred configuration options.
|
|
@@ -157,8 +156,17 @@ After that, all you need to do is place the dash button in your preferred locati
|
|
|
157
156
|
|
|
158
157
|
That's it, enjoy!
|
|
159
158
|
|
|
160
|
-
|
|
161
|
-
|
|
159
|
+
---
|
|
160
|
+
|
|
161
|
+
##### Changelog:
|
|
162
|
+
|
|
163
|
+
**v0.0.18**
|
|
164
|
+
- Bug fixed and improved documentation.
|
|
165
|
+
|
|
166
|
+
**v0.0.17**
|
|
167
|
+
- Added a new environment variable option for the Config Portal API endpoint.
|
|
168
|
+
|
|
169
|
+
**v0.0.16**
|
|
162
170
|
- Added customization option to change the main menu view type.
|
|
163
171
|
- Added a new option to retrieve the main menu list and display it from the portal API.
|
|
164
172
|
- Replaced all icons with FontAwesome. (Any third-party application now needs to import FontAwesome.)
|