@things-factory/oauth2-client 5.0.11 → 6.0.0-alpha.3
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/bootstrap.d.ts +1 -0
- package/dist-client/bootstrap.js +2 -0
- package/dist-client/bootstrap.js.map +1 -0
- package/dist-client/index.d.ts +0 -0
- package/dist-client/index.js +2 -0
- package/dist-client/index.js.map +1 -0
- package/dist-client/pages/oauth2-client/oauth2-client-importer.d.ts +22 -0
- package/dist-client/pages/oauth2-client/oauth2-client-importer.js +100 -0
- package/dist-client/pages/oauth2-client/oauth2-client-importer.js.map +1 -0
- package/dist-client/pages/oauth2-client/oauth2-client-list-page.d.ts +55 -0
- package/dist-client/pages/oauth2-client/oauth2-client-list-page.js +315 -0
- package/dist-client/pages/oauth2-client/oauth2-client-list-page.js.map +1 -0
- package/dist-client/pages/oauth2-client-register.d.ts +21 -0
- package/dist-client/pages/oauth2-client-register.js +190 -0
- package/dist-client/pages/oauth2-client-register.js.map +1 -0
- package/dist-client/pages/oauth2-client.d.ts +35 -0
- package/dist-client/pages/oauth2-client.js +586 -0
- package/dist-client/pages/oauth2-client.js.map +1 -0
- package/dist-client/pages/oauth2-clients.d.ts +1 -0
- package/dist-client/pages/oauth2-clients.js +194 -0
- package/dist-client/pages/oauth2-clients.js.map +1 -0
- package/dist-client/route.d.ts +1 -0
- package/dist-client/route.js +14 -0
- package/dist-client/route.js.map +1 -0
- package/dist-client/tsconfig.tsbuildinfo +1 -0
- 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
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import '@operato/data-grist'
|
|
2
|
+
|
|
3
|
+
import gql from 'graphql-tag'
|
|
4
|
+
import { css, html, LitElement } from 'lit'
|
|
5
|
+
import { property } from 'lit/decorators.js'
|
|
6
|
+
|
|
7
|
+
import { client } from '@operato/graphql'
|
|
8
|
+
import { i18next } from '@operato/i18n'
|
|
9
|
+
import { isMobileDevice } from '@operato/utils'
|
|
10
|
+
|
|
11
|
+
export class Oauth2ClientImporter extends LitElement {
|
|
12
|
+
static styles = [
|
|
13
|
+
css`
|
|
14
|
+
:host {
|
|
15
|
+
display: flex;
|
|
16
|
+
flex-direction: column;
|
|
17
|
+
|
|
18
|
+
background-color: #fff;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
ox-grist {
|
|
22
|
+
flex: 1;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.button-container {
|
|
26
|
+
display: flex;
|
|
27
|
+
margin-left: auto;
|
|
28
|
+
padding: var(--padding-default);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
mwc-button {
|
|
32
|
+
margin-left: var(--margin-default);
|
|
33
|
+
}
|
|
34
|
+
`
|
|
35
|
+
]
|
|
36
|
+
|
|
37
|
+
@property({ type: Array }) oauth2Clients: any[] = []
|
|
38
|
+
@property({ type: Object }) columns = {
|
|
39
|
+
list: { fields: ['name', 'description'] },
|
|
40
|
+
pagination: { infinite: true },
|
|
41
|
+
columns: [
|
|
42
|
+
{
|
|
43
|
+
type: 'string',
|
|
44
|
+
name: 'name',
|
|
45
|
+
header: i18next.t('field.name'),
|
|
46
|
+
width: 150
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
type: 'string',
|
|
50
|
+
name: 'description',
|
|
51
|
+
header: i18next.t('field.description'),
|
|
52
|
+
width: 200
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
type: 'checkbox',
|
|
56
|
+
name: 'active',
|
|
57
|
+
header: i18next.t('field.active'),
|
|
58
|
+
width: 60
|
|
59
|
+
}
|
|
60
|
+
]
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
render() {
|
|
65
|
+
return html`
|
|
66
|
+
<ox-grist
|
|
67
|
+
.mode=${isMobileDevice() ? 'LIST' : 'GRID'}
|
|
68
|
+
.config=${this.columns}
|
|
69
|
+
.data=${
|
|
70
|
+
{
|
|
71
|
+
records: this.oauth2Clients
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
></ox-grist>
|
|
75
|
+
|
|
76
|
+
<div class="button-container">
|
|
77
|
+
<mwc-button raised @click="${this.save.bind(this)}">${i18next.t('button.save')}</mwc-button>
|
|
78
|
+
</div>
|
|
79
|
+
`
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
async save() {
|
|
83
|
+
const response = await client.mutate({
|
|
84
|
+
mutation: gql`
|
|
85
|
+
mutation importOauth2Clients($oauth2Clients: [Oauth2ClientPatch!]!) {
|
|
86
|
+
importOauth2Clients(oauth2Clients: $oauth2Clients)
|
|
87
|
+
}
|
|
88
|
+
`,
|
|
89
|
+
variables: { oauth2Clients: this.oauth2Clients }
|
|
90
|
+
})
|
|
91
|
+
|
|
92
|
+
if (response.errors?.length) return
|
|
93
|
+
|
|
94
|
+
this.dispatchEvent(new CustomEvent('imported'))
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
import '@operato/data-grist'
|
|
2
|
+
|
|
3
|
+
import { CommonButtonStyles, CommonGristStyles, ScrollbarStyles } from '@operato/styles'
|
|
4
|
+
import { PageView, store } from '@operato/shell'
|
|
5
|
+
import { css, html } from 'lit'
|
|
6
|
+
import { customElement, property, query } from 'lit/decorators.js'
|
|
7
|
+
import { ScopedElementsMixin } from '@open-wc/scoped-elements'
|
|
8
|
+
import {
|
|
9
|
+
ColumnConfig,
|
|
10
|
+
DataGrist,
|
|
11
|
+
FetchOption,
|
|
12
|
+
SortersControl
|
|
13
|
+
} from '@operato/data-grist'
|
|
14
|
+
import { client } from '@operato/graphql'
|
|
15
|
+
import { i18next, localize } from '@operato/i18n'
|
|
16
|
+
import { notify, openPopup } from '@operato/layout'
|
|
17
|
+
import { OxPopup } from '@operato/popup'
|
|
18
|
+
import { isMobileDevice } from '@operato/utils'
|
|
19
|
+
|
|
20
|
+
import { connect } from 'pwa-helpers/connect-mixin'
|
|
21
|
+
import gql from 'graphql-tag'
|
|
22
|
+
|
|
23
|
+
import { Oauth2ClientImporter } from './oauth2-client-importer'
|
|
24
|
+
|
|
25
|
+
@customElement('oauth2-client-list-page')
|
|
26
|
+
export class Oauth2ClientListPage extends connect(store)(localize(i18next)(ScopedElementsMixin(PageView))) {
|
|
27
|
+
|
|
28
|
+
static styles = [
|
|
29
|
+
ScrollbarStyles,
|
|
30
|
+
CommonGristStyles,
|
|
31
|
+
css`
|
|
32
|
+
:host {
|
|
33
|
+
display: flex;
|
|
34
|
+
|
|
35
|
+
width: 100%;
|
|
36
|
+
|
|
37
|
+
--grid-record-emphasized-background-color: red;
|
|
38
|
+
--grid-record-emphasized-color: yellow;
|
|
39
|
+
}
|
|
40
|
+
`
|
|
41
|
+
]
|
|
42
|
+
|
|
43
|
+
static get scopedElements() {
|
|
44
|
+
return {
|
|
45
|
+
'oauth2-client-importer': Oauth2ClientImporter
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
@property({ type: Object }) gristConfig: any
|
|
50
|
+
@property({ type: String }) mode: 'CARD' | 'GRID' | 'LIST' = isMobileDevice() ? 'CARD' : 'GRID'
|
|
51
|
+
|
|
52
|
+
@query('ox-grist') private grist!: DataGrist
|
|
53
|
+
@query('#sorter-control') private sortersControl!: OxPopup
|
|
54
|
+
|
|
55
|
+
get context() {
|
|
56
|
+
return {
|
|
57
|
+
title: i18next.t('title.oauth2-client list'),
|
|
58
|
+
help: 'oauth2-client/oauth2-client',
|
|
59
|
+
actions: [
|
|
60
|
+
{
|
|
61
|
+
title: i18next.t('button.save'),
|
|
62
|
+
action: this._updateOauth2Client.bind(this),
|
|
63
|
+
...CommonButtonStyles.save
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
title: i18next.t('button.delete'),
|
|
67
|
+
action: this._deleteOauth2Client.bind(this),
|
|
68
|
+
...CommonButtonStyles.delete
|
|
69
|
+
}
|
|
70
|
+
],
|
|
71
|
+
exportable: {
|
|
72
|
+
name: i18next.t('title.oauth2-client list'),
|
|
73
|
+
data: this.exportHandler.bind(this)
|
|
74
|
+
},
|
|
75
|
+
importable: {
|
|
76
|
+
handler: this.importHandler.bind(this)
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
render() {
|
|
82
|
+
const mode = this.mode || (isMobileDevice() ? 'CARD' : 'GRID')
|
|
83
|
+
|
|
84
|
+
return html`
|
|
85
|
+
<ox-grist
|
|
86
|
+
.mode=${mode}
|
|
87
|
+
.config=${this.gristConfig}
|
|
88
|
+
.fetchHandler=${this.fetchHandler.bind(this)}
|
|
89
|
+
>
|
|
90
|
+
<div slot="headroom">
|
|
91
|
+
<div id="filters">
|
|
92
|
+
<ox-filters-form autofocus></ox-filters-form>
|
|
93
|
+
</div>
|
|
94
|
+
|
|
95
|
+
<div id="sorters">
|
|
96
|
+
Sort
|
|
97
|
+
<mwc-icon
|
|
98
|
+
@click=${e => {
|
|
99
|
+
const target = e.currentTarget
|
|
100
|
+
this.sortersControl.open({
|
|
101
|
+
right: 0,
|
|
102
|
+
top: target.offsetTop + target.offsetHeight
|
|
103
|
+
})
|
|
104
|
+
}}
|
|
105
|
+
>expand_more</mwc-icon
|
|
106
|
+
>
|
|
107
|
+
<ox-popup id="sorter-control">
|
|
108
|
+
<ox-sorters-control> </ox-sorters-control>
|
|
109
|
+
</ox-popup>
|
|
110
|
+
</div>
|
|
111
|
+
|
|
112
|
+
<div id="modes">
|
|
113
|
+
<mwc-icon @click=${() => (this.mode = 'GRID')} ?active=${mode == 'GRID'}>grid_on</mwc-icon>
|
|
114
|
+
<mwc-icon @click=${() => (this.mode = 'LIST')} ?active=${mode == 'LIST'}>format_list_bulleted</mwc-icon>
|
|
115
|
+
<mwc-icon @click=${() => (this.mode = 'CARD')} ?active=${mode == 'CARD'}>apps</mwc-icon>
|
|
116
|
+
</div>
|
|
117
|
+
</div>
|
|
118
|
+
</ox-grist>
|
|
119
|
+
`
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
async pageInitialized(lifecycle: any) {
|
|
123
|
+
this.gristConfig = {
|
|
124
|
+
list: {
|
|
125
|
+
fields: ['name', 'description'],
|
|
126
|
+
details: ['active', 'updatedAt']
|
|
127
|
+
},
|
|
128
|
+
columns: [
|
|
129
|
+
{ type: 'gutter', gutterName: 'sequence' },
|
|
130
|
+
{ type: 'gutter', gutterName: 'row-selector', multiple: true },
|
|
131
|
+
{
|
|
132
|
+
type: 'string',
|
|
133
|
+
name: 'name',
|
|
134
|
+
header: i18next.t('field.name'),
|
|
135
|
+
record: {
|
|
136
|
+
editable: true
|
|
137
|
+
},
|
|
138
|
+
filter: 'search',
|
|
139
|
+
sortable: true,
|
|
140
|
+
width: 150
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
type: 'string',
|
|
144
|
+
name: 'description',
|
|
145
|
+
header: i18next.t('field.description'),
|
|
146
|
+
record: {
|
|
147
|
+
editable: true
|
|
148
|
+
},
|
|
149
|
+
filter: 'search',
|
|
150
|
+
width: 200
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
type: 'checkbox',
|
|
154
|
+
name: 'active',
|
|
155
|
+
label: true,
|
|
156
|
+
header: i18next.t('field.active'),
|
|
157
|
+
record: {
|
|
158
|
+
editable: true
|
|
159
|
+
},
|
|
160
|
+
filter: true,
|
|
161
|
+
sortable: true,
|
|
162
|
+
width: 60
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
type: 'resource-object',
|
|
166
|
+
name: 'updater',
|
|
167
|
+
header: i18next.t('field.updater'),
|
|
168
|
+
record: {
|
|
169
|
+
editable: false
|
|
170
|
+
},
|
|
171
|
+
sortable: true,
|
|
172
|
+
width: 120
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
type: 'datetime',
|
|
176
|
+
name: 'updatedAt',
|
|
177
|
+
header: i18next.t('field.updated_at'),
|
|
178
|
+
record: {
|
|
179
|
+
editable: false
|
|
180
|
+
},
|
|
181
|
+
sortable: true,
|
|
182
|
+
width: 180
|
|
183
|
+
}
|
|
184
|
+
],
|
|
185
|
+
rows: {
|
|
186
|
+
selectable: {
|
|
187
|
+
multiple: true
|
|
188
|
+
}
|
|
189
|
+
},
|
|
190
|
+
sorters: [
|
|
191
|
+
{
|
|
192
|
+
name: 'name'
|
|
193
|
+
}
|
|
194
|
+
]
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
async pageUpdated(changes: any, lifecycle: any) {
|
|
199
|
+
if (this.active) {
|
|
200
|
+
// do something here when this page just became as active
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
async fetchHandler({ page = 1, limit = 100, sortings = [], filters = [] }: FetchOption) {
|
|
205
|
+
const response = await client.query({
|
|
206
|
+
query: gql`
|
|
207
|
+
query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
|
|
208
|
+
responses: oauth2Clients(filters: $filters, pagination: $pagination, sortings: $sortings) {
|
|
209
|
+
items {
|
|
210
|
+
id
|
|
211
|
+
name
|
|
212
|
+
description
|
|
213
|
+
active
|
|
214
|
+
updater {
|
|
215
|
+
id
|
|
216
|
+
name
|
|
217
|
+
}
|
|
218
|
+
updatedAt
|
|
219
|
+
}
|
|
220
|
+
total
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
`,
|
|
224
|
+
variables: {
|
|
225
|
+
filters,
|
|
226
|
+
pagination: { page, limit },
|
|
227
|
+
sortings
|
|
228
|
+
}
|
|
229
|
+
})
|
|
230
|
+
|
|
231
|
+
return {
|
|
232
|
+
total: response.data.responses.total || 0,
|
|
233
|
+
records: response.data.responses.items || []
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
async _deleteOauth2Client() {
|
|
238
|
+
if (confirm(i18next.t('text.sure_to_x', { x: i18next.t('text.delete') }))) {
|
|
239
|
+
const ids = this.grist.selected.map(record => record.id)
|
|
240
|
+
if (ids && ids.length > 0) {
|
|
241
|
+
const response = await client.mutate({
|
|
242
|
+
mutation: gql`
|
|
243
|
+
mutation ($ids: [String!]!) {
|
|
244
|
+
deleteOauth2Clients(ids: $ids)
|
|
245
|
+
}
|
|
246
|
+
`,
|
|
247
|
+
variables: {
|
|
248
|
+
ids
|
|
249
|
+
}
|
|
250
|
+
})
|
|
251
|
+
|
|
252
|
+
if (!response.errors) {
|
|
253
|
+
this.grist.fetch()
|
|
254
|
+
notify({
|
|
255
|
+
message: i18next.t('text.info_x_successfully', { x: i18next.t('text.delete') })
|
|
256
|
+
})
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
async _updateOauth2Client() {
|
|
263
|
+
let patches = this.grist.dirtyRecords
|
|
264
|
+
if (patches && patches.length) {
|
|
265
|
+
patches = patches.map(patch => {
|
|
266
|
+
let patchField: any = patch.id ? { id: patch.id } : {}
|
|
267
|
+
const dirtyFields = patch.__dirtyfields__
|
|
268
|
+
for (let key in dirtyFields) {
|
|
269
|
+
patchField[key] = dirtyFields[key].after
|
|
270
|
+
}
|
|
271
|
+
patchField.cuFlag = patch.__dirty__
|
|
272
|
+
|
|
273
|
+
return patchField
|
|
274
|
+
})
|
|
275
|
+
|
|
276
|
+
const response = await client.mutate({
|
|
277
|
+
mutation: gql`
|
|
278
|
+
mutation ($patches: [Oauth2ClientPatch!]!) {
|
|
279
|
+
updateMultipleOauth2Client(patches: $patches) {
|
|
280
|
+
name
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
`,
|
|
284
|
+
variables: {
|
|
285
|
+
patches
|
|
286
|
+
}
|
|
287
|
+
})
|
|
288
|
+
|
|
289
|
+
if (!response.errors) {
|
|
290
|
+
this.grist.fetch()
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
async exportHandler() {
|
|
296
|
+
const exportTargets = this.grist.selected.length ? this.grist.selected : this.grist.dirtyData.records
|
|
297
|
+
const targetFieldSet = new Set([
|
|
298
|
+
'id',
|
|
299
|
+
'name',
|
|
300
|
+
'description',
|
|
301
|
+
'active'
|
|
302
|
+
])
|
|
303
|
+
|
|
304
|
+
return exportTargets.map(oauth2Client => {
|
|
305
|
+
let tempObj = {}
|
|
306
|
+
for (const field of targetFieldSet) {
|
|
307
|
+
tempObj[field] = oauth2Client[field]
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
return tempObj
|
|
311
|
+
})
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
async importHandler(records) {
|
|
315
|
+
const popup = openPopup(
|
|
316
|
+
html`
|
|
317
|
+
<oauth2-client-importer
|
|
318
|
+
.oauth2Clients=${records}
|
|
319
|
+
@imported=${() => {
|
|
320
|
+
history.back()
|
|
321
|
+
this.grist.fetch()
|
|
322
|
+
}}
|
|
323
|
+
></oauth2-client-importer>
|
|
324
|
+
`,
|
|
325
|
+
{
|
|
326
|
+
backdrop: true,
|
|
327
|
+
size: 'large',
|
|
328
|
+
title: i18next.t('title.import oauth2-client')
|
|
329
|
+
}
|
|
330
|
+
)
|
|
331
|
+
|
|
332
|
+
popup.onclosed = () => {
|
|
333
|
+
this.grist.fetch()
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
|
|
@@ -1,96 +1,95 @@
|
|
|
1
1
|
import gql from 'graphql-tag'
|
|
2
2
|
import { css, html } from 'lit'
|
|
3
|
+
import { customElement, property, query } from 'lit/decorators.js'
|
|
3
4
|
import { connect } from 'pwa-helpers/connect-mixin.js'
|
|
4
5
|
|
|
6
|
+
import { client } from '@operato/graphql'
|
|
5
7
|
import { notify } from '@operato/layout'
|
|
6
|
-
import {
|
|
8
|
+
import { navigate, PageView, store } from '@operato/shell'
|
|
7
9
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
10
|
+
@customElement('oauth2-client-register')
|
|
11
|
+
export class Oauth2ClientRegister 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);
|
|
17
19
|
|
|
18
|
-
|
|
20
|
+
position: relative;
|
|
19
21
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
22
|
+
overflow: auto;
|
|
23
|
+
}
|
|
24
|
+
h2 {
|
|
25
|
+
margin: var(--title-margin);
|
|
26
|
+
font: var(--title-font);
|
|
27
|
+
color: var(--title-text-color);
|
|
28
|
+
}
|
|
29
|
+
[page-description] {
|
|
30
|
+
margin: var(--page-description-margin);
|
|
31
|
+
font: var(--page-description-font);
|
|
32
|
+
color: var(--page-description-color);
|
|
33
|
+
}
|
|
34
|
+
[icon] {
|
|
35
|
+
position: absolute;
|
|
36
|
+
top: 10px;
|
|
37
|
+
right: 10px;
|
|
36
38
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
max-width: 80px;
|
|
40
|
+
}
|
|
41
|
+
[icon] img {
|
|
42
|
+
max-width: 100%;
|
|
43
|
+
max-height: 100%;
|
|
44
|
+
}
|
|
43
45
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
46
|
+
:host * {
|
|
47
|
+
display: block;
|
|
48
|
+
}
|
|
49
|
+
label {
|
|
50
|
+
font: var(--label-font);
|
|
51
|
+
color: var(--label-color);
|
|
52
|
+
text-transform: var(--label-text-transform);
|
|
53
|
+
}
|
|
54
|
+
input,
|
|
55
|
+
select {
|
|
56
|
+
border: var(--border-dark-color);
|
|
57
|
+
border-radius: var(--border-radius);
|
|
58
|
+
margin: var(--input-margin);
|
|
59
|
+
padding: var(--input-padding);
|
|
60
|
+
font: var(--input-font);
|
|
61
|
+
|
|
62
|
+
flex: 1;
|
|
63
|
+
}
|
|
64
|
+
select:focus,
|
|
65
|
+
input:focus {
|
|
66
|
+
outline: none;
|
|
67
|
+
}
|
|
66
68
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
69
|
+
[field-2column] {
|
|
70
|
+
display: grid;
|
|
71
|
+
grid-template-columns: 1fr 1fr;
|
|
72
|
+
grid-gap: 15px;
|
|
73
|
+
}
|
|
74
|
+
[field] {
|
|
75
|
+
display: flex;
|
|
76
|
+
flex-direction: column;
|
|
77
|
+
}
|
|
78
|
+
[grid-span] {
|
|
79
|
+
grid-column: span 2;
|
|
80
|
+
}
|
|
81
|
+
@media screen and (max-width: 480px) {
|
|
72
82
|
[field] {
|
|
73
|
-
display: flex;
|
|
74
|
-
flex-direction: column;
|
|
75
|
-
}
|
|
76
|
-
[grid-span] {
|
|
77
83
|
grid-column: span 2;
|
|
78
84
|
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
`
|
|
85
|
-
]
|
|
86
|
-
}
|
|
85
|
+
}
|
|
86
|
+
`
|
|
87
|
+
]
|
|
87
88
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
}
|
|
93
|
-
}
|
|
89
|
+
@property({ type: Object }) application: any
|
|
90
|
+
@property({ type: String }) _icon?: string
|
|
91
|
+
|
|
92
|
+
@query('form') form!: HTMLFormElement
|
|
94
93
|
|
|
95
94
|
get context() {
|
|
96
95
|
return {
|
|
@@ -149,8 +148,7 @@ class Oauth2ClientRegister extends connect(store)(PageView) {
|
|
|
149
148
|
async createOauth2Client(e) {
|
|
150
149
|
e.preventDefault()
|
|
151
150
|
|
|
152
|
-
const
|
|
153
|
-
const formData = new FormData(form)
|
|
151
|
+
const formData = new FormData(this.form)
|
|
154
152
|
|
|
155
153
|
const oauth2Client = Array.from(formData.entries()).reduce((oauth2Client, [key, value]) => {
|
|
156
154
|
oauth2Client[key] = value
|
|
@@ -183,12 +181,7 @@ class Oauth2ClientRegister extends connect(store)(PageView) {
|
|
|
183
181
|
|
|
184
182
|
async pageUpdated(changes, lifecycle, before) {
|
|
185
183
|
if (this.active) {
|
|
186
|
-
this.
|
|
187
|
-
|
|
188
|
-
this.itemId = lifecycle.resourceId
|
|
189
|
-
this.params = lifecycle.params
|
|
184
|
+
this.form.reset()
|
|
190
185
|
}
|
|
191
186
|
}
|
|
192
187
|
}
|
|
193
|
-
|
|
194
|
-
customElements.define('oauth2-client-register', Oauth2ClientRegister)
|