@things-factory/auth-ui 7.0.1-alpha.9 → 7.0.1-alpha.90

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 (166) hide show
  1. package/client/auth-style-sign.ts +29 -18
  2. package/client/bootstrap.ts +6 -10
  3. package/client/components/abstract-auth-page.ts +41 -22
  4. package/client/components/abstract-password-reset.ts +11 -9
  5. package/client/components/abstract-sign.ts +138 -0
  6. package/client/components/change-password.ts +3 -3
  7. package/client/components/contact-us.ts +19 -23
  8. package/client/components/create-domain-popup.ts +11 -7
  9. package/client/components/create-role.ts +8 -20
  10. package/client/components/create-user.ts +8 -16
  11. package/client/components/credential-manager.ts +64 -0
  12. package/client/components/delete-user-popup.ts +1 -1
  13. package/client/components/domain-switch.ts +7 -4
  14. package/client/components/invite-customer.ts +7 -14
  15. package/client/components/invite-user.ts +2 -7
  16. package/client/components/ownership-transfer-popup.ts +3 -3
  17. package/client/components/partner-role-editor.ts +10 -16
  18. package/client/components/profile-component.ts +124 -7
  19. package/client/components/role-privilege-editor.ts +10 -17
  20. package/client/components/user-role-editor.ts +27 -38
  21. package/client/entries/auth/activate.ts +17 -17
  22. package/client/entries/auth/checkin.ts +15 -19
  23. package/client/entries/auth/forgot-password.ts +8 -6
  24. package/client/entries/auth/result.ts +13 -12
  25. package/client/entries/auth/signup.ts +20 -24
  26. package/client/entries/oauth2/oauth2-decision-error-page.ts +2 -2
  27. package/client/entries/oauth2/oauth2-decision-page.ts +60 -55
  28. package/client/entries/public/home.ts +40 -18
  29. package/client/index.ts +93 -66
  30. package/client/pages/app-binding/app-binding.ts +5 -9
  31. package/client/pages/app-binding/app-bindings.ts +2 -2
  32. package/client/pages/appliance/appliance.ts +6 -9
  33. package/client/pages/appliance/home.ts +3 -3
  34. package/client/pages/appliance/register.ts +1 -1
  35. package/client/pages/application/application.ts +29 -50
  36. package/client/pages/application/applications.ts +4 -12
  37. package/client/pages/application/register.ts +1 -1
  38. package/client/pages/attribute/attribute-set-item-list.ts +8 -22
  39. package/client/pages/attribute/attribute-set-management.ts +14 -20
  40. package/client/pages/auth-provider/auth-provider-management.ts +10 -16
  41. package/client/pages/domain/domain-management.ts +4 -9
  42. package/client/pages/user/user-management.ts +5 -5
  43. package/dist-client/auth-style-sign.js +29 -18
  44. package/dist-client/auth-style-sign.js.map +1 -1
  45. package/dist-client/bootstrap.d.ts +1 -1
  46. package/dist-client/bootstrap.js +5 -5
  47. package/dist-client/bootstrap.js.map +1 -1
  48. package/dist-client/components/abstract-auth-page.d.ts +4 -4
  49. package/dist-client/components/abstract-auth-page.js +40 -22
  50. package/dist-client/components/abstract-auth-page.js.map +1 -1
  51. package/dist-client/components/abstract-password-reset.d.ts +3 -2
  52. package/dist-client/components/abstract-password-reset.js +10 -9
  53. package/dist-client/components/abstract-password-reset.js.map +1 -1
  54. package/dist-client/components/abstract-sign.d.ts +3 -0
  55. package/dist-client/components/abstract-sign.js +110 -0
  56. package/dist-client/components/abstract-sign.js.map +1 -1
  57. package/dist-client/components/change-password.js +3 -3
  58. package/dist-client/components/change-password.js.map +1 -1
  59. package/dist-client/components/contact-us.d.ts +4 -4
  60. package/dist-client/components/contact-us.js +18 -23
  61. package/dist-client/components/contact-us.js.map +1 -1
  62. package/dist-client/components/create-domain-popup.d.ts +1 -1
  63. package/dist-client/components/create-domain-popup.js +11 -7
  64. package/dist-client/components/create-domain-popup.js.map +1 -1
  65. package/dist-client/components/create-role.d.ts +1 -1
  66. package/dist-client/components/create-role.js +7 -19
  67. package/dist-client/components/create-role.js.map +1 -1
  68. package/dist-client/components/create-user.js +6 -14
  69. package/dist-client/components/create-user.js.map +1 -1
  70. package/dist-client/components/credential-manager.d.ts +11 -0
  71. package/dist-client/components/credential-manager.js +64 -0
  72. package/dist-client/components/credential-manager.js.map +1 -0
  73. package/dist-client/components/delete-user-popup.js +1 -1
  74. package/dist-client/components/delete-user-popup.js.map +1 -1
  75. package/dist-client/components/domain-switch.d.ts +2 -0
  76. package/dist-client/components/domain-switch.js +9 -4
  77. package/dist-client/components/domain-switch.js.map +1 -1
  78. package/dist-client/components/invite-customer.d.ts +1 -1
  79. package/dist-client/components/invite-customer.js +5 -8
  80. package/dist-client/components/invite-customer.js.map +1 -1
  81. package/dist-client/components/invite-user.js +2 -7
  82. package/dist-client/components/invite-user.js.map +1 -1
  83. package/dist-client/components/ownership-transfer-popup.d.ts +1 -1
  84. package/dist-client/components/ownership-transfer-popup.js +3 -3
  85. package/dist-client/components/ownership-transfer-popup.js.map +1 -1
  86. package/dist-client/components/partner-role-editor.d.ts +1 -1
  87. package/dist-client/components/partner-role-editor.js +10 -16
  88. package/dist-client/components/partner-role-editor.js.map +1 -1
  89. package/dist-client/components/profile-component.d.ts +6 -0
  90. package/dist-client/components/profile-component.js +111 -7
  91. package/dist-client/components/profile-component.js.map +1 -1
  92. package/dist-client/components/role-privilege-editor.js +10 -17
  93. package/dist-client/components/role-privilege-editor.js.map +1 -1
  94. package/dist-client/components/user-role-editor.d.ts +2 -0
  95. package/dist-client/components/user-role-editor.js +26 -37
  96. package/dist-client/components/user-role-editor.js.map +1 -1
  97. package/dist-client/entries/auth/activate.d.ts +2 -1
  98. package/dist-client/entries/auth/activate.js +16 -17
  99. package/dist-client/entries/auth/activate.js.map +1 -1
  100. package/dist-client/entries/auth/checkin.d.ts +2 -2
  101. package/dist-client/entries/auth/checkin.js +13 -16
  102. package/dist-client/entries/auth/checkin.js.map +1 -1
  103. package/dist-client/entries/auth/forgot-password.d.ts +2 -1
  104. package/dist-client/entries/auth/forgot-password.js +7 -6
  105. package/dist-client/entries/auth/forgot-password.js.map +1 -1
  106. package/dist-client/entries/auth/result.d.ts +2 -2
  107. package/dist-client/entries/auth/result.js +12 -12
  108. package/dist-client/entries/auth/result.js.map +1 -1
  109. package/dist-client/entries/auth/signup.js +19 -24
  110. package/dist-client/entries/auth/signup.js.map +1 -1
  111. package/dist-client/entries/oauth2/oauth2-decision-error-page.d.ts +1 -1
  112. package/dist-client/entries/oauth2/oauth2-decision-error-page.js +2 -2
  113. package/dist-client/entries/oauth2/oauth2-decision-error-page.js.map +1 -1
  114. package/dist-client/entries/oauth2/oauth2-decision-page.d.ts +1 -1
  115. package/dist-client/entries/oauth2/oauth2-decision-page.js +59 -54
  116. package/dist-client/entries/oauth2/oauth2-decision-page.js.map +1 -1
  117. package/dist-client/entries/public/home.d.ts +3 -2
  118. package/dist-client/entries/public/home.js +40 -18
  119. package/dist-client/entries/public/home.js.map +1 -1
  120. package/dist-client/index.d.ts +11 -2
  121. package/dist-client/index.js +74 -66
  122. package/dist-client/index.js.map +1 -1
  123. package/dist-client/pages/app-binding/app-binding.d.ts +1 -1
  124. package/dist-client/pages/app-binding/app-binding.js +4 -9
  125. package/dist-client/pages/app-binding/app-binding.js.map +1 -1
  126. package/dist-client/pages/app-binding/app-bindings.js +2 -2
  127. package/dist-client/pages/app-binding/app-bindings.js.map +1 -1
  128. package/dist-client/pages/appliance/appliance.d.ts +1 -1
  129. package/dist-client/pages/appliance/appliance.js +5 -9
  130. package/dist-client/pages/appliance/appliance.js.map +1 -1
  131. package/dist-client/pages/appliance/home.js +3 -3
  132. package/dist-client/pages/appliance/home.js.map +1 -1
  133. package/dist-client/pages/appliance/register.js +1 -1
  134. package/dist-client/pages/appliance/register.js.map +1 -1
  135. package/dist-client/pages/application/application.d.ts +1 -1
  136. package/dist-client/pages/application/application.js +28 -50
  137. package/dist-client/pages/application/application.js.map +1 -1
  138. package/dist-client/pages/application/applications.js +4 -12
  139. package/dist-client/pages/application/applications.js.map +1 -1
  140. package/dist-client/pages/application/register.js +1 -1
  141. package/dist-client/pages/application/register.js.map +1 -1
  142. package/dist-client/pages/attribute/attribute-set-item-list.d.ts +1 -1
  143. package/dist-client/pages/attribute/attribute-set-item-list.js +6 -22
  144. package/dist-client/pages/attribute/attribute-set-item-list.js.map +1 -1
  145. package/dist-client/pages/attribute/attribute-set-management.d.ts +11 -2
  146. package/dist-client/pages/attribute/attribute-set-management.js +7 -11
  147. package/dist-client/pages/attribute/attribute-set-management.js.map +1 -1
  148. package/dist-client/pages/auth-provider/auth-provider-management.d.ts +11 -2
  149. package/dist-client/pages/auth-provider/auth-provider-management.js +8 -11
  150. package/dist-client/pages/auth-provider/auth-provider-management.js.map +1 -1
  151. package/dist-client/pages/domain/domain-management.d.ts +1 -0
  152. package/dist-client/pages/domain/domain-management.js +3 -7
  153. package/dist-client/pages/domain/domain-management.js.map +1 -1
  154. package/dist-client/pages/user/user-management.d.ts +1 -0
  155. package/dist-client/pages/user/user-management.js +4 -5
  156. package/dist-client/pages/user/user-management.js.map +1 -1
  157. package/dist-client/tsconfig.tsbuildinfo +1 -1
  158. package/dist-server/tsconfig.tsbuildinfo +1 -1
  159. package/package.json +8 -12
  160. package/translations/en.json +1 -0
  161. package/translations/ja.json +1 -0
  162. package/translations/ko.json +1 -0
  163. package/translations/ms.json +1 -0
  164. package/translations/zh.json +1 -0
  165. package/views/auth-page.html +3 -2
  166. package/views/oauth2-page.html +3 -2
@@ -1,8 +1,10 @@
1
- import '@material/mwc-icon-button'
2
- import '@material/mwc-button'
1
+ import '@material/web/icon/icon.js'
2
+ import '@material/web/button/text-button.js'
3
+ import '@material/web/button/elevated-button.js'
3
4
 
4
5
  import { css, html, LitElement } from 'lit'
5
6
  import { customElement, property, query } from 'lit/decorators.js'
7
+ import { ifDefined } from 'lit/directives/if-defined.js'
6
8
 
7
9
  import { i18next, localize } from '@operato/i18n'
8
10
 
@@ -15,19 +17,33 @@ export class HomePage extends localize(i18next)(LitElement) {
15
17
  position: relative;
16
18
  }
17
19
 
18
- [home] {
20
+ .signin {
19
21
  position: absolute;
20
- left: 20px;
22
+ right: 20px;
21
23
  top: 10px;
22
- font-size: 2em;
23
- color: var(--primary-color);
24
+ display: inline-block;
25
+ padding: 12px 24px;
26
+ font-size: 16px;
27
+ font-weight: bold;
28
+ color: var(--md-sys-color-on-primary);
29
+ background-color: var(--md-sys-color-primary-container);
30
+ border: none;
31
+ border-radius: 4px;
32
+ text-align: center;
33
+ text-decoration: none;
34
+ transition:
35
+ background-color 0.3s,
36
+ transform 0.3s;
24
37
  }
25
38
 
26
- [signin] {
27
- position: absolute;
28
- right: 20px;
29
- top: 20px;
30
- font-size: 2em;
39
+ .signin:hover {
40
+ background-color: var(--md-sys-color-on-primary-container);
41
+ transform: translateY(-2px);
42
+ }
43
+
44
+ .signin:active {
45
+ background-color: var(--md-sys-color-primary-container);
46
+ transform: translateY(0);
31
47
  }
32
48
 
33
49
  [message] {
@@ -96,7 +112,7 @@ export class HomePage extends localize(i18next)(LitElement) {
96
112
  input {
97
113
  border: var(--border-dark-color);
98
114
  border-radius: var(--border-radius);
99
- padding: var(--input-padding);
115
+ padding: var(--padding-default);
100
116
  font: var(--input-font);
101
117
  }
102
118
 
@@ -150,7 +166,7 @@ export class HomePage extends localize(i18next)(LitElement) {
150
166
  margin: var(--margin-narrow) 0 var(--margin-default) 0;
151
167
  text-align: center;
152
168
  }
153
- fieldset mwc-button {
169
+ fieldset md-text-button {
154
170
  width: 100%;
155
171
  }
156
172
  }
@@ -171,8 +187,15 @@ export class HomePage extends localize(i18next)(LitElement) {
171
187
  const explanation2 = this.explanation2 || 'Everything you need to go from where you are, to where you want to be.'
172
188
 
173
189
  return html`
174
- <mwc-icon-button home icon="home" @click=${e => (window.location.href = '/')}></mwc-icon-button>
175
- <mwc-button signin dense @click=${e => (window.location.href = '/auth/signin')}>sign in</mwc-button>
190
+ <a
191
+ class="signin"
192
+ @click=${e => {
193
+ e.preventDefault()
194
+ window.location.href = '/auth/signin'
195
+ }}
196
+ >
197
+ ${i18next.t('button.sign_in')}</a
198
+ >
176
199
 
177
200
  <div message>
178
201
  <strong>${tagline}</strong> ${explanation1} <br />
@@ -181,14 +204,13 @@ export class HomePage extends localize(i18next)(LitElement) {
181
204
  </div>
182
205
 
183
206
  <div ticket>
184
- <div brand><img src=${icon} /></div>
207
+ <div brand><img src=${ifDefined(icon)} /></div>
185
208
  <div content>
186
- <form action="/auth/join" accept-charset="utf-8" name="join" method="POST">
209
+ <form action="/auth/join" accept-charset="utf-8" name="join" method="post">
187
210
  <fieldset>
188
211
  <legend>${title} invitation ticket</legend>
189
212
  <input type="text" name="email" placeholder="Enter your email address" />
190
213
  <input type="submit" value="join now" />
191
- <!-- help this button, pls <mwc-button raised label="join now"></mwc-button> -->
192
214
  </fieldset>
193
215
  </form>
194
216
  </div>
package/client/index.ts CHANGED
@@ -1,97 +1,124 @@
1
- import '@material/mwc-icon'
1
+ import '@material/web/icon/icon.js'
2
2
  import '@operato/i18n/ox-i18n.js'
3
3
 
4
4
  import { html } from 'lit-html'
5
5
 
6
6
  import { navigate, store } from '@operato/shell'
7
- import { ADD_MORENDA } from '@things-factory/more-base'
7
+ import { ADD_MORENDA } from '@things-factory/more-base/client'
8
8
  import { hasPrivilege } from '@things-factory/auth-base/dist-client'
9
9
 
10
10
  export * from './components/role-selector.js'
11
11
  export * from './components/domain-switch.js'
12
12
  export * from './components/invite-user.js'
13
13
 
14
- export async function setAuthManagementMenus() {
14
+ export type AuthManagementMenuOptions = {
15
+ role?: boolean
16
+ appliance?: boolean
17
+ application?: boolean
18
+ user?: boolean
19
+ authProvider?: boolean
20
+ domain?: boolean
21
+ attribute?: boolean
22
+ }
23
+
24
+ export async function setAuthManagementMenus(options?: any) {
25
+ const {
26
+ role = true,
27
+ appliance = true,
28
+ application = true,
29
+ user = true,
30
+ authProvider = true,
31
+ domain = true,
32
+ attribute = true
33
+ } = options || {}
34
+
15
35
  if (
16
36
  await hasPrivilege({ privilege: 'mutation', category: 'user', domainOwnerGranted: true, superUserGranted: true })
17
37
  ) {
18
- store.dispatch({
19
- type: ADD_MORENDA,
20
- morenda: {
21
- icon: html` <mwc-icon>how_to_reg</mwc-icon> `,
22
- name: html` <ox-i18n msgid="text.role_management"></ox-i18n> `,
23
- action: () => {
24
- navigate('roles')
38
+ role &&
39
+ store.dispatch({
40
+ type: ADD_MORENDA,
41
+ morenda: {
42
+ icon: html` <md-icon>how_to_reg</md-icon> `,
43
+ name: html` <ox-i18n msgid="text.role_management"></ox-i18n> `,
44
+ action: () => {
45
+ navigate('roles')
46
+ }
25
47
  }
26
- }
27
- })
48
+ })
28
49
 
29
- store.dispatch({
30
- type: ADD_MORENDA,
31
- morenda: {
32
- icon: html` <mwc-icon>devices</mwc-icon> `,
33
- name: html` <ox-i18n msgid="text.appliance"></ox-i18n> `,
34
- action: () => {
35
- navigate('appliance-home')
50
+ appliance &&
51
+ store.dispatch({
52
+ type: ADD_MORENDA,
53
+ morenda: {
54
+ icon: html` <md-icon>devices</md-icon> `,
55
+ name: html` <ox-i18n msgid="text.appliance"></ox-i18n> `,
56
+ action: () => {
57
+ navigate('appliance-home')
58
+ }
36
59
  }
37
- }
38
- })
60
+ })
39
61
 
40
- store.dispatch({
41
- type: ADD_MORENDA,
42
- morenda: {
43
- icon: html` <mwc-icon>apps</mwc-icon> `,
44
- name: html` <ox-i18n msgid="text.application management"></ox-i18n> `,
45
- action: () => {
46
- navigate('applications')
62
+ application &&
63
+ store.dispatch({
64
+ type: ADD_MORENDA,
65
+ morenda: {
66
+ icon: html` <md-icon>apps</md-icon> `,
67
+ name: html` <ox-i18n msgid="text.application management"></ox-i18n> `,
68
+ action: () => {
69
+ navigate('applications')
70
+ }
47
71
  }
48
- }
49
- })
72
+ })
50
73
 
51
- store.dispatch({
52
- type: ADD_MORENDA,
53
- morenda: {
54
- icon: html` <mwc-icon>people</mwc-icon> `,
55
- name: html` <ox-i18n msgid="text.user management"></ox-i18n> `,
56
- action: () => {
57
- navigate('users')
74
+ user &&
75
+ store.dispatch({
76
+ type: ADD_MORENDA,
77
+ morenda: {
78
+ icon: html` <md-icon>people</md-icon> `,
79
+ name: html` <ox-i18n msgid="text.user management"></ox-i18n> `,
80
+ action: () => {
81
+ navigate('users')
82
+ }
58
83
  }
59
- }
60
- })
84
+ })
61
85
 
62
- store.dispatch({
63
- type: ADD_MORENDA,
64
- morenda: {
65
- icon: html` <mwc-icon>badge</mwc-icon> `,
66
- name: html` <ox-i18n msgid="text.auth-provider management"></ox-i18n> `,
67
- action: () => {
68
- navigate('auth-providers')
86
+ authProvider &&
87
+ store.dispatch({
88
+ type: ADD_MORENDA,
89
+ morenda: {
90
+ icon: html` <md-icon>badge</md-icon> `,
91
+ name: html` <ox-i18n msgid="text.auth-provider management"></ox-i18n> `,
92
+ action: () => {
93
+ navigate('auth-providers')
94
+ }
69
95
  }
70
- }
71
- })
96
+ })
72
97
  }
73
98
 
74
99
  if (await hasPrivilege({ superUserGranted: true })) {
75
- store.dispatch({
76
- type: ADD_MORENDA,
77
- morenda: {
78
- icon: html` <mwc-icon>business</mwc-icon> `,
79
- name: html` <ox-i18n msgid="text.domain management"></ox-i18n> `,
80
- action: () => {
81
- navigate('domains')
100
+ domain &&
101
+ store.dispatch({
102
+ type: ADD_MORENDA,
103
+ morenda: {
104
+ icon: html` <md-icon>business</md-icon> `,
105
+ name: html` <ox-i18n msgid="text.domain management"></ox-i18n> `,
106
+ action: () => {
107
+ navigate('domains')
108
+ }
82
109
  }
83
- }
84
- })
110
+ })
85
111
 
86
- store.dispatch({
87
- type: ADD_MORENDA,
88
- morenda: {
89
- icon: html` <mwc-icon>dataset</mwc-icon> `,
90
- name: html` <ox-i18n msgid="text.attribute management"></ox-i18n> `,
91
- action: () => {
92
- navigate('attributes')
112
+ attribute &&
113
+ store.dispatch({
114
+ type: ADD_MORENDA,
115
+ morenda: {
116
+ icon: html` <md-icon>dataset</md-icon> `,
117
+ name: html` <ox-i18n msgid="text.attribute management"></ox-i18n> `,
118
+ action: () => {
119
+ navigate('attributes')
120
+ }
93
121
  }
94
- }
95
- })
122
+ })
96
123
  }
97
124
  }
@@ -1,3 +1,5 @@
1
+ import '@material/web/icon/icon.js'
2
+
1
3
  import Clipboard from 'clipboard'
2
4
  import gql from 'graphql-tag'
3
5
  import { css, html } from 'lit'
@@ -164,7 +166,7 @@ class AppBinding extends connect(store)(PageView) {
164
166
 
165
167
  return html`
166
168
  <div>
167
- <h2><mwc-icon>link</mwc-icon>&nbsp;${app.name}</h2>
169
+ <h2><md-icon>link</md-icon>&nbsp;${app.name}</h2>
168
170
  <p page-description>${app.description}</p>
169
171
  </div>
170
172
 
@@ -235,10 +237,7 @@ class AppBinding extends connect(store)(PageView) {
235
237
  <input id="access-token" type="text" .value=${this.accessToken || ''} readonly />
236
238
  <button button-in-field clipboard-copy @click=${e => e.preventDefault()}>copy</button>
237
239
  ${accessTokenExp
238
- ? html`<div input-hint>
239
- expired in ${new Date(accessTokenExp).toLocaleString()} :
240
- ${asyncReplace(this.expTimer(accessTokenExp))}
241
- </div>`
240
+ ? html`<div input-hint>expired in ${new Date(accessTokenExp).toLocaleString()} : ${asyncReplace(this.expTimer(accessTokenExp))}</div>`
242
241
  : html``}
243
242
  </div>
244
243
 
@@ -247,10 +246,7 @@ class AppBinding extends connect(store)(PageView) {
247
246
  <input id="refresh-token" type="text" .value=${binding.refreshToken || ''} readonly />
248
247
  <button button-in-field clipboard-copy @click=${e => e.preventDefault()}>copy</button>
249
248
  ${refreshTokenExp
250
- ? html`<div input-hint>
251
- expired in ${new Date(refreshTokenExp).toLocaleString()} :
252
- ${asyncReplace(this.expTimer(refreshTokenExp))}
253
- </div>`
249
+ ? html`<div input-hint>expired in ${new Date(refreshTokenExp).toLocaleString()} : ${asyncReplace(this.expTimer(refreshTokenExp))}</div>`
254
250
  : html``}
255
251
  </div>
256
252
  </div>
@@ -16,7 +16,7 @@ class AppBindings extends connect(store)(PageView) {
16
16
 
17
17
  overflow: auto;
18
18
  }
19
- mwc-button {
19
+ md-elevated-button {
20
20
  margin-right: 0;
21
21
  float: right;
22
22
  }
@@ -114,7 +114,7 @@ class AppBindings extends connect(store)(PageView) {
114
114
  `
115
115
  )}
116
116
  </table>
117
- <mwc-button raised @click=${e => navigate('applications')} label="registered applications .."></mwc-button>
117
+ <md-elevated-button @click=${e => navigate('applications')}>registered applications ..</md-elevated-button>
118
118
  `
119
119
  }
120
120
 
@@ -1,3 +1,5 @@
1
+ import '@material/web/icon/icon.js'
2
+
1
3
  import Clipboard from 'clipboard'
2
4
  import gql from 'graphql-tag'
3
5
  import { css, html } from 'lit'
@@ -150,7 +152,7 @@ class Appliance extends connect(store)(PageView) {
150
152
 
151
153
  return html`
152
154
  <div>
153
- <h2><mwc-icon>devices</mwc-icon>&nbsp;${appliance.name}</h2>
155
+ <h2><md-icon>devices</md-icon>&nbsp;${appliance.name}</h2>
154
156
  <p page-description>${appliance.description}</p>
155
157
  </div>
156
158
 
@@ -199,13 +201,10 @@ class Appliance extends connect(store)(PageView) {
199
201
  <div field grid-span>
200
202
  <label for="access-token">${i18next.t('label.access token')}</label>
201
203
  <input id="access-token" type="text" .value=${appliance.accessToken} readonly />
202
- <button button-in-field clipboard-copy @click=${e => e.preventDefault()}>
203
- ${i18next.t('button.copy')}
204
- </button>
204
+ <button button-in-field clipboard-copy @click=${e => e.preventDefault()}>${i18next.t('button.copy')}</button>
205
205
  ${accessTokenExp
206
206
  ? html`<div input-hint>
207
- ${i18next.t('text.token expiry time')} ${new Date(accessTokenExp * 1000).toLocaleString()} :
208
- ${asyncReplace(this.expTimer(accessTokenExp))}
207
+ ${i18next.t('text.token expiry time')} ${new Date(accessTokenExp * 1000).toLocaleString()} : ${asyncReplace(this.expTimer(accessTokenExp))}
209
208
  </div>`
210
209
  : html``}
211
210
  </div>
@@ -214,9 +213,7 @@ class Appliance extends connect(store)(PageView) {
214
213
  </div>
215
214
 
216
215
  <button @click=${this.deleteAppliance.bind(this)}>${i18next.t('button.delete this appliance')}</button>
217
- <button @click=${this.generateApplianceSecret.bind(this)}>
218
- ${i18next.t('button.generate new access token')}
219
- </button>
216
+ <button @click=${this.generateApplianceSecret.bind(this)}>${i18next.t('button.generate new access token')}</button>
220
217
  <button @click=${this.updateAppliance.bind(this)}>${i18next.t('button.update')}</button>
221
218
  </form>
222
219
  `
@@ -96,10 +96,10 @@ class Appliances extends connect(store)(PageView) {
96
96
  <div>
97
97
  <h2>Registered Appliances</h2>
98
98
  <p page-description>
99
- What type of appliance are you building?<br />Choose the app type that best suits the audience you’re building
100
- for. The appliance type can’t be changed after it’s created.
99
+ What type of appliance are you building?<br />Choose the app type that best suits the audience you’re building for. The appliance type can’t be changed after
100
+ it’s created.
101
101
  </p>
102
- <mwc-button raised @click=${e => navigate('appliance-register')} label="register new appliance"></mwc-button>
102
+ <md-elevated-button @click=${e => navigate('appliance-register')}>register new appliance</md-elevated-button>
103
103
  </div>
104
104
 
105
105
  <table>
@@ -136,7 +136,7 @@ class ApplianceRegister extends connect(store)(PageView) {
136
136
  <input id="netmask" type="text" name="netmask" />
137
137
  </div>
138
138
 
139
- <mwc-button grid-span @click=${this.createAppliance.bind(this)} raised label="register"></mwc-button>
139
+ <md-elevated-button grid-span @click=${this.createAppliance.bind(this)}>register</md-elevated-button>
140
140
  </div>
141
141
  </form>
142
142
  </div>
@@ -1,3 +1,5 @@
1
+ import '@material/web/icon/icon.js'
2
+
1
3
  import Clipboard from 'clipboard'
2
4
  import gql from 'graphql-tag'
3
5
  import { css, html } from 'lit'
@@ -8,10 +10,12 @@ import { APPLICATION_TYPES } from '../../constants/application'
8
10
 
9
11
  import { client } from '@operato/graphql'
10
12
  import { navigate, PageView, store } from '@operato/shell'
13
+ import { ButtonContainerStyles } from '@operato/styles'
11
14
 
12
15
  @customElement('application-page')
13
16
  class Application extends connect(store)(PageView) {
14
17
  static styles = [
18
+ ButtonContainerStyles,
15
19
  css`
16
20
  :host {
17
21
  display: flex;
@@ -53,15 +57,12 @@ class Application extends connect(store)(PageView) {
53
57
  border: var(--border-dark-color);
54
58
  border-radius: var(--border-radius);
55
59
  margin: var(--input-margin);
56
- padding: var(--input-padding);
60
+ padding: 9px;
57
61
  font: var(--input-font);
58
62
  flex: 1;
59
63
  }
60
64
  select:focus,
61
65
  input:focus,
62
- button {
63
- outline: none;
64
- }
65
66
  form {
66
67
  max-width: var(--content-container-max-width);
67
68
  }
@@ -102,23 +103,19 @@ class Application extends connect(store)(PageView) {
102
103
  }
103
104
  [button-in-field] {
104
105
  position: absolute;
105
- top: 24px;
106
- right: 4px;
106
+ top: 16px;
107
+ right: 2px;
108
+ padding: 0;
109
+ border-radius: 0;
107
110
  }
108
111
  [input-hint] {
109
112
  font: var(--input-hint-font);
110
113
  color: var(--input-hint-color);
111
114
  }
112
115
  [danger] {
113
- --mdc-theme-primary: var(--mdc-danger-button-primary-color);
114
- }
115
- .button-container {
116
- margin-top: var(--margin-wide);
117
- text-align: right;
118
- }
119
- .button-container mwc-button {
120
- margin-left: var(--margin-narrow);
116
+ --md-theme-primary: var(--md-danger-button-primary-color);
121
117
  }
118
+
122
119
  @media screen and (max-width: 480px) {
123
120
  [field] {
124
121
  grid-column: span 2;
@@ -145,7 +142,7 @@ class Application extends connect(store)(PageView) {
145
142
 
146
143
  return html`
147
144
  <div>
148
- <h2><mwc-icon>apps</mwc-icon>&nbsp;${app.name}</h2>
145
+ <h2><md-icon>apps</md-icon>&nbsp;${app.name}</h2>
149
146
  <p page-description>${app.description}</p>
150
147
  </div>
151
148
 
@@ -211,28 +208,18 @@ class Application extends connect(store)(PageView) {
211
208
  <div field grid-span>
212
209
  <label for="auth-url">auth URL</label>
213
210
  <input id="auth-url" type="text" .value=${app.authUrl} readonly />
214
- <mwc-button
215
- dense
216
- unelevated
217
- button-in-field
218
- clipboard-copy
219
- @click=${e => e.preventDefault()}
220
- label="copy"
221
- ></mwc-button>
211
+ <md-text-button dense button-in-field clipboard-copy @click=${e => e.preventDefault()}
212
+ >copy</md-text-button
213
+ >
222
214
  The endpoint for authorization server. This is used to get the authorization code.
223
215
  </div>
224
216
 
225
217
  <div field grid-span>
226
218
  <label for="access-token-url">access token URL</label>
227
219
  <input id="access-token-url" type="text" .value=${app.accessTokenUrl} readonly />
228
- <mwc-button
229
- dense
230
- unelevated
231
- button-in-field
232
- clipboard-copy
233
- @click=${e => e.preventDefault()}
234
- label="copy"
235
- ></mwc-button>
220
+ <md-text-button dense button-in-field clipboard-copy @click=${e => e.preventDefault()}
221
+ >copy</md-text-button
222
+ >
236
223
  The endpoint for authentication server. This is used to exchange the authorization code for an access
237
224
  token.
238
225
  </div>
@@ -247,36 +234,28 @@ class Application extends connect(store)(PageView) {
247
234
  <div field grid-span>
248
235
  <label for="app-key">appKey</label>
249
236
  <input id="app-key" type="text" .value=${app.appKey} readonly />
250
- <mwc-button
251
- dense
252
- unelevated
253
- button-in-field
254
- clipboard-copy
255
- @click=${e => e.preventDefault()}
256
- label="copy"
257
- ></mwc-button>
237
+ <md-text-button dense button-in-field clipboard-copy @click=${e => e.preventDefault()}
238
+ >copy</md-text-button
239
+ >
258
240
  </div>
259
241
 
260
242
  <div field grid-span>
261
243
  <label for="app-secret">appSecret</label>
262
244
  <input id="app-secret" type="text" .value=${app.appSecret} readonly />
263
- <mwc-button
264
- dense
265
- unelevated
266
- button-in-field
267
- clipboard-copy
268
- @click=${e => e.preventDefault()}
269
- label="copy"
270
- ></mwc-button>
245
+ <md-text-button dense button-in-field clipboard-copy @click=${e => e.preventDefault()}
246
+ >copy</md-text-button
247
+ >
271
248
  </div>
272
249
  </div>
273
250
  </fieldset>
274
251
  </div>
275
252
 
276
253
  <div class="button-container">
277
- <mwc-button raised danger label="delete this app" @click=${this.deleteApplication.bind(this)}></mwc-button>
278
- <mwc-button raised label="update" @click=${this.updateApplication.bind(this)}></mwc-button>
279
- <mwc-button outlined label="generate new secret"></mwc-button>
254
+ <button danger @click=${this.deleteApplication.bind(this)}>
255
+ <md-icon>delete_forever</md-icon>delete this app
256
+ </button>
257
+ <button @click=${this.updateApplication.bind(this)}><md-icon>save</md-icon>update</button>
258
+ <button><md-icon>passkey</md-icon>generate new secret</button>
280
259
  </div>
281
260
  </form>
282
261
  `
@@ -17,7 +17,7 @@ class Applications extends connect(store)(PageView) {
17
17
  overflow: auto;
18
18
  }
19
19
 
20
- [outlined] {
20
+ md-outlined-button {
21
21
  float: right;
22
22
  margin-top: var(--margin-default);
23
23
  }
@@ -99,17 +99,10 @@ class Applications extends connect(store)(PageView) {
99
99
  return html`
100
100
  <div>
101
101
  <h2>Registered Applications</h2>
102
- <p page-description>
103
- What type of app are you building?<br />Choose the app type that best suits the audience you’re building for.
104
- </p>
105
- <mwc-button
106
- raised
107
- @click=${e => navigate('application-register')}
108
- label="register new application"
109
- ></mwc-button>
102
+ <p page-description>What type of app are you building?<br />Choose the app type that best suits the audience you’re building for.</p>
103
+ <md-elevated-button @click=${e => navigate('application-register')}>register new application</md-elevated-button>
110
104
  </div>
111
105
 
112
- <!-- <div> -->
113
106
  <table>
114
107
  <tr>
115
108
  <th>app name</th>
@@ -134,8 +127,7 @@ class Applications extends connect(store)(PageView) {
134
127
  )}
135
128
  </table>
136
129
 
137
- <mwc-button outlined @click=${e => navigate('app-bindings')} label="bound applications .."></mwc-button>
138
- <!-- </div> -->
130
+ <md-outlined-button @click=${e => navigate('app-bindings')}>bound applications ..</md-outlined-button>
139
131
  `
140
132
  }
141
133
 
@@ -165,7 +165,7 @@ class ApplicationRegister extends connect(store)(PageView) {
165
165
  <input id="email" type="text" name="email" />
166
166
  </div>
167
167
 
168
- <mwc-button grid-span @click=${this.createApplication.bind(this)} raised label="register"></mwc-button>
168
+ <md-elevated-button grid-span @click=${this.createApplication.bind(this)}>register</md-elevated-button>
169
169
  </div>
170
170
  </form>
171
171
  </div>