Skip to content

Commit 15da0a6

Browse files
committed
feat: sql- add/edit/delete of sql configuration not working #283
1 parent 744f6a4 commit 15da0a6

File tree

16 files changed

+432
-398
lines changed

16 files changed

+432
-398
lines changed

app/locales/en/translation.json

+33-10
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,13 @@
2424
},
2525
"fields": {
2626
"access_token_signing_alg": "Access Token Signing Algorithm",
27-
"activate": "activate",
27+
"activate": "Activate",
2828
"active": "Active",
2929
"application_type": "Application Type",
3030
"attributes": "Attributes",
3131
"attribute_edit_type": "Attribute Edit Type",
3232
"attribute_view_type": "Attribute View Type",
3333
"authentication_method": "Authentication method for the Token Endpoint",
34-
"authorization_code_access_token": "Authorization Code Access Token",
35-
"average_of_mau": "Average of MAU",
3634
"base_dns": "Base DNs",
3735
"bind_dn": "Bind DN",
3836
"bind_password": "Bind Password",
@@ -41,7 +39,6 @@
4139
"cache_configuration": "Cache Configuration",
4240
"cache_provider_type": "Cache Provider Type",
4341
"claims": "Claims",
44-
"client_credentials_access_token": "Client Credentials Access Token",
4542
"client_expiration_date": "Client Expiration Date",
4643
"client_id": "Client Id",
4744
"client_name": "Client Name",
@@ -107,8 +104,6 @@
107104
"memcached_configuration": "memcachedConfiguration",
108105
"maximum_length": "Maximum length",
109106
"minimum_length": "Minimum length",
110-
"month": "Month",
111-
"monthly_active_users": "Monthly Active Users",
112107
"multivalued": "Multivalued?",
113108
"name": "Name",
114109
"native_persistence_configuration": "nativePersistenceConfiguration",
@@ -221,7 +216,14 @@
221216
"companyName": "Company Name",
222217
"customerEmail": "Customer Email",
223218
"customerName": "Customer Name",
224-
"licenseDetails": "License Details"
219+
"licenseDetails": "License Details",
220+
"username": "Username",
221+
"connectionUris": "Connection URIs",
222+
"schemaName": "Schema Name",
223+
"passwordEncryptionMethod": "Password Encryption Method",
224+
"serverTimezone": "Server Timezone",
225+
"binaryAttributes": "Binary Attributes",
226+
"certificateAttributes": "Certificate Attributes"
225227
},
226228
"languages": {
227229
"french": "Français",
@@ -295,7 +297,9 @@
295297
"edit_ldap": "Edit Ldap",
296298
"edit_attribute": "Edit Attribute",
297299
"refresh_data": "Refresh Data",
298-
"view_attribute": "View attribute"
300+
"view_attribute": "View attribute",
301+
"edit_sql": "Edit SQL",
302+
"add_sql": "Add SQL"
299303
},
300304
"placeholders": {
301305
"action_commit_message": "Provide the reason of this change",
@@ -332,7 +336,14 @@
332336
"smtp_user_name": "Enter the SMTP user name",
333337
"smtp_user_password": "Enter the SMTP user password",
334338
"spontaneous_client_id": "Enter the spontaneous client id",
335-
"typeahead_holder_message": "Enter multiple items by selecting from appeared dropdown after entering each item."
339+
"typeahead_holder_message": "Enter multiple items by selecting from appeared dropdown after entering each item.",
340+
"sql_config_name": "Enter the sql configuration name.",
341+
"sql_username": "Enter the Username.",
342+
"sql_password": "Enter the Password.",
343+
"sql_schemaname": "Enter the schema name.",
344+
"sql_passwordEncryptionMethod": "Add password encryption method.",
345+
"sql_serverTimezone": "Enter server timezone.",
346+
"activate_sql_configuration": "Activate SQL configuration."
336347
},
337348
"titles": {
338349
"acrs": "ACRs",
@@ -793,14 +804,26 @@
793804
"buckets": "The couchbase buckets to store data.",
794805
"defaultBucket": "The default bucket for the Gluu Server.",
795806
"connectTimeout": "Connection time out.",
796-
"computationPoolSize": "Computation pool size.",
807+
"computationPoolSize": "",
797808
"useSSL":"Use this feature if the backend server allows SSL connectivity.",
798809
"sslTrustStoreFile": "SSL truststore file.",
799810
"sslTrustStoreFormat": "SSL truststore format.",
800811
"sslTrustStorePin": "Encoded truststore pin.",
801812
"userName": "Database username.",
802813
"userPassword": "Database password."
803814

815+
},
816+
"sql": {
817+
"config_name": "Enter the sql configuration name.",
818+
"username": "Enter the database username.",
819+
"password": "Enter the database password.",
820+
"schemaname": "Enter the schema name.",
821+
"passwordEncryptionMethod": "Add password encryption method.",
822+
"serverTimezone": "Enter server timezone.",
823+
"binaryAttributes": "Binary attributes.",
824+
"certificateAttributes": "Certificate attributes.",
825+
"activate": "Activate SQL configuration.",
826+
"connectionUri": "Connection URI of database."
804827
}
805828
}
806829
}

app/utils/ApiResources.js

+1
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@ export const JSON_CONFIG = 'json_properties'
66
export const SETTINGS = 'settings'
77
export const LICENSE = 'license'
88
export const LDAP = 'ldap'
9+
export const SQL = 'sql'
910
export const COUCHBASE = 'couchbase'
1011
export const CACHE = 'cache'

plugins/services-plugin/Components/Configuration/SqlAddPage.js

+11-16
Original file line numberDiff line numberDiff line change
@@ -2,34 +2,29 @@ import React from 'react'
22
import { connect } from 'react-redux'
33
import { useHistory } from 'react-router-dom'
44
import { Container, CardBody, Card } from '../../../../app/components'
5-
import LdapForm from './LdapForm'
6-
import { addLdap } from '../../redux/actions/LdapActions'
5+
import SqlForm from './SqlForm'
6+
import { addSql } from '../../redux/actions/SqlActions'
77
import { buildPayload } from '../../../../app/utils/PermChecker'
88

9-
function LdapAddPage({ dispatch }) {
9+
function SqlAddPage({ dispatch }) {
1010
const userAction = {}
1111
const history = useHistory()
1212
function handleSubmit(data) {
1313
if (data) {
14-
let message = data.ldap.action_message
15-
delete data.ldap.action_message
14+
let message = data.sql.action_message
15+
delete data.sql.action_message
1616
buildPayload(userAction, message, data)
17-
dispatch(addLdap(userAction))
18-
history.push('/config/ldap')
17+
dispatch(addSql(userAction))
18+
history.push('/config/sql')
1919
}
2020
}
21-
const defautConfigurations = {
22-
maxConnections: 2,
23-
useSSL: false,
24-
useAnonymousBind: false,
25-
enabled: false
26-
}
21+
const defautConfigurations = {}
2722
return (
2823
<React.Fragment>
2924
<Container>
3025
<Card className="mb-3">
3126
<CardBody>
32-
<LdapForm
27+
<SqlForm
3328
item={defautConfigurations}
3429
handleSubmit={handleSubmit}
3530
/>
@@ -41,8 +36,8 @@ function LdapAddPage({ dispatch }) {
4136
}
4237
const mapStateToProps = (state) => {
4338
return {
44-
loading: state.ldapReducer.loading,
39+
loading: state.sqlReducer.loading,
4540
permissions: state.authReducer.permissions,
4641
}
4742
}
48-
export default connect(mapStateToProps)(LdapAddPage)
43+
export default connect(mapStateToProps)(SqlAddPage)

plugins/services-plugin/Components/Configuration/SqlDetailPage.js

+24-62
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
} from '../../../../app/components'
1010
import { useTranslation } from 'react-i18next'
1111

12-
const LdapDetailPage = ({ row, testLdapConnection }) => {
12+
const SqlDetailPage = ({ row, testSqlConnection }) => {
1313
const { t } = useTranslation()
1414

1515
function getBadgeTheme(status) {
@@ -20,8 +20,8 @@ const LdapDetailPage = ({ row, testLdapConnection }) => {
2020
}
2121
}
2222

23-
function checkLdapConnection() {
24-
testLdapConnection(row)
23+
function checkSqlConnection() {
24+
testSqlConnection(row)
2525
}
2626

2727
return (
@@ -31,7 +31,7 @@ const LdapDetailPage = ({ row, testLdapConnection }) => {
3131
<Col sm={6}>
3232
<FormGroup row>
3333
<Label for="input" sm={6}>
34-
{t('fields.configuration_id')}:
34+
{t('fields.name')}:
3535
</Label>
3636
<Label for="input" sm={6}>
3737
{row.configId}
@@ -41,35 +41,36 @@ const LdapDetailPage = ({ row, testLdapConnection }) => {
4141
<Col sm={6}>
4242
<FormGroup row>
4343
<Label for="input" sm={6}>
44-
{t('fields.bind_dn')}:
44+
{t('fields.username')}:
4545
</Label>
4646
<Label for="input" sm={6}>
47-
{row.bindDN}
47+
{row.userName}
4848
</Label>
4949
</FormGroup>
5050
</Col>
5151
</Row>
5252
<Row>
5353
<Col sm={6}>
5454
<FormGroup row>
55-
<Label sm={6}>{t('fields.status')}:</Label>
55+
<Label sm={6}>{t('fields.connectionUris')}:</Label>
5656
<Label sm={6}>
57-
<Badge color={getBadgeTheme(row.enabled)}>
58-
{row.enabled
59-
? `${t('options.enabled')}`
60-
: `${t('options.disable')}`}
61-
</Badge>
57+
{row.connectionUri &&
58+
row.connectionUri.map((ele, index) => (
59+
<Badge key={index} color="primary">
60+
{ele}
61+
</Badge>
62+
))}
6263
</Label>
6364
</FormGroup>
6465
</Col>
6566
<Col sm={6}>
6667
<FormGroup row>
67-
<Label sm={6}>{t('fields.servers')}:</Label>
68+
<Label sm={6}>{t('fields.binaryAttributes')}:</Label>
6869
<Label sm={6}>
69-
{row.servers &&
70-
row.servers.map((server, index) => (
70+
{row.binaryAttributes &&
71+
row.binaryAttributes.map((attr, index) => (
7172
<Badge key={index} color="primary">
72-
{server}
73+
{attr}
7374
</Badge>
7475
))}
7576
</Label>
@@ -79,68 +80,29 @@ const LdapDetailPage = ({ row, testLdapConnection }) => {
7980
<Row>
8081
<Col sm={4}>
8182
<FormGroup row>
82-
<Label sm={6}>{t('fields.max_connections')}:</Label>
83-
<Label sm={6}>{row.maxConnections}</Label>
83+
<Label sm={6}>{t('fields.schemaName')}:</Label>
84+
<Label sm={6}>{row.schemaName}</Label>
8485
</FormGroup>
8586
</Col>
8687
<Col sm={4}>
8788
<FormGroup row>
88-
<Label sm={6}>{t('fields.use_ssl')}:</Label>
89+
<Label sm={6}>{t('fields.passwordEncryptionMethod')}:</Label>
8990
<Label sm={6}>
90-
{row.useSSL}
91-
<Badge color={getBadgeTheme(row.useSSL)}>
92-
{row.useSSL ? t('options.true') : t('options.false')}
93-
</Badge>
91+
{row.passwordEncryptionMethod}
9492
</Label>
9593
</FormGroup>
9694
</Col>
9795
<Col sm={4}>
9896
<FormGroup row>
99-
<Label sm={6}>{t('fields.base_dns')}:</Label>
97+
<Label sm={6}>{t('fields.serverTimezone')}:</Label>
10098
<Label sm={6}>
101-
{row.baseDNs &&
102-
row.baseDNs.map((baseDN, index) => (
103-
<Badge key={baseDN} color="primary">
104-
{baseDN}
105-
</Badge>
106-
))}
99+
{row.serverTimezone}
107100
</Label>
108101
</FormGroup>
109102
</Col>
110103
</Row>
111-
<Row>
112-
<Col sm={4}>
113-
<FormGroup row>
114-
<Label sm={6}>{t('fields.primary_key')}:</Label>
115-
<Label sm={6}>{row.primaryKey}</Label>
116-
</FormGroup>
117-
</Col>
118-
<Col sm={4}>
119-
<FormGroup row>
120-
<Label sm={6}>{t('fields.local_primary_key')}:</Label>
121-
<Label sm={6}>{row.localPrimaryKey}</Label>
122-
</FormGroup>
123-
</Col>
124-
<Col sm={4}>
125-
<FormGroup row>
126-
<Label sm={6}>{t('fields.use_anonymous_bind')}:</Label>
127-
<Label sm={6}>{row.useAnonymousBind}</Label>
128-
</FormGroup>
129-
</Col>
130-
</Row>
131-
<Row>
132-
<Col sm={4}>
133-
<button
134-
onClick={checkLdapConnection}
135-
type="button"
136-
className="btn btn-primary text-center"
137-
>
138-
{t('fields.test_connection')}
139-
</button>
140-
</Col>
141-
</Row>
142104
</Container>
143105
</React.Fragment>
144106
)
145107
}
146-
export default LdapDetailPage
108+
export default SqlDetailPage

plugins/services-plugin/Components/Configuration/SqlEditPage.js

+12-17
Original file line numberDiff line numberDiff line change
@@ -2,34 +2,29 @@ import React from 'react'
22
import { connect } from 'react-redux'
33
import { useHistory } from 'react-router-dom'
44
import { Container, CardBody, Card } from '../../../../app/components'
5-
import LdapForm from './LdapForm'
6-
import { editLdap } from '../../redux/actions/LdapActions'
5+
import SqlForm from './SqlForm'
6+
import { editSql } from '../../redux/actions/SqlActions'
77
import { buildPayload } from '../../../../app/utils/PermChecker'
88

9-
function LdapEditPage({ item, dispatch }) {
9+
function SqlEditPage({ item, dispatch }) {
1010
const userAction = {}
1111
const history = useHistory()
1212
function handleSubmit(data) {
1313
if (data) {
14-
let message = data.ldap.action_message
15-
delete data.ldap.action_message
14+
let message = data.sql.action_message
15+
delete data.sql.action_message
1616
buildPayload(userAction, message, data)
17-
dispatch(editLdap(userAction))
18-
history.push('/config/ldap')
17+
dispatch(editSql(userAction))
18+
history.push('/config/sql')
1919
}
2020
}
21-
const defautConfigurations = {
22-
maxConnections: 2,
23-
useSSL: false,
24-
useAnonymousBind: false,
25-
enabled: false
26-
}
21+
2722
return (
2823
<React.Fragment>
2924
<Container>
3025
<Card className="mb-3">
3126
<CardBody>
32-
<LdapForm item={item} handleSubmit={handleSubmit} />
27+
<SqlForm item={item} handleSubmit={handleSubmit} />
3328
</CardBody>
3429
</Card>
3530
</Container>
@@ -38,9 +33,9 @@ function LdapEditPage({ item, dispatch }) {
3833
}
3934
const mapStateToProps = (state) => {
4035
return {
41-
item: state.ldapReducer.item,
42-
loading: state.ldapReducer.loading,
36+
item: state.sqlReducer.item,
37+
loading: state.sqlReducer.loading,
4338
permissions: state.authReducer.permissions,
4439
}
4540
}
46-
export default connect(mapStateToProps)(LdapEditPage)
41+
export default connect(mapStateToProps)(SqlEditPage)

0 commit comments

Comments
 (0)