Skip to content

Commit

Permalink
Merge branch 'dev' into ew-release-igv-drs
Browse files Browse the repository at this point in the history
  • Loading branch information
eweitz authored Jan 24, 2025
2 parents 204ac42 + 7679b0d commit b5a016c
Show file tree
Hide file tree
Showing 27 changed files with 353 additions and 192 deletions.
4 changes: 2 additions & 2 deletions src/billing/ConsolidatedSpendReport.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ import { parseCurrencyIfNeeded } from 'src/billing/utils';
import { BillingProject } from 'src/billing-core/models';
import { ButtonOutline, fixedSpinnerOverlay } from 'src/components/common';
import { ariaSort, HeaderRenderer } from 'src/components/table';
import { Ajax } from 'src/libs/ajax';
import { Billing } from 'src/libs/ajax/billing/Billing';
import {
AggregatedWorkspaceSpendData,
SpendReport as SpendReportServerResponse,
} from 'src/libs/ajax/billing/billing-models';
import { Metrics } from 'src/libs/ajax/Metrics';
import { Workspaces } from 'src/libs/ajax/workspaces/Workspaces';
import Events, { extractBillingDetails } from 'src/libs/events';
import * as Nav from 'src/libs/nav';
import { memoWithName, useCancellation } from 'src/libs/react-utils';
Expand Down Expand Up @@ -203,7 +203,7 @@ export const ConsolidatedSpendReport = (props: ConsolidatedSpendReportProps): Re
const startDate = subDays(spendReportLengthInDays, new Date()).toISOString().slice(0, 10);

const fetchWorkspaces = async (signal: AbortSignal): Promise<WorkspaceWrapper[]> => {
const fetchedWorkspaces = await Ajax(signal).Workspaces.list(
const fetchedWorkspaces = await Workspaces(signal).list(
[
'workspace.billingAccount',
'workspace.bucketName',
Expand Down
4 changes: 2 additions & 2 deletions src/billing/Members/Members.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ export const Members = (props: MembersProps): ReactNode => {
footer={[
'Warning: Adding any user to this project will mean they can incur costs to the billing associated with this project.',
]}
addFunction={(roles: string[], emails: string[]) =>
Billing().addProjectUsers(billingProjectName, roles as BillingRole[], emails)
addFunction={(roles: string, emails: string[]) =>
Billing().addProjectUsers(billingProjectName, [roles] as BillingRole[], emails)
}
onDismiss={() => setAddingMember(false)}
onSuccess={() => {
Expand Down
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
4 changes: 2 additions & 2 deletions src/groups/GroupDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,10 @@ export const GroupDetails = (props: GroupDetailsProps) => {
memberLabel='member'
title='Add users to Terra Group'
addUnregisteredUser
addFunction={(roles: string[], emails: string[]) =>
addFunction={(role: string, emails: string[]) =>
Groups()
.group(groupName)
.addUsers(roles as GroupRole[], emails)
.addUsers(role as GroupRole, emails)
}
onDismiss={() => setAddingNewMember(false)}
onSuccess={refresh}
Expand Down
2 changes: 1 addition & 1 deletion src/groups/Members/NewMemberModal.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ describe('NewMemberModal', () => {
});
expect(screen.getByText(userRole)).toBeInTheDocument();
expect(addButton).not.toBeDisabled();
expect(mockAddFunction).toHaveBeenCalledWith([userRole], userEmails);
expect(mockAddFunction).toHaveBeenCalledWith(userRole, userEmails);
expect(mockOnSuccess).toHaveBeenCalled();
});
});
Expand Down
4 changes: 2 additions & 2 deletions src/groups/Members/NewMemberModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { useCancellation, useOnMount } from 'src/libs/react-utils';
import { cond, summarizeErrors, withBusyState } from 'src/libs/utils';

interface NewMemberModalProps {
addFunction: (roles: string[], emails: string[]) => Promise<unknown>;
addFunction: (role: string, emails: string[]) => Promise<unknown>;
addUnregisteredUser?: boolean;
adminLabel: string;
memberLabel: string;
Expand Down Expand Up @@ -58,7 +58,7 @@ export const NewMemberModal = (props: NewMemberModalProps) => {
const submit = async () => {
// only called by invite and add, which set busy & catch errors
try {
await addFunction([role], userEmails);
await addFunction(role, userEmails);
onSuccess();
} catch (error: any) {
if ('status' in error && error.status >= 400 && error.status <= 499) {
Expand Down
Loading

0 comments on commit b5a016c

Please sign in to comment.