Fix display of database rows when password is not available
closes #4381
This commit is contained in:
parent
bf2456d0fc
commit
e040fd1ebd
2 changed files with 7 additions and 10 deletions
|
@ -15,8 +15,7 @@ export const rawDataToServerDatabase = (data: any): ServerDatabase => ({
|
|||
username: data.username,
|
||||
connectionString: `${data.host.address}:${data.host.port}`,
|
||||
allowConnectionsFrom: data.connections_from,
|
||||
password:
|
||||
data.relationships && data.relationships.password ? data.relationships.password.attributes.password : undefined,
|
||||
password: data.relationships.password?.attributes?.password,
|
||||
});
|
||||
|
||||
export default (uuid: string, includePassword = true): Promise<ServerDatabase[]> => {
|
||||
|
|
|
@ -34,6 +34,10 @@ export default ({ database, className }: Props) => {
|
|||
const appendDatabase = ServerContext.useStoreActions((actions) => actions.databases.appendDatabase);
|
||||
const removeDatabase = ServerContext.useStoreActions((actions) => actions.databases.removeDatabase);
|
||||
|
||||
const jdbcConnectionString = `jdbc:mysql://${database.username}${
|
||||
database.password ? `:${database.password}` : ''
|
||||
}@${database.connectionString}/${database.name}`;
|
||||
|
||||
const schema = object().shape({
|
||||
confirm: string()
|
||||
.required('The database name must be provided.')
|
||||
|
@ -122,14 +126,8 @@ export default ({ database, className }: Props) => {
|
|||
</Can>
|
||||
<div css={tw`mt-6`}>
|
||||
<Label>JDBC Connection String</Label>
|
||||
<CopyOnClick
|
||||
text={`jdbc:mysql://${database.username}:${database.password}@${database.connectionString}/${database.name}`}
|
||||
>
|
||||
<Input
|
||||
type={'text'}
|
||||
readOnly
|
||||
value={`jdbc:mysql://${database.username}:${database.password}@${database.connectionString}/${database.name}`}
|
||||
/>
|
||||
<CopyOnClick text={jdbcConnectionString}>
|
||||
<Input type={'text'} readOnly value={jdbcConnectionString} />
|
||||
</CopyOnClick>
|
||||
</div>
|
||||
<div css={tw`mt-6 text-right`}>
|
||||
|
|
Loading…
Reference in a new issue