Skip to content

Commit

Permalink
Enhance TODOs
Browse files Browse the repository at this point in the history
Signed-off-by: lucferbux <[email protected]>
  • Loading branch information
lucferbux committed Nov 8, 2024
1 parent cff98f6 commit 96c6382
Show file tree
Hide file tree
Showing 18 changed files with 44 additions and 56 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class AppChrome {
cy.testA11y();
}

// TODO: implement when authorization is enabled
// TODO: [Auth-enablement] Uncomment once auth is enabled
// shouldBeUnauthorized() {
// cy.findByTestId('unauthorized-error');
// return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import type { Matcher, MatcherOptions as DTLMatcherOptions } from '@testing-libr
declare global {
namespace Cypress {
interface Chainable {
// TODO: Uncomment when authorization is enabled
// TODO: [Auth-enablement] Uncomment once auth is enabled
// /**
// * Visits the URL and performs a login if necessary.
// * Uses credentials supplied by environment variables if not provided.
Expand Down Expand Up @@ -121,7 +121,7 @@ declare global {
}
}

// TODO: Uncomment when authorization is enabled
// TODO: [Auth-enablement] Uncomment once auth is enabled
// Cypress.Commands.add('visitWithLogin', (url, user = TEST_USER) => {
// if (Cypress.env('MOCK')) {
// cy.visit(url);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,35 +205,22 @@ describe('Model Registry core', () => {
});
});

// TODO: Enable when model registration is there
// describe('Register Model button', () => {
// it('Navigates to register page from empty state', () => {
// initIntercepts({ disableModelRegistryFeature: false, registeredModels: [] });
// modelRegistry.visit();
// modelRegistry.findRegisterModelButton().click();
// cy.findByTestId('app-page-title').should('exist');
// cy.findByTestId('app-page-title').contains('Register model');
// cy.findByText('Model registry - modelregistry-sample').should('exist');
// });

// it('Navigates to register page from table toolbar', () => {
// initIntercepts({ disableModelRegistryFeature: false });
// modelRegistry.visit();
// modelRegistry.findRegisterModelButton().click();
// cy.findByTestId('app-page-title').should('exist');
// cy.findByTestId('app-page-title').contains('Register model');
// cy.findByText('Model registry - modelregistry-sample').should('exist');
// });

// it('should be accessible for non-admin users', () => {
// asProjectEditUser();
// initIntercepts({
// disableModelRegistryFeature: false,
// allowed: false,
// });

// modelRegistry.visit();
// modelRegistry.navigate();
// modelRegistry.shouldModelRegistrySelectorExist();
// });
// });
describe('Register Model button', () => {
it('Navigates to register page from empty state', () => {
initIntercepts({ registeredModels: [] });
modelRegistry.visit();
modelRegistry.findRegisterModelButton().click();
cy.findByTestId('app-page-title').should('exist');
cy.findByTestId('app-page-title').contains('Register model');
cy.findByText('Model registry - modelregistry-sample').should('exist');
});

it('Navigates to register page from table toolbar', () => {
initIntercepts({ registeredModels: [] });
modelRegistry.visit();
modelRegistry.findRegisterModelButton().click();
cy.findByTestId('app-page-title').should('exist');
cy.findByTestId('app-page-title').contains('Register model');
cy.findByText('Model registry - modelregistry-sample').should('exist');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ describe('Model Versions', () => {
});

it('Model versions table', () => {
// TODO: Uncomment when we fix finding listbox items
// TODO: [Testing] Uncomment when we fix finding listbox items

initIntercepts({
modelRegistries: [
Expand Down
6 changes: 4 additions & 2 deletions clients/ui/frontend/src/app/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ const App: React.FC = () => {
<Button
variant="secondary"
onClick={() => {
// TODO: logout
// TODO: [Auth-enablement] Logout when auth is enabled
}}
>
Logout
Expand Down Expand Up @@ -94,7 +94,9 @@ const App: React.FC = () => {
</MastheadBrand>
</MastheadMain>

<MastheadContent>{/* TODO: Change this into a component for Header Tools */}</MastheadContent>
<MastheadContent>
{/* TODO: [Auth-enablement] Add logout and user status once we enable itNavigates to register page from table toolbar */}
</MastheadContent>
</Masthead>
);

Expand Down
4 changes: 2 additions & 2 deletions clients/ui/frontend/src/app/AppRoutes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const useAdminSettings = (): NavDataItem[] => {
// get auth access for example set admin as true
const isAdmin = true; //this should be a call to getting auth / role access

// TODO: Remove the linter skip when we implement authentication
// TODO: [Auth-enablement] Remove the linter skip when we implement authentication
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
if (!isAdmin) {
return [];
Expand Down Expand Up @@ -56,7 +56,7 @@ const AppRoutes: React.FC = () => {
<Route path="/modelRegistry/*" element={<ModelRegistryRoutes />} />
<Route path="*" element={<NotFound />} />
{
// TODO: Remove the linter skip when we implement authentication
// TODO: [Auth-enablement] Remove the linter skip when we implement authentication
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
isAdmin && (
<Route path="/modelRegistrySettings/*" element={<ModelRegistrySettingsRoutes />} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ const RegistrationCommonFormSections: React.FC<RegistrationCommonFormSectionsPro
isFirstVersion,
latestVersion,
}) => {
// const [isAutofillModalOpen, setAutofillModalOpen] = React.useState(false); TODO: Check wether we should use data connections
// TODO: [Data connections] Check wether we should use data connections
// const [isAutofillModalOpen, setAutofillModalOpen] = React.useState(false);

// const connectionDataMap: Record<string, keyof RegistrationCommonFormData> = {
// AWS_S3_ENDPOINT: 'modelLocationEndpoint',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const useRegistrationCommonState = (): RegistrationCommonState => {
const [submitError, setSubmitError] = React.useState<Error | undefined>(undefined);

const { apiState } = React.useContext(ModelRegistryContext);
const author = 'kubeflow-user'; // TODO: enable this once we have users ---> useAppSelector((state) => state.user || '');
const author = 'kubeflow-user'; // TODO: [Auth-enablement] Enable this once we have users ---> useAppSelector((state) => state.user || '');

const handleSubmit = (doSubmit: () => Promise<unknown>) => {
setIsSubmitting(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ type ModelRegistriesTableProps = {
};

const ModelRegistriesTable: React.FC<ModelRegistriesTableProps> = ({ modelRegistries }) => (
// TODO: Add toolbar once we manage permissions
// TODO: [Model Registry RBAC] Add toolbar once we manage permissions
<Table
data-testid="model-registries-table"
data={modelRegistries}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ const ModelRegistriesTableRow: React.FC<ModelRegistriesTableRowProps> = ({ model
</>
);

// TODO: Get rest of columns once we manage permissions
// TODO: [Model Registry RBAC] Get rest of columns once we manage permissions

export default ModelRegistriesTableRow;
2 changes: 1 addition & 1 deletion clients/ui/frontend/src/app/pages/settings/columns.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export const modelRegistryColumns: SortableData<ModelRegistry>[] = [
sortable: (a, b) => a.name.localeCompare(b.name),
width: 30,
},
// TODO: Add once we manage permissions
// TODO: [Model Registry RBAC] Add once we manage permissions
// {
// field: 'status',
// label: 'Status',
Expand Down
1 change: 0 additions & 1 deletion clients/ui/frontend/src/shared/api/apiUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,6 @@ export const isModelRegistryResponse = <T>(response: unknown): response is Model
if (typeof response === 'object' && response !== null) {
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
const modelRegistryBody = response as { data?: T };
// TODO: Check if data is conforming any type so we have a proper check
return modelRegistryBody.data !== undefined;
}
return false;
Expand Down
1 change: 0 additions & 1 deletion clients/ui/frontend/src/shared/api/errorUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ export const handleRestFailures = <T>(promise: Promise<T>): Promise<T> =>
}
if (isCommonStateError(e)) {
// Common state errors are handled by useFetchState at storage level, let them deal with it
// TODO: check whether we need this or not
throw e;
}
// eslint-disable-next-line no-console
Expand Down
4 changes: 2 additions & 2 deletions clients/ui/frontend/src/shared/hooks/useSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export const useSettings = (): {
};

// Mock a settings config call
// TODO: replace with thea actual call once we have the endpoint
// TODO: [Data Flow] replace with thea actual call once we have the endpoint
export const fetchConfig = async (): Promise<ConfigSettings> => ({
common: {
featureFlags: {
Expand All @@ -72,7 +72,7 @@ export const fetchConfig = async (): Promise<ConfigSettings> => ({
});

// Mock a settings user call
// TODO: replace with thea actual call once we have the endpoint
// TODO: [Auth-enablement] replace with thea actual call once we have the endpoint
export const fetchUser = async (): Promise<UserSettings> => ({
username: 'admin',
isAdmin: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const useTimeBasedRefresh = (): SetTime => {
if (lastDate < refreshDateMarker) {
setNewDateString(refreshDateMarker.toString());
console.log('Logging out and refreshing');
// TODO: Replace with actual logout function
// TODO: [Auth-enablement] Replace with actual logout function
//logout().then(() => window.location.reload());
} else {
console.error(
Expand Down
8 changes: 4 additions & 4 deletions clients/ui/frontend/src/shared/types.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
import { ValueOf } from '~/shared/typeHelpers';

// TODO: Get the status config params
// TODO: [Data Flow] Get the status config params
export type UserSettings = {
username: string;
isAdmin: boolean;
isAllowed: boolean;
};

// TODO: Add more config parameters
// TODO: [Data Flow] Add more config parameters
export type ConfigSettings = {
common: CommonConfig;
};

// TODO: Add more config parameters
// TODO: [Data Flow] Add more config parameters
export type CommonConfig = {
featureFlags: FeatureFlag;
};

// TODO: Add more config parameters
// TODO: [Data Flow] Add more config parameters
export type FeatureFlag = {
modelRegistry: boolean;
};
Expand Down
2 changes: 1 addition & 1 deletion clients/ui/frontend/src/shared/utilities/const.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// TODO: Fetch the .env variable here.
// TODO: [Env Handling] Fetch the .env variable here.
const POLL_INTERVAL = 30000;

export { POLL_INTERVAL };
2 changes: 1 addition & 1 deletion clients/ui/frontend/src/shared/utilities/time.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// TODO: Trimed down version of the original file. Needs to be updated with the original file.
// TODO: [Reusable Codebase] Trimed down version of the original file. Needs to be updated with the original file.

const printAgo = (time: number, unit: string) => `${time} ${unit}${time > 1 ? 's' : ''} ago`;
const printIn = (time: number, unit: string) => `in ${time} ${unit}${time > 1 ? 's' : ''}`;
Expand Down

0 comments on commit 96c6382

Please sign in to comment.