Skip to content

Commit

Permalink
Merge branch 'dev' into kp_CORE-231_rename_button
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinpalis authored Jan 24, 2025
2 parents a5b9132 + 7679b0d commit 1a8f5da
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 17 deletions.
4 changes: 2 additions & 2 deletions src/data-catalog/DataBrowser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import { CloudProviderIcon } from 'src/components/CloudProviderIcon';
import { Link, spinnerOverlay } from 'src/components/common';
import { icon } from 'src/components/icons';
import { ColumnSelector, MiniSortable, SimpleTable } from 'src/components/table';
import { Ajax } from 'src/libs/ajax';
import { Dataset } from 'src/libs/ajax/Catalog';
import { Metrics } from 'src/libs/ajax/Metrics';
import colors from 'src/libs/colors';
import Events from 'src/libs/events';
import * as Nav from 'src/libs/nav';
Expand Down Expand Up @@ -210,7 +210,7 @@ const DataBrowserTableComponent = ({ sort, setSort, cols, setCols, filteredList
Link,
{
onClick: () => {
Ajax().Metrics.captureEvent(Events.catalogViewDetails, {
void Metrics().captureEvent(Events.catalogViewDetails, {
id: datum.id,
title: datum['dct:title'],
});
Expand Down
16 changes: 8 additions & 8 deletions src/data-catalog/DataBrowserDetails.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import { libraryTopMatter } from 'src/components/library-common';
import { MarkdownViewer } from 'src/components/markdown';
import { ReactComponent as AzureLogo } from 'src/images/azure.svg';
import { ReactComponent as GcpLogo } from 'src/images/gcp.svg';
import { Ajax } from 'src/libs/ajax';
import { Dataset } from 'src/libs/ajax/Catalog';
import { JobModel, JobStatus, jobStatusTypes } from 'src/libs/ajax/DataRepo';
import { DataRepo, JobModel, JobStatus, jobStatusTypes } from 'src/libs/ajax/DataRepo';
import { Metrics } from 'src/libs/ajax/Metrics';
import colors from 'src/libs/colors';
import { getConfig } from 'src/libs/config';
import { withErrorReporting } from 'src/libs/error';
Expand Down Expand Up @@ -159,7 +159,7 @@ export const SidebarComponent = ({ dataObj, id }: SidebarComponentProps) => {
const actionTooltip = access === datasetAccessTypes.Granted ? '' : uiMessaging.controlledFeatureTooltip;

const importDataToWorkspace = (dataset) => {
Ajax().Metrics.captureEvent(Events.catalogWorkspaceLinkFromDetailsView, {
void Metrics().captureEvent(Events.catalogWorkspaceLinkFromDetailsView, {
id,
title: dataObj['dct:title'],
source: dataset['dcat:accessURL'],
Expand All @@ -183,7 +183,7 @@ export const SidebarComponent = ({ dataObj, id }: SidebarComponentProps) => {
async () => {
setTdrSnapshotPreparePolling(true);
const jobInfo = (await withErrorReporting('Error exporting dataset')(
async () => await Ajax().DataRepo.snapshot(dataset['dct:identifier']).exportSnapshot()
async () => await DataRepo().snapshot(dataset['dct:identifier']).exportSnapshot()
)()) as JobModel;
setSnapshotExportJobId(jobInfo.id);
},
Expand Down Expand Up @@ -286,7 +286,7 @@ export const SidebarComponent = ({ dataObj, id }: SidebarComponentProps) => {
marginTop: 20,
},
onClick: () => {
Ajax().Metrics.captureEvent(Events.catalogViewPreviewData, {
void Metrics().captureEvent(Events.catalogViewPreviewData, {
id: dataObj.id,
title: dataObj['dct:title'],
});
Expand Down Expand Up @@ -394,20 +394,20 @@ const SnapshotExportModal = ({ jobId, dataset, onDismiss, onFailure }: SnapshotE
);

const checkJobStatus = async () => {
const jobInfo = await Ajax(signal).DataRepo.job(jobId).details();
const jobInfo = await DataRepo(signal).job(jobId).details();
const newJobStatus = jobInfo.job_status;
Utils.switchCase<JobStatus, void>(
newJobStatus,
[
jobStatusTypes.succeeded,
async () => {
const jobResult = await withErrorReporting('Error getting export result')(
async () => await Ajax().DataRepo.job(jobId).result()
async () => await DataRepo().job(jobId).result()
)();
// @ts-ignore - this has an unknown response type, but in this case it should
// include these fields
const jobResultManifest = jobResult?.format?.parquet?.manifest;
Ajax().Metrics.captureEvent(Events.catalogWorkspaceLinkExportFinished);
void Metrics().captureEvent(Events.catalogWorkspaceLinkExportFinished);
jobResultManifest
? Nav.history.push({
pathname: Nav.getPath('import-data'),
Expand Down
6 changes: 3 additions & 3 deletions src/data-catalog/DataBrowserPreview.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { centeredSpinner, icon } from 'src/components/icons';
import { libraryTopMatter } from 'src/components/library-common';
import ModalDrawer from 'src/components/ModalDrawer';
import { ColumnSelector, SimpleTable } from 'src/components/table';
import { Ajax } from 'src/libs/ajax';
import { Catalog } from 'src/libs/ajax/Catalog';
import colors from 'src/libs/colors';
import { withErrorReporting } from 'src/libs/error';
import * as Nav from 'src/libs/nav';
Expand Down Expand Up @@ -112,7 +112,7 @@ const DataBrowserPreview = ({ id }) => {
useOnMount(() => {
const loadData = async () => {
// TODO (DC-283): move to catalog service
const { tables: newTables } = await Ajax(signal).Catalog.getDatasetTables(id);
const { tables: newTables } = await Catalog(signal).getDatasetTables(id);

const hasData = _.flow(
_.sortBy('name'),
Expand All @@ -135,7 +135,7 @@ const DataBrowserPreview = ({ id }) => {
Utils.withBusyState(setLoading),
withErrorReporting('Error loading table')
)(async () => {
const previewTableData = await Ajax(signal).Catalog.getDatasetPreviewTable({ id, tableName: selectedTable });
const previewTableData = await Catalog(signal).getDatasetPreviewTable({ id, tableName: selectedTable });

const newDisplayColumns = _.flow(
Utils.toIndexPairs,
Expand Down
4 changes: 2 additions & 2 deletions src/data-catalog/create-dataset/CreateDataset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { div, h } from 'react-hyperscript-helpers';
import { ButtonPrimary, spinnerOverlay } from 'src/components/common';
import FooterWrapper from 'src/components/FooterWrapper';
import { TopBar } from 'src/components/TopBar';
import { Ajax } from 'src/libs/ajax';
import {
Catalog,
DataCollection,
datasetDataUsePermissionTypes,
DatasetMetadata,
Expand Down Expand Up @@ -286,7 +286,7 @@ export const CreateDataset = ({ storageSystem, storageSourceId }: CreateDatasetP
Utils.withBusyState(setLoading)
)(async () => {
const response = await (
await Ajax().Catalog.upsertDataset(storageSystemState, storageSourceIdState, metadata)
await Catalog().upsertDataset(storageSystemState, storageSourceIdState, metadata)
).json();
Nav.goToPath('library-details', { id: response.id });
})();
Expand Down
4 changes: 2 additions & 2 deletions src/data-catalog/data-browser-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { CSSProperties, Fragment, ReactElement, useState } from 'react';
import { div, h } from 'react-hyperscript-helpers';
import { ButtonOutline } from 'src/components/common';
import { icon } from 'src/components/icons';
import { Ajax } from 'src/libs/ajax';
import { Catalog } from 'src/libs/ajax/Catalog';
import { DataCollection, Dataset } from 'src/libs/ajax/Catalog';
import { getEnabledBrand } from 'src/libs/brand-utils';
import { withErrorReporting } from 'src/libs/error';
Expand Down Expand Up @@ -185,7 +185,7 @@ export const prepareDatasetsForDisplay = (
);

export const fetchDataCatalog = async (opts: { signal?: AbortSignal } = {}): Promise<Dataset[]> => {
const { result: datasets } = await Ajax(opts.signal).Catalog.getDatasets();
const { result: datasets } = await Catalog(opts.signal).getDatasets();
const dataCollectionsToInclude = getEnabledBrand().catalogDataCollectionsToInclude;
return prepareDatasetsForDisplay(datasets, dataCollectionsToInclude);
};
Expand Down

0 comments on commit 1a8f5da

Please sign in to comment.