@things-factory/oauth2-client 10.1.26 → 10.1.28

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.
@@ -1,60 +1,40 @@
1
1
  import { __decorate, __metadata } from "tslib";
2
- import '@material/web/button/elevated-button.js';
3
- import '@material/web/button/outlined-button.js';
4
2
  import gql from 'graphql-tag';
5
3
  import { css, html } from 'lit';
6
4
  import { customElement, property } from 'lit/decorators.js';
7
5
  import { client } from '@operato/graphql';
8
6
  import { notify } from '@operato/layout';
9
7
  import { navigate, PageView } from '@operato/shell';
10
- let Oauth2Clients = class Oauth2Clients extends PageView {
8
+ import { i18next, localize } from '@operato/i18n';
9
+ import { CommonButtonStyles, DocumentPageStyles } from '@operato/styles';
10
+ let Oauth2Clients = class Oauth2Clients extends localize(i18next)(PageView) {
11
11
  constructor() {
12
12
  super(...arguments);
13
13
  this.clients = [];
14
14
  }
15
15
  static { this.styles = [
16
+ /* Read and edited down one column (ADR-0060 decision 8) - the frame owns width, padding, spacing. */
17
+ DocumentPageStyles,
16
18
  css `
17
- :host { display: flex;
18
- flex-direction: column;
19
- background-color: var(--md-sys-color-background);
20
- padding: var(--spacing-large);
21
-
22
- overflow: auto;
23
- }
24
-
25
- md-elevated-button { text-transform: capitalize;
26
- }
27
-
28
- md-outlined-button { float: right;
29
- margin-top: var(--spacing-medium);
30
- text-transform: capitalize;
31
- }
32
-
33
- h2 { margin: var(--title-margin);
34
- font: var(--title-font);
35
- color: var(--title-text-color);
36
- }
37
-
38
- [page-description] { margin: var(--page-description-margin);
39
- font: var(--page-description-font);
40
- color: var(--page-description-color);
41
- }
42
-
43
- table { width: 100%;
44
- margin: var(--spacing-large) 0;
19
+ table {
20
+ width: 100%;
45
21
  border-collapse: collapse;
46
- }
22
+ }
47
23
 
48
- tr { background-color: var(--tr-background-color);
49
- }
24
+ tr {
25
+ background-color: var(--tr-background-color);
26
+ }
50
27
 
51
- tr:nth-child(odd) { background-color: var(--tr-background-odd-color);
52
- }
28
+ tr:nth-child(odd) {
29
+ background-color: var(--tr-background-odd-color);
30
+ }
53
31
 
54
- tr:hover { background-color: var(--tr-background-hover-color);
55
- }
32
+ tr:hover {
33
+ background-color: var(--tr-background-hover-color);
34
+ }
56
35
 
57
- th { border-top: var(--th-border-top);
36
+ th {
37
+ border-top: var(--th-border-top);
58
38
  border-bottom: var(--td-border-bottom);
59
39
  padding: var(--th-padding);
60
40
 
@@ -62,71 +42,77 @@ let Oauth2Clients = class Oauth2Clients extends PageView {
62
42
  color: var(--th-color);
63
43
  text-transform: var(--th-text-transform);
64
44
  text-align: left;
65
- }
45
+ }
66
46
 
67
- td { padding: var(--td-padding);
47
+ td {
48
+ padding: var(--td-padding);
68
49
  border-bottom: var(--border-dim-color);
69
50
  line-height: 1.1;
70
- }
51
+ }
71
52
 
72
- td a { font: var(--td-font);
53
+ td a {
54
+ font: var(--td-font);
73
55
  text-decoration: none;
74
56
  color: var(--md-sys-color-on-surface);
75
- }
57
+ }
76
58
 
77
- td a strong { font: bold 16px var(--theme-font);
59
+ td a strong {
60
+ font: bold 16px var(--theme-font);
78
61
 
79
62
  display: block;
80
63
  text-decoration: none;
81
- }
64
+ }
82
65
 
83
- .text-align-center { text-align: center;
84
- }
66
+ .text-align-center {
67
+ text-align: center;
68
+ }
85
69
 
86
- .text-align-right { text-align: right;
87
- }
70
+ .text-align-right {
71
+ text-align: right;
72
+ }
88
73
  `
89
74
  ]; }
90
75
  get context() {
91
- return { title: `clients`
76
+ /* The action goes to the page action bar, where every other screen keeps its actions. */
77
+ return {
78
+ title: i18next.t('text.oauth2-clients'),
79
+ actions: [
80
+ {
81
+ title: i18next.t('button.register'),
82
+ action: () => navigate('oauth2-client-register'),
83
+ ...CommonButtonStyles.submit
84
+ }
85
+ ]
92
86
  };
93
87
  }
94
88
  render() {
95
89
  var clients = this.clients || [];
90
+ /* The screen name is in the title bar; the h2 that used to sit here said it a second time. */
96
91
  return html `
97
- <div>
98
- <h2>Registered Oauth2 Clients</h2>
99
- <p page-description>
100
- What type of oauth2 client are you building?<br />Choose the platform type that best suits the audience you’re
101
- building for.
102
- </p>
103
- <md-elevated-button @click=${e => navigate('oauth2-client-register')}
104
- >register new oauth2 client</md-elevated-button
105
- >
106
- </div>
107
-
108
- <div>
109
- <table>
110
- <tr>
111
- <th>app name</th>
112
- <th>API health</th>
113
- <th>Installs</th>
114
- <th>status</th>
115
- </tr>
116
- ${clients.map(client => html `
117
- <tr>
118
- <td>
119
- <a href=${`oauth2-client/${client.id}`}>
120
- <strong>${client.name}</strong>
121
- ${client.description}
122
- </a>
123
- </td>
124
- <td class="text-align-center">OK</td>
125
- <td class="text-align-right">1</td>
126
- <td class="text-align-center">draft</td>
127
- </tr>
128
- `)}
129
- </table>
92
+ <div class="page">
93
+ <section class="page-section">
94
+ <table class="page-card">
95
+ <tr>
96
+ <th>app name</th>
97
+ <th>API health</th>
98
+ <th>Installs</th>
99
+ <th>status</th>
100
+ </tr>
101
+ ${clients.map(client => html `
102
+ <tr>
103
+ <td>
104
+ <a href=${`oauth2-client/${client.id}`}>
105
+ <strong>${client.name}</strong>
106
+ ${client.description}
107
+ </a>
108
+ </td>
109
+ <td class="text-align-center">OK</td>
110
+ <td class="text-align-right">1</td>
111
+ <td class="text-align-center">draft</td>
112
+ </tr>
113
+ `)}
114
+ </table>
115
+ </section>
130
116
  </div>
131
117
  `;
132
118
  }
@@ -136,20 +122,22 @@ let Oauth2Clients = class Oauth2Clients extends PageView {
136
122
  }
137
123
  }
138
124
  async fetchOauth2Clients() {
139
- const response = await client.query({ query: gql `
140
- query { oauth2Clients { items { id
125
+ const response = await client.query({
126
+ query: gql `
127
+ query {
128
+ oauth2Clients {
129
+ items {
130
+ id
141
131
  name
142
132
  description
143
- }
133
+ }
144
134
  total
145
- }
146
- }
135
+ }
136
+ }
147
137
  `
148
138
  });
149
139
  if (response.errors) {
150
- notify({ level: 'error',
151
- message: 'fetch oauth2 clients fail'
152
- });
140
+ notify({ level: 'error', message: 'fetch oauth2 clients fail' });
153
141
  }
154
142
  else {
155
143
  return response.data.oauth2Clients;
@@ -1 +1 @@
1
- {"version":3,"file":"oauth2-clients.js","sourceRoot":"","sources":["../../client/pages/oauth2-clients.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,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AACxC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAGnD,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,QAAQ;IAApC;;QA4E6B,YAAO,GAAU,EAAE,CAAA;IAqEhD,CAAC;aAjJ+C,WAAM,GAAG;QACrD,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAwEF;KACF,AA1EmD,CA0EnD;IAID,IAAI,OAAO;QAAS,OAAO,EAAQ,KAAK,EAAE,SAAS;SACnD,CAAA;IACD,CAAC;IAEA,MAAM;QAAS,IAAI,OAAO,GAAG,IAAI,CAAC,OAAO,IAAI,EAAE,CAAA;QAE7C,OAAO,IAAI,CAAA;;;;;;;qCAOsB,CAAC,CAAC,EAAE,CAAC,QAAQ,CAAC,wBAAwB,CAAC;;;;;;;;;;;;;YAahE,OAAO,CAAC,GAAG,CACX,MAAM,CAAC,EAAE,CAAC,IAAI,CAAA;;;4BAGE,iBAAiB,MAAM,CAAC,EAAE,EAAE;8BAC1B,MAAM,CAAC,IAAI;sBACnB,MAAM,CAAC,WAAW;;;;;;;aAO3B,CACF;;;KAGN,CAAA;IACJ,CAAC;IAEA,KAAK,CAAC,WAAW,CAAC,OAAO,EAAE,SAAS,EAAE,MAAM;QAAQ,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAAO,IAAI,CAAC,OAAO,GAAG,CAAC,MAAM,IAAI,CAAC,kBAAkB,EAAE,CAAC,EAAE,KAAK,IAAI,EAAE,CAAA;QAC3I,CAAC;IACD,CAAC;IAEA,KAAK,CAAC,kBAAkB;QAAS,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC,EAAQ,KAAK,EAAE,GAAG,CAAA;;;;;;;;OAQlF;SACL,CAAC,CAAA;QAEC,IAAI,QAAQ,CAAC,MAAM,EAAE,CAAC;YAAO,MAAM,CAAC,EAAU,KAAK,EAAE,OAAO;gBACxD,OAAO,EAAE,2BAA2B;aAC1C,CAAC,CAAA;QACF,CAAC;aAAM,CAAC;YAAO,OAAO,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAA;QACjD,CAAC;IACD,CAAC;;AApE2B;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;;8CAAoB;AA5E1C,aAAa;IADlB,aAAa,CAAC,gBAAgB,CAAC;GAC1B,aAAa,CAiJlB","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 { client } from '@operato/graphql'\nimport { notify } from '@operato/layout'\nimport { navigate, PageView } from '@operato/shell'\n\n@customElement('oauth2-clients')\nclass Oauth2Clients extends PageView { static styles = [\n css`\n :host { 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\n md-elevated-button { text-transform: capitalize;\n }\n\n md-outlined-button { float: right;\n margin-top: var(--spacing-medium);\n text-transform: capitalize;\n }\n\n h2 { margin: var(--title-margin);\n font: var(--title-font);\n color: var(--title-text-color);\n }\n\n [page-description] { margin: var(--page-description-margin);\n font: var(--page-description-font);\n color: var(--page-description-color);\n }\n\n table { width: 100%;\n margin: var(--spacing-large) 0;\n border-collapse: collapse;\n }\n\n tr { background-color: var(--tr-background-color);\n }\n\n tr:nth-child(odd) { background-color: var(--tr-background-odd-color);\n }\n\n tr:hover { background-color: var(--tr-background-hover-color);\n }\n\n th { 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 { padding: var(--td-padding);\n border-bottom: var(--border-dim-color);\n line-height: 1.1;\n }\n\n td a { font: var(--td-font);\n text-decoration: none;\n color: var(--md-sys-color-on-surface);\n }\n\n td a strong { font: bold 16px var(--theme-font);\n\n display: block;\n text-decoration: none;\n }\n\n .text-align-center { text-align: center;\n }\n\n .text-align-right { text-align: right;\n }\n `\n ]\n\n @property({ type: Array }) clients: any[] = []\n\n get context() { return { title: `clients`\n }\n }\n\n render() { var clients = this.clients || []\n\n return html`\n <div>\n <h2>Registered Oauth2 Clients</h2>\n <p page-description>\n What type of oauth2 client are you building?<br />Choose the platform type that best suits the audience you’re\n building for.\n </p>\n <md-elevated-button @click=${e => navigate('oauth2-client-register')}\n >register new oauth2 client</md-elevated-button\n >\n </div>\n\n <div>\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 ${clients.map(\n client => html`\n <tr>\n <td>\n <a href=${`oauth2-client/${client.id}`}>\n <strong>${client.name}</strong>\n ${client.description}\n </a>\n </td>\n <td class=\"text-align-center\">OK</td>\n <td class=\"text-align-right\">1</td>\n <td class=\"text-align-center\">draft</td>\n </tr>\n `\n )}\n </table>\n </div>\n `\n }\n\n async pageUpdated(changes, lifecycle, before) { if (this.active) { this.clients = (await this.fetchOauth2Clients())?.items || []\n }\n }\n\n async fetchOauth2Clients() { const response = await client.query({ query: gql`\n query { oauth2Clients { items { id\n name\n description\n }\n total\n }\n }\n `\n })\n\n if (response.errors) { notify({ level: 'error',\n message: 'fetch oauth2 clients fail'\n })\n } else { return response.data.oauth2Clients\n }\n }\n}\n"]}
1
+ {"version":3,"file":"oauth2-clients.js","sourceRoot":"","sources":["../../client/pages/oauth2-clients.ts"],"names":[],"mappings":";AACA,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,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AACxC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACnD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AAGxE,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,QAAQ,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC;IAAvD;;QA8D6B,YAAO,GAAU,EAAE,CAAA;IA+EhD,CAAC;aA5IQ,WAAM,GAAG;QACd,qGAAqG;QACrG,kBAAkB;QAClB,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAuDF;KACF,AA3DY,CA2DZ;IAID,IAAI,OAAO;QACT,yFAAyF;QACzF,OAAO;YACL,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,qBAAqB,CAAC;YACvC,OAAO,EAAE;gBACP;oBACE,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,iBAAiB,CAAC;oBACnC,MAAM,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,wBAAwB,CAAC;oBAChD,GAAG,kBAAkB,CAAC,MAAM;iBAC7B;aACF;SACF,CAAA;IACH,CAAC;IAED,MAAM;QACJ,IAAI,OAAO,GAAG,IAAI,CAAC,OAAO,IAAI,EAAE,CAAA;QAEhC,8FAA8F;QAC9F,OAAO,IAAI,CAAA;;;;;;;;;;cAUD,OAAO,CAAC,GAAG,CACX,MAAM,CAAC,EAAE,CAAC,IAAI,CAAA;;;8BAGE,iBAAiB,MAAM,CAAC,EAAE,EAAE;gCAC1B,MAAM,CAAC,IAAI;wBACnB,MAAM,CAAC,WAAW;;;;;;;eAO3B,CACF;;;;KAIR,CAAA;IACH,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,OAAO,EAAE,SAAS,EAAE,MAAM;QAC1C,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAChB,IAAI,CAAC,OAAO,GAAG,CAAC,MAAM,IAAI,CAAC,kBAAkB,EAAE,CAAC,EAAE,KAAK,IAAI,EAAE,CAAA;QAC/D,CAAC;IACH,CAAC;IAED,KAAK,CAAC,kBAAkB;QACtB,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC;YAClC,KAAK,EAAE,GAAG,CAAA;;;;;;;;;;;OAWT;SACF,CAAC,CAAA;QAEF,IAAI,QAAQ,CAAC,MAAM,EAAE,CAAC;YACpB,MAAM,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,2BAA2B,EAAE,CAAC,CAAA;QAClE,CAAC;aAAM,CAAC;YACN,OAAO,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAA;QACpC,CAAC;IACH,CAAC;;AA9E0B;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;;8CAAoB;AA9D1C,aAAa;IADlB,aAAa,CAAC,gBAAgB,CAAC;GAC1B,aAAa,CA6IlB","sourcesContent":["\nimport gql from 'graphql-tag'\nimport { css, html } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\nimport { client } from '@operato/graphql'\nimport { notify } from '@operato/layout'\nimport { navigate, PageView } from '@operato/shell'\nimport { i18next, localize } from '@operato/i18n'\nimport { CommonButtonStyles, DocumentPageStyles } from '@operato/styles'\n\n@customElement('oauth2-clients')\nclass Oauth2Clients extends localize(i18next)(PageView) {\n static styles = [\n /* Read and edited down one column (ADR-0060 decision 8) - the frame owns width, padding, spacing. */\n DocumentPageStyles,\n css`\n table {\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(--border-dim-color);\n line-height: 1.1;\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 }) clients: any[] = []\n\n get context() {\n /* The action goes to the page action bar, where every other screen keeps its actions. */\n return {\n title: i18next.t('text.oauth2-clients'),\n actions: [\n {\n title: i18next.t('button.register'),\n action: () => navigate('oauth2-client-register'),\n ...CommonButtonStyles.submit\n }\n ]\n }\n }\n\n render() {\n var clients = this.clients || []\n\n /* The screen name is in the title bar; the h2 that used to sit here said it a second time. */\n return html`\n <div class=\"page\">\n <section class=\"page-section\">\n <table class=\"page-card\">\n <tr>\n <th>app name</th>\n <th>API health</th>\n <th>Installs</th>\n <th>status</th>\n </tr>\n ${clients.map(\n client => html`\n <tr>\n <td>\n <a href=${`oauth2-client/${client.id}`}>\n <strong>${client.name}</strong>\n ${client.description}\n </a>\n </td>\n <td class=\"text-align-center\">OK</td>\n <td class=\"text-align-right\">1</td>\n <td class=\"text-align-center\">draft</td>\n </tr>\n `\n )}\n </table>\n </section>\n </div>\n `\n }\n\n async pageUpdated(changes, lifecycle, before) {\n if (this.active) {\n this.clients = (await this.fetchOauth2Clients())?.items || []\n }\n }\n\n async fetchOauth2Clients() {\n const response = await client.query({\n query: gql`\n query {\n oauth2Clients {\n items {\n id\n name\n description\n }\n total\n }\n }\n `\n })\n\n if (response.errors) {\n notify({ level: 'error', message: 'fetch oauth2 clients fail' })\n } else {\n return response.data.oauth2Clients\n }\n }\n}\n"]}