@things-factory/oauth2-client 5.0.15 → 6.0.0-alpha.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/client/{bootstrap.js → bootstrap.ts} +0 -0
- package/{server/controllers → client}/index.ts +0 -0
- package/client/pages/oauth2-client/oauth2-client-importer.ts +97 -0
- package/client/pages/oauth2-client/oauth2-client-list-page.ts +337 -0
- package/client/pages/{oauth2-client-register.js → oauth2-client-register.ts} +79 -86
- package/client/pages/{oauth2-client.js → oauth2-client.ts} +157 -161
- package/client/pages/oauth2-clients.ts +192 -0
- package/client/{route.js → route.ts} +1 -1
- package/client/tsconfig.json +11 -0
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-server/index.d.ts +2 -0
- package/dist-server/index.js +1 -2
- package/dist-server/index.js.map +1 -1
- package/dist-server/routes.d.ts +1 -0
- package/dist-server/routes.js +7 -9
- package/dist-server/routes.js.map +1 -1
- package/dist-server/service/index.d.ts +5 -0
- package/dist-server/service/index.js +19 -0
- package/dist-server/service/index.js.map +1 -0
- package/dist-server/service/oauth2-client/index.d.ts +5 -0
- package/dist-server/service/oauth2-client/index.js +9 -0
- package/dist-server/service/oauth2-client/index.js.map +1 -0
- package/dist-server/service/oauth2-client/oauth2-client-mutation.d.ts +11 -0
- package/dist-server/service/oauth2-client/oauth2-client-mutation.js +165 -0
- package/dist-server/service/oauth2-client/oauth2-client-mutation.js.map +1 -0
- package/dist-server/service/oauth2-client/oauth2-client-query.d.ts +11 -0
- package/dist-server/service/oauth2-client/oauth2-client-query.js +79 -0
- package/dist-server/service/oauth2-client/oauth2-client-query.js.map +1 -0
- package/dist-server/service/oauth2-client/oauth2-client-type.d.ts +45 -0
- package/dist-server/service/oauth2-client/oauth2-client-type.js +177 -0
- package/dist-server/service/oauth2-client/oauth2-client-type.js.map +1 -0
- package/dist-server/service/oauth2-client/oauth2-client.d.ts +39 -0
- package/dist-server/{entities → service/oauth2-client}/oauth2-client.js +47 -9
- package/dist-server/service/oauth2-client/oauth2-client.js.map +1 -0
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +12 -10
- package/server/index.ts +2 -3
- package/server/routes.ts +8 -13
- package/server/service/index.ts +17 -0
- package/server/service/oauth2-client/index.ts +6 -0
- package/server/service/oauth2-client/oauth2-client-mutation.ts +188 -0
- package/server/service/oauth2-client/oauth2-client-query.ts +50 -0
- package/server/service/oauth2-client/oauth2-client-type.ts +126 -0
- package/server/service/oauth2-client/oauth2-client.ts +193 -0
- package/server/tsconfig.json +11 -0
- package/things-factory.config.js +5 -14
- package/client/index.js +0 -1
- package/client/pages/oauth2-clients.js +0 -197
- package/dist-server/controllers/index.js +0 -1
- package/dist-server/controllers/index.js.map +0 -1
- package/dist-server/entities/index.js +0 -9
- package/dist-server/entities/index.js.map +0 -1
- package/dist-server/entities/oauth2-client.js.map +0 -1
- package/dist-server/graphql/index.js +0 -12
- package/dist-server/graphql/index.js.map +0 -1
- package/dist-server/graphql/resolvers/index.js +0 -5
- package/dist-server/graphql/resolvers/index.js.map +0 -1
- package/dist-server/graphql/resolvers/oauth2-client/create-oauth2-client.js +0 -19
- package/dist-server/graphql/resolvers/oauth2-client/create-oauth2-client.js.map +0 -1
- package/dist-server/graphql/resolvers/oauth2-client/delete-oauth2-client.js +0 -12
- package/dist-server/graphql/resolvers/oauth2-client/delete-oauth2-client.js.map +0 -1
- package/dist-server/graphql/resolvers/oauth2-client/delete-oauth2-clients.js +0 -15
- package/dist-server/graphql/resolvers/oauth2-client/delete-oauth2-clients.js.map +0 -1
- package/dist-server/graphql/resolvers/oauth2-client/get-oauth2-access-token.js +0 -45
- package/dist-server/graphql/resolvers/oauth2-client/get-oauth2-access-token.js.map +0 -1
- package/dist-server/graphql/resolvers/oauth2-client/index.js +0 -15
- package/dist-server/graphql/resolvers/oauth2-client/index.js.map +0 -1
- package/dist-server/graphql/resolvers/oauth2-client/oauth2-client-query.js +0 -44
- package/dist-server/graphql/resolvers/oauth2-client/oauth2-client-query.js.map +0 -1
- package/dist-server/graphql/resolvers/oauth2-client/refresh-oauth2-access-token.js +0 -34
- package/dist-server/graphql/resolvers/oauth2-client/refresh-oauth2-access-token.js.map +0 -1
- package/dist-server/graphql/resolvers/oauth2-client/update-oauth2-client.js +0 -15
- package/dist-server/graphql/resolvers/oauth2-client/update-oauth2-client.js.map +0 -1
- package/dist-server/graphql/types/index.js +0 -5
- package/dist-server/graphql/types/index.js.map +0 -1
- package/dist-server/graphql/types/oauth2-client/index.js +0 -26
- package/dist-server/graphql/types/oauth2-client/index.js.map +0 -1
- package/dist-server/graphql/types/oauth2-client/new-oauth2-client.js +0 -28
- package/dist-server/graphql/types/oauth2-client/new-oauth2-client.js.map +0 -1
- package/dist-server/graphql/types/oauth2-client/oauth2-client-list.js +0 -12
- package/dist-server/graphql/types/oauth2-client/oauth2-client-list.js.map +0 -1
- package/dist-server/graphql/types/oauth2-client/oauth2-client-patch.js +0 -28
- package/dist-server/graphql/types/oauth2-client/oauth2-client-patch.js.map +0 -1
- package/dist-server/graphql/types/oauth2-client/oauth2-client.js +0 -36
- package/dist-server/graphql/types/oauth2-client/oauth2-client.js.map +0 -1
- package/server/entities/index.ts +0 -9
- package/server/entities/oauth2-client.ts +0 -156
- package/server/graphql/index.ts +0 -9
- package/server/graphql/resolvers/index.ts +0 -1
- package/server/graphql/resolvers/oauth2-client/create-oauth2-client.ts +0 -24
- package/server/graphql/resolvers/oauth2-client/delete-oauth2-client.ts +0 -10
- package/server/graphql/resolvers/oauth2-client/delete-oauth2-clients.ts +0 -13
- package/server/graphql/resolvers/oauth2-client/get-oauth2-access-token.ts +0 -60
- package/server/graphql/resolvers/oauth2-client/index.ts +0 -21
- package/server/graphql/resolvers/oauth2-client/oauth2-client-query.ts +0 -62
- package/server/graphql/resolvers/oauth2-client/refresh-oauth2-access-token.ts +0 -51
- package/server/graphql/resolvers/oauth2-client/update-oauth2-client.ts +0 -17
- package/server/graphql/types/index.ts +0 -1
- package/server/graphql/types/oauth2-client/index.ts +0 -23
- package/server/graphql/types/oauth2-client/new-oauth2-client.ts +0 -24
- package/server/graphql/types/oauth2-client/oauth2-client-list.ts +0 -8
- package/server/graphql/types/oauth2-client/oauth2-client-patch.ts +0 -24
- package/server/graphql/types/oauth2-client/oauth2-client.ts +0 -32
- package/tsconfig.json +0 -9
|
@@ -3,6 +3,7 @@ import '@operato/help/ox-help-icon.js'
|
|
|
3
3
|
import Clipboard from 'clipboard'
|
|
4
4
|
import gql from 'graphql-tag'
|
|
5
5
|
import { css, html } from 'lit'
|
|
6
|
+
import { customElement, property, query, queryAll } from 'lit/decorators.js'
|
|
6
7
|
import { asyncReplace } from 'lit/directives/async-replace.js'
|
|
7
8
|
import { connect } from 'pwa-helpers/connect-mixin.js'
|
|
8
9
|
|
|
@@ -37,160 +38,161 @@ updatedAt
|
|
|
37
38
|
createdAt
|
|
38
39
|
`
|
|
39
40
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
41
|
+
@customElement('oauth2-client')
|
|
42
|
+
export class Oauth2Client extends connect(store)(PageView) {
|
|
43
|
+
static styles = [
|
|
44
|
+
css`
|
|
45
|
+
:host {
|
|
46
|
+
display: flex;
|
|
47
|
+
flex-direction: column;
|
|
48
|
+
overflow-y: auto;
|
|
49
|
+
position: relative;
|
|
50
|
+
|
|
51
|
+
background-color: var(--main-section-background-color);
|
|
52
|
+
padding: var(--padding-wide);
|
|
53
|
+
}
|
|
54
|
+
h2 {
|
|
55
|
+
margin: var(--title-margin);
|
|
56
|
+
font: var(--title-font);
|
|
57
|
+
color: var(--title-text-color);
|
|
58
|
+
}
|
|
59
|
+
[page-description] {
|
|
60
|
+
margin: var(--page-description-margin);
|
|
61
|
+
font: var(--page-description-font);
|
|
62
|
+
color: var(--page-description-color);
|
|
63
|
+
}
|
|
64
|
+
[icon] {
|
|
65
|
+
position: absolute;
|
|
66
|
+
top: 10px;
|
|
67
|
+
right: 10px;
|
|
68
|
+
max-width: 80px;
|
|
69
|
+
}
|
|
70
|
+
[icon] img {
|
|
71
|
+
max-width: 100%;
|
|
72
|
+
max-height: 100%;
|
|
73
|
+
}
|
|
73
74
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
75
|
+
[button-primary] {
|
|
76
|
+
background-color: var(--button-primary-background-color);
|
|
77
|
+
border: var(--button-border);
|
|
78
|
+
border-radius: var(--button-border-radius);
|
|
79
|
+
margin: var(--button-margin);
|
|
80
|
+
padding: var(--button-primary-padding);
|
|
81
|
+
color: var(--button-primary-color);
|
|
82
|
+
font: var(--button-primary-font);
|
|
83
|
+
text-transform: var(--button-text-transform);
|
|
84
|
+
|
|
85
|
+
text-decoration: none;
|
|
86
|
+
}
|
|
87
|
+
[button-primary]:hover {
|
|
88
|
+
background-color: var(--button-primary-active-background-color);
|
|
89
|
+
box-shadow: var(--button-active-box-shadow);
|
|
90
|
+
}
|
|
91
|
+
label {
|
|
92
|
+
font: var(--label-font);
|
|
93
|
+
color: var(--label-color);
|
|
94
|
+
text-transform: var(--label-text-transform);
|
|
95
|
+
}
|
|
96
|
+
input,
|
|
97
|
+
select {
|
|
98
|
+
border: var(--border-dark-color);
|
|
99
|
+
border-radius: var(--border-radius);
|
|
100
|
+
margin: var(--input-margin);
|
|
101
|
+
padding: var(--input-padding);
|
|
102
|
+
font: var(--input-font);
|
|
103
|
+
|
|
104
|
+
flex: 1;
|
|
105
|
+
}
|
|
106
|
+
select:focus,
|
|
107
|
+
input:focus,
|
|
108
|
+
button {
|
|
109
|
+
outline: none;
|
|
110
|
+
}
|
|
111
|
+
form {
|
|
112
|
+
max-width: var(--content-container-max-width);
|
|
113
|
+
}
|
|
114
|
+
[fieldset-container] {
|
|
115
|
+
background-color: var(--theme-white-color);
|
|
116
|
+
margin: var(--margin-wide) 0 var(--margin-default) 0;
|
|
117
|
+
padding: var(--padding-default);
|
|
118
|
+
border-radius: var(--border-radius);
|
|
119
|
+
box-shadow: var(--box-shadow);
|
|
120
|
+
}
|
|
121
|
+
[fieldset-container] fieldset {
|
|
122
|
+
margin: 0;
|
|
123
|
+
margin-top: -15px;
|
|
124
|
+
}
|
|
125
|
+
fieldset {
|
|
126
|
+
border-radius: var(--border-radius);
|
|
127
|
+
border: var(--border-dark-color);
|
|
128
|
+
margin: var(--fieldset-margin);
|
|
129
|
+
padding: var(--fieldset-padding);
|
|
130
|
+
}
|
|
131
|
+
legend {
|
|
132
|
+
padding: var(--legend-padding);
|
|
133
|
+
font-weight: bold;
|
|
134
|
+
color: var(--legend-color);
|
|
135
|
+
}
|
|
136
|
+
[field-2column] {
|
|
137
|
+
display: grid;
|
|
138
|
+
grid-template-columns: 1fr 1fr;
|
|
139
|
+
grid-gap: 15px;
|
|
140
|
+
}
|
|
141
|
+
[field] {
|
|
142
|
+
display: flex;
|
|
143
|
+
flex-direction: column;
|
|
144
|
+
position: relative;
|
|
145
|
+
}
|
|
146
|
+
[grid-span] {
|
|
147
|
+
grid-column: span 2;
|
|
148
|
+
}
|
|
149
|
+
button,
|
|
150
|
+
input[type='submit'],
|
|
151
|
+
[button-in-field] {
|
|
152
|
+
background-color: var(--button-background-color);
|
|
153
|
+
border: var(--button-border);
|
|
154
|
+
border-radius: var(--button-border-radius);
|
|
155
|
+
padding: var(--button-padding);
|
|
156
|
+
color: var(--button-color);
|
|
157
|
+
font: var(--button-font);
|
|
158
|
+
text-transform: var(--button-text-transform);
|
|
159
|
+
|
|
160
|
+
margin: var(--margin-default) 0 var(--margin-default) var(--margin-default);
|
|
161
|
+
float: right;
|
|
162
|
+
text-decoration: none;
|
|
163
|
+
}
|
|
164
|
+
button:hover,
|
|
165
|
+
input[type='submit']:hover {
|
|
166
|
+
border: var(--button-activ-border);
|
|
167
|
+
box-shadow: var(--button-active-box-shadow);
|
|
168
|
+
}
|
|
169
|
+
[button-in-field] {
|
|
170
|
+
border-radius: 0 var(--button-border-radius) var(--button-border-radius) 0;
|
|
171
|
+
position: absolute;
|
|
172
|
+
top: 11px;
|
|
173
|
+
right: 0;
|
|
174
|
+
max-height: 36px;
|
|
175
|
+
}
|
|
176
|
+
[input-hint] {
|
|
177
|
+
font: var(--input-hint-font);
|
|
178
|
+
color: var(--input-hint-color);
|
|
179
|
+
}
|
|
180
|
+
@media screen and (max-width: 480px) {
|
|
140
181
|
[field] {
|
|
141
|
-
display: flex;
|
|
142
|
-
flex-direction: column;
|
|
143
|
-
position: relative;
|
|
144
|
-
}
|
|
145
|
-
[grid-span] {
|
|
146
182
|
grid-column: span 2;
|
|
147
183
|
}
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
background-color: var(--button-background-color);
|
|
152
|
-
border: var(--button-border);
|
|
153
|
-
border-radius: var(--button-border-radius);
|
|
154
|
-
padding: var(--button-padding);
|
|
155
|
-
color: var(--button-color);
|
|
156
|
-
font: var(--button-font);
|
|
157
|
-
text-transform: var(--button-text-transform);
|
|
158
|
-
|
|
159
|
-
margin: var(--margin-default) 0 var(--margin-default) var(--margin-default);
|
|
160
|
-
float: right;
|
|
161
|
-
text-decoration: none;
|
|
162
|
-
}
|
|
163
|
-
button:hover,
|
|
164
|
-
input[type='submit']:hover {
|
|
165
|
-
border: var(--button-activ-border);
|
|
166
|
-
box-shadow: var(--button-active-box-shadow);
|
|
167
|
-
}
|
|
168
|
-
[button-in-field] {
|
|
169
|
-
border-radius: 0 var(--button-border-radius) var(--button-border-radius) 0;
|
|
170
|
-
position: absolute;
|
|
171
|
-
top: 11px;
|
|
172
|
-
right: 0;
|
|
173
|
-
max-height: 36px;
|
|
174
|
-
}
|
|
175
|
-
[input-hint] {
|
|
176
|
-
font: var(--input-hint-font);
|
|
177
|
-
color: var(--input-hint-color);
|
|
178
|
-
}
|
|
179
|
-
@media screen and (max-width: 480px) {
|
|
180
|
-
[field] {
|
|
181
|
-
grid-column: span 2;
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
`
|
|
185
|
-
]
|
|
186
|
-
}
|
|
184
|
+
}
|
|
185
|
+
`
|
|
186
|
+
]
|
|
187
187
|
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
188
|
+
@property({ type: Object }) oauth2Client: any
|
|
189
|
+
@property({ type: String }) _grantType?: string
|
|
190
|
+
|
|
191
|
+
@query('form') form!: HTMLFormElement
|
|
192
|
+
@queryAll('[clipboard-copy]') copybuttons
|
|
193
|
+
|
|
194
|
+
private clipboard?: Clipboard
|
|
195
|
+
private _icon?: string
|
|
194
196
|
|
|
195
197
|
get context() {
|
|
196
198
|
return {
|
|
@@ -414,10 +416,8 @@ class Oauth2Client extends connect(store)(PageView) {
|
|
|
414
416
|
}
|
|
415
417
|
|
|
416
418
|
firstUpdated() {
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
this.clipboard = new Clipboard(copybuttons, {
|
|
420
|
-
target: trigger => trigger.parentElement.querySelector('input')
|
|
419
|
+
this.clipboard = new Clipboard(this.copybuttons, {
|
|
420
|
+
target: (trigger => trigger.parentElement.querySelector('input')) as any
|
|
421
421
|
})
|
|
422
422
|
}
|
|
423
423
|
|
|
@@ -463,8 +463,7 @@ class Oauth2Client extends connect(store)(PageView) {
|
|
|
463
463
|
}
|
|
464
464
|
|
|
465
465
|
async updateOauth2Client() {
|
|
466
|
-
const
|
|
467
|
-
const formData = new FormData(form)
|
|
466
|
+
const formData = new FormData(this.form)
|
|
468
467
|
|
|
469
468
|
const patch = Array.from(formData.entries()).reduce((patch, [key, value]) => {
|
|
470
469
|
patch[key] = value
|
|
@@ -527,9 +526,9 @@ class Oauth2Client extends connect(store)(PageView) {
|
|
|
527
526
|
const id = this.lifecycle.resourceId
|
|
528
527
|
|
|
529
528
|
if (this.oauth2Client.grantType == 'code') {
|
|
530
|
-
const response = await client.
|
|
531
|
-
|
|
532
|
-
|
|
529
|
+
const response = await client.mutate({
|
|
530
|
+
mutation: gql`
|
|
531
|
+
mutation ($id: String!) {
|
|
533
532
|
getOauth2AuthUrl(id: $id)
|
|
534
533
|
}
|
|
535
534
|
`,
|
|
@@ -541,7 +540,6 @@ class Oauth2Client extends connect(store)(PageView) {
|
|
|
541
540
|
if (!response.errors) {
|
|
542
541
|
location.href = response.data.getOauth2AuthUrl
|
|
543
542
|
} else {
|
|
544
|
-
console.log('error', response.status, await response.text())
|
|
545
543
|
notify({
|
|
546
544
|
level: 'error',
|
|
547
545
|
message: 'getting application access token fail'
|
|
@@ -606,5 +604,3 @@ class Oauth2Client extends connect(store)(PageView) {
|
|
|
606
604
|
}
|
|
607
605
|
}
|
|
608
606
|
}
|
|
609
|
-
|
|
610
|
-
customElements.define('oauth2-client', Oauth2Client)
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import gql from 'graphql-tag'
|
|
2
|
+
import { css, html } from 'lit'
|
|
3
|
+
import { customElement, property } from 'lit/decorators.js'
|
|
4
|
+
import { connect } from 'pwa-helpers/connect-mixin.js'
|
|
5
|
+
|
|
6
|
+
import { client } from '@operato/graphql'
|
|
7
|
+
import { notify } from '@operato/layout'
|
|
8
|
+
import { PageView, store } from '@operato/shell'
|
|
9
|
+
|
|
10
|
+
@customElement('oauth2-clients')
|
|
11
|
+
class Oauth2Clients extends connect(store)(PageView) {
|
|
12
|
+
static styles = [
|
|
13
|
+
css`
|
|
14
|
+
:host {
|
|
15
|
+
display: flex;
|
|
16
|
+
flex-direction: column;
|
|
17
|
+
background-color: var(--main-section-background-color);
|
|
18
|
+
padding: var(--padding-wide);
|
|
19
|
+
|
|
20
|
+
overflow: auto;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
[button-primary] {
|
|
24
|
+
background-color: var(--button-primary-background-color);
|
|
25
|
+
border: var(--button-border);
|
|
26
|
+
border-radius: var(--button-border-radius);
|
|
27
|
+
margin: var(--button-margin);
|
|
28
|
+
padding: var(--button-primary-padding);
|
|
29
|
+
color: var(--button-primary-color);
|
|
30
|
+
font: var(--button-primary-font);
|
|
31
|
+
text-transform: var(--button-text-transform);
|
|
32
|
+
|
|
33
|
+
text-decoration: none;
|
|
34
|
+
}
|
|
35
|
+
[button-primary]:hover {
|
|
36
|
+
background-color: var(--button-primary-active-background-color);
|
|
37
|
+
box-shadow: var(--button-active-box-shadow);
|
|
38
|
+
}
|
|
39
|
+
[button] {
|
|
40
|
+
background-color: var(--button-background-color);
|
|
41
|
+
border: var(--button-border);
|
|
42
|
+
border-radius: var(--button-border-radius);
|
|
43
|
+
margin: var(--button-margin);
|
|
44
|
+
padding: var(--button-padding);
|
|
45
|
+
color: var(--button-color);
|
|
46
|
+
font: var(--button-font);
|
|
47
|
+
text-transform: var(--button-text-transform);
|
|
48
|
+
|
|
49
|
+
margin-right: 0;
|
|
50
|
+
float: right;
|
|
51
|
+
text-decoration: none;
|
|
52
|
+
}
|
|
53
|
+
[button]:hover {
|
|
54
|
+
border: var(--button-activ-border);
|
|
55
|
+
box-shadow: var(--button-active-box-shadow);
|
|
56
|
+
}
|
|
57
|
+
h2 {
|
|
58
|
+
margin: var(--title-margin);
|
|
59
|
+
font: var(--title-font);
|
|
60
|
+
color: var(--title-text-color);
|
|
61
|
+
}
|
|
62
|
+
[page-description] {
|
|
63
|
+
margin: var(--page-description-margin);
|
|
64
|
+
font: var(--page-description-font);
|
|
65
|
+
color: var(--page-description-color);
|
|
66
|
+
}
|
|
67
|
+
div {
|
|
68
|
+
margin: var(--margin-wide) 0;
|
|
69
|
+
}
|
|
70
|
+
table {
|
|
71
|
+
background-color: var(--theme-white-color);
|
|
72
|
+
width: 100%;
|
|
73
|
+
border-collapse: collapse;
|
|
74
|
+
}
|
|
75
|
+
th {
|
|
76
|
+
background-color: rgba(var(--primary-color-rgb), 0.1);
|
|
77
|
+
border-top: var(--th-border-top);
|
|
78
|
+
border-bottom: var(--border-dark-color);
|
|
79
|
+
padding: var(--th-padding);
|
|
80
|
+
|
|
81
|
+
font: var(--th-font);
|
|
82
|
+
color: var(--secondary-color);
|
|
83
|
+
text-transform: var(--th-text-transform);
|
|
84
|
+
}
|
|
85
|
+
td {
|
|
86
|
+
padding: var(--td-padding);
|
|
87
|
+
border-bottom: var(--border-dark-color);
|
|
88
|
+
line-height: 1.1;
|
|
89
|
+
}
|
|
90
|
+
td a {
|
|
91
|
+
font: var(--td-font);
|
|
92
|
+
text-decoration: none;
|
|
93
|
+
color: var(--theme-black-color);
|
|
94
|
+
}
|
|
95
|
+
td a strong {
|
|
96
|
+
color: var(--secondary-text-color);
|
|
97
|
+
font: bold 16px var(--theme-font);
|
|
98
|
+
|
|
99
|
+
display: block;
|
|
100
|
+
text-decoration: none;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.text-align-center {
|
|
104
|
+
text-align: center;
|
|
105
|
+
}
|
|
106
|
+
.text-align-right {
|
|
107
|
+
text-align: right;
|
|
108
|
+
}
|
|
109
|
+
`
|
|
110
|
+
]
|
|
111
|
+
|
|
112
|
+
@property({ type: Array }) clients: any[] = []
|
|
113
|
+
|
|
114
|
+
get context() {
|
|
115
|
+
return {
|
|
116
|
+
title: `clients`
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
render() {
|
|
121
|
+
var clients = this.clients || []
|
|
122
|
+
|
|
123
|
+
return html`
|
|
124
|
+
<div>
|
|
125
|
+
<h2>Registered Oauth2 Clients</h2>
|
|
126
|
+
<p page-description>
|
|
127
|
+
What type of oauth2 client are you building?<br />Choose the platform type that best suits the audience you’re
|
|
128
|
+
building for.
|
|
129
|
+
</p>
|
|
130
|
+
<a href="oauth2-client-register" button-primary>register new oauth2 client</a>
|
|
131
|
+
</div>
|
|
132
|
+
|
|
133
|
+
<div>
|
|
134
|
+
<table>
|
|
135
|
+
<tr>
|
|
136
|
+
<th>app name</th>
|
|
137
|
+
<th>API health</th>
|
|
138
|
+
<th>Installs</th>
|
|
139
|
+
<th>status</th>
|
|
140
|
+
</tr>
|
|
141
|
+
${clients.map(
|
|
142
|
+
client => html`
|
|
143
|
+
<tr>
|
|
144
|
+
<td>
|
|
145
|
+
<a href=${`oauth2-client/${client.id}`}>
|
|
146
|
+
<strong>${client.name}</strong>
|
|
147
|
+
${client.description}
|
|
148
|
+
</a>
|
|
149
|
+
</td>
|
|
150
|
+
<td class="text-align-center">OK</td>
|
|
151
|
+
<td class="text-align-right">1</td>
|
|
152
|
+
<td class="text-align-center">draft</td>
|
|
153
|
+
</tr>
|
|
154
|
+
`
|
|
155
|
+
)}
|
|
156
|
+
</table>
|
|
157
|
+
</div>
|
|
158
|
+
`
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
async pageUpdated(changes, lifecycle, before) {
|
|
162
|
+
if (this.active) {
|
|
163
|
+
this.clients = (await this.fetchOauth2Clients())?.items || []
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
async fetchOauth2Clients() {
|
|
168
|
+
const response = await client.query({
|
|
169
|
+
query: gql`
|
|
170
|
+
query {
|
|
171
|
+
oauth2Clients {
|
|
172
|
+
items {
|
|
173
|
+
id
|
|
174
|
+
name
|
|
175
|
+
description
|
|
176
|
+
}
|
|
177
|
+
total
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
`
|
|
181
|
+
})
|
|
182
|
+
|
|
183
|
+
if (response.errors) {
|
|
184
|
+
notify({
|
|
185
|
+
level: 'error',
|
|
186
|
+
message: 'fetch oauth2 clients fail'
|
|
187
|
+
})
|
|
188
|
+
} else {
|
|
189
|
+
return response.data.oauth2Clients
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|