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:
Vijay Prasanna 2023-04-19 17:39:52 +05:30 committed by hasura-bot
parent 72d0c73377
commit fad183d854
10 changed files with 21 additions and 17 deletions

View File

@ -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>
)} )}

View File

@ -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

View File

@ -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,
}, },
}; };
}; };

View File

@ -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,

View File

@ -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
); );

View File

@ -20,5 +20,6 @@ export function useGetDatabaseSchemas(dataSourceName: string) {
return result; return result;
} }
}, },
refetchOnWindowFocus: false,
}); });
} }

View File

@ -43,6 +43,7 @@ export const useTrackTables = ({
args: { args: {
table: trackableTable.table, table: trackableTable.table,
source: dataSourceName, source: dataSourceName,
configuration: trackableTable.configuration,
}, },
})), })),
}, },

View File

@ -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"

View File

@ -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;
}; };
}; };

View File

@ -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) => {