Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(ui): move objects/ops related pages into folders #3403

Merged
merged 6 commits into from
Jan 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 8 additions & 10 deletions weave-js/src/components/PagePanelComponents/Home/Browse3.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,16 +72,14 @@ import {CompareEvaluationsPage} from './Browse3/pages/CompareEvaluationsPage/Com
import {LeaderboardListingPage} from './Browse3/pages/LeaderboardPage/LeaderboardListingPage';
import {LeaderboardPage} from './Browse3/pages/LeaderboardPage/LeaderboardPage';
import {ModsPage} from './Browse3/pages/ModsPage';
import {ObjectPage} from './Browse3/pages/ObjectPage';
import {ObjectVersionPage} from './Browse3/pages/ObjectVersionPage';
import {
ObjectVersionsPage,
WFHighLevelObjectVersionFilter,
} from './Browse3/pages/ObjectVersionsPage';
import {OpPage} from './Browse3/pages/OpPage';
import {OpsPage} from './Browse3/pages/OpsPage';
import {OpVersionPage} from './Browse3/pages/OpVersionPage';
import {OpVersionsPage} from './Browse3/pages/OpVersionsPage';
import {ObjectPage} from './Browse3/pages/ObjectsPage/ObjectPage';
import {WFHighLevelObjectVersionFilter} from './Browse3/pages/ObjectsPage/objectsPageTypes';
import {ObjectVersionPage} from './Browse3/pages/ObjectsPage/ObjectVersionPage';
import {ObjectVersionsPage} from './Browse3/pages/ObjectsPage/ObjectVersionsPage';
import {OpPage} from './Browse3/pages/OpsPage/OpPage';
import {OpsPage} from './Browse3/pages/OpsPage/OpsPage';
import {OpVersionPage} from './Browse3/pages/OpsPage/OpVersionPage';
import {OpVersionsPage} from './Browse3/pages/OpsPage/OpVersionsPage';
import {PlaygroundPage} from './Browse3/pages/PlaygroundPage/PlaygroundPage';
import {ScorersPage} from './Browse3/pages/ScorersPage/ScorersPage';
import {TablePage} from './Browse3/pages/TablePage';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ import React, {
import {useHistory, useLocation} from 'react-router-dom';

import {WFHighLevelCallFilter} from './pages/CallsPage/callsTableFilter';
import {WFHighLevelObjectVersionFilter} from './pages/ObjectVersionsPage';
import {WFHighLevelOpVersionFilter} from './pages/OpVersionsPage';
import {WFHighLevelObjectVersionFilter} from './pages/ObjectsPage/objectsPageTypes';
import {WFHighLevelOpVersionFilter} from './pages/OpsPage/opsPageTypes';
import {useURLSearchParamsDict} from './pages/util';
import {
AWL_ROW_EDGE_NAME,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import {
ScrollableTabContent,
SimplePageLayoutWithHeader,
} from '../pages/common/SimplePageLayout';
import {DeleteObjectButtonWithModal} from '../pages/ObjectVersionPage';
import {TabUseDataset} from '../pages/TabUseDataset';
import {DeleteObjectButtonWithModal} from '../pages/ObjectsPage/ObjectDeleteButtons';
import {TabUseDataset} from '../pages/ObjectsPage/Tabs/TabUseDataset';
import {useWFHooks} from '../pages/wfReactInterface/context';
import {objectVersionKeyToRefUri} from '../pages/wfReactInterface/utilities';
import {ObjectVersionSchema} from '../pages/wfReactInterface/wfDataModelHooksInterface';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ import {
SimplePageLayoutWithHeader,
} from '../common/SimplePageLayout';
import {CompareEvaluationsPageContent} from '../CompareEvaluationsPage/CompareEvaluationsPage';
import {TabUseCall} from '../TabUseCall';
import {useURLSearchParamsDict} from '../util';
import {useWFHooks} from '../wfReactInterface/context';
import {CallSchema} from '../wfReactInterface/wfDataModelHooksInterface';
Expand All @@ -46,6 +45,7 @@ import {CallOverview} from './CallOverview';
import {CallSummary} from './CallSummary';
import {CallTraceView, useCallFlattenedTraceTree} from './CallTraceView';
import {PaginationControls} from './PaginationControls';
import {TabUseCall} from './TabUseCall';

export const CallPage: FC<{
entity: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import {Box} from '@mui/material';
import * as Tabs from '@wandb/weave/components/Tabs';
import React, {useState} from 'react';

import {CopyableText} from '../../../../CopyableText';
import {DocLink} from './common/Links';
import {TabUseBanner} from './TabUseBanner';
import {CallSchema} from './wfReactInterface/wfDataModelHooksInterface';
import {CopyableText} from '../../../../../CopyableText';
import {DocLink} from '../common/Links';
import {TabUseBanner} from '../common/TabUseBanner';
import {CallSchema} from '../wfReactInterface/wfDataModelHooksInterface';

type TabUseCallProps = {
call: CallSchema;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {useWeaveflowRouteContext} from '../../context';
import {Empty} from '../common/Empty';
import {EMPTY_PROPS_LEADERBOARDS} from '../common/EmptyContent';
import {SimplePageLayout} from '../common/SimplePageLayout';
import {ObjectVersionsTable} from '../ObjectVersionsPage';
import {ObjectVersionsTable} from '../ObjectsPage/ObjectVersionsTable';
import {
useBaseObjectInstances,
useCreateBuiltinObjectInstance,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
import {Button} from '@wandb/weave/components/Button';
import {maybePluralizeWord} from '@wandb/weave/core/util/string';
import React, {useState} from 'react';

import {useClosePeek} from '../../context';
import {DeleteModal} from '../common/DeleteModal';
import {useWFHooks} from '../wfReactInterface/context';
import {ObjectVersionSchema} from '../wfReactInterface/wfDataModelHooksInterface';

export const DeleteObjectButtonWithModal: React.FC<{
objVersionSchema: ObjectVersionSchema;
overrideDisplayStr?: string;
}> = ({objVersionSchema, overrideDisplayStr}) => {
const {useObjectDeleteFunc} = useWFHooks();
const closePeek = useClosePeek();
const {objectVersionsDelete} = useObjectDeleteFunc();
const [deleteModalOpen, setDeleteModalOpen] = useState(false);

const deleteStr =
overrideDisplayStr ??
`${objVersionSchema.objectId}:v${objVersionSchema.versionIndex}`;

return (
<>
<Button
icon="delete"
variant="ghost"
onClick={() => setDeleteModalOpen(true)}
/>
<DeleteModal
open={deleteModalOpen}
onClose={() => setDeleteModalOpen(false)}
deleteTitleStr={deleteStr}
onDelete={() =>
objectVersionsDelete(
objVersionSchema.entity,
objVersionSchema.project,
objVersionSchema.objectId,
[objVersionSchema.versionHash]
)
}
onSuccess={closePeek}
/>
</>
);
};

export const DeleteObjectVersionsButtonWithModal: React.FC<{
entity: string;
project: string;
objectName: string;
objectVersions: string[];
disabled?: boolean;
onSuccess: () => void;
}> = ({entity, project, objectName, objectVersions, disabled, onSuccess}) => {
const {useObjectDeleteFunc} = useWFHooks();
const {objectVersionsDelete} = useObjectDeleteFunc();
const [deleteModalOpen, setDeleteModalOpen] = useState(false);

const numObjects = objectVersions.length;
const versionsStr = maybePluralizeWord(numObjects, 'version', 's');
const objectDigests = objectVersions.map(v => v.split(':')[1]);
const deleteTitleStr = `${numObjects} ${objectName} ${versionsStr}`;

return (
<>
<Button
icon="delete"
variant="ghost"
onClick={() => setDeleteModalOpen(true)}
disabled={disabled}
/>
<DeleteModal
open={deleteModalOpen}
onClose={() => setDeleteModalOpen(false)}
deleteTitleStr={deleteTitleStr}
deleteBodyStrs={objectVersions}
onDelete={() =>
objectVersionsDelete(entity, project, objectName, objectDigests)
}
onSuccess={onSuccess}
/>
</>
);
};
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';

import {SimplePageLayout} from './common/SimplePageLayout';
import {FilterableObjectVersionsTable} from './ObjectVersionsPage';
import {SimplePageLayout} from '../common/SimplePageLayout';
import {FilterableObjectVersionsTable} from './ObjectVersionsTable';

export const ObjectPage: React.FC<{
entity: string;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,51 +1,50 @@
import Box from '@mui/material/Box';
import {Button} from '@wandb/weave/components/Button';
import {useObjectViewEvent} from '@wandb/weave/integrations/analytics/useViewEvents';
import React, {useMemo, useState} from 'react';
import React, {useMemo} from 'react';

import {maybePluralizeWord} from '../../../../../core/util/string';
import {Icon, IconName} from '../../../../Icon';
import {LoadingDots} from '../../../../LoadingDots';
import {Tailwind} from '../../../../Tailwind';
import {Tooltip} from '../../../../Tooltip';
import {useClosePeek} from '../context';
import {DatasetVersionPage} from '../datasets/DatasetVersionPage';
import {NotFoundPanel} from '../NotFoundPanel';
import {CustomWeaveTypeProjectContext} from '../typeViews/CustomWeaveTypeDispatcher';
import {WeaveCHTableSourceRefContext} from './CallPage/DataTableView';
import {ObjectViewerSection} from './CallPage/ObjectViewerSection';
import {WFHighLevelCallFilter} from './CallsPage/callsTableFilter';
import {DeleteModal, useShowDeleteButton} from './common/DeleteModal';
import {maybePluralizeWord} from '../../../../../../core/util/string';
import {Icon, IconName} from '../../../../../Icon';
import {LoadingDots} from '../../../../../LoadingDots';
import {Tailwind} from '../../../../../Tailwind';
import {Tooltip} from '../../../../../Tooltip';
import {DatasetVersionPage} from '../../datasets/DatasetVersionPage';
import {NotFoundPanel} from '../../NotFoundPanel';
import {CustomWeaveTypeProjectContext} from '../../typeViews/CustomWeaveTypeDispatcher';
import {WeaveCHTableSourceRefContext} from '../CallPage/DataTableView';
import {ObjectViewerSection} from '../CallPage/ObjectViewerSection';
import {WFHighLevelCallFilter} from '../CallsPage/callsTableFilter';
import {useShowDeleteButton} from '../common/DeleteModal';
import {
CallLink,
CallsLink,
ObjectVersionsLink,
objectVersionText,
OpVersionLink,
} from './common/Links';
import {CenteredAnimatedLoader} from './common/Loader';
} from '../common/Links';
import {CenteredAnimatedLoader} from '../common/Loader';
import {
ScrollableTabContent,
SimpleKeyValueTable,
SimplePageLayoutWithHeader,
} from './common/SimplePageLayout';
import {EvaluationLeaderboardTab} from './LeaderboardTab';
import {TabPrompt} from './TabPrompt';
import {TabUseModel} from './TabUseModel';
import {TabUseObject} from './TabUseObject';
import {TabUsePrompt} from './TabUsePrompt';
import {KNOWN_BASE_OBJECT_CLASSES} from './wfReactInterface/constants';
import {useWFHooks} from './wfReactInterface/context';
} from '../common/SimplePageLayout';
import {EvaluationLeaderboardTab} from '../LeaderboardTab';
import {TabUsePrompt} from '../OpsPage/Tabs/TabUsePrompt';
import {KNOWN_BASE_OBJECT_CLASSES} from '../wfReactInterface/constants';
import {useWFHooks} from '../wfReactInterface/context';
import {
isObjDeleteError,
objectVersionKeyToRefUri,
refUriToOpVersionKey,
} from './wfReactInterface/utilities';
} from '../wfReactInterface/utilities';
import {
CallSchema,
KnownBaseObjectClassType,
ObjectVersionSchema,
} from './wfReactInterface/wfDataModelHooksInterface';
} from '../wfReactInterface/wfDataModelHooksInterface';
import {DeleteObjectButtonWithModal} from './ObjectDeleteButtons';
import {TabPrompt} from './Tabs/TabPrompt';
import {TabUseModel} from './Tabs/TabUseModel';
import {TabUseObject} from './Tabs/TabUseObject';

type ObjectIconProps = {
baseObjectClass: KnownBaseObjectClassType;
Expand Down Expand Up @@ -642,41 +641,3 @@ const OpVersionCallsLink: React.FC<{
</>
);
};

export const DeleteObjectButtonWithModal: React.FC<{
objVersionSchema: ObjectVersionSchema;
overrideDisplayStr?: string;
}> = ({objVersionSchema, overrideDisplayStr}) => {
const {useObjectDeleteFunc} = useWFHooks();
const closePeek = useClosePeek();
const {objectVersionsDelete} = useObjectDeleteFunc();
const [deleteModalOpen, setDeleteModalOpen] = useState(false);

const deleteStr =
overrideDisplayStr ??
`${objVersionSchema.objectId}:v${objVersionSchema.versionIndex}`;

return (
<>
<Button
icon="delete"
variant="ghost"
onClick={() => setDeleteModalOpen(true)}
/>
<DeleteModal
open={deleteModalOpen}
onClose={() => setDeleteModalOpen(false)}
deleteTitleStr={deleteStr}
onDelete={() =>
objectVersionsDelete(
objVersionSchema.entity,
objVersionSchema.project,
objVersionSchema.objectId,
[objVersionSchema.versionHash]
)
}
onSuccess={closePeek}
/>
</>
);
};
Loading
Loading