diff --git a/src/main/controllers/dataset_exists.ts b/src/main/controllers/dataset_exists.ts new file mode 100644 index 00000000..039979f8 --- /dev/null +++ b/src/main/controllers/dataset_exists.ts @@ -0,0 +1,30 @@ +import { NextFunction, Request, Response } from "express"; +import { fetchDataset, fetchDraftDataset } from "../services/dataset"; +import _ from "lodash"; +import { getDiff } from "json-difference"; + +export default { + name: 'dataset:exists', + handler: () => async (request: Request, response: Response, next: NextFunction) => { + const { datasetId } = request.params; + try { + const liveDataset = await Promise.allSettled([fetchDataset({ datasetId })]) + if(liveDataset[0].status == 'fulfilled') { + return response.status(200).json(liveDataset[0].value) + } + + const draftDataset = await Promise.allSettled([fetchDraftDataset({ datasetId })]) + if(draftDataset[0].status == 'fulfilled') { + return response.status(200).json(draftDataset[0].value) + } + + if(draftDataset[0].status == 'rejected') { + return response.status(_.get(draftDataset[0], ['reason', 'status'])).json(_.get(draftDataset[0], ['reason', 'response', 'data'])) + } + + + } catch (error) { + next(error); + } + } +}; diff --git a/src/main/resources/routesConfig.ts b/src/main/resources/routesConfig.ts index 571f8cdb..4ac8343a 100644 --- a/src/main/resources/routesConfig.ts +++ b/src/main/resources/routesConfig.ts @@ -163,6 +163,14 @@ export default [ ensureLoggedInMiddleware, controllers.get('dataset:diff')?.handler({}) ] + }, + { + path: 'exists/:datasetId', + method: 'GET', + middlewares: [ + ensureLoggedInMiddleware, + controllers.get('dataset:exists')?.handler({}) + ] } ] }, diff --git a/web-console-v2/src/App.tsx b/web-console-v2/src/App.tsx index 495cf0f0..a6cc303d 100644 --- a/web-console-v2/src/App.tsx +++ b/web-console-v2/src/App.tsx @@ -5,21 +5,19 @@ import SideBar from 'components/Sidebar/Sidebar'; import Navbar from 'components/Navbar/Navbar'; import _ from 'lodash'; import { AlertContextProvider } from 'contexts/AlertContextProvider'; -import { BrowserRouter, Route, Routes } from 'react-router-dom'; +import { BrowserRouter } from 'react-router-dom'; import AlertComponent from 'components/@extended/CustomAlert'; import AppRouter from 'router'; import styles from 'App.module.css'; import { queryClient } from 'queryClient'; import Locales from 'components/Locales'; import { fetchSystemSettings, getBaseURL } from 'services/configData'; -import Loadable from 'pages/auth/components/Loadable'; -const Login = Loadable(lazy(() => import('pages/auth/Login'))); const useSidebarToggle = () => { const sidebarExpandValue = localStorage.getItem('sidebarExpand') const [isSidebarExpanded, setSidebarExpanded] = useState( - _.isEqual(localStorage.getItem('sidebarExpand'), "true") + _.isEqual(localStorage.getItem('sidebarExpand'), "true") && window.location.pathname !== '/console/login' ); const toggleSidebar = useCallback(() => { @@ -42,15 +40,10 @@ const App: FC = () => { fetchSystemSettings(); }, []); - - return ( - - } /> -
{ - if (completed || onProgress) { - setSelectedStep(index); - navigate(route); - } - }; useEffect(() => { const queryParams = new URLSearchParams(location.search); @@ -60,7 +53,7 @@ const DynamicStepper = ({ steps: initialSteps, initialSelectedStep }: StepperPro } }, [location, initialSteps]); - const handleRouteNavigation = (route: string, datasetId: string) => { + const handleRouteNavigation = (route: string) => { const routeMapping: Record = { connector: `/dataset/edit/connector/configure/${datasetId}`, ingestion: `/dataset/edit/ingestion/schema/${datasetId}`, @@ -107,43 +100,18 @@ const DynamicStepper = ({ steps: initialSteps, initialSelectedStep }: StepperPro return ( - {steps.map((step, idx) => ( - { - if (['connector', 'ingestion', 'processing', 'storage', 'preview'].includes(step.route)) { - handleRouteNavigation(step.route, datasetId); - } else { - handleClick(step.route, step.index, step.completed, step.active); - } - }} - > - - {step.completed ? ( - - ) : ( - - {step.index} - - )} - - - {step.name} - - - ))} - + + {steps.map((step) => { + return ( + + handleRouteNavigation(step.route)}> + Optional} StepIconProps={{sx: {classes: step.completed ? 'completed':''}}}>{step.name} + + + ); + })} + + ); }; diff --git a/web-console-v2/src/index.css b/web-console-v2/src/index.css index dc33209a..2c8877cc 100644 --- a/web-console-v2/src/index.css +++ b/web-console-v2/src/index.css @@ -126,4 +126,16 @@ div.HelpSection_expanded__vqSxk { .MuiAccordionSummary-content { margin-bottom: 5px !important; +} + +.MuiStepIcon-root.Mui-completed { + color: #f58601 !important; +} + +.MuiStepIcon-root.Mui-active { + color: #f58601 !important; +} + +.MuiStepLabel-label.Mui-active { + color: #f58601 !important; } \ No newline at end of file diff --git a/web-console-v2/src/pages/ConnectorConfiguration/ConnectorConfiguration.tsx b/web-console-v2/src/pages/ConnectorConfiguration/ConnectorConfiguration.tsx index df626d06..d591708b 100644 --- a/web-console-v2/src/pages/ConnectorConfiguration/ConnectorConfiguration.tsx +++ b/web-console-v2/src/pages/ConnectorConfiguration/ConnectorConfiguration.tsx @@ -8,7 +8,7 @@ import HelpSection from 'components/HelpSection/HelpSection'; import _ from 'lodash'; import React, { useEffect, useState } from 'react'; import { useLocation, useNavigate, useParams } from 'react-router-dom'; -import { endpoints, useFetchDatasetsById, useReadConnectors } from 'services/dataset'; +import { endpoints, useFetchDatasetsById, useReadConnectors, useUpdateDataset } from 'services/dataset'; import styles from './ConnectorConfiguration.module.css'; import sampleSchema from './Schema'; import { customizeValidator } from '@rjsf/validator-ajv8'; @@ -126,7 +126,7 @@ const ConnectorConfiguration: React.FC = () => { } const readConnector = useReadConnectors({ connectorId: selectedConnectorId }); - const dataset = useFetchDatasetsById({datasetId, queryParams: 'status=Draft&mode=edit&fields=connectors_config'}); + const dataset = useFetchDatasetsById({datasetId, queryParams: 'status=Draft&mode=edit&fields=connectors_config,version_key'}); useEffect(() => { if (dataset.data && dataset.data.connectors_config[0]) { const connectorId = _.get(dataset.data.connectors_config[0], 'connector_id') @@ -244,19 +244,46 @@ const ConnectorConfiguration: React.FC = () => { return combinedHelp; }; + const updateDataset = useUpdateDataset(); + const handleButtonClick = () => { - navigate(`/dataset/edit/ingestion/meta/${datasetId}?step=connector&skipped=false&completed=true`, { - state: { - connectorConfig: { - id: selectedConnectorId, - connector_id: selectedConnectorId, - connector_config: formData || {}, - operations_config: opFormData || {} + if(datasetId === '') { + navigate(`/dataset/edit/ingestion/meta/${datasetId}?step=connector&skipped=false&completed=true`, { + state: { + connectorConfig: { + id: selectedConnectorId, + connector_id: selectedConnectorId, + connector_config: formData || {}, + operations_config: opFormData || {} + }, + selectedConnectorId + } + }); + } else { + updateDataset.mutate( + { + data: { + dataset_id: datasetId, + connectors_config: [{ + value: { + id: `${datasetId}_${selectedConnectorId}`, + connector_id: selectedConnectorId, + connector_config: formData || {}, + operations_config: opFormData || {}, + version: 'v2' + }, + action: "upsert" + }] + } }, - selectedConnectorId - } - }); + { + onSuccess: () => { + navigate(`/dataset/edit/ingestion/meta/${datasetId}?step=connector&skipped=false&completed=true`); + } + } + ); + } }; const handleHelpSectionToggle = () => { diff --git a/web-console-v2/src/pages/Dashboard/IndividualDashboardPage/IndividualDashboardPage.tsx b/web-console-v2/src/pages/Dashboard/IndividualDashboardPage/IndividualDashboardPage.tsx index a114234d..be9cc38b 100644 --- a/web-console-v2/src/pages/Dashboard/IndividualDashboardPage/IndividualDashboardPage.tsx +++ b/web-console-v2/src/pages/Dashboard/IndividualDashboardPage/IndividualDashboardPage.tsx @@ -11,6 +11,7 @@ import intereactIds from 'data/telemetry/interact.json' import { v4 } from 'uuid'; import Health from '../health'; import { metricsMetadata } from '../metrics'; +import { getConfigValueV1 } from 'services/configData'; const IndividualMetricDashboards = (props: any) => { const { id } = props; @@ -73,11 +74,16 @@ const IndividualMetricDashboards = (props: any) => { } } + const navigateToGrafana = (path: any) => { + if (path) { + window.open(path); + } +} const renderGrafanaIcon = () => { const link = _.get(metadata, 'links.grafana.link') if (!link) return null; return ( - navigateToGrafana(link)}> + { navigateToGrafana(getConfigValueV1("GRAFANA_URL")) }}> diff --git a/web-console-v2/src/pages/Rollup/components/ListRollups.tsx b/web-console-v2/src/pages/Rollup/components/ListRollups.tsx index 618cf2b8..578b8f47 100644 --- a/web-console-v2/src/pages/Rollup/components/ListRollups.tsx +++ b/web-console-v2/src/pages/Rollup/components/ListRollups.tsx @@ -69,7 +69,7 @@ const ListRollups = () => { }) const addNewRollup = () => { - navigate(`/home/datasets/rollups/${datasetId}`, { state: { rollupGranularityOption: rollupGranularityOption, edit: false } }) + navigate(`/datasets/rollups/${datasetId}`, { state: { rollupGranularityOption: rollupGranularityOption, edit: false } }) } const handleClose = () => { @@ -94,7 +94,7 @@ const ListRollups = () => { return { - navigate(`/home/datasets/rollups/${datasetId}`, + navigate(`/datasets/rollups/${datasetId}`, { state: { rollupGranularityOption: rollupGranularityOption, edit: true, rollupDatasourceName: value.row.original.datasourceId, aggregationLevel: value.row.original.aggregation } }) }} > @@ -147,7 +147,7 @@ const ListRollups = () => { : renderRollups()} {rollups.length === granularityOptions.length ? <> : - - - - - - Processing - - - - - - Data Validation : {validationConfig.mode} - - - - - - - - Data Denormalization - - - - {denormData.length > 0 ? ( - - ) : ( - - No records - + {(response.isPending) ? : + + + + Connector - {connectorConfig && connectorMeta ? connectorMeta.name : 'No connector configured'} + + {connectorMeta && ( + + + + + + + + + Configuration + + + + Config + Value + + + + {connectorConfig && _.entries(connectorConfig.connector_config).map(([configKey, configValue]) => ( + + {connectorMeta.ui_spec.properties[configKey].title} + {String(configValue)} + + ))} + +
+
+
+ {connectorConfig.operations_config && ( + + + + + + + Fetch Configuration + + + + Config + Value + + + + {connectorConfig && _.entries(connectorConfig.operations_config).map(([configKey, configValue]) => ( + + {configKey == 'interval' ? 'Polling Interval' : 'Polling Schedule'} + {String(configValue)} + + ))} + +
+
+
)} -
-
- - - - Transformations +
+ + )} + + + + Ingestion + + + + + + + Dataset Name + Dataset ID + Dataset Type + + + + + {datasetName} + {datasetId} + {_.get(datasetTypeMapping, datasetType)} + + +
+
+ + + + + + + Data Schema + + + + Field + Arrival Format + Data Type + Required + + + + {dataSchema && RenderFieldRows('', dataSchema.properties)} + +
+
+
+
+
+ + + Processing + + + + + + + Configurations + + + + + Add New Fields + {validationConfig && validationConfig.mode === 'Strict' ? 'No' : 'Yes'} + {validationConfig && validationConfig.mode === 'Strict' ? 'Events will be skipped if there are unknown fields' : 'Events will be processed even if there are unknown fields'} + + + Enable Deduplication + {dedupConfig && dedupConfig.drop_duplicates ? 'Yes' : 'No'} + Dedupe Key: {dedupConfig ? dedupConfig?.dedup_key: 'Not Applicable'} + + +
+
- {transformationData.length > 0 ? ( - - ) : ( - - No records - - )} - - - - - Storage + + + + + Data Denormalization + + + Dataset Field + Master Dataset + Input Field (to store the data) + + + + {dataDenormalizations.length === 0 && + ( + No fields are added for denormalization + ) + } + {dataDenormalizations.length > 0 && dataDenormalizations.map((value) => ( + + {value.denorm_key} + {value.dataset_id} + {value.denorm_out_field} + + ))} + +
+
- - - - - Dataset Type : {getDatasetType(datasetType)} - - - - - - - - Storage Type: - {olap_store_enabled && ( - - )} - {lakehouse_enabled && ( - - )} - {cache_enabled && } - - - - {storageKeysList.length > 0 ? ( - - ) : ( - - No records - - )} -
-
+ + + + + Data Privacy + + + Field + Data Type + Action + Skip Record on Failure? + + + + {sensitiveFields.length === 0 && + ( + No senstive fields have been added + ) + } + {sensitiveFields.length > 0 && sensitiveFields.map((value) => ( + + {value.field} + {_.capitalize(value.datatype)} + {_.capitalize(value.type)} + {value.mode === 'Strict' ? 'Yes': 'No'} + + ))} + +
+
+ + + + + Data Transformations + + + Field + Data Type + Transformation + Skip Record on Failure? + + + + {transformFields.length === 0 && + ( + No transformation fields have been added + ) + } + {transformFields.length > 0 && transformFields.map((value) => ( + + {value.field} + {_.capitalize(value.datatype)} + {_.capitalize(value.expr)} + {value.mode === 'Strict' ? 'Yes': 'No'} + + ))} + +
+
- - } + + + + + Derived Fields + + + Field + Data Type + Transformation + Skip Record on Failure? + + + + {derivedFields.length === 0 && + ( + No derived fields have been added + ) + } + {derivedFields.length > 0 && derivedFields.map((value) => ( + + {value.field} + {_.capitalize(value.datatype)} + {_.capitalize(value.expr)} + {value.mode === 'Strict' ? 'Yes': 'No'} + + ))} + +
+
+
+
+ + + Storage + + + + + + + Lakehouse (Hudi) + Real-time Store (Druid) + Cache Store (Redis) + Primary Key + Timestamp Key + Partition Key + + + + + + + + {keysConfig?.data_key} + {keysConfig?.timestamp_key} + {keysConfig?.partition_key} + + +
+
+
+
+
+ } ); -}; +} -export default AllConfigurations; +export default AllConfigurations; \ No newline at end of file diff --git a/web-console-v2/src/pages/StepsPages/PreviewAndSave/Preview.tsx b/web-console-v2/src/pages/StepsPages/PreviewAndSave/Preview.tsx index 107a15dc..574f78c6 100644 --- a/web-console-v2/src/pages/StepsPages/PreviewAndSave/Preview.tsx +++ b/web-console-v2/src/pages/StepsPages/PreviewAndSave/Preview.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { useLocation, useNavigate, useParams } from 'react-router-dom'; +import { useLocation, useNavigate } from 'react-router-dom'; import { FC, ReactElement, useState, useEffect } from 'react'; import { Box, Button, Stack, Tab, Tabs } from '@mui/material'; import AllConfigurations from './AllConfigurations'; @@ -9,6 +9,7 @@ import KeyboardBackspaceIcon from '@mui/icons-material/KeyboardBackspace'; import styles from './Preview.module.css'; import Actions from 'components/ActionButtons/Actions'; import { useFetchDatasetsById, usePublishDataset } from 'services/dataset'; +import { fetchSessionStorageValue } from 'utils/sessionStorage'; import AlertDialog from 'components/AlertDialog/AlertDialog'; import en from 'utils/locales/en.json'; import Loader from 'components/Loader'; @@ -29,7 +30,8 @@ const renderContent = (selectedTab: number) => { const Preview: FC = (): ReactElement => { const navigate = useNavigate(); - const { datasetId }:any = useParams(); + const datasetId = fetchSessionStorageValue('configDetails', 'dataset_id') || ''; + const { search, state } = useLocation(); const [selectedTab, setSelectedTab] = useState(0); const [open, setOpen] = useState(false); @@ -87,10 +89,6 @@ const Preview: FC = (): ReactElement => { setOpen(false); }; - const handleNavigate = () => { - navigate(`/dataset/edit/storage/${datasetId}`) - }; - return ( { flex={1} mx={3.5} overflow="auto" - paddingBottom="3.8rem" + paddingBottom="8rem" > - + @@ -162,7 +161,7 @@ const Preview: FC = (): ReactElement => { ))} - + {renderContent(selectedTab)} diff --git a/web-console-v2/src/pages/StepsPages/Processing/Processing.tsx b/web-console-v2/src/pages/StepsPages/Processing/Processing.tsx index 52226d5c..e654fd3b 100644 --- a/web-console-v2/src/pages/StepsPages/Processing/Processing.tsx +++ b/web-console-v2/src/pages/StepsPages/Processing/Processing.tsx @@ -217,7 +217,7 @@ const Processing: React.FC = () => { } }); } else { - updateDataset({ data: { [keyName]: data } }); + updateDataset({ data: { [keyName]: data, dataset_id: datasetId } }); } }; @@ -228,7 +228,8 @@ const Processing: React.FC = () => { value: { field_key: fieldKey }, action: 'remove' } - ] + ], + dataset_id: datasetId }; if (!fieldKey && _.has(data, 'denorm_config')) newData = data; diff --git a/web-console-v2/src/pages/StepsPages/StepperPage.tsx b/web-console-v2/src/pages/StepsPages/StepperPage.tsx index a6780faa..78f4e1e3 100644 --- a/web-console-v2/src/pages/StepsPages/StepperPage.tsx +++ b/web-console-v2/src/pages/StepsPages/StepperPage.tsx @@ -41,7 +41,7 @@ const stepData = { route: 'storage' }, { - name: 'Preview & Save', + name: 'Preview', index: 5, completed: false, skipped: false, @@ -70,14 +70,14 @@ const StepperPage = () => { const storageKeys = _.get(dataset.data, ['dataset_config', 'keys_config'], {}); const storageType = _.get(dataset.data, ['dataset_config', 'indexing_config'], {}); newSteps.push(connectorData.length > 0 ? { - name: 'Connector', + name: 'Connector?', index: 1, completed: true, skipped: false, active: false, route: 'connector' } : { - name: 'Connector', + name: 'Connector?', index: 1, completed: false, skipped: true, @@ -146,7 +146,7 @@ const StepperPage = () => { } newSteps.push({ - name: 'Preview & Save', + name: 'Preview', index: 5, completed: false, skipped: false, diff --git a/web-console-v2/src/pages/alertManager/components/QueryBuilder.tsx b/web-console-v2/src/pages/alertManager/components/QueryBuilder.tsx index 40c34570..170243b8 100644 --- a/web-console-v2/src/pages/alertManager/components/QueryBuilder.tsx +++ b/web-console-v2/src/pages/alertManager/components/QueryBuilder.tsx @@ -186,28 +186,30 @@ const QueryBuilder = (props: any) => { category: yup.string().required(en.isRequired), metric: yup.string().required(en.isRequired), operator: yup.string().required(en.isRequired), - threshold: yup.number().when('operator', (operator: any, schema) => { - return !_.includes(["within_range", "outside_range"], operator) - ? schema.required(en.isRequired) - : schema; + threshold: yup.number().when('operator', { + is: (operator: any) => !_.includes(["within_range", "outside_range"], operator), + then: (schema) => schema.required(en.isRequired), + otherwise: (schema) => schema.notRequired(), }), - threshold_from: yup.number().when('operator', (operator: any, schema) => { - return _.includes(["within_range", "outside_range"], operator) - ? schema.required(en.isRequired).min(0) - : schema; + threshold_from: yup.number().when('operator', { + is: (operator: any) => _.includes(["within_range", "outside_range"], operator), + then: (schema) => schema.required(en.isRequired).min(0), + otherwise: (schema) => schema.notRequired(), }), - threshold_to: yup.number().when('operator', (operator: any, schema) => { - return _.includes(["within_range", "outside_range"], operator) - ? schema.required(en.isRequired) + threshold_to: yup.number().when('operator', { + is: (operator: any) => _.includes(["within_range", "outside_range"], operator), + then: (schema) => + schema + .required(en.isRequired) .min(0) .test( 'greater-than-threshold-from', 'Value must be greater than Threshold - From.', - function (testValue) { - return testValue > _.get(this.parent, "threshold_from"); + function (value) { + return value > this.parent.threshold_from; } - ) - : schema; + ), + otherwise: (schema) => schema.notRequired(), }) }); diff --git a/web-console-v2/src/pages/auth/components/AuthCard.tsx b/web-console-v2/src/pages/auth/components/AuthCard.tsx index 9bdcbc72..b9074fea 100644 --- a/web-console-v2/src/pages/auth/components/AuthCard.tsx +++ b/web-console-v2/src/pages/auth/components/AuthCard.tsx @@ -16,8 +16,6 @@ const AuthCard = ({ children, ...other }: any) => ( content={false} {...other} border={false} - boxShadow - shadow={(theme: any) => theme.customShadows.z1} > {children} diff --git a/web-console-v2/src/pages/auth/components/LoginSocialButton.js b/web-console-v2/src/pages/auth/components/LoginSocialButton.tsx similarity index 94% rename from web-console-v2/src/pages/auth/components/LoginSocialButton.js rename to web-console-v2/src/pages/auth/components/LoginSocialButton.tsx index e9e153cb..afca65ec 100644 --- a/web-console-v2/src/pages/auth/components/LoginSocialButton.js +++ b/web-console-v2/src/pages/auth/components/LoginSocialButton.tsx @@ -12,7 +12,7 @@ const LoginSocialButton = () => { const matchDownSM = useMediaQuery(theme.breakpoints.down('sm')); const allowedAuthTypes = getConfigValueV1("AUTHENTICATION_ALLOWED_TYPES") || "" - const renderSocialButtons = (option) => { + const renderSocialButtons = (option: any) => { return ( ( _.includes(allowedAuthTypes, _.lowerCase(option.value))) ? : <> + : null ) } diff --git a/web-console-v2/src/pages/dashboardV1/ReadyToPublishDatasets.tsx b/web-console-v2/src/pages/dashboardV1/ReadyToPublishDatasets.tsx index 6cfbc83e..113762d8 100644 --- a/web-console-v2/src/pages/dashboardV1/ReadyToPublishDatasets.tsx +++ b/web-console-v2/src/pages/dashboardV1/ReadyToPublishDatasets.tsx @@ -352,7 +352,7 @@ const ReadyToPublishDatasetsList = ({ setDatasetType, sourceConfigs }: any) => {
- navigateToPath(`/home/datasets/management/${row?.dataset_id}?status=${DatasetStatus.ReadyToPublish}`)}> + navigateToPath(`/datasets/management/${row?.dataset_id}?status=${DatasetStatus.ReadyToPublish}`)}> import('pages/alertManager/views/CustomRules')); +const Login = Loadable(lazy(() => import('pages/auth/Login'))); // Base path for all routes export const routeConfigurations: RouteConfig[] = [ { path: '/', label: "Dashboard", element: }, + {path: '/login', element: }, { path: `/dataset/create`, label: "New Dataset", element: }, { path: '/dataset', @@ -84,7 +89,9 @@ export const routeConfigurations: RouteConfig[] = [ { path: `/datasets`, label: "Datasets", element: }, { path: `/datasets/metrics/:datasetId`, label: "Metrics", element: }, { path: `/datasets/addEvents/:datasetId`, label: "Add Events", element: }, - { path: `/datasets/view/:datasetId`, label: "View", element: } + { path: `/datasets/view/:datasetId`, label: "View", element: }, + { path: `/datasets/rollups/:datasetId`, element: }, + { path: `$/datasets/management/:datasetId`, label: "Rollups", element: } ]; const AppRouter = () => ( diff --git a/web-console-v2/src/services/dataset.ts b/web-console-v2/src/services/dataset.ts index cc28f6e4..1c5a641a 100644 --- a/web-console-v2/src/services/dataset.ts +++ b/web-console-v2/src/services/dataset.ts @@ -34,7 +34,8 @@ const ENDPOINTS = { DATASETS_DIFF: '/api/dataset/diff', PUBLISH_DATASET: '/config/v2/datasets/status-transition', LIST_CONNECTORS: '/config/v2/connectors/list', - READ_CONNECTORS: '/config/v2/connectors/read' + READ_CONNECTORS: '/config/v2/connectors/read', + DATASET_EXISTS: '/api/dataset/exists' }; export const endpoints = ENDPOINTS @@ -51,7 +52,6 @@ export const useFetchDatasetsById = ({ return useQuery({ queryKey: ['fetchDatasetsById', 'datasetId', 'status', queryParams], queryFn: () => http.get(`${ENDPOINTS.DATASETS_READ}/${datasetId}?${queryParams}`).then((response: AxiosResponse) => { - console.log("response", response) setDatasetId(_.get(response, ['data', 'result', 'dataset_id'])) setVersionKey(_.get(response, ['data', 'result', 'version_key'])); return _.get(response, ['data', 'result']) @@ -162,7 +162,7 @@ export const useUpdateDataset = () => const request = generateRequestBody({ request: { ..._.omit(updatedRequestPayload, ['configurations', 'dataMappings']), - ..._.omit(configDetail, ['name']) + ..._.pick(configDetail, ['version_key']) }, apiId: 'api.datasets.update' }); @@ -198,6 +198,14 @@ export const useFetchDatasetDiff = ({ datasetId }: { datasetId: string }) => { }); }; +export const useFetchDatasetExists = ({ datasetId }: { datasetId: string }) => { + return useQuery({ + queryKey: ['fetchDatasetExists'], + queryFn: () => http.get(`${ENDPOINTS.DATASET_EXISTS}/${datasetId}`).then((res) => res.data), + enabled: !!datasetId + }); +}; + export const usePublishDataset = () => useMutation({ mutationFn: ({ payload = {} }: any) => { diff --git a/web-console-v2/src/theme.ts b/web-console-v2/src/theme.ts index a93e9a53..ac0d692a 100644 --- a/web-console-v2/src/theme.ts +++ b/web-console-v2/src/theme.ts @@ -339,7 +339,8 @@ export const theme = createTheme({ h2Tertiary: 'h2', bodySecondary: 'body1', bodyBold: 'body1', - captionMedium: 'caption', + caption: 'caption', + captionMedium: 'captionMedium', textCTAPrimary: 'body1', textCTASecondary: 'body2', h5: 'h5'