@things-factory/auth-ui 7.0.1-rc.9 → 7.0.2

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.
Files changed (113) hide show
  1. package/client/auth-style-sign.ts +5 -4
  2. package/client/components/abstract-auth-page.ts +8 -3
  3. package/client/components/abstract-password-reset.ts +2 -0
  4. package/client/components/abstract-sign.ts +3 -2
  5. package/client/components/change-password.ts +1 -1
  6. package/client/components/create-domain-popup.ts +1 -1
  7. package/client/components/create-role.ts +2 -2
  8. package/client/components/create-user.ts +2 -2
  9. package/client/components/domain-switch.ts +3 -3
  10. package/client/components/my-login-history.ts +1 -1
  11. package/client/components/ownership-transfer-popup.ts +2 -2
  12. package/client/components/partner-info-card.ts +2 -2
  13. package/client/components/partner-role-editor.ts +2 -2
  14. package/client/components/profile-component.ts +2 -2
  15. package/client/components/role-edit-form.ts +1 -1
  16. package/client/components/role-privilege-editor.ts +5 -5
  17. package/client/components/role-selector.ts +6 -6
  18. package/client/components/user-role-editor.ts +8 -4
  19. package/client/entries/auth/activate.ts +2 -1
  20. package/client/entries/auth/checkin.ts +9 -6
  21. package/client/entries/auth/result.ts +3 -2
  22. package/client/entries/auth/signin.ts +4 -0
  23. package/client/entries/auth/signup.ts +3 -0
  24. package/client/entries/oauth2/oauth2-decision-page.ts +4 -4
  25. package/client/entries/public/home.ts +4 -4
  26. package/client/pages/app-binding/app-binding.ts +4 -4
  27. package/client/pages/app-binding/app-bindings.ts +3 -3
  28. package/client/pages/appliance/appliance.ts +4 -4
  29. package/client/pages/appliance/home.ts +4 -4
  30. package/client/pages/appliance/register.ts +2 -2
  31. package/client/pages/application/application.ts +4 -4
  32. package/client/pages/application/applications.ts +3 -3
  33. package/client/pages/application/register.ts +3 -3
  34. package/client/pages/partner/partner-management.ts +1 -1
  35. package/client/pages/role/role-management.ts +9 -6
  36. package/client/pages/user/user-management.ts +2 -2
  37. package/dist-client/auth-style-sign.js +5 -4
  38. package/dist-client/auth-style-sign.js.map +1 -1
  39. package/dist-client/components/abstract-auth-page.d.ts +1 -0
  40. package/dist-client/components/abstract-auth-page.js +7 -3
  41. package/dist-client/components/abstract-auth-page.js.map +1 -1
  42. package/dist-client/components/abstract-password-reset.js +2 -0
  43. package/dist-client/components/abstract-password-reset.js.map +1 -1
  44. package/dist-client/components/abstract-sign.js +3 -2
  45. package/dist-client/components/abstract-sign.js.map +1 -1
  46. package/dist-client/components/change-password.js +1 -1
  47. package/dist-client/components/change-password.js.map +1 -1
  48. package/dist-client/components/create-domain-popup.js +1 -1
  49. package/dist-client/components/create-domain-popup.js.map +1 -1
  50. package/dist-client/components/create-role.js +2 -2
  51. package/dist-client/components/create-role.js.map +1 -1
  52. package/dist-client/components/create-user.js +2 -2
  53. package/dist-client/components/create-user.js.map +1 -1
  54. package/dist-client/components/domain-switch.js +3 -3
  55. package/dist-client/components/domain-switch.js.map +1 -1
  56. package/dist-client/components/my-login-history.js +1 -1
  57. package/dist-client/components/my-login-history.js.map +1 -1
  58. package/dist-client/components/ownership-transfer-popup.js +2 -2
  59. package/dist-client/components/ownership-transfer-popup.js.map +1 -1
  60. package/dist-client/components/partner-info-card.js +2 -2
  61. package/dist-client/components/partner-info-card.js.map +1 -1
  62. package/dist-client/components/partner-role-editor.js +2 -2
  63. package/dist-client/components/partner-role-editor.js.map +1 -1
  64. package/dist-client/components/profile-component.js +2 -2
  65. package/dist-client/components/profile-component.js.map +1 -1
  66. package/dist-client/components/role-edit-form.js +1 -1
  67. package/dist-client/components/role-edit-form.js.map +1 -1
  68. package/dist-client/components/role-privilege-editor.js +5 -5
  69. package/dist-client/components/role-privilege-editor.js.map +1 -1
  70. package/dist-client/components/role-selector.js +6 -6
  71. package/dist-client/components/role-selector.js.map +1 -1
  72. package/dist-client/components/user-role-editor.js +8 -4
  73. package/dist-client/components/user-role-editor.js.map +1 -1
  74. package/dist-client/entries/auth/activate.js +2 -1
  75. package/dist-client/entries/auth/activate.js.map +1 -1
  76. package/dist-client/entries/auth/checkin.js +9 -6
  77. package/dist-client/entries/auth/checkin.js.map +1 -1
  78. package/dist-client/entries/auth/result.js +3 -2
  79. package/dist-client/entries/auth/result.js.map +1 -1
  80. package/dist-client/entries/auth/signin.d.ts +1 -0
  81. package/dist-client/entries/auth/signin.js +3 -0
  82. package/dist-client/entries/auth/signin.js.map +1 -1
  83. package/dist-client/entries/auth/signup.js +3 -0
  84. package/dist-client/entries/auth/signup.js.map +1 -1
  85. package/dist-client/entries/oauth2/oauth2-decision-page.js +4 -4
  86. package/dist-client/entries/oauth2/oauth2-decision-page.js.map +1 -1
  87. package/dist-client/entries/public/home.js +4 -4
  88. package/dist-client/entries/public/home.js.map +1 -1
  89. package/dist-client/pages/app-binding/app-binding.js +4 -4
  90. package/dist-client/pages/app-binding/app-binding.js.map +1 -1
  91. package/dist-client/pages/app-binding/app-bindings.js +3 -3
  92. package/dist-client/pages/app-binding/app-bindings.js.map +1 -1
  93. package/dist-client/pages/appliance/appliance.js +4 -4
  94. package/dist-client/pages/appliance/appliance.js.map +1 -1
  95. package/dist-client/pages/appliance/home.js +4 -4
  96. package/dist-client/pages/appliance/home.js.map +1 -1
  97. package/dist-client/pages/appliance/register.js +2 -2
  98. package/dist-client/pages/appliance/register.js.map +1 -1
  99. package/dist-client/pages/application/application.js +4 -4
  100. package/dist-client/pages/application/application.js.map +1 -1
  101. package/dist-client/pages/application/applications.js +3 -3
  102. package/dist-client/pages/application/applications.js.map +1 -1
  103. package/dist-client/pages/application/register.js +3 -3
  104. package/dist-client/pages/application/register.js.map +1 -1
  105. package/dist-client/pages/partner/partner-management.js +1 -1
  106. package/dist-client/pages/partner/partner-management.js.map +1 -1
  107. package/dist-client/pages/role/role-management.js +9 -6
  108. package/dist-client/pages/role/role-management.js.map +1 -1
  109. package/dist-client/pages/user/user-management.js +2 -2
  110. package/dist-client/pages/user/user-management.js.map +1 -1
  111. package/dist-client/tsconfig.tsbuildinfo +1 -1
  112. package/dist-server/tsconfig.tsbuildinfo +1 -1
  113. package/package.json +11 -11
@@ -1 +1 @@
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;AAG1D,IAAM,WAAW,GAAjB,MAAM,WAAY,SAAQ,OAAO,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC;IAiLhD,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;;2CAE4B,GAAG,CAAC,IAAI;8BACrB,GAAG,CAAC,WAAW;;;;mBAI1B,GAAG,CAAC,IAAI;;;;;;;;;;kEAUuC,GAAG,CAAC,IAAI;;;;;gFAKM,GAAG,CAAC,WAAW;;;;;oEAK3B,GAAG,CAAC,KAAK;;;;;;oBAMzD,iBAAiB,CAAC,GAAG,CACrB,IAAI,CAAC,EAAE,CACL,IAAI,CAAA,kBAAkB,GAAG,CAAC,IAAI,gBAAgB,IAAI,KAAK,GAAG,CAAC,IAAI,C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iB,CAAC,CAAC;QACvB,CAAC,CAAC,cAAc,EAAE,CAAA;QAElB,MAAM,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,UAAU,CAAA;QAEpC,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC;YACnC,QAAQ,EAAE,GAAG,CAAA;;;;OAIZ;YACD,SAAS,EAAE;gBACT,EAAE;aACH;SACF,CAAC,CAAA;QAEF,MAAM,MAAM,GAAG,QAAQ,CAAC,IAAI,CAAC,iBAAiB,CAAA;QAC9C,IAAI,MAAM,EAAE,CAAC;YACX,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAA;YAC5B,QAAQ,CAAC,cAAc,CAAC,CAAA;QAC1B,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,KAAK,CAAC,aAAa,CAAC,CAAA;QAC9B,CAAC;IACH,CAAC;;AA3ZM,kBAAM,GAAG;IACd,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAwKF;CACF,AA1KY,CA0KZ;AAE2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;gDAAiB;AACd;IAA7B,QAAQ,CAAC,kBAAkB,CAAC;;gDAAY;AA9KrC,WAAW;IADhB,aAAa,CAAC,kBAAkB,CAAC;GAC5B,WAAW,CA6ZhB","sourcesContent":["import '@material/web/icon/icon.js'\n\nimport 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\n background-color: var(--md-sys-color-background);\n padding: var(--padding-wide);\n }\n\n h2 {\n margin: var(--title-margin);\n font: var(--title-font);\n color: var(--title-text-color);\n }\n\n [page-description] {\n margin: var(--page-description-margin);\n font: var(--page-description-font);\n color: var(--page-description-color);\n }\n\n [icon] {\n position: absolute;\n top: 10px;\n right: 10px;\n max-width: 80px;\n }\n\n [icon] img {\n max-width: 100%;\n max-height: 100%;\n }\n\n [button-primary] {\n background-color: var(--button-primary-background-color);\n border: var(--button-border);\n border-radius: var(--button-border-radius);\n margin: var(--button-margin);\n padding: var(--button-primary-padding);\n color: var(--button-primary-color);\n font: var(--button-primary-font);\n text-transform: var(--button-text-transform);\n\n text-decoration: none;\n }\n\n [button-primary]:hover {\n background-color: var(--button-primary-active-background-color);\n box-shadow: var(--button-active-box-shadow);\n }\n\n [fieldset-container] {\n background-color: var(--md-sys-color-surface);\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 label {\n font: var(--label-font);\n color: var(--label-color, var(--md-sys-color-on-surface));\n text-transform: var(--label-text-transform);\n }\n\n input,\n select {\n border: var(--border-dim-color);\n border-radius: var(--border-radius);\n margin: var(--input-margin);\n padding: var(--input-padding);\n font: var(--input-font);\n\n flex: 1;\n }\n\n select:focus,\n input:focus,\n button {\n outline: none;\n }\n\n form {\n max-width: var(--content-container-max-width);\n }\n }\n\n [fieldset-container] fieldset {\n margin: 0;\n margin-top: -15px;\n }\n\n fieldset {\n border-radius: var(--border-radius);\n border: var(--border-dim-color);\n margin: var(--fieldset-margin);\n padding: var(--fieldset-padding);\n }\n\n legend {\n padding: var(--legend-padding);\n font-weight: bold;\n color: var(--legend-color);\n }\n\n [field-2column] {\n display: grid;\n grid-template-columns: 1fr 1fr;\n grid-gap: 15px;\n }\n\n [field] {\n display: flex;\n flex-direction: column;\n position: relative;\n }\n\n [grid-span] {\n grid-column: span 2;\n }\n\n button {\n display: flex;\n align-items: center;\n gap: var(--spacing-small);\n }\n\n button,\n input[type='submit'],\n [button-in-field] {\n background-color: var(--button-background-color);\n border: var(--button-border);\n border-radius: var(--button-border-radius);\n padding: var(--button-padding);\n color: var(--button-color);\n font: var(--button-font);\n text-transform: var(--button-text-transform);\n\n margin: var(--margin-default) 0 var(--margin-default) var(--margin-default);\n float: right;\n text-decoration: none;\n }\n\n button:hover,\n input[type='submit']:hover {\n border: var(--button-activ-border);\n box-shadow: var(--button-active-box-shadow);\n }\n\n [button-in-field] {\n border-radius: 0 var(--button-border-radius) var(--button-border-radius) 0;\n position: absolute;\n top: 12px;\n right: 0;\n max-height: 36px;\n }\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><md-icon>apps</md-icon>&nbsp;${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 <button dense button-in-field clipboard-copy @click=${e => e.preventDefault()}>copy</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 <button dense button-in-field clipboard-copy @click=${e => e.preventDefault()}>copy</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 <button dense button-in-field clipboard-copy @click=${e => e.preventDefault()}>copy</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 <button dense button-in-field clipboard-copy @click=${e => e.preventDefault()}>copy</button>\n </div>\n </div>\n </fieldset>\n </div>\n\n <div class=\"button-container\">\n <button danger @click=${this.deleteApplication.bind(this)}>\n <md-icon>delete_forever</md-icon>delete this app\n </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
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,cAAc,EAAE,CAAA;QAElB,MAAM,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,UAAU,CAAA;QAEpC,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC;YACnC,QAAQ,EAAE,GAAG,CAAA;;;;OAIZ;YACD,SAAS,EAAE;gBACT,EAAE;aACH;SACF,CAAC,CAAA;QAEF,MAAM,MAAM,GAAG,QAAQ,CAAC,IAAI,CAAC,iBAAiB,CAAA;QAC9C,IAAI,MAAM,EAAE,CAAC;YACX,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAA;YAC5B,QAAQ,CAAC,cAAc,CAAC,CAAA;QAC1B,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,KAAK,CAAC,aAAa,CAAC,CAAA;QAC9B,CAAC;IACH,CAAC;;AA3ZM,kBAAM,GAAG;IACd,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAwKF;CACF,AA1KY,CA0KZ;AAE2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;gDAAiB;AACd;IAA7B,QAAQ,CAAC,kBAAkB,CAAC;;gDAAY;AA9KrC,WAAW;IADhB,aAAa,CAAC,kBAAkB,CAAC;GAC5B,WAAW,CA6ZhB","sourcesContent":["import '@material/web/icon/icon.js'\n\nimport 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\n background-color: var(--md-sys-color-background);\n padding: var(--spacing-large);\n }\n\n h2 {\n margin: var(--title-margin);\n font: var(--title-font);\n color: var(--title-text-color);\n }\n\n [page-description] {\n margin: var(--page-description-margin);\n font: var(--page-description-font);\n color: var(--page-description-color);\n }\n\n [icon] {\n position: absolute;\n top: 10px;\n right: 10px;\n max-width: 80px;\n }\n\n [icon] img {\n max-width: 100%;\n max-height: 100%;\n }\n\n [button-primary] {\n background-color: var(--button-primary-background-color);\n border: var(--button-border);\n border-radius: var(--button-border-radius);\n margin: var(--button-margin);\n padding: var(--button-primary-padding);\n color: var(--button-primary-color);\n font: var(--button-primary-font);\n text-transform: var(--button-text-transform);\n\n text-decoration: none;\n }\n\n [button-primary]:hover {\n background-color: var(--button-primary-active-background-color);\n box-shadow: var(--button-active-box-shadow);\n }\n\n [fieldset-container] {\n background-color: var(--md-sys-color-surface);\n margin: var(--spacing-large) 0 var(--spacing-medium) 0;\n padding: var(--spacing-medium);\n border-radius: var(--border-radius);\n box-shadow: var(--box-shadow);\n\n label {\n font: var(--label-font);\n color: var(--label-color, var(--md-sys-color-on-surface));\n text-transform: var(--label-text-transform);\n }\n\n input,\n select {\n border: var(--border-dim-color);\n border-radius: var(--border-radius);\n margin: var(--input-margin);\n padding: var(--input-padding);\n font: var(--input-font);\n\n flex: 1;\n }\n\n select:focus,\n input:focus,\n button {\n outline: none;\n }\n\n form {\n max-width: var(--content-container-max-width);\n }\n }\n\n [fieldset-container] fieldset {\n margin: 0;\n margin-top: -15px;\n }\n\n fieldset {\n border-radius: var(--border-radius);\n border: var(--border-dim-color);\n margin: var(--fieldset-margin);\n padding: var(--fieldset-padding);\n }\n\n legend {\n padding: var(--legend-padding);\n font-weight: bold;\n color: var(--legend-color);\n }\n\n [field-2column] {\n display: grid;\n grid-template-columns: 1fr 1fr;\n grid-gap: 15px;\n }\n\n [field] {\n display: flex;\n flex-direction: column;\n position: relative;\n }\n\n [grid-span] {\n grid-column: span 2;\n }\n\n button {\n display: flex;\n align-items: center;\n gap: var(--spacing-small);\n }\n\n button,\n input[type='submit'],\n [button-in-field] {\n background-color: var(--button-background-color);\n border: var(--button-border);\n border-radius: var(--button-border-radius);\n padding: var(--button-padding);\n color: var(--button-color);\n font: var(--button-font);\n text-transform: var(--button-text-transform);\n\n margin: var(--spacing-medium) 0 var(--spacing-medium) var(--spacing-medium);\n float: right;\n text-decoration: none;\n }\n\n button:hover,\n input[type='submit']:hover {\n border: var(--button-activ-border);\n box-shadow: var(--button-active-box-shadow);\n }\n\n [button-in-field] {\n border-radius: 0 var(--button-border-radius) var(--button-border-radius) 0;\n position: absolute;\n top: 12px;\n right: 0;\n max-height: 36px;\n }\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><md-icon>apps</md-icon>&nbsp;${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 <button dense button-in-field clipboard-copy @click=${e => e.preventDefault()}>copy</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 <button dense button-in-field clipboard-copy @click=${e => e.preventDefault()}>copy</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 <button dense button-in-field clipboard-copy @click=${e => e.preventDefault()}>copy</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 <button dense button-in-field clipboard-copy @click=${e => e.preventDefault()}>copy</button>\n </div>\n </div>\n </fieldset>\n </div>\n\n <div class=\"button-container\">\n <button danger @click=${this.deleteApplication.bind(this)}>\n <md-icon>delete_forever</md-icon>delete this app\n </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"]}
@@ -86,7 +86,7 @@ Applications.styles = [
86
86
  css `
87
87
  :host {
88
88
  background-color: var(--md-sys-color-background);
89
- padding: var(--padding-wide);
89
+ padding: var(--spacing-large);
90
90
 
91
91
  overflow: auto;
92
92
  }
@@ -97,7 +97,7 @@ Applications.styles = [
97
97
 
98
98
  md-outlined-button {
99
99
  float: right;
100
- margin-top: var(--margin-default);
100
+ margin-top: var(--spacing-medium);
101
101
  text-transform: capitalize;
102
102
  }
103
103
 
@@ -114,7 +114,7 @@ Applications.styles = [
114
114
  }
115
115
 
116
116
  table {
117
- margin: var(--margin-wide) 0;
117
+ margin: var(--spacing-large) 0;
118
118
  width: 100%;
119
119
  border-collapse: collapse;
120
120
  }
@@ -1 +1 @@
1
- {"version":3,"file":"applications.js","sourceRoot":"","sources":["../../../client/pages/application/applications.ts"],"names":[],"mappings":";AAAA,OAAO,yCAAyC,CAAA;AAChD,OAAO,yCAAyC,CAAA;AAEhD,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAC3D,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAA;AAEtD,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAG1D,IAAM,YAAY,GAAlB,MAAM,YAAa,SAAQ,OAAO,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC;IAAnD;;QA2F6B,iBAAY,GAAU,EAAE,CAAA;IA8ErD,CAAC;IA5EC,IAAI,OAAO;QACT,OAAO;YACL,KAAK,EAAE,cAAc;YACrB,IAAI,EAAE,kBAAkB;SACzB,CAAA;IACH,CAAC;IAED,MAAM;QACJ,IAAI,IAAI,GAAG,IAAI,CAAC,YAAY,IAAI,EAAE,CAAA;QAElC,OAAO,IAAI,CAAA;;;;;;;qCAOsB,CAAC,CAAC,EAAE,CAAC,QAAQ,CAAC,sBAAsB,CAAC;;;;;;;;;;;;UAYhE,IAAI,CAAC,GAAG,CACR,GAAG,CAAC,EAAE,CAAC,IAAI,CAAA;;;0BAGK,eAAe,GAAG,CAAC,EAAE,EAAE;4BACrB,GAAG,CAAC,IAAI;oBAChB,GAAG,CAAC,WAAW;;;;;;;WAOxB,CACF;;;mCAG0B,CAAC,CAAC,EAAE,CAAC,QAAQ,CAAC,cAAc,CAAC;KAC3D,CAAA;IACH,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,OAAO,EAAE,SAAS,EAAE,MAAM;QAC1C,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAChB,IAAI,CAAC,YAAY,GAAG,CAAC,MAAM,IAAI,CAAC,iBAAiB,EAAE,CAAC,CAAC,KAAK,CAAA;QAC5D,CAAC;IACH,CAAC;IAED,KAAK,CAAC,iBAAiB;QACrB,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC;YAClC,KAAK,EAAE,GAAG,CAAA;;;;;;;;;;;OAWT;SACF,CAAC,CAAA;QAEF,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;YACrB,OAAO,QAAQ,CAAC,IAAI,CAAC,YAAY,CAAA;QACnC,CAAC;IACH,CAAC;;AAvKM,mBAAM,GAAG;IACd,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAsFF;CACF,AAxFY,CAwFZ;AAE0B;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;;kDAAyB;AA3F/C,YAAY;IADjB,aAAa,CAAC,mBAAmB,CAAC;GAC7B,YAAY,CAyKjB","sourcesContent":["import '@material/web/button/elevated-button.js'\nimport '@material/web/button/outlined-button.js'\n\nimport gql from 'graphql-tag'\nimport { css, html } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\nimport { connect } from 'pwa-helpers/connect-mixin.js'\n\nimport { client } from '@operato/graphql'\nimport { navigate, PageView, store } from '@operato/shell'\n\n@customElement('applications-page')\nclass Applications extends connect(store)(PageView) {\n static styles = [\n css`\n :host {\n background-color: var(--md-sys-color-background);\n padding: var(--padding-wide);\n\n overflow: auto;\n }\n\n md-elevated-button {\n text-transform: capitalize;\n }\n\n md-outlined-button {\n float: right;\n margin-top: var(--margin-default);\n text-transform: capitalize;\n }\n\n h2 {\n margin: var(--title-margin);\n font: var(--title-font);\n color: var(--title-text-color);\n }\n\n [page-description] {\n margin: var(--page-description-margin);\n font: var(--page-description-font);\n color: var(--page-description-color);\n }\n\n table {\n margin: var(--margin-wide) 0;\n width: 100%;\n border-collapse: collapse;\n }\n\n tr {\n background-color: var(--tr-background-color);\n }\n\n tr:nth-child(odd) {\n background-color: var(--tr-background-odd-color);\n }\n\n tr:hover {\n background-color: var(--tr-background-hover-color);\n }\n\n th {\n border-top: var(--th-border-top);\n border-bottom: var(--td-border-bottom);\n padding: var(--th-padding);\n\n font: var(--th-font);\n color: var(--th-color);\n text-transform: var(--th-text-transform);\n text-align: left;\n }\n\n td {\n padding: var(--td-padding);\n border-bottom: var(--td-border-bottom);\n font: var(--td-font);\n color: var(--td-color);\n }\n\n td a {\n font: var(--td-font);\n text-decoration: none;\n color: var(--md-sys-color-on-surface);\n }\n\n td a strong {\n font: bold 16px var(--theme-font);\n\n display: block;\n text-decoration: none;\n }\n\n .text-align-center {\n text-align: center;\n }\n\n .text-align-right {\n text-align: right;\n }\n `\n ]\n\n @property({ type: Array }) applications: any[] = []\n\n get context() {\n return {\n title: `applications`,\n help: 'auth/application'\n }\n }\n\n render() {\n var apps = this.applications || []\n\n return html`\n <div>\n <h2>Registered Applications</h2>\n <p page-description>\n What type of app are you building?<br />Choose the app type that best suits the audience you’re building for.\n </p>\n\n <md-elevated-button @click=${e => navigate('application-register')}\n >register new application</md-elevated-button\n >\n </div>\n\n <table>\n <tr>\n <th>app name</th>\n <th>API health</th>\n <th>Installs</th>\n <th>status</th>\n </tr>\n ${apps.map(\n app => html`\n <tr>\n <td>\n <a href=${`application/${app.id}`}>\n <strong>${app.name}</strong>\n ${app.description}\n </a>\n </td>\n <td>OK</td>\n <td class=\"text-align-center\">1</td>\n <td>draft</td>\n </tr>\n `\n )}\n </table>\n\n <md-outlined-button @click=${e => navigate('app-bindings')}>bound applications ..</md-outlined-button>\n `\n }\n\n async pageUpdated(changes, lifecycle, before) {\n if (this.active) {\n this.applications = (await this.fetchApplications()).items\n }\n }\n\n async fetchApplications() {\n const response = await client.query({\n query: gql`\n query {\n applications {\n items {\n id\n name\n description\n }\n total\n }\n }\n `\n })\n\n if (!response.errors) {\n return response.data.applications\n }\n }\n}\n"]}
1
+ {"version":3,"file":"applications.js","sourceRoot":"","sources":["../../../client/pages/application/applications.ts"],"names":[],"mappings":";AAAA,OAAO,yCAAyC,CAAA;AAChD,OAAO,yCAAyC,CAAA;AAEhD,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAC3D,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAA;AAEtD,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAG1D,IAAM,YAAY,GAAlB,MAAM,YAAa,SAAQ,OAAO,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC;IAAnD;;QA2F6B,iBAAY,GAAU,EAAE,CAAA;IA8ErD,CAAC;IA5EC,IAAI,OAAO;QACT,OAAO;YACL,KAAK,EAAE,cAAc;YACrB,IAAI,EAAE,kBAAkB;SACzB,CAAA;IACH,CAAC;IAED,MAAM;Q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@material/web/button/elevated-button.js'\nimport '@material/web/button/outlined-button.js'\n\nimport gql from 'graphql-tag'\nimport { css, html } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\nimport { connect } from 'pwa-helpers/connect-mixin.js'\n\nimport { client } from '@operato/graphql'\nimport { navigate, PageView, store } from '@operato/shell'\n\n@customElement('applications-page')\nclass Applications extends connect(store)(PageView) {\n static styles = [\n css`\n :host {\n background-color: var(--md-sys-color-background);\n padding: var(--spacing-large);\n\n overflow: auto;\n }\n\n md-elevated-button {\n text-transform: capitalize;\n }\n\n md-outlined-button {\n float: right;\n margin-top: var(--spacing-medium);\n text-transform: capitalize;\n }\n\n h2 {\n margin: var(--title-margin);\n font: var(--title-font);\n color: var(--title-text-color);\n }\n\n [page-description] {\n margin: var(--page-description-margin);\n font: var(--page-description-font);\n color: var(--page-description-color);\n }\n\n table {\n margin: var(--spacing-large) 0;\n width: 100%;\n border-collapse: collapse;\n }\n\n tr {\n background-color: var(--tr-background-color);\n }\n\n tr:nth-child(odd) {\n background-color: var(--tr-background-odd-color);\n }\n\n tr:hover {\n background-color: var(--tr-background-hover-color);\n }\n\n th {\n border-top: var(--th-border-top);\n border-bottom: var(--td-border-bottom);\n padding: var(--th-padding);\n\n font: var(--th-font);\n color: var(--th-color);\n text-transform: var(--th-text-transform);\n text-align: left;\n }\n\n td {\n padding: var(--td-padding);\n border-bottom: var(--td-border-bottom);\n font: var(--td-font);\n color: var(--td-color);\n }\n\n td a {\n font: var(--td-font);\n text-decoration: none;\n color: var(--md-sys-color-on-surface);\n }\n\n td a strong {\n font: bold 16px var(--theme-font);\n\n display: block;\n text-decoration: none;\n }\n\n .text-align-center {\n text-align: center;\n }\n\n .text-align-right {\n text-align: right;\n }\n `\n ]\n\n @property({ type: Array }) applications: any[] = []\n\n get context() {\n return {\n title: `applications`,\n help: 'auth/application'\n }\n }\n\n render() {\n var apps = this.applications || []\n\n return html`\n <div>\n <h2>Registered Applications</h2>\n <p page-description>\n What type of app are you building?<br />Choose the app type that best suits the audience you’re building for.\n </p>\n\n <md-elevated-button @click=${e => navigate('application-register')}\n >register new application</md-elevated-button\n >\n </div>\n\n <table>\n <tr>\n <th>app name</th>\n <th>API health</th>\n <th>Installs</th>\n <th>status</th>\n </tr>\n ${apps.map(\n app => html`\n <tr>\n <td>\n <a href=${`application/${app.id}`}>\n <strong>${app.name}</strong>\n ${app.description}\n </a>\n </td>\n <td>OK</td>\n <td class=\"text-align-center\">1</td>\n <td>draft</td>\n </tr>\n `\n )}\n </table>\n\n <md-outlined-button @click=${e => navigate('app-bindings')}>bound applications ..</md-outlined-button>\n `\n }\n\n async pageUpdated(changes, lifecycle, before) {\n if (this.active) {\n this.applications = (await this.fetchApplications()).items\n }\n }\n\n async fetchApplications() {\n const response = await client.query({\n query: gql`\n query {\n applications {\n items {\n id\n name\n description\n }\n total\n }\n }\n `\n })\n\n if (!response.errors) {\n return response.data.applications\n }\n }\n}\n"]}
@@ -105,7 +105,7 @@ ApplicationRegister.styles = [
105
105
  css `
106
106
  :host {
107
107
  background-color: var(--md-sys-color-background);
108
- padding: var(--padding-wide);
108
+ padding: var(--spacing-large);
109
109
 
110
110
  position: relative;
111
111
 
@@ -135,7 +135,7 @@ ApplicationRegister.styles = [
135
135
 
136
136
  img[pagedeco] {
137
137
  width: 150px;
138
- margin: 0 var(--margin-wide);
138
+ margin: 0 var(--spacing-large);
139
139
  float: left;
140
140
  position: relative;
141
141
  top: -20px;
@@ -143,7 +143,7 @@ ApplicationRegister.styles = [
143
143
 
144
144
  [form-container] {
145
145
  background-color: var(--md-sys-color-surface);
146
- padding: var(--padding-wide);
146
+ padding: var(--spacing-large);
147
147
  border-radius: var(--border-radius);
148
148
  box-shadow: var(--box-shadow);
149
149
  max-width: var(--input-container-max-width);
@@ -1 +1 @@
1
- {"version":3,"file":"register.js","sourceRoot":"","sources":["../../../client/pages/application/register.ts"],"names":[],"mappings":";AAAA,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GA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C,GAAG,KAAK,CAAA;YACxB,OAAO,WAAW,CAAA;QACpB,CAAC,EAAE,EAAE,CAAC,CAAA;QAEN,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC;YACnC,QAAQ,EAAE,GAAG,CAAA;;;;;;OAMZ;YACD,SAAS,EAAE;gBACT,WAAW;aACZ;SACF,CAAC,CAAA;QAEF,IAAI,QAAQ,CAAC,MAAM,EAAE,CAAC;YACpB,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAA;QAC/B,CAAC;aAAM,CAAC;YACN,MAAM,EAAE,GAAG,QAAQ,CAAC,IAAI,CAAC,iBAAiB,CAAC,EAAE,CAAA;YAC7C,QAAQ,CAAC,eAAe,EAAE,EAAE,CAAC,CAAA;QAC/B,CAAC;IACH,CAAC;IAED,WAAW,CAAC,OAAO,EAAE,SAAS,EAAE,MAAM;QACpC,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAChB,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAA;QACnB,CAAC;IACH,CAAC;;AAvMM,0BAAM,GAAG;IACd,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA0FF;CACF,AA5FY,CA4FZ;AAE2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;wDAAiB;AAE7B;IAAd,KAAK,CAAC,MAAM,CAAC;8BAAQ,eAAe;iDAAA;AAE5B;IAAR,KAAK,EAAE;;kDAAe;AAnGnB,mBAAmB;IADxB,aAAa,CAAC,sBAAsB,CAAC;GAChC,mBAAmB,CAyMxB","sourcesContent":["import gql from 'graphql-tag'\nimport { css, html } from 'lit'\nimport { customElement, property, query, state } from 'lit/decorators.js'\nimport { connect } from 'pwa-helpers/connect-mixin.js'\n\nimport { client } from '@operato/graphql'\nimport { navigate, PageView, store } from '@operato/shell'\n\n@customElement('application-register')\nclass ApplicationRegister extends connect(store)(PageView) {\n static styles = [\n css`\n :host {\n background-color: var(--md-sys-color-background);\n padding: var(--padding-wide);\n\n position: relative;\n\n overflow: auto;\n }\n h2 {\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\n max-width: 80px;\n }\n [icon] img {\n max-width: 100%;\n max-height: 100%;\n }\n\n img[pagedeco] {\n width: 150px;\n margin: 0 var(--margin-wide);\n float: left;\n position: relative;\n top: -20px;\n }\n\n [form-container] {\n background-color: var(--md-sys-color-surface);\n padding: var(--padding-wide);\n border-radius: var(--border-radius);\n box-shadow: var(--box-shadow);\n max-width: var(--input-container-max-width);\n position: relative;\n top: -50px;\n clear: both;\n }\n label {\n font: var(--label-font);\n color: var(--label-color, var(--md-sys-color-on-surface));\n text-transform: var(--label-text-transform);\n }\n input {\n border: var(--border-dim-color);\n border-radius: var(--border-radius);\n margin: var(--input-margin);\n padding: var(--input-padding);\n font: var(--input-font);\n\n flex: 1;\n }\n select:focus,\n input:focus {\n outline: none;\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 }\n [grid-span] {\n grid-column: span 2;\n }\n @media screen and (max-width: 480px) {\n img[pagedeco] {\n display: none;\n }\n [form-container] {\n position: initial;\n }\n [field] {\n grid-column: span 2;\n }\n }\n `\n ]\n\n @property({ type: Object }) application: any\n\n @query('form') form!: HTMLFormElement\n\n @state() _icon?: string\n\n get context() {\n return {\n title: `application registration`,\n help: 'auth/application'\n }\n }\n\n render() {\n return html`\n <img src=\"/assets/images/image-api.png\" pagedeco />\n <h2>Register new application</h2>\n <p page-description>\n You can register new application here.<br />\n What type of app are you building? Choose the app type that best suits the audience you’re building for.\n </p>\n\n ${this._icon\n ? html`\n <div icon>\n <img src=${this._icon} />\n </div>\n `\n : html``}\n\n <div form-container>\n <form>\n <div field-2column>\n <div field grid-span>\n <label for=\"name\">name</label>\n <input id=\"name\" type=\"text\" name=\"name\" />\n </div>\n\n <div field grid-span>\n <label for=\"description\">description</label>\n <input id=\"description\" type=\"text\" name=\"description\" />\n </div>\n\n <div field grid-span>\n <label for=\"app-url\">application url</label>\n <input id=\"app-url\" type=\"text\" name=\"url\" />\n </div>\n\n <div field grid-span>\n <label for=\"redirect-url\">redirectUrl</label>\n <input id=\"redirect-url\" type=\"text\" name=\"redirectUrl\" />\n </div>\n\n <div field grid-span>\n <label for=\"icon\">application icon</label>\n <input id=\"icon\" type=\"text\" name=\"icon\" @change=${e => (this._icon = e.target.value)} />\n </div>\n\n <div field grid-span>\n <label for=\"email\">contact email</label>\n <input id=\"email\" type=\"text\" name=\"email\" />\n </div>\n\n <md-elevated-button grid-span @click=${this.createApplication.bind(this)}>register</md-elevated-button>\n </div>\n </form>\n </div>\n `\n }\n\n async createApplication(e) {\n e.preventDefault()\n\n const formData = new FormData(this.form)\n\n const application = Array.from(formData.entries()).reduce((application, [key, value]) => {\n application[key] = value\n return application\n }, {})\n\n const response = await client.mutate({\n mutation: gql`\n mutation ($application: NewApplication!) {\n createApplication(application: $application) {\n id\n }\n }\n `,\n variables: {\n application\n }\n })\n\n if (response.errors) {\n console.log('creation fail.')\n } else {\n const id = response.data.createApplication.id\n navigate(`application/${id}`)\n }\n }\n\n pageUpdated(changes, lifecycle, before) {\n if (this.active) {\n this.form.reset()\n }\n }\n}\n"]}
1
+ {"version":3,"file":"register.js","sourceRoot":"","sources":["../../../client/pages/application/register.ts"],"names":[],"mappings":";AAAA,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CA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AAM,CAAC;YACnC,QAAQ,EAAE,GAAG,CAAA;;;;;;OAMZ;YACD,SAAS,EAAE;gBACT,WAAW;aACZ;SACF,CAAC,CAAA;QAEF,IAAI,QAAQ,CAAC,MAAM,EAAE,CAAC;YACpB,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAA;QAC/B,CAAC;aAAM,CAAC;YACN,MAAM,EAAE,GAAG,QAAQ,CAAC,IAAI,CAAC,iBAAiB,CAAC,EAAE,CAAA;YAC7C,QAAQ,CAAC,eAAe,EAAE,EAAE,CAAC,CAAA;QAC/B,CAAC;IACH,CAAC;IAED,WAAW,CAAC,OAAO,EAAE,SAAS,EAAE,MAAM;QACpC,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAChB,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAA;QACnB,CAAC;IACH,CAAC;;AAvMM,0BAAM,GAAG;IACd,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA0FF;CACF,AA5FY,CA4FZ;AAE2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;wDAAiB;AAE7B;IAAd,KAAK,CAAC,MAAM,CAAC;8BAAQ,eAAe;iDAAA;AAE5B;IAAR,KAAK,EAAE;;kDAAe;AAnGnB,mBAAmB;IADxB,aAAa,CAAC,sBAAsB,CAAC;GAChC,mBAAmB,CAyMxB","sourcesContent":["import gql from 'graphql-tag'\nimport { css, html } from 'lit'\nimport { customElement, property, query, state } from 'lit/decorators.js'\nimport { connect } from 'pwa-helpers/connect-mixin.js'\n\nimport { client } from '@operato/graphql'\nimport { navigate, PageView, store } from '@operato/shell'\n\n@customElement('application-register')\nclass ApplicationRegister extends connect(store)(PageView) {\n static styles = [\n css`\n :host {\n background-color: var(--md-sys-color-background);\n padding: var(--spacing-large);\n\n position: relative;\n\n overflow: auto;\n }\n h2 {\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\n max-width: 80px;\n }\n [icon] img {\n max-width: 100%;\n max-height: 100%;\n }\n\n img[pagedeco] {\n width: 150px;\n margin: 0 var(--spacing-large);\n float: left;\n position: relative;\n top: -20px;\n }\n\n [form-container] {\n background-color: var(--md-sys-color-surface);\n padding: var(--spacing-large);\n border-radius: var(--border-radius);\n box-shadow: var(--box-shadow);\n max-width: var(--input-container-max-width);\n position: relative;\n top: -50px;\n clear: both;\n }\n label {\n font: var(--label-font);\n color: var(--label-color, var(--md-sys-color-on-surface));\n text-transform: var(--label-text-transform);\n }\n input {\n border: var(--border-dim-color);\n border-radius: var(--border-radius);\n margin: var(--input-margin);\n padding: var(--input-padding);\n font: var(--input-font);\n\n flex: 1;\n }\n select:focus,\n input:focus {\n outline: none;\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 }\n [grid-span] {\n grid-column: span 2;\n }\n @media screen and (max-width: 480px) {\n img[pagedeco] {\n display: none;\n }\n [form-container] {\n position: initial;\n }\n [field] {\n grid-column: span 2;\n }\n }\n `\n ]\n\n @property({ type: Object }) application: any\n\n @query('form') form!: HTMLFormElement\n\n @state() _icon?: string\n\n get context() {\n return {\n title: `application registration`,\n help: 'auth/application'\n }\n }\n\n render() {\n return html`\n <img src=\"/assets/images/image-api.png\" pagedeco />\n <h2>Register new application</h2>\n <p page-description>\n You can register new application here.<br />\n What type of app are you building? Choose the app type that best suits the audience you’re building for.\n </p>\n\n ${this._icon\n ? html`\n <div icon>\n <img src=${this._icon} />\n </div>\n `\n : html``}\n\n <div form-container>\n <form>\n <div field-2column>\n <div field grid-span>\n <label for=\"name\">name</label>\n <input id=\"name\" type=\"text\" name=\"name\" />\n </div>\n\n <div field grid-span>\n <label for=\"description\">description</label>\n <input id=\"description\" type=\"text\" name=\"description\" />\n </div>\n\n <div field grid-span>\n <label for=\"app-url\">application url</label>\n <input id=\"app-url\" type=\"text\" name=\"url\" />\n </div>\n\n <div field grid-span>\n <label for=\"redirect-url\">redirectUrl</label>\n <input id=\"redirect-url\" type=\"text\" name=\"redirectUrl\" />\n </div>\n\n <div field grid-span>\n <label for=\"icon\">application icon</label>\n <input id=\"icon\" type=\"text\" name=\"icon\" @change=${e => (this._icon = e.target.value)} />\n </div>\n\n <div field grid-span>\n <label for=\"email\">contact email</label>\n <input id=\"email\" type=\"text\" name=\"email\" />\n </div>\n\n <md-elevated-button grid-span @click=${this.createApplication.bind(this)}>register</md-elevated-button>\n </div>\n </form>\n </div>\n `\n }\n\n async createApplication(e) {\n e.preventDefault()\n\n const formData = new FormData(this.form)\n\n const application = Array.from(formData.entries()).reduce((application, [key, value]) => {\n application[key] = value\n return application\n }, {})\n\n const response = await client.mutate({\n mutation: gql`\n mutation ($application: NewApplication!) {\n createApplication(application: $application) {\n id\n }\n }\n `,\n variables: {\n application\n }\n })\n\n if (response.errors) {\n console.log('creation fail.')\n } else {\n const id = response.data.createApplication.id\n navigate(`application/${id}`)\n }\n }\n\n pageUpdated(changes, lifecycle, before) {\n if (this.active) {\n this.form.reset()\n }\n }\n}\n"]}
@@ -91,7 +91,7 @@ PartnerManagement.styles = [
91
91
  display: flex;
92
92
  flex-direction: column;
93
93
  background-color: var(--md-sys-color-background);
94
- padding: var(--padding-wide);
94
+ padding: var(--spacing-large);
95
95
 
96
96
  overflow: auto;
97
97
  }
@@ -1 +1 @@
1
- {"version":3,"file":"partner-management.js","sourceRoot":"","sources":["../../../client/pages/partner/partner-management.ts"],"names":[],"mappings":";AAAA,OAAO,8BAA8B,CAAA;AACrC,OAAO,oCAAoC,CAAA;AAC3C,OAAO,sCAAsC,CAAA;AAC7C,OAAO,kCAAkC,CAAA;AAEzC,OAAO,GA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gC,IAAI,wBAAwB;SACrE;;;;;qBAKY,IAAI,CAAC,SAAS,IAAI,EAAE;gCACT,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC;;KAE1D,CAAA;IACH,CAAC;IAED,WAAW;QACT,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAChB,IAAI,CAAC,eAAe,EAAE,CAAA;QACxB,CAAC;aAAM,CAAC;YACN,8BAA8B;QAChC,CAAC;IACH,CAAC;IAED,KAAK,CAAC,eAAe;;QACnB,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC;YAClC,KAAK,EAAE,GAAG,CAAA;;;;;;;;;;;;;OAaT;YACD,OAAO,EAAE,UAAU,EAAE;SACtB,CAAC,CAAA;QAEF,IAAI,CAAC,CAAA,MAAA,QAAQ,CAAC,MAAM,0CAAE,MAAM,CAAA,EAAE,CAAC;YAC7B,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAA;YACxC,IAAI,CAAC,OAAO,GAAG,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAA;QACtC,CAAC;IACH,CAAC;;AA9FM,wBAAM,GAAG;IACd,GAAG,CAAA;;;;;;;;;;;;;;;;;KAiBF;CACF,AAnBY,CAmBZ;AAE0B;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;;oDAAsB;AACrB;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;;kDAAoB;AAvB1C,iBAAiB;IADtB,aAAa,CAAC,oBAAoB,CAAC;GAC9B,iBAAiB,CAgGtB","sourcesContent":["import '@things-factory/component-ui'\nimport '../../components/partner-info-card'\nimport '../../components/partner-role-editor'\nimport '../../components/invite-customer'\n\nimport gql from 'graphql-tag'\nimport { css, html } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\nimport { connect } from 'pwa-helpers/connect-mixin.js'\n\nimport { client, gqlContext } from '@operato/graphql'\nimport { i18next } from '@operato/i18n'\nimport { PageView, store } from '@operato/shell'\n\n@customElement('partner-management')\nclass PartnerManagement extends connect(store)(PageView) {\n static styles = [\n css`\n :host {\n display: flex;\n flex-direction: column;\n background-color: var(--md-sys-color-background);\n padding: var(--padding-wide);\n\n overflow: auto;\n }\n h2 {\n margin: var(--title-margin);\n font: var(--title-font);\n color: var(--title-text-color);\n }\n .role-editor {\n flex: 1;\n }\n `\n ]\n\n @property({ type: Array }) customers: any[] = []\n @property({ type: Array }) vendors: any[] = []\n\n get context() {\n return {\n title: `${i18next.t('title.partners')}`,\n help: 'operato-hub/partners'\n }\n }\n\n render() {\n const data = {\n [i18next.t('label.customers')]: this.customers || [],\n [i18next.t('label.vendors')]: this.vendors || []\n }\n\n return html`\n <h2>partners</h2>\n\n <quick-find-list\n .data=\"${data}\"\n .contentRenderer=\"${(item, currentTabKey) => html`\n ${currentTabKey === i18next.t('label.customers')\n ? html`\n <partner-role-editor\n class=\"role-editor\"\n .customer=\"${item}\"\n @contractTerminated=\"${this.refreshPartners.bind(this)}\"\n ></partner-role-editor>\n `\n : html`<partner-info-card .partner=\"${item}\"></partner-info-card>`}\n `}\"\n >\n </quick-find-list>\n\n <invite-customer\n .customers=${this.customers || []}\n @invitationCompleted=\"${this.refreshPartners.bind(this)}\"\n ></invite-customer>\n `\n }\n\n pageUpdated() {\n if (this.active) {\n this.refreshPartners()\n } else {\n /* this page is deactivated */\n }\n }\n\n async refreshPartners() {\n const response = await client.query({\n query: gql`\n query {\n customers {\n id\n name\n description\n }\n vendors {\n id\n name\n description\n }\n }\n `,\n context: gqlContext()\n })\n\n if (!response.errors?.length) {\n this.customers = response.data.customers\n this.vendors = response.data.vendors\n }\n }\n}\n"]}
1
+ {"version":3,"file":"partner-management.js","sourceRoot":"","sources":["../../../client/pages/partner/partner-management.ts"],"names":[],"mappings":";AAAA,OAAO,8BAA8B,CAAA;AACrC,OAAO,oCAAoC,CAAA;AAC3C,OAAO,sCAAsC,CAAA;AAC7C,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D;YACH,CAAC,CAAC,IAAI,CAAA,gCAAgC,IAAI,wBAAwB;SACrE;;;;;qBAKY,IAAI,CAAC,SAAS,IAAI,EAAE;gCACT,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC;;KAE1D,CAAA;IACH,CAAC;IAED,WAAW;QACT,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAChB,IAAI,CAAC,eAAe,EAAE,CAAA;QACxB,CAAC;aAAM,CAAC;YACN,8BAA8B;QAChC,CAAC;IACH,CAAC;IAED,KAAK,CAAC,eAAe;;QACnB,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC;YAClC,KAAK,EAAE,GAAG,CAAA;;;;;;;;;;;;;OAaT;YACD,OAAO,EAAE,UAAU,EAAE;SACtB,CAAC,CAAA;QAEF,IAAI,CAAC,CAAA,MAAA,QAAQ,CAAC,MAAM,0CAAE,MAAM,CAAA,EAAE,CAAC;YAC7B,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAA;YACxC,IAAI,CAAC,OAAO,GAAG,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAA;QACtC,CAAC;IACH,CAAC;;AA9FM,wBAAM,GAAG;IACd,GAAG,CAAA;;;;;;;;;;;;;;;;;KAiBF;CACF,AAnBY,CAmBZ;AAE0B;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;;oDAAsB;AACrB;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;;kDAAoB;AAvB1C,iBAAiB;IADtB,aAAa,CAAC,oBAAoB,CAAC;GAC9B,iBAAiB,CAgGtB","sourcesContent":["import '@things-factory/component-ui'\nimport '../../components/partner-info-card'\nimport '../../components/partner-role-editor'\nimport '../../components/invite-customer'\n\nimport gql from 'graphql-tag'\nimport { css, html } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\nimport { connect } from 'pwa-helpers/connect-mixin.js'\n\nimport { client, gqlContext } from '@operato/graphql'\nimport { i18next } from '@operato/i18n'\nimport { PageView, store } from '@operato/shell'\n\n@customElement('partner-management')\nclass PartnerManagement extends connect(store)(PageView) {\n static styles = [\n css`\n :host {\n display: flex;\n flex-direction: column;\n background-color: var(--md-sys-color-background);\n padding: var(--spacing-large);\n\n overflow: auto;\n }\n h2 {\n margin: var(--title-margin);\n font: var(--title-font);\n color: var(--title-text-color);\n }\n .role-editor {\n flex: 1;\n }\n `\n ]\n\n @property({ type: Array }) customers: any[] = []\n @property({ type: Array }) vendors: any[] = []\n\n get context() {\n return {\n title: `${i18next.t('title.partners')}`,\n help: 'operato-hub/partners'\n }\n }\n\n render() {\n const data = {\n [i18next.t('label.customers')]: this.customers || [],\n [i18next.t('label.vendors')]: this.vendors || []\n }\n\n return html`\n <h2>partners</h2>\n\n <quick-find-list\n .data=\"${data}\"\n .contentRenderer=\"${(item, currentTabKey) => html`\n ${currentTabKey === i18next.t('label.customers')\n ? html`\n <partner-role-editor\n class=\"role-editor\"\n .customer=\"${item}\"\n @contractTerminated=\"${this.refreshPartners.bind(this)}\"\n ></partner-role-editor>\n `\n : html`<partner-info-card .partner=\"${item}\"></partner-info-card>`}\n `}\"\n >\n </quick-find-list>\n\n <invite-customer\n .customers=${this.customers || []}\n @invitationCompleted=\"${this.refreshPartners.bind(this)}\"\n ></invite-customer>\n `\n }\n\n pageUpdated() {\n if (this.active) {\n this.refreshPartners()\n } else {\n /* this page is deactivated */\n }\n }\n\n async refreshPartners() {\n const response = await client.query({\n query: gql`\n query {\n customers {\n id\n name\n description\n }\n vendors {\n id\n name\n description\n }\n }\n `,\n context: gqlContext()\n })\n\n if (!response.errors?.length) {\n this.customers = response.data.customers\n this.vendors = response.data.vendors\n }\n }\n}\n"]}
@@ -9,7 +9,7 @@ import { customElement, property, query } from 'lit/decorators.js';
9
9
  import { connect } from 'pwa-helpers/connect-mixin.js';
10
10
  import { client, gqlContext } from '@operato/graphql';
11
11
  import { i18next } from '@operato/i18n';
12
- import { PageView, store } from '@operato/shell';
12
+ import { InheritedValueType, PageView, store } from '@operato/shell';
13
13
  let RoleManagement = class RoleManagement extends connect(store)(PageView) {
14
14
  constructor() {
15
15
  super(...arguments);
@@ -64,8 +64,8 @@ let RoleManagement = class RoleManagement extends connect(store)(PageView) {
64
64
  async fetchRoles() {
65
65
  const response = await client.query({
66
66
  query: gql `
67
- query roles($sortings: [Sorting!]) {
68
- roles(sortings: $sortings) {
67
+ query roles($sortings: [Sorting!], $inherited: InheritedValueType) {
68
+ roles(sortings: $sortings, inherited: $inherited) {
69
69
  items {
70
70
  id
71
71
  name
@@ -79,7 +79,10 @@ let RoleManagement = class RoleManagement extends connect(store)(PageView) {
79
79
  }
80
80
  }
81
81
  `,
82
- variables: { sortings: [{ name: 'name' }] },
82
+ variables: {
83
+ sortings: [{ name: 'name' }],
84
+ inherited: InheritedValueType.Only
85
+ },
83
86
  context: gqlContext()
84
87
  });
85
88
  return response.data.roles.items;
@@ -91,7 +94,7 @@ RoleManagement.styles = [
91
94
  display: flex;
92
95
  flex-direction: column;
93
96
  background-color: var(--md-sys-color-background);
94
- padding: var(--padding-wide);
97
+ padding: var(--spacing-large);
95
98
  overflow: auto;
96
99
  }
97
100
 
@@ -108,7 +111,7 @@ RoleManagement.styles = [
108
111
  #roles-privileges {
109
112
  flex: 1;
110
113
  display: flex;
111
- margin-top: var(--margin-default);
114
+ margin-top: var(--spacing-medium);
112
115
  max-width: var(--content-container-max-width);
113
116
  flex-direction: row;
114
117
  overflow: auto;
@@ -1 +1 @@
1
- {"version":3,"file":"role-management.js","sourceRoot":"","sources":["../../../client/pages/role/role-management.ts"],"names":[],"mappings":";AAAA,OAAO,8BAA8B,CAAA;AACrC,OAAO,8BAA8B,CAAA;AACrC,OAAO,iCAAiC,CAAA;AACxC,OAAO,wCAAwC,CAAA;AAE/C,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,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C;;qDAAsE;AAhF3F,cAAc;IADnB,aAAa,CAAC,iBAAiB,CAAC;GAC3B,cAAc,CAiHnB","sourcesContent":["import '@things-factory/component-ui'\nimport '../../components/create-role'\nimport '../../components/role-edit-form'\nimport '../../components/role-privilege-editor'\n\nimport gql from 'graphql-tag'\nimport { css, html } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\nimport { connect } from 'pwa-helpers/connect-mixin.js'\n\nimport { client, gqlContext } from '@operato/graphql'\nimport { i18next } from '@operato/i18n'\nimport { PageView, store } from '@operato/shell'\n\n@customElement('role-management')\nclass RoleManagement extends connect(store)(PageView) {\n static styles = [\n css`\n :host {\n display: flex;\n flex-direction: column;\n background-color: var(--md-sys-color-background);\n padding: var(--padding-wide);\n overflow: auto;\n }\n\n [subtitle] {\n padding: var(--subtitle-padding);\n font: var(--subtitle-font);\n color: var(--subtitle-text-color);\n }\n\n input {\n display: block;\n }\n\n #roles-privileges {\n flex: 1;\n display: flex;\n margin-top: var(--margin-default);\n max-width: var(--content-container-max-width);\n flex-direction: row;\n overflow: auto;\n border-top: var(--border-dim-color);\n }\n `\n ]\n\n @property({ type: String }) title: string = ''\n @property({ type: Object }) role: any\n @property({ type: Array }) roles: any[] = []\n @property({ type: Object }) updateRoleObj: any\n\n get context() {\n return {\n title: i18next.t('text.role_management'),\n help: 'auth/roles'\n }\n }\n\n render() {\n const data = {\n roles: this.roles || []\n }\n\n return html`\n <create-role\n @fetch-roles=${async () => {\n this.roles = await this.fetchRoles()\n }}\n ></create-role>\n\n <div subtitle>${i18next.t('text.registered roles')}</div>\n <div id=\"roles-privileges\">\n <quick-find-list\n .data=\"${data}\"\n .openHeaderRenderer=${role => html`\n <role-edit-form .role=\"${role}\" @roleChanged=\"${e => (this.updateRoleObj = e.detail)}\"></role-edit-form>\n `}\n .contentRenderer=\"${(role, _currentTabKey) => html`\n <role-privilege-editor\n .updateRoleObj=${this.updateRoleObj || {}}\n .role=${role}\n @fetch-roles=${async () => {\n this.roles = await this.fetchRoles()\n await this.updateComplete\n this.quickFindList.openByKey(role.id)\n }}\n ></role-privilege-editor>\n `}\"\n ></quick-find-list>\n </div>\n `\n }\n\n @query('quick-find-list') quickFindList!: HTMLElement & { openByKey: (roleId: string) => void }\n\n async pageUpdated(changes, lifecycle, before) {\n if (this.active) {\n this.roles = await this.fetchRoles()\n this.role = this.roles && this.roles[0]\n }\n }\n\n async fetchRoles() {\n const response = await client.query({\n query: gql`\n query roles($sortings: [Sorting!]) {\n roles(sortings: $sortings) {\n items {\n id\n name\n description\n privileges {\n id\n name\n }\n }\n total\n }\n }\n `,\n variables: { sortings: [{ name: 'name' }] },\n context: gqlContext()\n })\n\n return response.data.roles.items\n }\n}\n"]}
1
+ {"version":3,"file":"role-management.js","sourceRoot":"","sources":["../../../client/pages/role/role-management.ts"],"names":[],"mappings":";AAAA,OAAO,8BAA8B,CAAA;AACrC,OAAO,8BAA8B,CAAA;AACrC,OAAO,iCAAiC,CAAA;AACxC,OAAO,wCAAwC,CAAA;AAE/C,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAClE,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAA;AAEtD,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,kBAAkB,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAGpE,IAAM,cAAc,GAApB,MAAM,cAAe,SAAQ,OAAO,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC;IAArD;;QAiC8B,UAAK,GAAW,EAAE,CAAA;QAEnB,UAAK,GAAU,EAAE,CAAA;IAiF9C,CAAC;IA9EC,IAAI,OAAO;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,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC;YAClC,KAAK,EAAE,GAAG,CAAA;;;;;;;;;;;;;;;OAeT;YACD,SAAS,EAAE;gBACT,QAAQ,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;gBAC5B,SAAS,EAAE,kBAAkB,CAAC,IAAI;aACnC;YACD,OAAO,EAAE,UAAU,EAAE;SACtB,CAAC,CAAA;QAEF,OAAO,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAA;IAClC,CAAC;;AAlHM,qBAAM,GAAG;IACd,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA4BF;CACF,AA9BY,CA8BZ;AAE2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;6CAAmB;AAClB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;4CAAU;AACV;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;;6CAAkB;AAChB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;qDAAmB;AA4CpB;IAAzB,KAAK,CAAC,iBAAiB,CAAC;;qDAAsE;AAhF3F,cAAc;IADnB,aAAa,CAAC,iBAAiB,CAAC;GAC3B,cAAc,CAoHnB","sourcesContent":["import '@things-factory/component-ui'\nimport '../../components/create-role'\nimport '../../components/role-edit-form'\nimport '../../components/role-privilege-editor'\n\nimport gql from 'graphql-tag'\nimport { css, html } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\nimport { connect } from 'pwa-helpers/connect-mixin.js'\n\nimport { client, gqlContext } from '@operato/graphql'\nimport { i18next } from '@operato/i18n'\nimport { InheritedValueType, PageView, store } from '@operato/shell'\n\n@customElement('role-management')\nclass RoleManagement extends connect(store)(PageView) {\n static styles = [\n css`\n :host {\n display: flex;\n flex-direction: column;\n background-color: var(--md-sys-color-background);\n padding: var(--spacing-large);\n overflow: auto;\n }\n\n [subtitle] {\n padding: var(--subtitle-padding);\n font: var(--subtitle-font);\n color: var(--subtitle-text-color);\n }\n\n input {\n display: block;\n }\n\n #roles-privileges {\n flex: 1;\n display: flex;\n margin-top: var(--spacing-medium);\n max-width: var(--content-container-max-width);\n flex-direction: row;\n overflow: auto;\n border-top: var(--border-dim-color);\n }\n `\n ]\n\n @property({ type: String }) title: string = ''\n @property({ type: Object }) role: any\n @property({ type: Array }) roles: any[] = []\n @property({ type: Object }) updateRoleObj: any\n\n get context() {\n return {\n title: i18next.t('text.role_management'),\n help: 'auth/roles'\n }\n }\n\n render() {\n const data = {\n roles: this.roles || []\n }\n\n return html`\n <create-role\n @fetch-roles=${async () => {\n this.roles = await this.fetchRoles()\n }}\n ></create-role>\n\n <div subtitle>${i18next.t('text.registered roles')}</div>\n <div id=\"roles-privileges\">\n <quick-find-list\n .data=\"${data}\"\n .openHeaderRenderer=${role => html`\n <role-edit-form .role=\"${role}\" @roleChanged=\"${e => (this.updateRoleObj = e.detail)}\"></role-edit-form>\n `}\n .contentRenderer=\"${(role, _currentTabKey) => html`\n <role-privilege-editor\n .updateRoleObj=${this.updateRoleObj || {}}\n .role=${role}\n @fetch-roles=${async () => {\n this.roles = await this.fetchRoles()\n await this.updateComplete\n this.quickFindList.openByKey(role.id)\n }}\n ></role-privilege-editor>\n `}\"\n ></quick-find-list>\n </div>\n `\n }\n\n @query('quick-find-list') quickFindList!: HTMLElement & { openByKey: (roleId: string) => void }\n\n async pageUpdated(changes, lifecycle, before) {\n if (this.active) {\n this.roles = await this.fetchRoles()\n this.role = this.roles && this.roles[0]\n }\n }\n\n async fetchRoles() {\n const response = await client.query({\n query: gql`\n query roles($sortings: [Sorting!], $inherited: InheritedValueType) {\n roles(sortings: $sortings, inherited: $inherited) {\n items {\n id\n name\n description\n privileges {\n id\n name\n }\n }\n total\n }\n }\n `,\n variables: { \n sortings: [{ name: 'name' }],\n inherited: InheritedValueType.Only\n },\n context: gqlContext()\n })\n\n return response.data.roles.items\n }\n}\n"]}
@@ -183,13 +183,13 @@ UserManagement.styles = [
183
183
  display: flex;
184
184
  flex-direction: column;
185
185
  background-color: var(--md-sys-color-background);
186
- padding: var(--padding-wide);
186
+ padding: var(--spacing-large);
187
187
  overflow: auto;
188
188
  }
189
189
 
190
190
  @media screen and (max-width: 600px) {
191
191
  :host {
192
- padding: var(--padding-narrow);
192
+ padding: var(--spacing-small);
193
193
  }
194
194
  }
195
195
  `
@@ -1 +1 @@
1
- {"version":3,"file":"user-management.js","sourceRoot":"","sources":["../../../client/pages/user/user-management.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4B,CAAA;AAEnC,OAAO,8BAA8B,CAAA;AACrC,OAAO,8BAA8B,CAAA;AACrC,OAAO,2CAA2C,CAAA;AAClD,OAAO,mCAAmC,CAAA;AAC1C,OAAO,8BAA8B,CAAA;AAErC,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAElE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAA;AAGtD,IAAM,cAAc,GAApB,MAAM,cAAe,SAAQ,QAAQ;IAArC;;QAmB6B,gBAAW,GAAU,EAAE,CAAA;QAEtB,eAAU,GAAW,EAAE,CAAA;QACtB,uBAAkB,GAAY,KAAK,CAAA;QACnC,kBAAa,GAAY,KAAK,CAAA;IAsL7D,CAAC;IAlLC,IAAI,OAAO;QACT,OAAO;YACL,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,sBAAsB,CAAC;YACxC,IAA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K,EAAE,CAAC;;mDAAwB;AACtB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;6CAAW;AACV;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;kDAAwB;AACtB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;;0DAAoC;AACnC;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;;qDAA+B;AAEtC;IAApB,KAAK,CAAC,YAAY,CAAC;;uDAAsD;AAzBtE,cAAc;IADnB,aAAa,CAAC,iBAAiB,CAAC;GAC3B,cAAc,CA6MnB","sourcesContent":["import '@material/web/icon/icon.js'\n\nimport '@things-factory/component-ui'\nimport '../../components/invite-user'\nimport '../../components/ownership-transfer-popup'\nimport '../../components/user-role-editor'\nimport '../../components/create-user'\n\nimport gql from 'graphql-tag'\nimport { css, html } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\n\nimport { client, gqlContext } from '@operato/graphql'\nimport { i18next } from '@operato/i18n'\nimport { PageView } from '@operato/shell'\nimport { OxPrompt } from '@operato/popup/ox-prompt.js'\n\n@customElement('user-management')\nclass UserManagement extends PageView {\n static styles = [\n css`\n :host {\n display: flex;\n flex-direction: column;\n background-color: var(--md-sys-color-background);\n padding: var(--padding-wide);\n overflow: auto;\n }\n\n @media screen and (max-width: 600px) {\n :host {\n padding: var(--padding-narrow);\n }\n }\n `\n ]\n\n @property({ type: Array }) domainUsers: any[] = []\n @property({ type: Object }) owner: any\n @property({ type: String }) currentTab: string = ''\n @property({ type: Boolean }) passwordResettable: boolean = false\n @property({ type: Boolean }) userCreatable: boolean = false\n\n @query('#user-list') userListElement!: HTMLElement & { close: () => void }\n\n get context() {\n return {\n title: i18next.t('text.user management'),\n help: 'auth/users'\n }\n }\n\n render() {\n const groupingUser = (this.domainUsers || []).reduce(\n (groupingUser, user) => {\n const userType = user.userType\n if (!groupingUser[userType]) {\n groupingUser[userType] = []\n }\n user.activated = user.status === 'activated'\n groupingUser[userType].push(user)\n\n return groupingUser\n },\n {\n admin: [],\n user: [],\n application: [],\n appliance: []\n }\n )\n\n const USER_TYPES = {\n USER: i18next.t('label.user'),\n APPLICATION: i18next.t('label.application'),\n APPLIANCE: i18next.t('text.appliance')\n }\n\n const userSet = {\n [USER_TYPES.USER]: [...groupingUser.user, ...groupingUser.admin],\n [USER_TYPES.APPLICATION]: groupingUser.application,\n [USER_TYPES.APPLIANCE]: groupingUser.appliance\n }\n\n return html`\n ${this.userCreatable\n ? html`<create-user\n @create-user=${async event => {\n const user = event.detail\n user.userType = 'user'\n\n await this.createUser(user)\n }}\n ></create-user>`\n : ''}\n <quick-find-list\n id=\"user-list\"\n .data=${userSet}\n @tabChanged=${e => (this.currentTab = e.detail.currentTabKey)}\n .headerRenderer=${user => {\n return html`\n ${!user.activated\n ? html`\n <md-icon>do_disturb</md-icon>\n ${user.name}\n `\n : html` ${user.owner ? html` <md-icon>supervisor_account</md-icon> ` : ''} ${user.name} `}\n `\n }}\n .contentRenderer=${user =>\n html` <user-role-editor\n .user=${user}\n .domainOwner=${this.owner}\n .activate=${user.activated}\n @userUpdated=${this.refreshUsers.bind(this)}\n @ownershipTransferred=${this.refreshUsers.bind(this)}\n .passwordResettable=${this.passwordResettable}\n ></user-role-editor>`}\n ></quick-find-list>\n\n ${this.currentTab === USER_TYPES.USER\n ? html`<invite-user @invitationCompleted=${this.refreshUsers.bind(this)}></invite-user>`\n : ''}\n `\n }\n\n async pageUpdated(changes, lifecycle, before) {\n if (this.active) {\n this.refreshUsers()\n this.checkPasswordResettable()\n this.checkUserCreatable()\n }\n }\n\n async refreshUsers() {\n const domainUsersResp = await client.query({\n query: gql`\n query {\n users {\n items {\n id\n name\n email\n userType\n status\n owner\n }\n }\n }\n `,\n context: gqlContext()\n })\n\n if (!domainUsersResp.errors?.length) {\n this.domainUsers = domainUsersResp.data.users.items || []\n this.owner = this.domainUsers.filter(user => user.owner)[0] || {}\n this.userListElement?.close()\n }\n }\n\n async checkPasswordResettable() {\n const response = await client.query({\n query: gql`\n query {\n checkResettablePasswordToDefault\n }\n `\n })\n\n if (!response.errors) {\n this.passwordResettable = response.data.checkResettablePasswordToDefault\n }\n }\n\n async checkUserCreatable() {\n const response = await client.query({\n query: gql`\n query {\n checkDefaultPassword\n }\n `\n })\n\n if (!response.errors) {\n this.userCreatable = response.data.checkDefaultPassword\n }\n }\n\n async createUser(user) {\n if (\n await OxPrompt.open({\n title: i18next.t('text.are_you_sure'),\n text: i18next.t('text.are_you_sure_to_x_user', { x: i18next.t('button.create') }),\n confirmButton: { text: i18next.t('button.confirm') },\n cancelButton: { text: i18next.t('button.cancel') }\n })\n ) {\n const response = await client.mutate({\n mutation: gql`\n mutation createUser($user: NewUser!) {\n createUser(user: $user) {\n name\n }\n }\n `,\n variables: { user },\n context: gqlContext()\n })\n\n if (!response.errors) {\n await OxPrompt.open({\n title: i18next.t('text.completed'),\n confirmButton: { text: i18next.t('button.confirm') }\n })\n\n await this.refreshUsers()\n }\n }\n }\n\n showToast(message) {\n document.dispatchEvent(new CustomEvent('notify', { detail: { message, option: { timer: 1000 } } }))\n }\n}\n"]}
1
+ {"version":3,"file":"user-management.js","sourceRoot":"","sources":["../../../client/pages/user/user-management.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4B,CAAA;AAEnC,OAAO,8BAA8B,CAAA;AACrC,OAAO,8BAA8B,CAAA;AACrC,OAAO,2CAA2C,CAAA;AAClD,OAAO,mCAAmC,CAAA;AAC1C,OAAO,8BAA8B,CAAA;AAErC,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAElE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AACrD,OAAO,EA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E;iBACrD,CAAC,CAAA;gBAEF,MAAM,IAAI,CAAC,YAAY,EAAE,CAAA;YAC3B,CAAC;QACH,CAAC;IACH,CAAC;IAED,SAAS,CAAC,OAAO;QACf,QAAQ,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,QAAQ,EAAE,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC,CAAA;IACrG,CAAC;;AA3MM,qBAAM,GAAG;IACd,GAAG,CAAA;;;;;;;;;;;;;;KAcF;CACF,AAhBY,CAgBZ;AAE0B;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;;mDAAwB;AACtB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;6CAAW;AACV;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;kDAAwB;AACtB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;;0DAAoC;AACnC;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;;qDAA+B;AAEtC;IAApB,KAAK,CAAC,YAAY,CAAC;;uDAAsD;AAzBtE,cAAc;IADnB,aAAa,CAAC,iBAAiB,CAAC;GAC3B,cAAc,CA6MnB","sourcesContent":["import '@material/web/icon/icon.js'\n\nimport '@things-factory/component-ui'\nimport '../../components/invite-user'\nimport '../../components/ownership-transfer-popup'\nimport '../../components/user-role-editor'\nimport '../../components/create-user'\n\nimport gql from 'graphql-tag'\nimport { css, html } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\n\nimport { client, gqlContext } from '@operato/graphql'\nimport { i18next } from '@operato/i18n'\nimport { PageView } from '@operato/shell'\nimport { OxPrompt } from '@operato/popup/ox-prompt.js'\n\n@customElement('user-management')\nclass UserManagement extends PageView {\n static styles = [\n css`\n :host {\n display: flex;\n flex-direction: column;\n background-color: var(--md-sys-color-background);\n padding: var(--spacing-large);\n overflow: auto;\n }\n\n @media screen and (max-width: 600px) {\n :host {\n padding: var(--spacing-small);\n }\n }\n `\n ]\n\n @property({ type: Array }) domainUsers: any[] = []\n @property({ type: Object }) owner: any\n @property({ type: String }) currentTab: string = ''\n @property({ type: Boolean }) passwordResettable: boolean = false\n @property({ type: Boolean }) userCreatable: boolean = false\n\n @query('#user-list') userListElement!: HTMLElement & { close: () => void }\n\n get context() {\n return {\n title: i18next.t('text.user management'),\n help: 'auth/users'\n }\n }\n\n render() {\n const groupingUser = (this.domainUsers || []).reduce(\n (groupingUser, user) => {\n const userType = user.userType\n if (!groupingUser[userType]) {\n groupingUser[userType] = []\n }\n user.activated = user.status === 'activated'\n groupingUser[userType].push(user)\n\n return groupingUser\n },\n {\n admin: [],\n user: [],\n application: [],\n appliance: []\n }\n )\n\n const USER_TYPES = {\n USER: i18next.t('label.user'),\n APPLICATION: i18next.t('label.application'),\n APPLIANCE: i18next.t('text.appliance')\n }\n\n const userSet = {\n [USER_TYPES.USER]: [...groupingUser.user, ...groupingUser.admin],\n [USER_TYPES.APPLICATION]: groupingUser.application,\n [USER_TYPES.APPLIANCE]: groupingUser.appliance\n }\n\n return html`\n ${this.userCreatable\n ? html`<create-user\n @create-user=${async event => {\n const user = event.detail\n user.userType = 'user'\n\n await this.createUser(user)\n }}\n ></create-user>`\n : ''}\n <quick-find-list\n id=\"user-list\"\n .data=${userSet}\n @tabChanged=${e => (this.currentTab = e.detail.currentTabKey)}\n .headerRenderer=${user => {\n return html`\n ${!user.activated\n ? html`\n <md-icon>do_disturb</md-icon>\n ${user.name}\n `\n : html` ${user.owner ? html` <md-icon>supervisor_account</md-icon> ` : ''} ${user.name} `}\n `\n }}\n .contentRenderer=${user =>\n html` <user-role-editor\n .user=${user}\n .domainOwner=${this.owner}\n .activate=${user.activated}\n @userUpdated=${this.refreshUsers.bind(this)}\n @ownershipTransferred=${this.refreshUsers.bind(this)}\n .passwordResettable=${this.passwordResettable}\n ></user-role-editor>`}\n ></quick-find-list>\n\n ${this.currentTab === USER_TYPES.USER\n ? html`<invite-user @invitationCompleted=${this.refreshUsers.bind(this)}></invite-user>`\n : ''}\n `\n }\n\n async pageUpdated(changes, lifecycle, before) {\n if (this.active) {\n this.refreshUsers()\n this.checkPasswordResettable()\n this.checkUserCreatable()\n }\n }\n\n async refreshUsers() {\n const domainUsersResp = await client.query({\n query: gql`\n query {\n users {\n items {\n id\n name\n email\n userType\n status\n owner\n }\n }\n }\n `,\n context: gqlContext()\n })\n\n if (!domainUsersResp.errors?.length) {\n this.domainUsers = domainUsersResp.data.users.items || []\n this.owner = this.domainUsers.filter(user => user.owner)[0] || {}\n this.userListElement?.close()\n }\n }\n\n async checkPasswordResettable() {\n const response = await client.query({\n query: gql`\n query {\n checkResettablePasswordToDefault\n }\n `\n })\n\n if (!response.errors) {\n this.passwordResettable = response.data.checkResettablePasswordToDefault\n }\n }\n\n async checkUserCreatable() {\n const response = await client.query({\n query: gql`\n query {\n checkDefaultPassword\n }\n `\n })\n\n if (!response.errors) {\n this.userCreatable = response.data.checkDefaultPassword\n }\n }\n\n async createUser(user) {\n if (\n await OxPrompt.open({\n title: i18next.t('text.are_you_sure'),\n text: i18next.t('text.are_you_sure_to_x_user', { x: i18next.t('button.create') }),\n confirmButton: { text: i18next.t('button.confirm') },\n cancelButton: { text: i18next.t('button.cancel') }\n })\n ) {\n const response = await client.mutate({\n mutation: gql`\n mutation createUser($user: NewUser!) {\n createUser(user: $user) {\n name\n }\n }\n `,\n variables: { user },\n context: gqlContext()\n })\n\n if (!response.errors) {\n await OxPrompt.open({\n title: i18next.t('text.completed'),\n confirmButton: { text: i18next.t('button.confirm') }\n })\n\n await this.refreshUsers()\n }\n }\n }\n\n showToast(message) {\n document.dispatchEvent(new CustomEvent('notify', { detail: { message, option: { timer: 1000 } } }))\n }\n}\n"]}