mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-15 01:12:56 +03:00
console: minor bug fixes (Tracking UI, Connect DB)
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8807 Co-authored-by: Luca Restagno <59067245+lucarestagno@users.noreply.github.com> GitOrigin-RevId: f681dfb5b4ace38efe087e18aef6dde8dbd8b940
This commit is contained in:
parent
72d0c73377
commit
fad183d854
@ -28,7 +28,7 @@ export const Cloud = ({
|
|||||||
<NeonConnect
|
<NeonConnect
|
||||||
allDatabases={sourceNames ?? []}
|
allDatabases={sourceNames ?? []}
|
||||||
dispatch={dispatch}
|
dispatch={dispatch}
|
||||||
connectDbUrl={'data/v2/manage/connect'}
|
connectDbUrl={'/data/v2/manage/connect'}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
@ -17,9 +17,9 @@ import { adaptGraphQLCustomization } from '../GraphQLCustomization/utils/adaptRe
|
|||||||
import { generateGDCRequestPayload } from './utils/generateRequest';
|
import { generateGDCRequestPayload } from './utils/generateRequest';
|
||||||
import { hasuraToast } from '../../../../new-components/Toasts';
|
import { hasuraToast } from '../../../../new-components/Toasts';
|
||||||
import { useManageDatabaseConnection } from '../../hooks/useManageDatabaseConnection';
|
import { useManageDatabaseConnection } from '../../hooks/useManageDatabaseConnection';
|
||||||
import { capitaliseFirstLetter } from '../../../../components/Common/ConfigureTransformation/utils';
|
|
||||||
import { Collapsible } from '../../../../new-components/Collapsible';
|
import { Collapsible } from '../../../../new-components/Collapsible';
|
||||||
import { DisplayToastErrorMessage } from '../Common/DisplayToastErrorMessage';
|
import { DisplayToastErrorMessage } from '../Common/DisplayToastErrorMessage';
|
||||||
|
import { useAvailableDrivers } from '../../../ConnectDB/hooks';
|
||||||
|
|
||||||
interface ConnectGDCSourceWidgetProps {
|
interface ConnectGDCSourceWidgetProps {
|
||||||
driver: string;
|
driver: string;
|
||||||
@ -57,6 +57,10 @@ export const ConnectGDCSourceWidget = (props: ConnectGDCSourceWidgetProps) => {
|
|||||||
const { driver, dataSourceName } = props;
|
const { driver, dataSourceName } = props;
|
||||||
const [tab, setTab] = useState('connection_details');
|
const [tab, setTab] = useState('connection_details');
|
||||||
|
|
||||||
|
const { data: drivers } = useAvailableDrivers();
|
||||||
|
const driverDisplayName =
|
||||||
|
drivers?.find(d => d.name === driver)?.displayName ?? driver;
|
||||||
|
|
||||||
const { data: metadataSource } = useMetadata(m =>
|
const { data: metadataSource } = useMetadata(m =>
|
||||||
m.metadata.sources.find(source => source.name === dataSourceName)
|
m.metadata.sources.find(source => source.name === dataSourceName)
|
||||||
);
|
);
|
||||||
@ -135,8 +139,8 @@ export const ConnectGDCSourceWidget = (props: ConnectGDCSourceWidgetProps) => {
|
|||||||
<div>
|
<div>
|
||||||
<div className="text-xl text-gray-600 font-semibold">
|
<div className="text-xl text-gray-600 font-semibold">
|
||||||
{isEditMode
|
{isEditMode
|
||||||
? `Edit ${capitaliseFirstLetter(driver)} Connection`
|
? `Edit ${driverDisplayName} Connection`
|
||||||
: `Connect New ${capitaliseFirstLetter(driver)} Database`}
|
: `Connect ${driverDisplayName} Database`}
|
||||||
</div>
|
</div>
|
||||||
<Form onSubmit={handleSubmit}>
|
<Form onSubmit={handleSubmit}>
|
||||||
<Tabs
|
<Tabs
|
||||||
|
@ -17,8 +17,9 @@ export const adaptMssqlConnectionInfo = (
|
|||||||
envVar: connectionInfo.connection_string.from_env,
|
envVar: connectionInfo.connection_string.from_env,
|
||||||
},
|
},
|
||||||
poolSettings: {
|
poolSettings: {
|
||||||
totalMaxConnections: connectionInfo.pool_settings?.total_max_connections,
|
totalMaxConnections:
|
||||||
idleTimeout: connectionInfo.pool_settings?.idle_timeout,
|
connectionInfo.pool_settings?.total_max_connections ?? undefined,
|
||||||
|
idleTimeout: connectionInfo.pool_settings?.idle_timeout ?? undefined,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -14,7 +14,7 @@ type useDatabaseConnectDriversProps = {
|
|||||||
const SuperConnectorDrivers: readonly DriverInfo[] = [
|
const SuperConnectorDrivers: readonly DriverInfo[] = [
|
||||||
{
|
{
|
||||||
name: 'mysqlgdc',
|
name: 'mysqlgdc',
|
||||||
displayName: 'MySql',
|
displayName: 'MySQL',
|
||||||
native: false,
|
native: false,
|
||||||
release: 'Alpha',
|
release: 'Alpha',
|
||||||
enterprise: true,
|
enterprise: true,
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
import { useQuery } from 'react-query';
|
import { useQuery } from 'react-query';
|
||||||
import { useAllSuggestedRelationships } from '../../../../DatabaseRelationships/components/SuggestedRelationships/hooks/useAllSuggestedRelationships';
|
import { useAllSuggestedRelationships } from '../../../../DatabaseRelationships/components/SuggestedRelationships/hooks/useAllSuggestedRelationships';
|
||||||
import { tableRelationships as getTableRelationships } from '../../../../DatabaseRelationships/utils/tableRelationships';
|
import { tableRelationships as getTableRelationships } from '../../../../DatabaseRelationships/utils/tableRelationships';
|
||||||
import { exportMetadata } from '../../../../DataSource';
|
import { useMetadata } from '../../../../hasura-metadata-api';
|
||||||
import { useHttpClient } from '../../../../Network';
|
|
||||||
|
|
||||||
export const getTrackedRelationshipsCacheKey = (dataSourceName: string) => [
|
export const getTrackedRelationshipsCacheKey = (dataSourceName: string) => [
|
||||||
'tracked_relationships',
|
'tracked_relationships',
|
||||||
@ -10,18 +9,16 @@ export const getTrackedRelationshipsCacheKey = (dataSourceName: string) => [
|
|||||||
];
|
];
|
||||||
|
|
||||||
export const useTrackedRelationships = (dataSourceName: string) => {
|
export const useTrackedRelationships = (dataSourceName: string) => {
|
||||||
const httpClient = useHttpClient();
|
|
||||||
|
|
||||||
const { suggestedRelationships } = useAllSuggestedRelationships({
|
const { suggestedRelationships } = useAllSuggestedRelationships({
|
||||||
dataSourceName,
|
dataSourceName,
|
||||||
isEnabled: true,
|
isEnabled: true,
|
||||||
omitTracked: false,
|
omitTracked: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
const fetchRelationships = async () => {
|
const { data: metadata } = useMetadata(m => m.metadata);
|
||||||
const { metadata } = await exportMetadata({ httpClient });
|
|
||||||
|
|
||||||
const currentMetadataSource = metadata.sources?.find(
|
const fetchRelationships = async () => {
|
||||||
|
const currentMetadataSource = metadata?.sources?.find(
|
||||||
source => source.name === dataSourceName
|
source => source.name === dataSourceName
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -20,5 +20,6 @@ export function useGetDatabaseSchemas(dataSourceName: string) {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
refetchOnWindowFocus: false,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -43,6 +43,7 @@ export const useTrackTables = ({
|
|||||||
args: {
|
args: {
|
||||||
table: trackableTable.table,
|
table: trackableTable.table,
|
||||||
source: dataSourceName,
|
source: dataSourceName,
|
||||||
|
configuration: trackableTable.configuration,
|
||||||
},
|
},
|
||||||
})),
|
})),
|
||||||
},
|
},
|
||||||
|
@ -35,7 +35,7 @@ export const MultipleJWTSecretsPage = () => {
|
|||||||
<MultipleJWTSecretsSvg />
|
<MultipleJWTSecretsSvg />
|
||||||
{isFeatureActive ? (
|
{isFeatureActive ? (
|
||||||
<p className="mt-md text-muted">
|
<p className="mt-md text-muted">
|
||||||
<strong>Setup Multiple Admin Secrets</strong>
|
<strong>Setup Multiple JWT Secrets</strong>
|
||||||
<br />
|
<br />
|
||||||
<a
|
<a
|
||||||
className="font-bold text-secondary"
|
className="font-bold text-secondary"
|
||||||
|
@ -63,7 +63,7 @@ export interface MssqlConfiguration {
|
|||||||
connection_info: {
|
connection_info: {
|
||||||
connection_string: string | FromEnv;
|
connection_string: string | FromEnv;
|
||||||
pool_settings?: {
|
pool_settings?: {
|
||||||
total_max_connections?: number;
|
total_max_connections?: number | null;
|
||||||
idle_timeout?: number;
|
idle_timeout?: number;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -4,7 +4,7 @@ export const getRoute = () => ({
|
|||||||
connectDatabase: (driver?: string) =>
|
connectDatabase: (driver?: string) =>
|
||||||
driver
|
driver
|
||||||
? `/data/v2/manage/database/add?driver=${driver}`
|
? `/data/v2/manage/database/add?driver=${driver}`
|
||||||
: 'data/v2/manage/connect',
|
: '/data/v2/manage/connect',
|
||||||
database: (dataSourceName: string) =>
|
database: (dataSourceName: string) =>
|
||||||
encodeURI(`/data/v2/manage/database?database=${dataSourceName}`),
|
encodeURI(`/data/v2/manage/database?database=${dataSourceName}`),
|
||||||
table: (dataSourceName: string, table: Table, operation?: string) => {
|
table: (dataSourceName: string, table: Table, operation?: string) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user