@things-factory/auth-ui 7.0.1-alpha.4 → 7.0.1-alpha.43
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/client/bootstrap.ts +6 -10
- package/client/components/change-password.ts +1 -1
- package/client/components/contact-us.ts +2 -8
- package/client/components/delete-user-popup.ts +1 -1
- package/client/index.ts +10 -12
- package/client/pages/application/application.ts +14 -51
- package/client/pages/attribute/attribute-set-item-list.ts +8 -22
- package/client/pages/attribute/attribute-set-management.ts +12 -20
- package/client/pages/auth-provider/auth-provider-management.ts +7 -16
- package/client/pages/domain/domain-management.ts +6 -18
- package/dist-client/bootstrap.d.ts +1 -1
- package/dist-client/bootstrap.js +5 -5
- package/dist-client/bootstrap.js.map +1 -1
- package/dist-client/components/change-password.js +1 -1
- package/dist-client/components/change-password.js.map +1 -1
- package/dist-client/components/contact-us.js +2 -8
- package/dist-client/components/contact-us.js.map +1 -1
- package/dist-client/components/delete-user-popup.js +1 -1
- package/dist-client/components/delete-user-popup.js.map +1 -1
- package/dist-client/index.d.ts +1 -1
- package/dist-client/index.js +9 -9
- package/dist-client/index.js.map +1 -1
- package/dist-client/pages/application/application.d.ts +1 -1
- package/dist-client/pages/application/application.js +12 -47
- package/dist-client/pages/application/application.js.map +1 -1
- package/dist-client/pages/attribute/attribute-set-item-list.d.ts +1 -1
- package/dist-client/pages/attribute/attribute-set-item-list.js +6 -22
- package/dist-client/pages/attribute/attribute-set-item-list.js.map +1 -1
- package/dist-client/pages/attribute/attribute-set-management.d.ts +10 -2
- package/dist-client/pages/attribute/attribute-set-management.js +6 -11
- package/dist-client/pages/attribute/attribute-set-management.js.map +1 -1
- package/dist-client/pages/auth-provider/auth-provider-management.d.ts +10 -2
- package/dist-client/pages/auth-provider/auth-provider-management.js +6 -11
- package/dist-client/pages/auth-provider/auth-provider-management.js.map +1 -1
- package/dist-client/pages/domain/domain-management.js +2 -11
- package/dist-client/pages/domain/domain-management.js.map +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -4
- package/views/auth-page.html +1 -0
- package/views/oauth2-page.html +1 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contact-us.js","sourceRoot":"","sources":["../../client/components/contact-us.ts"],"names":[],"mappings":";AAAA,OAAO,wBAAwB,CAAA;AAC/B,OAAO,yBAAyB,CAAA;AAChC,OAAO,sBAAsB,CAAA;AAC7B,OAAO,sBAAsB,CAAA;AAC7B,OAAO,eAAe,CAAA;AAEtB,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAExD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"contact-us.js","sourceRoot":"","sources":["../../client/components/contact-us.ts"],"names":[],"mappings":";AAAA,OAAO,wBAAwB,CAAA;AAC/B,OAAO,yBAAyB,CAAA;AAChC,OAAO,sBAAsB,CAAA;AAC7B,OAAO,sBAAsB,CAAA;AAC7B,OAAO,eAAe,CAAA;AAEtB,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAExD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,+CAA+C,CAAA;AAG7D,IAAM,SAAS,GAAf,MAAM,SAAU,SAAQ,QAAQ,CAAC,OAAO,CAAC,CAAC,UAAU,CAAC;IAC1D,MAAM,KAAK,MAAM;QACf,OAAO;YACL,GAAG,CAAA;;;;;;;;;;;;;;;;;;OAkBF;SACF,CAAA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C,CAAC,MAAyB,CAAA;QAExC,MAAM,QAAQ,GAAG,IAAI,QAAQ,CAAC,IAAI,CAAC,CAAA;QACnC,IAAI,IAAI,GAAG,EAAE,CAAA;QAEb,wBAAwB;QACxB,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,QAAQ,CAAC,OAAO,EAAE,EAAE;YAC7C,IAAI,CAAC,GAAG,CAAC,GAAG,KAAK,CAAA;SAClB;QAED,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,CAAA;QAEzB,IAAI,CAAC,KAAK,EAAE,CAAA;IACd,CAAC;CACF,CAAA;AA1EC;IAAC,KAAK,CAAC,SAAS,CAAC;;yCAAyC;AAC1D;IAAC,KAAK,CAAC,gBAAgB,CAAC;8BAAgB,gBAAgB;+CAAA;AACxD;IAAC,KAAK,CAAC,eAAe,CAAC;8BAAe,gBAAgB;8CAAA;AACtD;IAAC,KAAK,CAAC,gBAAgB,CAAC;8BAAgB,gBAAgB;+CAAA;AA5B7C,SAAS;IADrB,aAAa,CAAC,YAAY,CAAC;GACf,SAAS,CAmGrB;SAnGY,SAAS","sourcesContent":["import '@material/mwc-textarea'\nimport '@material/mwc-textfield'\nimport '@material/mwc-button'\nimport '@material/mwc-dialog'\nimport '@operato/i18n'\n\nimport { css, html, LitElement } from 'lit'\nimport { customElement, query } from 'lit/decorators.js'\n\nimport { i18next, localize } from '@operato/i18n'\nimport { auth } from '@things-factory/auth-base/dist-client/auth.js'\n\n@customElement('contact-us')\nexport class ContactUs extends localize(i18next)(LitElement) {\n static get styles() {\n return [\n css`\n :host {\n --mdc-theme-primary: var(--primary-color);\n }\n\n * {\n box-sizing: border-box;\n }\n\n *:focus {\n outline: none;\n }\n\n #input-form {\n display: grid;\n grid-template-rows: 1fr 1fr 3fr;\n grid-gap: 10px 0;\n }\n `\n ]\n }\n\n @query('#dialog') dialog!: HTMLElement & { open: boolean }\n @query('#subject-input') subjectInput!: HTMLInputElement\n @query('#sender-input') senderInput!: HTMLInputElement\n @query('#content-input') contentInput!: HTMLInputElement\n\n render() {\n return html`\n <mwc-button raised label=${i18next.t('button.need help')} @click=${e => (this.dialog.open = true)}></mwc-button>\n\n <mwc-dialog id=\"dialog\" heading=${i18next.t('title.need help')}>\n <form action=\"\" method=\"POST\">\n <input id=\"subject-input\" name=\"subject\" type=\"hidden\" />\n <input id=\"sender-input\" name=\"sender\" type=\"hidden\" />\n <input id=\"content-input\" name=\"content\" type=\"hidden\" />\n </form>\n <div id=\"input-form\">\n <mwc-textfield\n type=\"text\"\n label=${i18next.t('label.subject')}\n dialogInitialFocus\n required\n @input=${e => {\n const val = e.target.value\n this.subjectInput.value = val\n }}\n ></mwc-textfield>\n <mwc-textfield\n type=\"text\"\n name=\"sender\"\n label=${i18next.t('label.email')}\n required\n @input=${e => {\n const val = e.target.value\n this.senderInput.value = val\n }}\n ></mwc-textfield>\n <mwc-textarea\n name=\"content\"\n label=${i18next.t('label.content')}\n required\n @keydown=${e => e.stopPropagation()}\n @input=${e => {\n const val = e.target.value\n this.contentInput.value = val\n }}\n ></mwc-textarea>\n </div>\n <mwc-button slot=\"primaryAction\" type=\"submit\" label=${i18next.t('button.submit')} raised @click=${e => this._submit(e)}></mwc-button>\n <mwc-button slot=\"secondaryAction\" dialogAction=\"cancel\" label=${i18next.t('button.cancel')}></mwc-button>\n </mwc-dialog>\n `\n }\n\n _checkValidity(): boolean {\n return false\n }\n\n _submit(e: MouseEvent) {\n if (!this._checkValidity()) return\n\n const form = e.target as HTMLFormElement\n\n const formData = new FormData(form)\n let json = {}\n\n //convert form into json\n for (const [key, value] of formData.entries()) {\n json[key] = value\n }\n\n auth.changePassword(json)\n\n form.reset()\n }\n}\n"]}
|
|
@@ -4,7 +4,7 @@ import { css, html, LitElement } from 'lit';
|
|
|
4
4
|
import { customElement } from 'lit/decorators.js';
|
|
5
5
|
import { i18next, localize } from '@operato/i18n';
|
|
6
6
|
import { notify } from '@operato/layout';
|
|
7
|
-
import { auth } from '@things-factory/auth-base/dist-client';
|
|
7
|
+
import { auth } from '@things-factory/auth-base/dist-client/auth.js';
|
|
8
8
|
let DeleteUserPopup = class DeleteUserPopup extends localize(i18next)(LitElement) {
|
|
9
9
|
render() {
|
|
10
10
|
return html `
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delete-user-popup.js","sourceRoot":"","sources":["../../client/components/delete-user-popup.ts"],"names":[],"mappings":";AAAA,OAAO,0BAA0B,CAAA;AAEjC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAEjD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AACxC,OAAO,EAAE,IAAI,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"delete-user-popup.js","sourceRoot":"","sources":["../../client/components/delete-user-popup.ts"],"names":[],"mappings":";AAAA,OAAO,0BAA0B,CAAA;AAEjC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAEjD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AACxC,OAAO,EAAE,IAAI,EAAE,MAAM,+CAA+C,CAAA;AAG7D,IAAM,eAAe,GAArB,MAAM,eAAgB,SAAQ,QAAQ,CAAC,OAAO,CAAC,CAAC,UAAU,CAAC;IA6DhE,MAAM;QACJ,OAAO,IAAI,CAAA;;;sBAGO,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;;;;;;;;;;KAUpC,CAAA;IACH,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,CAAQ;QACnB,CAAC,CAAC,cAAc,EAAE,CAAA;QAElB,MAAM,IAAI,GAAG,CAAC,CAAC,MAAyB,CAAA;QAExC,IAAI,MAAM,GAAG,EAAE,CAAA;QACf,IAAI,QAAQ,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;YACxC,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAA;QACrB,CAAC,CAAC,CAAA;QAEF,IAAI;YACF,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAA;YAC7C,MAAM,CAAC;gBACL,KAAK,EAAE,MAAM;gBACb,OAAO;aACR,CAAC,CAAA;YAEF,IAAI,CAAC,OAAO,EAAE,CAAA;SACf;QAAC,OAAO,CAAM,EAAE;YACf,IAAI,CAAC,KAAK,EAAE,CAAA;YAEZ,MAAM,CAAC;gBACL,KAAK,EAAE,OAAO;gBACd,OAAO,EAAE,SAAS,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;aACxC,CAAC,CAAA;SACH;IACH,CAAC;;AAvGM,sBAAM,GAAG;IACd,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAwDF;CACF,CAAA;AA3DU,eAAe;IAD3B,aAAa,CAAC,mBAAmB,CAAC;GACtB,eAAe,CAyG3B;SAzGY,eAAe","sourcesContent":["import '@operato/i18n/ox-i18n.js'\n\nimport { css, html, LitElement } from 'lit'\nimport { customElement } from 'lit/decorators.js'\n\nimport { i18next, localize } from '@operato/i18n'\nimport { notify } from '@operato/layout'\nimport { auth } from '@things-factory/auth-base/dist-client/auth.js'\n\n@customElement('delete-user-popup')\nexport class DeleteUserPopup extends localize(i18next)(LitElement) {\n static styles = [\n css`\n :host {\n display: flex;\n flex-direction: column;\n background-color: var(--popup-content-background-color);\n padding: var(--popup-content-padding);\n }\n\n * {\n box-sizing: border-box;\n }\n *:focus {\n outline: none;\n }\n\n label {\n font: bold 14px var(--theme-font);\n color: var(--primary-color);\n }\n\n input {\n border: var(--change-password-field-border);\n border-radius: var(--change-password-field-border-radius);\n padding: var(--change-password-field-padding);\n\n font: var(--change-password-field-font);\n width: var(--change-password-field-width);\n }\n input:focus {\n border: 1px solid var(--focus-background-color);\n }\n\n div.field {\n padding-bottom: 10px;\n }\n\n ::placeholder {\n font-size: 0.8rem;\n text-transform: capitalize;\n }\n\n button {\n background-color: var(--status-danger-color, red);\n margin: 2px 2px 10px 2px;\n height: var(--button-height, 28px);\n color: var(--button-color, #fff);\n font: var(--button-font);\n border-radius: var(--button-radius, 5px);\n border: var(--button-border, 1px solid transparent);\n line-height: 1.5;\n }\n button:hover,\n button:active {\n background-color: var(--button-active-background-color, #22a6a7);\n border: var(--button-active-border);\n }\n `\n ]\n\n render() {\n return html`\n <h1><ox-i18n msgid=\"label.delete account\"></ox-i18n></h1>\n <span><ox-i18n msgid=\"text.delete account warning message\"></ox-i18n></span>\n <form @submit=${e => this.submit(e)}>\n <div class=\"field\">\n <label for=\"email\"><ox-i18n msgid=\"label.email\"></ox-i18n></label>\n <input id=\"email\" type=\"email\" name=\"email\" autocapitalize=\"off\" required />\n <label for=\"password\"><ox-i18n msgid=\"label.password\"></ox-i18n></label>\n <input id=\"password\" type=\"password\" name=\"password\" required />\n </div>\n\n <button class=\"ui button\" type=\"submit\"><ox-i18n msgid=\"label.delete account\"></ox-i18n></button>\n </form>\n `\n }\n\n async submit(e: Event) {\n e.preventDefault()\n\n const form = e.target as HTMLFormElement\n\n var params = {}\n new FormData(form).forEach((value, key) => {\n params[key] = value\n })\n\n try {\n const message = await auth.deleteUser(params)\n notify({\n level: 'info',\n message\n })\n\n auth.signout()\n } catch (e: any) {\n form.reset()\n\n notify({\n level: 'error',\n message: 'message' in e ? e.message : e\n })\n }\n }\n}\n"]}
|
package/dist-client/index.d.ts
CHANGED
package/dist-client/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import '@material/
|
|
1
|
+
import '@material/web/icon/icon.js';
|
|
2
2
|
import '@operato/i18n/ox-i18n.js';
|
|
3
3
|
import { html } from 'lit-html';
|
|
4
4
|
import { navigate, store } from '@operato/shell';
|
|
5
|
-
import { ADD_MORENDA } from '@things-factory/more-base';
|
|
5
|
+
import { ADD_MORENDA } from '@things-factory/more-base/client';
|
|
6
6
|
import { hasPrivilege } from '@things-factory/auth-base/dist-client';
|
|
7
7
|
export * from './components/role-selector.js';
|
|
8
8
|
export * from './components/domain-switch.js';
|
|
@@ -12,7 +12,7 @@ export async function setAuthManagementMenus() {
|
|
|
12
12
|
store.dispatch({
|
|
13
13
|
type: ADD_MORENDA,
|
|
14
14
|
morenda: {
|
|
15
|
-
icon: html ` <
|
|
15
|
+
icon: html ` <md-icon>how_to_reg</md-icon> `,
|
|
16
16
|
name: html ` <ox-i18n msgid="text.role_management"></ox-i18n> `,
|
|
17
17
|
action: () => {
|
|
18
18
|
navigate('roles');
|
|
@@ -22,7 +22,7 @@ export async function setAuthManagementMenus() {
|
|
|
22
22
|
store.dispatch({
|
|
23
23
|
type: ADD_MORENDA,
|
|
24
24
|
morenda: {
|
|
25
|
-
icon: html ` <
|
|
25
|
+
icon: html ` <md-icon>devices</md-icon> `,
|
|
26
26
|
name: html ` <ox-i18n msgid="text.appliance"></ox-i18n> `,
|
|
27
27
|
action: () => {
|
|
28
28
|
navigate('appliance-home');
|
|
@@ -32,7 +32,7 @@ export async function setAuthManagementMenus() {
|
|
|
32
32
|
store.dispatch({
|
|
33
33
|
type: ADD_MORENDA,
|
|
34
34
|
morenda: {
|
|
35
|
-
icon: html ` <
|
|
35
|
+
icon: html ` <md-icon>apps</md-icon> `,
|
|
36
36
|
name: html ` <ox-i18n msgid="text.application management"></ox-i18n> `,
|
|
37
37
|
action: () => {
|
|
38
38
|
navigate('applications');
|
|
@@ -42,7 +42,7 @@ export async function setAuthManagementMenus() {
|
|
|
42
42
|
store.dispatch({
|
|
43
43
|
type: ADD_MORENDA,
|
|
44
44
|
morenda: {
|
|
45
|
-
icon: html ` <
|
|
45
|
+
icon: html ` <md-icon>people</md-icon> `,
|
|
46
46
|
name: html ` <ox-i18n msgid="text.user management"></ox-i18n> `,
|
|
47
47
|
action: () => {
|
|
48
48
|
navigate('users');
|
|
@@ -52,7 +52,7 @@ export async function setAuthManagementMenus() {
|
|
|
52
52
|
store.dispatch({
|
|
53
53
|
type: ADD_MORENDA,
|
|
54
54
|
morenda: {
|
|
55
|
-
icon: html ` <
|
|
55
|
+
icon: html ` <md-icon>badge</md-icon> `,
|
|
56
56
|
name: html ` <ox-i18n msgid="text.auth-provider management"></ox-i18n> `,
|
|
57
57
|
action: () => {
|
|
58
58
|
navigate('auth-providers');
|
|
@@ -64,7 +64,7 @@ export async function setAuthManagementMenus() {
|
|
|
64
64
|
store.dispatch({
|
|
65
65
|
type: ADD_MORENDA,
|
|
66
66
|
morenda: {
|
|
67
|
-
icon: html ` <
|
|
67
|
+
icon: html ` <md-icon>business</md-icon> `,
|
|
68
68
|
name: html ` <ox-i18n msgid="text.domain management"></ox-i18n> `,
|
|
69
69
|
action: () => {
|
|
70
70
|
navigate('domains');
|
|
@@ -74,7 +74,7 @@ export async function setAuthManagementMenus() {
|
|
|
74
74
|
store.dispatch({
|
|
75
75
|
type: ADD_MORENDA,
|
|
76
76
|
morenda: {
|
|
77
|
-
icon: html ` <
|
|
77
|
+
icon: html ` <md-icon>dataset</md-icon> `,
|
|
78
78
|
name: html ` <ox-i18n msgid="text.attribute management"></ox-i18n> `,
|
|
79
79
|
action: () => {
|
|
80
80
|
navigate('attributes');
|
package/dist-client/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../client/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../client/index.ts"],"names":[],"mappings":"AAAA,OAAO,4BAA4B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\nimport { html } from 'lit-html'\n\nimport { navigate, store } from '@operato/shell'\nimport { ADD_MORENDA } from '@things-factory/more-base/client'\nimport { hasPrivilege } from '@things-factory/auth-base/dist-client'\n\nexport * from './components/role-selector.js'\nexport * from './components/domain-switch.js'\nexport * from './components/invite-user.js'\n\nexport async function setAuthManagementMenus() {\n if (await hasPrivilege({ privilege: 'mutation', category: 'user', domainOwnerGranted: true, superUserGranted: true })) {\n store.dispatch({\n type: ADD_MORENDA,\n morenda: {\n icon: html` <md-icon>how_to_reg</md-icon> `,\n name: html` <ox-i18n msgid=\"text.role_management\"></ox-i18n> `,\n action: () => {\n navigate('roles')\n }\n }\n })\n\n store.dispatch({\n type: ADD_MORENDA,\n morenda: {\n icon: html` <md-icon>devices</md-icon> `,\n name: html` <ox-i18n msgid=\"text.appliance\"></ox-i18n> `,\n action: () => {\n navigate('appliance-home')\n }\n }\n })\n\n store.dispatch({\n type: ADD_MORENDA,\n morenda: {\n icon: html` <md-icon>apps</md-icon> `,\n name: html` <ox-i18n msgid=\"text.application management\"></ox-i18n> `,\n action: () => {\n navigate('applications')\n }\n }\n })\n\n store.dispatch({\n type: ADD_MORENDA,\n morenda: {\n icon: html` <md-icon>people</md-icon> `,\n name: html` <ox-i18n msgid=\"text.user management\"></ox-i18n> `,\n action: () => {\n navigate('users')\n }\n }\n })\n\n store.dispatch({\n type: ADD_MORENDA,\n morenda: {\n icon: html` <md-icon>badge</md-icon> `,\n name: html` <ox-i18n msgid=\"text.auth-provider management\"></ox-i18n> `,\n action: () => {\n navigate('auth-providers')\n }\n }\n })\n }\n\n if (await hasPrivilege({ superUserGranted: true })) {\n store.dispatch({\n type: ADD_MORENDA,\n morenda: {\n icon: html` <md-icon>business</md-icon> `,\n name: html` <ox-i18n msgid=\"text.domain management\"></ox-i18n> `,\n action: () => {\n navigate('domains')\n }\n }\n })\n\n store.dispatch({\n type: ADD_MORENDA,\n morenda: {\n icon: html` <md-icon>dataset</md-icon> `,\n name: html` <ox-i18n msgid=\"text.attribute management\"></ox-i18n> `,\n action: () => {\n navigate('attributes')\n }\n }\n })\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import '@material/web/icon/icon.js';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { __decorate, __metadata } from "tslib";
|
|
2
|
+
import '@material/web/icon/icon.js';
|
|
2
3
|
import Clipboard from 'clipboard';
|
|
3
4
|
import gql from 'graphql-tag';
|
|
4
5
|
import { css, html } from 'lit';
|
|
@@ -7,6 +8,7 @@ import { connect } from 'pwa-helpers/connect-mixin.js';
|
|
|
7
8
|
import { APPLICATION_TYPES } from '../../constants/application';
|
|
8
9
|
import { client } from '@operato/graphql';
|
|
9
10
|
import { navigate, PageView, store } from '@operato/shell';
|
|
11
|
+
import { ButtonContainerStyles } from '@operato/styles';
|
|
10
12
|
let Application = class Application extends connect(store)(PageView) {
|
|
11
13
|
get context() {
|
|
12
14
|
return {
|
|
@@ -83,30 +85,15 @@ let Application = class Application extends connect(store)(PageView) {
|
|
|
83
85
|
<div field grid-span>
|
|
84
86
|
<label for="auth-url">auth URL</label>
|
|
85
87
|
<input id="auth-url" type="text" .value=${app.authUrl} readonly />
|
|
86
|
-
<mwc-button
|
|
87
|
-
dense
|
|
88
|
-
unelevated
|
|
89
|
-
button-in-field
|
|
90
|
-
clipboard-copy
|
|
91
|
-
@click=${e => e.preventDefault()}
|
|
92
|
-
label="copy"
|
|
93
|
-
></mwc-button>
|
|
88
|
+
<mwc-button dense unelevated button-in-field clipboard-copy @click=${e => e.preventDefault()} label="copy"></mwc-button>
|
|
94
89
|
The endpoint for authorization server. This is used to get the authorization code.
|
|
95
90
|
</div>
|
|
96
91
|
|
|
97
92
|
<div field grid-span>
|
|
98
93
|
<label for="access-token-url">access token URL</label>
|
|
99
94
|
<input id="access-token-url" type="text" .value=${app.accessTokenUrl} readonly />
|
|
100
|
-
<mwc-button
|
|
101
|
-
|
|
102
|
-
unelevated
|
|
103
|
-
button-in-field
|
|
104
|
-
clipboard-copy
|
|
105
|
-
@click=${e => e.preventDefault()}
|
|
106
|
-
label="copy"
|
|
107
|
-
></mwc-button>
|
|
108
|
-
The endpoint for authentication server. This is used to exchange the authorization code for an access
|
|
109
|
-
token.
|
|
95
|
+
<mwc-button dense unelevated button-in-field clipboard-copy @click=${e => e.preventDefault()} label="copy"></mwc-button>
|
|
96
|
+
The endpoint for authentication server. This is used to exchange the authorization code for an access token.
|
|
110
97
|
</div>
|
|
111
98
|
</div>
|
|
112
99
|
</fieldset>
|
|
@@ -119,36 +106,22 @@ let Application = class Application extends connect(store)(PageView) {
|
|
|
119
106
|
<div field grid-span>
|
|
120
107
|
<label for="app-key">appKey</label>
|
|
121
108
|
<input id="app-key" type="text" .value=${app.appKey} readonly />
|
|
122
|
-
<mwc-button
|
|
123
|
-
dense
|
|
124
|
-
unelevated
|
|
125
|
-
button-in-field
|
|
126
|
-
clipboard-copy
|
|
127
|
-
@click=${e => e.preventDefault()}
|
|
128
|
-
label="copy"
|
|
129
|
-
></mwc-button>
|
|
109
|
+
<mwc-button dense unelevated button-in-field clipboard-copy @click=${e => e.preventDefault()} label="copy"></mwc-button>
|
|
130
110
|
</div>
|
|
131
111
|
|
|
132
112
|
<div field grid-span>
|
|
133
113
|
<label for="app-secret">appSecret</label>
|
|
134
114
|
<input id="app-secret" type="text" .value=${app.appSecret} readonly />
|
|
135
|
-
<mwc-button
|
|
136
|
-
dense
|
|
137
|
-
unelevated
|
|
138
|
-
button-in-field
|
|
139
|
-
clipboard-copy
|
|
140
|
-
@click=${e => e.preventDefault()}
|
|
141
|
-
label="copy"
|
|
142
|
-
></mwc-button>
|
|
115
|
+
<mwc-button dense unelevated button-in-field clipboard-copy @click=${e => e.preventDefault()} label="copy"></mwc-button>
|
|
143
116
|
</div>
|
|
144
117
|
</div>
|
|
145
118
|
</fieldset>
|
|
146
119
|
</div>
|
|
147
120
|
|
|
148
121
|
<div class="button-container">
|
|
149
|
-
<
|
|
150
|
-
<
|
|
151
|
-
<
|
|
122
|
+
<button danger @click=${this.deleteApplication.bind(this)}><md-icon>delete_forever</md-icon>delete this app</button>
|
|
123
|
+
<button @click=${this.updateApplication.bind(this)}><md-icon>save</md-icon>update</button>
|
|
124
|
+
<button><md-icon>passkey</md-icon>generate new secret</button>
|
|
152
125
|
</div>
|
|
153
126
|
</form>
|
|
154
127
|
`;
|
|
@@ -255,6 +228,7 @@ let Application = class Application extends connect(store)(PageView) {
|
|
|
255
228
|
}
|
|
256
229
|
};
|
|
257
230
|
Application.styles = [
|
|
231
|
+
ButtonContainerStyles,
|
|
258
232
|
css `
|
|
259
233
|
:host {
|
|
260
234
|
display: flex;
|
|
@@ -352,16 +326,7 @@ Application.styles = [
|
|
|
352
326
|
font: var(--input-hint-font);
|
|
353
327
|
color: var(--input-hint-color);
|
|
354
328
|
}
|
|
355
|
-
|
|
356
|
-
--mdc-theme-primary: var(--mdc-danger-button-primary-color);
|
|
357
|
-
}
|
|
358
|
-
.button-container {
|
|
359
|
-
margin-top: var(--margin-wide);
|
|
360
|
-
text-align: right;
|
|
361
|
-
}
|
|
362
|
-
.button-container mwc-button {
|
|
363
|
-
margin-left: var(--margin-narrow);
|
|
364
|
-
}
|
|
329
|
+
|
|
365
330
|
@media screen and (max-width: 480px) {
|
|
366
331
|
[field] {
|
|
367
332
|
grid-column: span 2;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"application.js","sourceRoot":"","sources":["../../../client/pages/application/application.ts"],"names":[],"mappings":";AAAA,OAAO,SAAS,MAAM,WAAW,CAAA;AACjC,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AACrE,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAA;AAEtD,OAAO,EAAE,iBAAiB,EAAE,MA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AC,CAAA;SACzB;aAAM;YACL,OAAO,CAAC,KAAK,CAAC,aAAa,CAAC,CAAA;SAC7B;IACH,CAAC;;AA7XM,kBAAM,GAAG;IACd,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAgHF;CACF,CAAA;AAED;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;gDAAiB;AAC5C;IAAC,QAAQ,CAAC,kBAAkB,CAAC;;gDAAY;AAtHrC,WAAW;IADhB,aAAa,CAAC,kBAAkB,CAAC;GAC5B,WAAW,CA+XhB","sourcesContent":["import Clipboard from 'clipboard'\nimport gql from 'graphql-tag'\nimport { css, html } from 'lit'\nimport { customElement, property, queryAll } from 'lit/decorators.js'\nimport { connect } from 'pwa-helpers/connect-mixin.js'\n\nimport { APPLICATION_TYPES } from '../../constants/application'\n\nimport { client } from '@operato/graphql'\nimport { navigate, PageView, store } from '@operato/shell'\n\n@customElement('application-page')\nclass Application extends connect(store)(PageView) {\n static styles = [\n css`\n :host {\n display: flex;\n flex-direction: column;\n overflow-y: auto;\n position: relative;\n background-color: var(--main-section-background-color);\n padding: var(--padding-wide);\n }\n h2 {\n display: flex;\n align-items: center;\n margin: var(--title-margin);\n font: var(--title-font);\n color: var(--title-text-color);\n }\n [page-description] {\n margin: var(--page-description-margin);\n font: var(--page-description-font);\n color: var(--page-description-color);\n }\n [icon] {\n position: absolute;\n top: 10px;\n right: 10px;\n max-width: 80px;\n }\n [icon] img {\n max-width: 100%;\n max-height: 100%;\n }\n label {\n font: var(--label-font);\n color: var(--label-color);\n text-transform: var(--label-text-transform);\n }\n input,\n select {\n border: var(--border-dark-color);\n border-radius: var(--border-radius);\n margin: var(--input-margin);\n padding: var(--input-padding);\n font: var(--input-font);\n flex: 1;\n }\n select:focus,\n input:focus,\n button {\n outline: none;\n }\n form {\n max-width: var(--content-container-max-width);\n }\n [fieldset-container] {\n background-color: var(--theme-white-color);\n margin: var(--margin-wide) 0 var(--margin-default) 0;\n padding: var(--padding-default);\n border-radius: var(--border-radius);\n box-shadow: var(--box-shadow);\n }\n [fieldset-container] fieldset {\n margin: 0;\n margin-top: -15px;\n }\n fieldset {\n border-radius: var(--border-radius);\n border: var(--border-dark-color);\n margin: var(--fieldset-margin);\n padding: var(--fieldset-padding);\n }\n legend {\n padding: var(--legend-padding);\n font-weight: bold;\n color: var(--legend-color);\n }\n [field-2column] {\n display: grid;\n grid-template-columns: 1fr 1fr;\n grid-gap: 15px;\n }\n [field] {\n display: flex;\n flex-direction: column;\n position: relative;\n }\n [grid-span] {\n grid-column: span 2;\n }\n [button-in-field] {\n position: absolute;\n top: 24px;\n right: 4px;\n }\n [input-hint] {\n font: var(--input-hint-font);\n color: var(--input-hint-color);\n }\n [danger] {\n --mdc-theme-primary: var(--mdc-danger-button-primary-color);\n }\n .button-container {\n margin-top: var(--margin-wide);\n text-align: right;\n }\n .button-container mwc-button {\n margin-left: var(--margin-narrow);\n }\n @media screen and (max-width: 480px) {\n [field] {\n grid-column: span 2;\n }\n }\n `\n ]\n\n @property({ type: Object }) application: any\n @queryAll('[clipboard-copy]') copybuttons\n private clipboard?: Clipboard\n\n get context() {\n return {\n title: {\n icon: 'apps',\n text: this.application.name\n }\n }\n }\n\n render() {\n var app = this.application || {}\n\n return html`\n <div>\n <h2><mwc-icon>apps</mwc-icon> ${app.name}</h2>\n <p page-description>${app.description}</p>\n </div>\n\n <div icon>\n <img src=${app.icon} />\n </div>\n\n <form>\n <div fieldset-container>\n <fieldset>\n <legend>application</legend>\n <div field-2column>\n <div field grid-span>\n <label for=\"name\">app name</label>\n <input id=\"name\" type=\"text\" name=\"name\" .value=${app.name} />\n </div>\n\n <div field grid-span>\n <label for=\"description\">description</label>\n <input id=\"description\" type=\"text\" name=\"description\" .value=${app.description} />\n </div>\n\n <div field grid-span>\n <label for=\"email\">contact email</label>\n <input id=\"email\" type=\"text\" name=\"email\" .value=${app.email} />\n </div>\n\n <div field grid-span>\n <label for=\"type-selector\">type</label>\n <select id=\"type-selector\" name=\"type\">\n ${APPLICATION_TYPES.map(\n type =>\n html`<option value=\"${app.type}\" ?selected=\"${type === app.type ? true : false}\">${type}</option>`\n )}\n </select>\n </div>\n\n <div field grid-span>\n <label for=\"url\">application URL</label>\n <input id=\"url\" type=\"text\" name=\"url\" .value=${app.url} />\n </div>\n\n <div field grid-span>\n <label for=\"icon\">icon</label>\n <input id=\"icon\" type=\"text\" name=\"icon\" .value=${app.icon} />\n </div>\n\n <div field grid-span>\n <label for=\"redirect-url\">redirect URL</label>\n <input id=\"redirect-url\" type=\"text\" name=\"redirectUrl\" .value=${app.redirectUrl} />\n </div>\n\n <div field grid-span>\n <label for=\"webhook\">webhook</label>\n <input id=\"webhook\" type=\"text\" name=\"webhook\" .value=${app.webhook} />\n </div>\n\n <div field grid-span>\n <label for=\"available-scopes\">available-scopes</label>\n <input id=\"available-scopes\" type=\"text\" .value=${app.availableScopes} readonly />\n </div>\n\n <div field grid-span>\n <label for=\"auth-url\">auth URL</label>\n <input id=\"auth-url\" type=\"text\" .value=${app.authUrl} readonly />\n <mwc-button\n dense\n unelevated\n button-in-field\n clipboard-copy\n @click=${e => e.preventDefault()}\n label=\"copy\"\n ></mwc-button>\n The endpoint for authorization server. This is used to get the authorization code.\n </div>\n\n <div field grid-span>\n <label for=\"access-token-url\">access token URL</label>\n <input id=\"access-token-url\" type=\"text\" .value=${app.accessTokenUrl} readonly />\n <mwc-button\n dense\n unelevated\n button-in-field\n clipboard-copy\n @click=${e => e.preventDefault()}\n label=\"copy\"\n ></mwc-button>\n The endpoint for authentication server. This is used to exchange the authorization code for an access\n token.\n </div>\n </div>\n </fieldset>\n </div>\n\n <div fieldset-container>\n <fieldset>\n <legend>credentials</legend>\n <div field-2column>\n <div field grid-span>\n <label for=\"app-key\">appKey</label>\n <input id=\"app-key\" type=\"text\" .value=${app.appKey} readonly />\n <mwc-button\n dense\n unelevated\n button-in-field\n clipboard-copy\n @click=${e => e.preventDefault()}\n label=\"copy\"\n ></mwc-button>\n </div>\n\n <div field grid-span>\n <label for=\"app-secret\">appSecret</label>\n <input id=\"app-secret\" type=\"text\" .value=${app.appSecret} readonly />\n <mwc-button\n dense\n unelevated\n button-in-field\n clipboard-copy\n @click=${e => e.preventDefault()}\n label=\"copy\"\n ></mwc-button>\n </div>\n </div>\n </fieldset>\n </div>\n\n <div class=\"button-container\">\n <mwc-button raised danger label=\"delete this app\" @click=${this.deleteApplication.bind(this)}></mwc-button>\n <mwc-button raised label=\"update\" @click=${this.updateApplication.bind(this)}></mwc-button>\n <mwc-button outlined label=\"generate new secret\"></mwc-button>\n </div>\n </form>\n `\n }\n\n firstUpdated() {\n this.clipboard = new Clipboard(this.copybuttons, {\n target: (trigger => trigger.parentElement.querySelector('input')) as any\n })\n }\n\n async pageUpdated(changes, lifecycle, before) {\n if (this.active) {\n await this.fetchApplication()\n }\n }\n\n async fetchApplication() {\n const response = await client.query({\n query: gql`\n query ($id: String!) {\n application(id: $id) {\n id\n name\n description\n email\n url\n icon\n redirectUrl\n authUrl\n accessTokenUrl\n webhook\n availableScopes\n appKey\n appSecret\n type\n }\n }\n `,\n variables: {\n id: this.lifecycle.resourceId\n }\n })\n\n this.application = response.data.application\n }\n\n async updateApplication(e) {\n e.preventDefault()\n\n const form = this.renderRoot.querySelector('form') as HTMLFormElement\n const formData = new FormData(form)\n\n const patch = Array.from(formData.entries()).reduce((patch, [key, value]) => {\n patch[key] = value\n return patch\n }, {})\n\n const id = this.lifecycle.resourceId\n\n const response = await client.mutate({\n mutation: gql`\n mutation ($id: String!, $patch: ApplicationPatch!) {\n updateApplication(id: $id, patch: $patch) {\n id\n name\n description\n email\n url\n icon\n redirectUrl\n webhook\n appKey\n appSecret\n type\n }\n }\n `,\n variables: {\n id,\n patch\n }\n })\n\n if (response.errors) {\n console.error('update fail')\n } else {\n this.application = { ...this.application, ...response.data.updateApplication }\n console.log('update sucess')\n }\n }\n\n async deleteApplication(e) {\n e.preventDefault()\n\n const id = this.lifecycle.resourceId\n\n const response = await client.mutate({\n mutation: gql`\n mutation ($id: String!) {\n deleteApplication(id: $id)\n }\n `,\n variables: {\n id\n }\n })\n\n const result = response.data.deleteApplication\n if (result) {\n console.log('delete sucess')\n navigate('applications')\n } else {\n console.error('delete fail')\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"application.js","sourceRoot":"","sources":["../../../client/pages/application/application.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4B,CAAA;AAEnC,OAAO,SAAS,MAAM,WAAW,CAAA;AACjC,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AACrE,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAA;AAEtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAA;AAE/D,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAC1D,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAA;AAGvD,IAAM,WAAW,GAAjB,MAAM,WAAY,SAAQ,OAAO,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC;IAiHhD,IAAI,OAAO;QACT,OAAO;YACL,KAAK,EAAE;gBACL,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI;aAC5B;SACF,CAAA;IACH,CAAC;IAED,MAAM;QACJ,IAAI,GAAG,GAAG,IAAI,CAAC,WAAW,IAAI,EAAE,CAAA;QAEhC,OAAO,IAAI,CAAA;;6CAE8B,GAAG,C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import { css, html } from 'lit'\nimport { customElement, property, queryAll } from 'lit/decorators.js'\nimport { connect } from 'pwa-helpers/connect-mixin.js'\n\nimport { APPLICATION_TYPES } from '../../constants/application'\n\nimport { client } from '@operato/graphql'\nimport { navigate, PageView, store } from '@operato/shell'\nimport { ButtonContainerStyles } from '@operato/styles'\n\n@customElement('application-page')\nclass Application extends connect(store)(PageView) {\n static styles = [\n ButtonContainerStyles,\n css`\n :host {\n display: flex;\n flex-direction: column;\n overflow-y: auto;\n position: relative;\n background-color: var(--main-section-background-color);\n padding: var(--padding-wide);\n }\n h2 {\n display: flex;\n align-items: center;\n margin: var(--title-margin);\n font: var(--title-font);\n color: var(--title-text-color);\n }\n [page-description] {\n margin: var(--page-description-margin);\n font: var(--page-description-font);\n color: var(--page-description-color);\n }\n [icon] {\n position: absolute;\n top: 10px;\n right: 10px;\n max-width: 80px;\n }\n [icon] img {\n max-width: 100%;\n max-height: 100%;\n }\n label {\n font: var(--label-font);\n color: var(--label-color);\n text-transform: var(--label-text-transform);\n }\n input,\n select {\n border: var(--border-dark-color);\n border-radius: var(--border-radius);\n margin: var(--input-margin);\n padding: var(--input-padding);\n font: var(--input-font);\n flex: 1;\n }\n select:focus,\n input:focus,\n button {\n outline: none;\n }\n form {\n max-width: var(--content-container-max-width);\n }\n [fieldset-container] {\n background-color: var(--theme-white-color);\n margin: var(--margin-wide) 0 var(--margin-default) 0;\n padding: var(--padding-default);\n border-radius: var(--border-radius);\n box-shadow: var(--box-shadow);\n }\n [fieldset-container] fieldset {\n margin: 0;\n margin-top: -15px;\n }\n fieldset {\n border-radius: var(--border-radius);\n border: var(--border-dark-color);\n margin: var(--fieldset-margin);\n padding: var(--fieldset-padding);\n }\n legend {\n padding: var(--legend-padding);\n font-weight: bold;\n color: var(--legend-color);\n }\n [field-2column] {\n display: grid;\n grid-template-columns: 1fr 1fr;\n grid-gap: 15px;\n }\n [field] {\n display: flex;\n flex-direction: column;\n position: relative;\n }\n [grid-span] {\n grid-column: span 2;\n }\n [button-in-field] {\n position: absolute;\n top: 24px;\n right: 4px;\n }\n [input-hint] {\n font: var(--input-hint-font);\n color: var(--input-hint-color);\n }\n\n @media screen and (max-width: 480px) {\n [field] {\n grid-column: span 2;\n }\n }\n `\n ]\n\n @property({ type: Object }) application: any\n @queryAll('[clipboard-copy]') copybuttons\n private clipboard?: Clipboard\n\n get context() {\n return {\n title: {\n icon: 'apps',\n text: this.application.name\n }\n }\n }\n\n render() {\n var app = this.application || {}\n\n return html`\n <div>\n <h2><mwc-icon>apps</mwc-icon> ${app.name}</h2>\n <p page-description>${app.description}</p>\n </div>\n\n <div icon>\n <img src=${app.icon} />\n </div>\n\n <form>\n <div fieldset-container>\n <fieldset>\n <legend>application</legend>\n <div field-2column>\n <div field grid-span>\n <label for=\"name\">app name</label>\n <input id=\"name\" type=\"text\" name=\"name\" .value=${app.name} />\n </div>\n\n <div field grid-span>\n <label for=\"description\">description</label>\n <input id=\"description\" type=\"text\" name=\"description\" .value=${app.description} />\n </div>\n\n <div field grid-span>\n <label for=\"email\">contact email</label>\n <input id=\"email\" type=\"text\" name=\"email\" .value=${app.email} />\n </div>\n\n <div field grid-span>\n <label for=\"type-selector\">type</label>\n <select id=\"type-selector\" name=\"type\">\n ${APPLICATION_TYPES.map(type => html`<option value=\"${app.type}\" ?selected=\"${type === app.type ? true : false}\">${type}</option>`)}\n </select>\n </div>\n\n <div field grid-span>\n <label for=\"url\">application URL</label>\n <input id=\"url\" type=\"text\" name=\"url\" .value=${app.url} />\n </div>\n\n <div field grid-span>\n <label for=\"icon\">icon</label>\n <input id=\"icon\" type=\"text\" name=\"icon\" .value=${app.icon} />\n </div>\n\n <div field grid-span>\n <label for=\"redirect-url\">redirect URL</label>\n <input id=\"redirect-url\" type=\"text\" name=\"redirectUrl\" .value=${app.redirectUrl} />\n </div>\n\n <div field grid-span>\n <label for=\"webhook\">webhook</label>\n <input id=\"webhook\" type=\"text\" name=\"webhook\" .value=${app.webhook} />\n </div>\n\n <div field grid-span>\n <label for=\"available-scopes\">available-scopes</label>\n <input id=\"available-scopes\" type=\"text\" .value=${app.availableScopes} readonly />\n </div>\n\n <div field grid-span>\n <label for=\"auth-url\">auth URL</label>\n <input id=\"auth-url\" type=\"text\" .value=${app.authUrl} readonly />\n <mwc-button dense unelevated button-in-field clipboard-copy @click=${e => e.preventDefault()} label=\"copy\"></mwc-button>\n The endpoint for authorization server. This is used to get the authorization code.\n </div>\n\n <div field grid-span>\n <label for=\"access-token-url\">access token URL</label>\n <input id=\"access-token-url\" type=\"text\" .value=${app.accessTokenUrl} readonly />\n <mwc-button dense unelevated button-in-field clipboard-copy @click=${e => e.preventDefault()} label=\"copy\"></mwc-button>\n The endpoint for authentication server. This is used to exchange the authorization code for an access token.\n </div>\n </div>\n </fieldset>\n </div>\n\n <div fieldset-container>\n <fieldset>\n <legend>credentials</legend>\n <div field-2column>\n <div field grid-span>\n <label for=\"app-key\">appKey</label>\n <input id=\"app-key\" type=\"text\" .value=${app.appKey} readonly />\n <mwc-button dense unelevated button-in-field clipboard-copy @click=${e => e.preventDefault()} label=\"copy\"></mwc-button>\n </div>\n\n <div field grid-span>\n <label for=\"app-secret\">appSecret</label>\n <input id=\"app-secret\" type=\"text\" .value=${app.appSecret} readonly />\n <mwc-button dense unelevated button-in-field clipboard-copy @click=${e => e.preventDefault()} label=\"copy\"></mwc-button>\n </div>\n </div>\n </fieldset>\n </div>\n\n <div class=\"button-container\">\n <button danger @click=${this.deleteApplication.bind(this)}><md-icon>delete_forever</md-icon>delete this app</button>\n <button @click=${this.updateApplication.bind(this)}><md-icon>save</md-icon>update</button>\n <button><md-icon>passkey</md-icon>generate new secret</button>\n </div>\n </form>\n `\n }\n\n firstUpdated() {\n this.clipboard = new Clipboard(this.copybuttons, {\n target: (trigger => trigger.parentElement.querySelector('input')) as any\n })\n }\n\n async pageUpdated(changes, lifecycle, before) {\n if (this.active) {\n await this.fetchApplication()\n }\n }\n\n async fetchApplication() {\n const response = await client.query({\n query: gql`\n query ($id: String!) {\n application(id: $id) {\n id\n name\n description\n email\n url\n icon\n redirectUrl\n authUrl\n accessTokenUrl\n webhook\n availableScopes\n appKey\n appSecret\n type\n }\n }\n `,\n variables: {\n id: this.lifecycle.resourceId\n }\n })\n\n this.application = response.data.application\n }\n\n async updateApplication(e) {\n e.preventDefault()\n\n const form = this.renderRoot.querySelector('form') as HTMLFormElement\n const formData = new FormData(form)\n\n const patch = Array.from(formData.entries()).reduce((patch, [key, value]) => {\n patch[key] = value\n return patch\n }, {})\n\n const id = this.lifecycle.resourceId\n\n const response = await client.mutate({\n mutation: gql`\n mutation ($id: String!, $patch: ApplicationPatch!) {\n updateApplication(id: $id, patch: $patch) {\n id\n name\n description\n email\n url\n icon\n redirectUrl\n webhook\n appKey\n appSecret\n type\n }\n }\n `,\n variables: {\n id,\n patch\n }\n })\n\n if (response.errors) {\n console.error('update fail')\n } else {\n this.application = { ...this.application, ...response.data.updateApplication }\n console.log('update sucess')\n }\n }\n\n async deleteApplication(e) {\n e.preventDefault()\n\n const id = this.lifecycle.resourceId\n\n const response = await client.mutate({\n mutation: gql`\n mutation ($id: String!) {\n deleteApplication(id: $id)\n }\n `,\n variables: {\n id\n }\n })\n\n const result = response.data.deleteApplication\n if (result) {\n console.log('delete sucess')\n navigate('applications')\n } else {\n console.error('delete fail')\n }\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import '@material/web/icon/icon.js';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { __decorate, __metadata } from "tslib";
|
|
2
|
+
import '@material/web/icon/icon.js';
|
|
2
3
|
import gql from 'graphql-tag';
|
|
3
4
|
import { css, html, LitElement } from 'lit';
|
|
4
5
|
import { customElement, property, query, state } from 'lit/decorators.js';
|
|
@@ -9,16 +10,11 @@ import { DataGrist } from '@operato/data-grist';
|
|
|
9
10
|
let AttributeSetItemList = class AttributeSetItemList extends localize(i18next)(LitElement) {
|
|
10
11
|
render() {
|
|
11
12
|
return html `
|
|
12
|
-
<ox-grist
|
|
13
|
-
|
|
14
|
-
.config=${this.gristConfig}
|
|
15
|
-
.fetchHandler=${this.fetchHandler.bind(this)}
|
|
16
|
-
></ox-grist>
|
|
13
|
+
<ox-grist .mode=${isMobileDevice() ? 'LIST' : 'GRID'} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)}></ox-grist>
|
|
14
|
+
|
|
17
15
|
<div class="button-container">
|
|
18
|
-
<
|
|
19
|
-
|
|
20
|
-
>
|
|
21
|
-
<mwc-button raised @click=${this.updateAttributeSetItems.bind(this)}>${i18next.t('button.save')}</mwc-button>
|
|
16
|
+
<button danger @click=${this.deleteAttributeSetItems.bind(this)}><md-icon>delete_forever</md-icon>${i18next.t('button.delete')}</button>
|
|
17
|
+
<button @click=${this.updateAttributeSetItems.bind(this)}><md-icon>save</md-icon>${i18next.t('button.save')}</button>
|
|
22
18
|
</div>
|
|
23
19
|
`;
|
|
24
20
|
}
|
|
@@ -194,6 +190,7 @@ let AttributeSetItemList = class AttributeSetItemList extends localize(i18next)(
|
|
|
194
190
|
};
|
|
195
191
|
AttributeSetItemList.styles = [
|
|
196
192
|
css `
|
|
193
|
+
ButtonContainerStyles,
|
|
197
194
|
:host {
|
|
198
195
|
display: flex;
|
|
199
196
|
flex-direction: column;
|
|
@@ -204,19 +201,6 @@ AttributeSetItemList.styles = [
|
|
|
204
201
|
ox-grist {
|
|
205
202
|
flex: 1;
|
|
206
203
|
}
|
|
207
|
-
|
|
208
|
-
.button-container {
|
|
209
|
-
display: flex;
|
|
210
|
-
margin-left: auto;
|
|
211
|
-
padding: var(--padding-default);
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
[danger] {
|
|
215
|
-
--mdc-theme-primary: var(--mdc-danger-button-primary-color);
|
|
216
|
-
}
|
|
217
|
-
mwc-button {
|
|
218
|
-
margin-left: var(--margin-default);
|
|
219
|
-
}
|
|
220
204
|
`
|
|
221
205
|
];
|
|
222
206
|
__decorate([
|
|
@@ -1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,KAAK,CAAC,uBAAuB;QACnC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,gBAAgB,EAAE,EAAE,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC,EAAE;YAC1E,OAAM;SACP;QAED,IAAI,CAAC,KAAK,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAAA;IACzC,CAAC;;AAhOM,2BAAM,GAAG;IACd,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;KAwBF;CACF,CAAA;AA9BD;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;uDAAe;AAE1C;IAAC,KAAK,EAAE;;yDAAiB;AA8BzB;IAAC,KAAK,CAAC,UAAU,CAAC;8BAAiB,SAAS;mDAAA;AAjCxC,oBAAoB;IADzB,aAAa,CAAC,yBAAyB,CAAC;GACnC,oBAAoB,CAsOzB","sourcesContent":["import gql from 'graphql-tag'\n\nimport { css, html, LitElement } from 'lit'\nimport { customElement, property, query, state } from 'lit/decorators.js'\n\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { isMobileDevice } from '@operato/utils'\nimport { ColumnConfig, DataGrist, FetchOption, SortersControl } from '@operato/data-grist'\n\n@customElement('attribute-set-item-list')\nclass AttributeSetItemList extends localize(i18next)(LitElement) {\n @property({ type: Object }) attribute: any\n\n @state() gristConfig: any\n\n static styles = [\n css`\n :host {\n display: flex;\n flex-direction: column;\n\n background-color: #fff;\n }\n\n ox-grist {\n flex: 1;\n }\n\n .button-container {\n display: flex;\n margin-left: auto;\n padding: var(--padding-default);\n }\n\n [danger] {\n --mdc-theme-primary: var(--mdc-danger-button-primary-color);\n }\n mwc-button {\n margin-left: var(--margin-default);\n }\n `\n ]\n\n @query('ox-grist') private grist!: DataGrist\n\n render() {\n return html`\n <ox-grist\n .mode=${isMobileDevice() ? 'LIST' : 'GRID'}\n .config=${this.gristConfig}\n .fetchHandler=${this.fetchHandler.bind(this)}\n ></ox-grist>\n <div class=\"button-container\">\n <mwc-button raised danger @click=${this.deleteAttributeSetItems.bind(this)}\n >${i18next.t('button.delete')}</mwc-button\n >\n <mwc-button raised @click=${this.updateAttributeSetItems.bind(this)}>${i18next.t('button.save')}</mwc-button>\n </div>\n `\n }\n\n async firstUpdated() {\n this.gristConfig = {\n list: { fields: ['name', 'description', 'active'] },\n columns: [\n { type: 'gutter', gutterName: 'row-selector', multiple: true },\n {\n type: 'gutter',\n gutterName: 'button',\n icon: 'add',\n handlers: {\n click: 'record-copy'\n }\n },\n { type: 'gutter', gutterName: 'sequence' },\n {\n type: 'gutter',\n gutterName: 'button',\n icon: 'arrow_upward',\n handlers: {\n click: 'move-up'\n }\n },\n {\n type: 'gutter',\n gutterName: 'button',\n icon: 'arrow_downward',\n handlers: {\n click: 'move-down'\n }\n },\n {\n type: 'string',\n name: 'name',\n header: i18next.t('field.name'),\n record: {\n editable: true\n },\n width: 140\n },\n {\n type: 'string',\n name: 'description',\n header: i18next.t('field.description'),\n record: {\n editable: true\n },\n width: 180\n },\n {\n type: 'string',\n name: 'tag',\n header: i18next.t('field.tag'),\n record: {\n editable: true\n },\n width: 180\n },\n {\n type: 'checkbox',\n name: 'active',\n label: true,\n header: i18next.t('field.active'),\n record: {\n editable: true\n },\n sortable: true,\n width: 60\n },\n {\n type: 'checkbox',\n name: 'hidden',\n label: true,\n header: i18next.t('field.hidden'),\n record: {\n editable: true\n },\n sortable: true,\n width: 60\n },\n {\n type: 'select',\n name: 'type',\n header: i18next.t('field.type'),\n record: {\n options: ['', 'number', 'text', 'select', 'boolean', 'date', 'datetime', 'file'],\n editable: true\n },\n width: 120\n },\n {\n type: 'parameters',\n name: 'options',\n header: i18next.t('field.options'),\n record: {\n editable: true,\n renderer: 'json5',\n options: async (value, column, record, row, field) => {\n return {\n name: record.type,\n help: '',\n spec:\n record.type === 'select'\n ? [\n {\n type: 'options' /* property-editor type */,\n name: 'options',\n label: 'options'\n }\n ]\n : [],\n context: this.grist,\n objectified: true\n }\n }\n },\n width: 120\n }\n ],\n rows: {\n selectable: {\n multiple: true\n }\n },\n pagination: {\n infinite: true\n },\n sorters: []\n }\n }\n\n async fetchHandler({ filters, page, limit, sortings = [] }: FetchOption) {\n const attributes = this.attribute.items || []\n\n return {\n total: attributes.length,\n records: attributes\n }\n }\n\n private async updateAttributeSetItems() {\n this.grist.commit()\n\n const response = await client.mutate({\n mutation: gql`\n mutation ($id: String!, $patch: AttributeSetPatch!) {\n updateAttributeSet(id: $id, patch: $patch) {\n entity\n }\n }\n `,\n variables: {\n id: this.attribute.id,\n patch: {\n items: this.grist.data.records,\n cuFlag: 'M'\n }\n }\n })\n\n if (!response.errors) {\n await document.dispatchEvent(\n new CustomEvent('notify', {\n detail: {\n message: i18next.t('text.info_x_successfully', {\n x: i18next.t('button.save')\n })\n }\n })\n )\n }\n }\n\n private async deleteAttributeSetItems() {\n if (!confirm(i18next.t('text.sure_to_x', { x: i18next.t('text.delete') }))) {\n return\n }\n\n this.grist.deleteSelectedRecords(false)\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"attribute-set-item-list.js","sourceRoot":"","sources":["../../../client/pages/attribute/attribute-set-item-list.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4B,CAAA;AAEnC,OAAO,GAAG,MAAM,aAAa,CAAA;AAE7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAEzE,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAC/C,OAAO,EAAgB,SAAS,EAA+B,MAAM,qBAAqB,CAAA;AAI1F,IAAM,oBAA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AAC;GACnC,oBAAoB,CAqNzB","sourcesContent":["import '@material/web/icon/icon.js'\n\nimport gql from 'graphql-tag'\n\nimport { css, html, LitElement } from 'lit'\nimport { customElement, property, query, state } from 'lit/decorators.js'\n\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { isMobileDevice } from '@operato/utils'\nimport { ColumnConfig, DataGrist, FetchOption, SortersControl } from '@operato/data-grist'\nimport { ButtonContainerStyles } from '@operato/styles'\n\n@customElement('attribute-set-item-list')\nclass AttributeSetItemList extends localize(i18next)(LitElement) {\n @property({ type: Object }) attribute: any\n\n @state() gristConfig: any\n\n static styles = [\n css`\n ButtonContainerStyles,\n :host {\n display: flex;\n flex-direction: column;\n\n background-color: #fff;\n }\n\n ox-grist {\n flex: 1;\n }\n `\n ]\n\n @query('ox-grist') private grist!: DataGrist\n\n render() {\n return html`\n <ox-grist .mode=${isMobileDevice() ? 'LIST' : 'GRID'} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)}></ox-grist>\n\n <div class=\"button-container\">\n <button danger @click=${this.deleteAttributeSetItems.bind(this)}><md-icon>delete_forever</md-icon>${i18next.t('button.delete')}</button>\n <button @click=${this.updateAttributeSetItems.bind(this)}><md-icon>save</md-icon>${i18next.t('button.save')}</button>\n </div>\n `\n }\n\n async firstUpdated() {\n this.gristConfig = {\n list: { fields: ['name', 'description', 'active'] },\n columns: [\n { type: 'gutter', gutterName: 'row-selector', multiple: true },\n {\n type: 'gutter',\n gutterName: 'button',\n icon: 'add',\n handlers: {\n click: 'record-copy'\n }\n },\n { type: 'gutter', gutterName: 'sequence' },\n {\n type: 'gutter',\n gutterName: 'button',\n icon: 'arrow_upward',\n handlers: {\n click: 'move-up'\n }\n },\n {\n type: 'gutter',\n gutterName: 'button',\n icon: 'arrow_downward',\n handlers: {\n click: 'move-down'\n }\n },\n {\n type: 'string',\n name: 'name',\n header: i18next.t('field.name'),\n record: {\n editable: true\n },\n width: 140\n },\n {\n type: 'string',\n name: 'description',\n header: i18next.t('field.description'),\n record: {\n editable: true\n },\n width: 180\n },\n {\n type: 'string',\n name: 'tag',\n header: i18next.t('field.tag'),\n record: {\n editable: true\n },\n width: 180\n },\n {\n type: 'checkbox',\n name: 'active',\n label: true,\n header: i18next.t('field.active'),\n record: {\n editable: true\n },\n sortable: true,\n width: 60\n },\n {\n type: 'checkbox',\n name: 'hidden',\n label: true,\n header: i18next.t('field.hidden'),\n record: {\n editable: true\n },\n sortable: true,\n width: 60\n },\n {\n type: 'select',\n name: 'type',\n header: i18next.t('field.type'),\n record: {\n options: ['', 'number', 'text', 'select', 'boolean', 'date', 'datetime', 'file'],\n editable: true\n },\n width: 120\n },\n {\n type: 'parameters',\n name: 'options',\n header: i18next.t('field.options'),\n record: {\n editable: true,\n renderer: 'json5',\n options: async (value, column, record, row, field) => {\n return {\n name: record.type,\n help: '',\n spec:\n record.type === 'select'\n ? [\n {\n type: 'options' /* property-editor type */,\n name: 'options',\n label: 'options'\n }\n ]\n : [],\n context: this.grist,\n objectified: true\n }\n }\n },\n width: 120\n }\n ],\n rows: {\n selectable: {\n multiple: true\n }\n },\n pagination: {\n infinite: true\n },\n sorters: []\n }\n }\n\n async fetchHandler({ filters, page, limit, sortings = [] }: FetchOption) {\n const attributes = this.attribute.items || []\n\n return {\n total: attributes.length,\n records: attributes\n }\n }\n\n private async updateAttributeSetItems() {\n this.grist.commit()\n\n const response = await client.mutate({\n mutation: gql`\n mutation ($id: String!, $patch: AttributeSetPatch!) {\n updateAttributeSet(id: $id, patch: $patch) {\n entity\n }\n }\n `,\n variables: {\n id: this.attribute.id,\n patch: {\n items: this.grist.data.records,\n cuFlag: 'M'\n }\n }\n })\n\n if (!response.errors) {\n await document.dispatchEvent(\n new CustomEvent('notify', {\n detail: {\n message: i18next.t('text.info_x_successfully', {\n x: i18next.t('button.save')\n })\n }\n })\n )\n }\n }\n\n private async deleteAttributeSetItems() {\n if (!confirm(i18next.t('text.sure_to_x', { x: i18next.t('text.delete') }))) {\n return\n }\n\n this.grist.deleteSelectedRecords(false)\n }\n}\n"]}
|
|
@@ -24,11 +24,19 @@ export declare class AttributeSetManagementPage extends AttributeSetManagementPa
|
|
|
24
24
|
filter: {
|
|
25
25
|
handler: () => void;
|
|
26
26
|
};
|
|
27
|
-
actions: {
|
|
27
|
+
actions: ({
|
|
28
28
|
title: string;
|
|
29
29
|
action: () => Promise<void>;
|
|
30
30
|
icon: string;
|
|
31
|
-
|
|
31
|
+
emphasis?: undefined;
|
|
32
|
+
} | {
|
|
33
|
+
title: string;
|
|
34
|
+
action: () => Promise<void>;
|
|
35
|
+
icon: string;
|
|
36
|
+
emphasis: {
|
|
37
|
+
danger: boolean;
|
|
38
|
+
};
|
|
39
|
+
})[];
|
|
32
40
|
toolbar: boolean;
|
|
33
41
|
};
|
|
34
42
|
render(): import("lit").TemplateResult<1>;
|
|
@@ -43,7 +43,10 @@ let AttributeSetManagementPage = class AttributeSetManagementPage extends connec
|
|
|
43
43
|
{
|
|
44
44
|
title: i18next.t('button.delete'),
|
|
45
45
|
action: this.deleteAttributeSet.bind(this),
|
|
46
|
-
icon: 'delete'
|
|
46
|
+
icon: 'delete',
|
|
47
|
+
emphasis: {
|
|
48
|
+
danger: true
|
|
49
|
+
}
|
|
47
50
|
}
|
|
48
51
|
],
|
|
49
52
|
toolbar: false
|
|
@@ -52,17 +55,9 @@ let AttributeSetManagementPage = class AttributeSetManagementPage extends connec
|
|
|
52
55
|
render() {
|
|
53
56
|
const mode = this.mode || (isMobileDevice() ? 'CARD' : 'GRID');
|
|
54
57
|
return html `
|
|
55
|
-
<ox-grist
|
|
56
|
-
.mode=${mode}
|
|
57
|
-
.config=${this.gristConfig}
|
|
58
|
-
.fetchHandler=${this.fetchHandler.bind(this)}
|
|
59
|
-
?url-params-sensitive=${this.active}
|
|
60
|
-
>
|
|
58
|
+
<ox-grist .mode=${mode} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)} ?url-params-sensitive=${this.active}>
|
|
61
59
|
<div slot="headroom" class="header">
|
|
62
|
-
<div class="title">
|
|
63
|
-
<mwc-icon>summarize</mwc-icon>
|
|
64
|
-
${i18next.t('title.attributes')}
|
|
65
|
-
</div>
|
|
60
|
+
<div class="title">${i18next.t('title.attributes')}</div>
|
|
66
61
|
|
|
67
62
|
<ox-context-page-toolbar class="actions" .context=${this.context}> </ox-context-page-toolbar>
|
|
68
63
|
</div>
|