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
allDatabases={sourceNames ?? []}
dispatch={dispatch}
connectDbUrl={'data/v2/manage/connect'}
connectDbUrl={'/data/v2/manage/connect'}
/>
</div>
)}

View File

@ -17,9 +17,9 @@ import { adaptGraphQLCustomization } from '../GraphQLCustomization/utils/adaptRe
import { generateGDCRequestPayload } from './utils/generateRequest';
import { hasuraToast } from '../../../../new-components/Toasts';
import { useManageDatabaseConnection } from '../../hooks/useManageDatabaseConnection';
import { capitaliseFirstLetter } from '../../../../components/Common/ConfigureTransformation/utils';
import { Collapsible } from '../../../../new-components/Collapsible';
import { DisplayToastErrorMessage } from '../Common/DisplayToastErrorMessage';
import { useAvailableDrivers } from '../../../ConnectDB/hooks';
interface ConnectGDCSourceWidgetProps {
driver: string;
@ -57,6 +57,10 @@ export const ConnectGDCSourceWidget = (props: ConnectGDCSourceWidgetProps) => {
const { driver, dataSourceName } = props;
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 =>
m.metadata.sources.find(source => source.name === dataSourceName)
);
@ -135,8 +139,8 @@ export const ConnectGDCSourceWidget = (props: ConnectGDCSourceWidgetProps) => {
<div>
<div className="text-xl text-gray-600 font-semibold">
{isEditMode
? `Edit ${capitaliseFirstLetter(driver)} Connection`
: `Connect New ${capitaliseFirstLetter(driver)} Database`}
? `Edit ${driverDisplayName} Connection`
: `Connect ${driverDisplayName} Database`}
</div>
<Form onSubmit={handleSubmit}>
<Tabs

View File

@ -17,8 +17,9 @@ export const adaptMssqlConnectionInfo = (
envVar: connectionInfo.connection_string.from_env,
},
poolSettings: {
totalMaxConnections: connectionInfo.pool_settings?.total_max_connections,
idleTimeout: connectionInfo.pool_settings?.idle_timeout,
totalMaxConnections:
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[] = [
{
name: 'mysqlgdc',
displayName: 'MySql',
displayName: 'MySQL',
native: false,
release: 'Alpha',
enterprise: true,

View File

@ -1,8 +1,7 @@
import { useQuery } from 'react-query';
import { useAllSuggestedRelationships } from '../../../../DatabaseRelationships/components/SuggestedRelationships/hooks/useAllSuggestedRelationships';
import { tableRelationships as getTableRelationships } from '../../../../DatabaseRelationships/utils/tableRelationships';
import { exportMetadata } from '../../../../DataSource';
import { useHttpClient } from '../../../../Network';
import { useMetadata } from '../../../../hasura-metadata-api';
export const getTrackedRelationshipsCacheKey = (dataSourceName: string) => [
'tracked_relationships',
@ -10,18 +9,16 @@ export const getTrackedRelationshipsCacheKey = (dataSourceName: string) => [
];
export const useTrackedRelationships = (dataSourceName: string) => {
const httpClient = useHttpClient();
const { suggestedRelationships } = useAllSuggestedRelationships({
dataSourceName,
isEnabled: true,
omitTracked: false,
});
const fetchRelationships = async () => {
const { metadata } = await exportMetadata({ httpClient });
const { data: metadata } = useMetadata(m => m.metadata);
const currentMetadataSource = metadata.sources?.find(
const fetchRelationships = async () => {
const currentMetadataSource = metadata?.sources?.find(
source => source.name === dataSourceName
);

View File

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

View File

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

View File

@ -35,7 +35,7 @@ export const MultipleJWTSecretsPage = () => {
<MultipleJWTSecretsSvg />
{isFeatureActive ? (
<p className="mt-md text-muted">
<strong>Setup Multiple Admin Secrets</strong>
<strong>Setup Multiple JWT Secrets</strong>
<br />
<a
className="font-bold text-secondary"

View File

@ -63,7 +63,7 @@ export interface MssqlConfiguration {
connection_info: {
connection_string: string | FromEnv;
pool_settings?: {
total_max_connections?: number;
total_max_connections?: number | null;
idle_timeout?: number;
};
};

View File

@ -4,7 +4,7 @@ export const getRoute = () => ({
connectDatabase: (driver?: string) =>
driver
? `/data/v2/manage/database/add?driver=${driver}`
: 'data/v2/manage/connect',
: '/data/v2/manage/connect',
database: (dataSourceName: string) =>
encodeURI(`/data/v2/manage/database?database=${dataSourceName}`),
table: (dataSourceName: string, table: Table, operation?: string) => {