diff --git a/backend/config/default.cjs b/backend/config/default.cjs index 1ebc57321..735d20e59 100644 --- a/backend/config/default.cjs +++ b/backend/config/default.cjs @@ -211,32 +211,11 @@ module.exports = { host: 'localhost:8080', }, - // A configurable checkbox on the last page when uploading a model - uploadWarning: { - showWarning: true, - checkboxText: 'By checking here you confirm that the information is correct', - }, - - // A configurable checkbox on the last page when requesting a deployment - deploymentWarning: { - showWarning: true, - checkboxText: 'By checking here you confirm that the information is correct', - }, - // Used by some admin pages (e.g. the logs) to directly open the correct page in your IDE // Not needed in production development: { logUrl: 'vscode://file/home/ec2-user/git/Bailo/', }, - - // The available seldon versions that can be used to build images - seldonVersions: [ - { - name: 'seldonio - 1.10.0', - image: 'seldonio/seldon-core-s2i-python37:1.10.0', - }, - ], - maxModelSizeGB: 50, }, connectors: { diff --git a/frontend/actions/accessRequest.ts b/frontend/actions/accessRequest.ts index aa1f00fcd..0bc6535bd 100644 --- a/frontend/actions/accessRequest.ts +++ b/frontend/actions/accessRequest.ts @@ -1,5 +1,5 @@ import useSWR from 'swr' -import { AccessRequestInterface } from 'types/interfaces' +import { AccessRequestInterface } from 'types/types' import { ErrorInfo, fetcher } from 'utils/fetcher' export function useGetAccessRequestsForModelId(modelId?: string) { diff --git a/frontend/actions/model.ts b/frontend/actions/model.ts index 211dd3882..c43abac58 100644 --- a/frontend/actions/model.ts +++ b/frontend/actions/model.ts @@ -1,8 +1,7 @@ import qs from 'querystring' import useSWR from 'swr' -import { ModelImage } from '../types/interfaces' -import { ModelForm, ModelInterface, Role } from '../types/v2/types' +import { ModelForm, ModelImage, ModelInterface, Role } from '../types/types' import { ErrorInfo, fetcher } from '../utils/fetcher' export interface ModelSearchResult { diff --git a/frontend/actions/modelCard.ts b/frontend/actions/modelCard.ts index 42e1abecf..aafb59800 100644 --- a/frontend/actions/modelCard.ts +++ b/frontend/actions/modelCard.ts @@ -1,9 +1,8 @@ import axios from 'axios' import useSWR from 'swr' - -import { ModelCardInterface, ModelCardRevisionInterface } from '../types/v2/types' -import { handleAxiosError } from '../utils/axios' -import { ErrorInfo, fetcher } from '../utils/fetcher' +import { ModelCardInterface, ModelCardRevisionInterface } from 'types/types' +import { handleAxiosError } from 'utils/axios' +import { ErrorInfo, fetcher } from 'utils/fetcher' export async function postFromSchema(modelId: string, schemaId: string) { try { diff --git a/frontend/actions/review.ts b/frontend/actions/review.ts index fe7f1372a..74a7c7156 100644 --- a/frontend/actions/review.ts +++ b/frontend/actions/review.ts @@ -1,10 +1,8 @@ import qs from 'querystring' import { ResponseTypeKeys } from 'src/common/ReviewWithComment' import useSWR from 'swr' -import { ModelInterface, ReleaseInterface } from 'types/types' -import { ReviewRequestInterface } from 'types/v2/types' +import { AccessRequestInterface, ModelInterface, ReleaseInterface, ReviewRequestInterface } from 'types/types' -import { AccessRequestInterface } from '../types/interfaces' import { ErrorInfo, fetcher } from '../utils/fetcher' export function useGetReviewRequestsForUser() { diff --git a/frontend/actions/team.ts b/frontend/actions/team.ts index 972589bd8..2363cb742 100644 --- a/frontend/actions/team.ts +++ b/frontend/actions/team.ts @@ -1,5 +1,5 @@ import useSWR from 'swr' -import { TeamInterface } from 'types/interfaces' +import { TeamInterface } from 'types/types' import { ErrorInfo, fetcher } from 'utils/fetcher' export const useGetTeams = () => { diff --git a/frontend/actions/user.ts b/frontend/actions/user.ts index 86b885178..73a0c77bc 100644 --- a/frontend/actions/user.ts +++ b/frontend/actions/user.ts @@ -1,7 +1,7 @@ import qs from 'querystring' import { UserInformation } from 'src/common/UserDisplay' import useSWR from 'swr' -import { EntityObject, ModelInterface, TokenActionsKeys, TokenInterface, TokenScopeKeys, User } from 'types/v2/types' +import { EntityObject, ModelInterface, TokenActionsKeys, TokenInterface, TokenScopeKeys, User } from 'types/types' import { ErrorInfo, fetcher } from '../utils/fetcher' diff --git a/frontend/pages/model/[modelId]/access-request/new.tsx b/frontend/pages/model/[modelId]/access-request/new.tsx index 573112a73..7d4125dbe 100644 --- a/frontend/pages/model/[modelId]/access-request/new.tsx +++ b/frontend/pages/model/[modelId]/access-request/new.tsx @@ -14,7 +14,7 @@ import JsonSchemaForm from 'src/Form/JsonSchemaForm' import Link from 'src/Link' import MessageAlert from 'src/MessageAlert' import Wrapper from 'src/Wrapper' -import { SplitSchemaNoRender } from 'types/interfaces' +import { SplitSchemaNoRender } from 'types/types' import { getErrorMessage } from 'utils/fetcher' import { getStepsData, getStepsFromSchema, setStepValidate, validateForm } from 'utils/formUtils' diff --git a/frontend/pages/model/[modelId]/access-request/schema.tsx b/frontend/pages/model/[modelId]/access-request/schema.tsx index 798de99c3..23324c41b 100644 --- a/frontend/pages/model/[modelId]/access-request/schema.tsx +++ b/frontend/pages/model/[modelId]/access-request/schema.tsx @@ -11,8 +11,7 @@ import MultipleErrorWrapper from 'src/errors/MultipleErrorWrapper' import Link from 'src/Link' import SchemaButton from 'src/model/common/SchemaButton' import Wrapper from 'src/Wrapper' -import { SchemaInterface } from 'types/types' -import { SchemaKind } from 'types/v2/types' +import { SchemaInterface, SchemaKind } from 'types/types' export default function NewSchemaSelection() { const router = useRouter() diff --git a/frontend/pages/model/[modelId]/history/[modelCardVersion].tsx b/frontend/pages/model/[modelId]/history/[modelCardVersion].tsx index 3e0175ae5..ea0196aa0 100644 --- a/frontend/pages/model/[modelId]/history/[modelCardVersion].tsx +++ b/frontend/pages/model/[modelId]/history/[modelCardVersion].tsx @@ -8,7 +8,7 @@ import Loading from 'src/common/Loading' import MultipleErrorWrapper from 'src/errors/MultipleErrorWrapper' import JsonSchemaForm from 'src/Form/JsonSchemaForm' import Wrapper from 'src/Wrapper' -import { SplitSchemaNoRender } from 'types/interfaces' +import { SplitSchemaNoRender } from 'types/types' import { getStepsFromSchema } from 'utils/formUtils' export default function ViewModelCardVersion() { diff --git a/frontend/pages/model/[modelId]/release/new.tsx b/frontend/pages/model/[modelId]/release/new.tsx index 0a461e464..714669e6d 100644 --- a/frontend/pages/model/[modelId]/release/new.tsx +++ b/frontend/pages/model/[modelId]/release/new.tsx @@ -11,8 +11,7 @@ import Link from 'src/Link' import MessageAlert from 'src/MessageAlert' import ReleaseForm from 'src/model/releases/ReleaseForm' import Wrapper from 'src/Wrapper' -import { FileWithMetadata, FlattenedModelImage } from 'types/interfaces' -import { FileInterface, isFileInterface } from 'types/v2/types' +import { FileInterface, FileWithMetadata, FlattenedModelImage, isFileInterface } from 'types/types' import { getErrorMessage } from 'utils/fetcher' import { isValidSemver } from 'utils/stringUtils' diff --git a/frontend/pages/model/[modelId]/schema.tsx b/frontend/pages/model/[modelId]/schema.tsx index fe696b1d6..97fa24019 100644 --- a/frontend/pages/model/[modelId]/schema.tsx +++ b/frontend/pages/model/[modelId]/schema.tsx @@ -15,8 +15,7 @@ import Link from 'src/Link' import MessageAlert from 'src/MessageAlert' import SchemaButton from 'src/model/common/SchemaButton' import Wrapper from 'src/Wrapper' -import { SchemaInterface } from 'types/types' -import { SchemaKind } from 'types/v2/types' +import { SchemaInterface, SchemaKind } from 'types/types' export default function NewSchemaSelection() { const router = useRouter() diff --git a/frontend/pages/model/new.tsx b/frontend/pages/model/new.tsx index 82cc5cd44..d0d0b3d68 100644 --- a/frontend/pages/model/new.tsx +++ b/frontend/pages/model/new.tsx @@ -20,8 +20,7 @@ import ModelDescriptionInput from 'src/model/ModelDescriptionInput' import ModelNameInput from 'src/model/ModelNameInput' import TeamSelect from 'src/TeamSelect' import Wrapper from 'src/Wrapper' -import { TeamInterface } from 'types/interfaces' -import { ModelForm, ModelVisibility } from 'types/v2/types' +import { ModelForm, ModelVisibility, TeamInterface } from 'types/types' import { getErrorMessage } from 'utils/fetcher' export default function NewModel() { diff --git a/frontend/pages/settings/personal-access-tokens/new.tsx b/frontend/pages/settings/personal-access-tokens/new.tsx index 23a765582..943c1f95f 100644 --- a/frontend/pages/settings/personal-access-tokens/new.tsx +++ b/frontend/pages/settings/personal-access-tokens/new.tsx @@ -21,7 +21,7 @@ import Link from 'src/Link' import MessageAlert from 'src/MessageAlert' import TokenDialog from 'src/settings/authentication/TokenDialog' import Wrapper from 'src/Wrapper' -import { TokenActions, TokenActionsKeys, TokenInterface, TokenScope } from 'types/v2/types' +import { TokenActions, TokenActionsKeys, TokenInterface, TokenScope } from 'types/types' import { getErrorMessage } from 'utils/fetcher' import { plural } from 'utils/stringUtils' diff --git a/frontend/src/Form/JsonSchemaForm.tsx b/frontend/src/Form/JsonSchemaForm.tsx index 13cfd82a4..59f45ad37 100644 --- a/frontend/src/Form/JsonSchemaForm.tsx +++ b/frontend/src/Form/JsonSchemaForm.tsx @@ -19,7 +19,7 @@ import { ArrayFieldTemplateProps, ObjectFieldTemplateProps, RJSFSchema } from '@ import validator from '@rjsf/validator-ajv8' import { Dispatch, SetStateAction, useState } from 'react' -import { SplitSchemaNoRender } from '../../types/interfaces' +import { SplitSchemaNoRender } from '../../types/types' import { setStepState } from '../../utils/formUtils' import { widgets } from '../../utils/formUtils' import ValidationErrorIcon from '../model/common/ValidationErrorIcon' diff --git a/frontend/src/MuiForms/EntitySelector.tsx b/frontend/src/MuiForms/EntitySelector.tsx index 402340469..dd19e5f2a 100644 --- a/frontend/src/MuiForms/EntitySelector.tsx +++ b/frontend/src/MuiForms/EntitySelector.tsx @@ -5,7 +5,7 @@ import TextField from '@mui/material/TextField' import { FormContextType } from '@rjsf/utils' import { debounce } from 'lodash-es' import { KeyboardEvent, SyntheticEvent, useCallback, useEffect, useMemo, useState } from 'react' -import { EntityObject } from 'types/v2/types' +import { EntityObject } from 'types/types' import { useGetCurrentUser, useListUsers } from '../../actions/user' import Loading from '../common/Loading' diff --git a/frontend/src/TeamSelect.tsx b/frontend/src/TeamSelect.tsx index 5922bf2de..e3a0d0917 100644 --- a/frontend/src/TeamSelect.tsx +++ b/frontend/src/TeamSelect.tsx @@ -3,7 +3,7 @@ import { useGetTeams } from 'actions/team' import { SyntheticEvent } from 'react' import LabelledInput from 'src/common/LabelledInput' import MessageAlert from 'src/MessageAlert' -import { TeamInterface } from 'types/interfaces' +import { TeamInterface } from 'types/types' const htmlId = 'team-input' diff --git a/frontend/src/common/MultiFileInput.tsx b/frontend/src/common/MultiFileInput.tsx index 67c16e671..efe3af2ca 100644 --- a/frontend/src/common/MultiFileInput.tsx +++ b/frontend/src/common/MultiFileInput.tsx @@ -3,8 +3,7 @@ import Button from '@mui/material/Button' import { styled } from '@mui/material/styles' import { ChangeEvent, useCallback, useMemo } from 'react' import MultiFileInputFileDisplay from 'src/common/MultiFileInputFileDisplay' -import { FileWithMetadata } from 'types/interfaces' -import { FileInterface } from 'types/v2/types' +import { FileInterface, FileWithMetadata } from 'types/types' const Input = styled('input')({ display: 'none', diff --git a/frontend/src/common/MultiFileInputFileDisplay.tsx b/frontend/src/common/MultiFileInputFileDisplay.tsx index 348e572d7..e441721d4 100644 --- a/frontend/src/common/MultiFileInputFileDisplay.tsx +++ b/frontend/src/common/MultiFileInputFileDisplay.tsx @@ -1,8 +1,7 @@ import { Chip, Grid, TextField, Tooltip, Typography } from '@mui/material' import prettyBytes from 'pretty-bytes' import { ChangeEvent, useState } from 'react' -import { FileWithMetadata } from 'types/interfaces' -import { FileInterface } from 'types/v2/types' +import { FileInterface, FileWithMetadata } from 'types/types' interface MultiFileInputDisplayProps { file: File | FileInterface diff --git a/frontend/src/common/ReviewWithComment.tsx b/frontend/src/common/ReviewWithComment.tsx index b849e9c54..2181dccfe 100644 --- a/frontend/src/common/ReviewWithComment.tsx +++ b/frontend/src/common/ReviewWithComment.tsx @@ -12,12 +12,10 @@ import { } from '@mui/material' import { useTheme } from '@mui/material/styles' import { SyntheticEvent, useMemo, useState } from 'react' -import { ReviewRequestInterface } from 'types/v2/types' import { useGetModelRoles } from '../../actions/model' import { useGetReviewRequestsForModel } from '../../actions/review' -import { AccessRequestInterface } from '../../types/interfaces' -import { ReleaseInterface } from '../../types/types' +import { AccessRequestInterface, ReleaseInterface, ReviewRequestInterface } from '../../types/types' import { getRoleDisplay } from '../../utils/roles' import MessageAlert from '../MessageAlert' import Loading from './Loading' diff --git a/frontend/src/common/UserAvatar.tsx b/frontend/src/common/UserAvatar.tsx index 1c2efad0a..b90a93cd8 100644 --- a/frontend/src/common/UserAvatar.tsx +++ b/frontend/src/common/UserAvatar.tsx @@ -2,8 +2,7 @@ import Avatar from '@mui/material/Avatar' import Typography from '@mui/material/Typography' import { randomColor } from 'randomcolor' import React, { useEffect, useState } from 'react' - -import { Entity } from '../../types/types' +import { Entity } from 'types/types' export default function UserAvatar({ entity, diff --git a/frontend/src/model/AccessRequests.tsx b/frontend/src/model/AccessRequests.tsx index 555d9b4c6..1fea5a07b 100644 --- a/frontend/src/model/AccessRequests.tsx +++ b/frontend/src/model/AccessRequests.tsx @@ -6,7 +6,7 @@ import MessageAlert from 'src/MessageAlert' import AccessRequestDisplay from 'src/model/accessRequests/AccessRequestDisplay' import { sortByCreatedAtDescending } from 'utils/dateUtils' -import { ModelInterface } from '../../types/v2/types' +import { ModelInterface } from '../../types/types' import EmptyBlob from '../common/EmptyBlob' import Loading from '../common/Loading' diff --git a/frontend/src/model/ModelImageList.tsx b/frontend/src/model/ModelImageList.tsx index cc8cf47cd..6a2afd1a8 100644 --- a/frontend/src/model/ModelImageList.tsx +++ b/frontend/src/model/ModelImageList.tsx @@ -4,10 +4,9 @@ import TextField from '@mui/material/TextField' import { useGetModelImages } from 'actions/model' import { SyntheticEvent, useMemo } from 'react' import Loading from 'src/common/Loading' -import { ModelInterface } from 'types/v2/types' import { sortByNameAscending } from 'utils/arrayUtils' -import { FlattenedModelImage } from '../../types/interfaces' +import { FlattenedModelImage, ModelInterface } from '../../types/types' import MessageAlert from '../MessageAlert' interface ModelImageListProps { diff --git a/frontend/src/model/ModelImages.tsx b/frontend/src/model/ModelImages.tsx index be3a6c8f1..ff166cc97 100644 --- a/frontend/src/model/ModelImages.tsx +++ b/frontend/src/model/ModelImages.tsx @@ -3,7 +3,7 @@ import { useGetModelImages } from 'actions/model' import { useMemo, useState } from 'react' import Forbidden from 'src/common/Forbidden' -import { ModelInterface } from '../../types/v2/types' +import { ModelInterface } from '../../types/types' import EmptyBlob from '../common/EmptyBlob' import Loading from '../common/Loading' import MessageAlert from '../MessageAlert' diff --git a/frontend/src/model/Overview.tsx b/frontend/src/model/Overview.tsx index 0de871b5c..d79345467 100644 --- a/frontend/src/model/Overview.tsx +++ b/frontend/src/model/Overview.tsx @@ -1,6 +1,6 @@ import { Container } from '@mui/material' import { useMemo } from 'react' -import { ModelInterface } from 'types/v2/types' +import { ModelInterface } from 'types/types' import FormEditPage from './overview/FormEditPage' import TemplatePage from './overview/TemplatePage' diff --git a/frontend/src/model/Releases.tsx b/frontend/src/model/Releases.tsx index ba00c0759..070812cfe 100644 --- a/frontend/src/model/Releases.tsx +++ b/frontend/src/model/Releases.tsx @@ -4,7 +4,7 @@ import { useEffect, useMemo, useState } from 'react' import MessageAlert from 'src/MessageAlert' import { useGetReleasesForModelId } from '../../actions/release' -import { ModelInterface } from '../../types/v2/types' +import { ModelInterface } from '../../types/types' import EmptyBlob from '../common/EmptyBlob' import Loading from '../common/Loading' import ReleaseDisplay from './releases/ReleaseDisplay' diff --git a/frontend/src/model/Settings.tsx b/frontend/src/model/Settings.tsx index f3e77f490..fa8322cd0 100644 --- a/frontend/src/model/Settings.tsx +++ b/frontend/src/model/Settings.tsx @@ -3,7 +3,7 @@ import { Container, Divider, List, ListItem, ListItemButton, Stack, Typography } import { useRouter } from 'next/router' import { useEffect, useState } from 'react' -import { ModelInterface } from '../../types/v2/types' +import { ModelInterface } from '../../types/types' import AccessRequestSettings from './settings/AccessRequestSettings' import ModelAccess from './settings/ModelAccess' import ModelDetails from './settings/ModelDetails' diff --git a/frontend/src/model/accessRequests/AccessRequestDisplay.tsx b/frontend/src/model/accessRequests/AccessRequestDisplay.tsx index e1e71a219..572304011 100644 --- a/frontend/src/model/accessRequests/AccessRequestDisplay.tsx +++ b/frontend/src/model/accessRequests/AccessRequestDisplay.tsx @@ -4,8 +4,7 @@ import { groupBy } from 'lodash-es' import { useEffect, useState } from 'react' import UserDisplay from 'src/common/UserDisplay' import Link from 'src/Link' -import { AccessRequestInterface } from 'types/interfaces' -import { ReviewRequestInterface, ReviewResponse } from 'types/v2/types' +import { AccessRequestInterface, ReviewRequestInterface, ReviewResponse } from 'types/types' import { formatDateString, sortByCreatedAtAscending } from 'utils/dateUtils' import { plural } from 'utils/stringUtils' diff --git a/frontend/src/model/accessRequests/EditableAccessRequestForm.tsx b/frontend/src/model/accessRequests/EditableAccessRequestForm.tsx index 58444bba2..99ed69ba5 100644 --- a/frontend/src/model/accessRequests/EditableAccessRequestForm.tsx +++ b/frontend/src/model/accessRequests/EditableAccessRequestForm.tsx @@ -6,7 +6,7 @@ import EditableFormHeading from 'src/Form/EditableFormHeading' import { getErrorMessage } from 'utils/fetcher' import { useGetSchema } from '../../../actions/schema' -import { AccessRequestInterface, SplitSchemaNoRender } from '../../../types/interfaces' +import { AccessRequestInterface, SplitSchemaNoRender } from '../../../types/types' import { getStepsData, getStepsFromSchema } from '../../../utils/formUtils' import Loading from '../../common/Loading' import JsonSchemaForm from '../../Form/JsonSchemaForm' diff --git a/frontend/src/model/common/ValidationErrorIcon.tsx b/frontend/src/model/common/ValidationErrorIcon.tsx index 1ae26d3b6..4cb8806cd 100644 --- a/frontend/src/model/common/ValidationErrorIcon.tsx +++ b/frontend/src/model/common/ValidationErrorIcon.tsx @@ -2,7 +2,7 @@ import ErrorIcon from '@mui/icons-material/ErrorOutline' import { Tooltip } from '@mui/material' import { useTheme } from '@mui/material/styles' -import { StepNoRender } from '../../../types/interfaces' +import { StepNoRender } from '../../../types/types' interface ValidationErrorIconProps { step: StepNoRender diff --git a/frontend/src/model/overview/FormEditPage.tsx b/frontend/src/model/overview/FormEditPage.tsx index fae62c6ab..c3ab52137 100644 --- a/frontend/src/model/overview/FormEditPage.tsx +++ b/frontend/src/model/overview/FormEditPage.tsx @@ -6,8 +6,7 @@ import UnsavedChangesContext from 'src/contexts/unsavedChangesContext' import { useGetModel } from '../../../actions/model' import { putModelCard, useGetModelCardRevisions } from '../../../actions/modelCard' import { useGetSchema } from '../../../actions/schema' -import { SplitSchemaNoRender } from '../../../types/interfaces' -import { ModelInterface } from '../../../types/v2/types' +import { ModelInterface, SplitSchemaNoRender } from '../../../types/types' import { getStepsData, getStepsFromSchema } from '../../../utils/formUtils' import Loading from '../../common/Loading' import JsonSchemaForm from '../../Form/JsonSchemaForm' diff --git a/frontend/src/model/overview/ModelCardHistoryDialog.tsx b/frontend/src/model/overview/ModelCardHistoryDialog.tsx index 40be81c59..4f535e82f 100644 --- a/frontend/src/model/overview/ModelCardHistoryDialog.tsx +++ b/frontend/src/model/overview/ModelCardHistoryDialog.tsx @@ -14,7 +14,7 @@ import { useTheme } from '@mui/material/styles' import { useMemo } from 'react' import { useGetModelCardRevisions } from '../../../actions/modelCard' -import { ModelInterface } from '../../../types/v2/types' +import { ModelInterface } from '../../../types/types' import { sortByCreatedAtDescending } from '../../../utils/dateUtils' import Loading from '../../common/Loading' import MessageAlert from '../../MessageAlert' diff --git a/frontend/src/model/overview/ModelCardRevisionListDisplay.tsx b/frontend/src/model/overview/ModelCardRevisionListDisplay.tsx index 71fa60b51..f60dd1b8d 100644 --- a/frontend/src/model/overview/ModelCardRevisionListDisplay.tsx +++ b/frontend/src/model/overview/ModelCardRevisionListDisplay.tsx @@ -2,7 +2,7 @@ import { TableBody, TableCell, TableRow } from '@mui/material' import { useTheme } from '@mui/material/styles' import { useRouter } from 'next/router' -import { ModelCardRevisionInterface } from '../../../types/v2/types' +import { ModelCardRevisionInterface } from '../../../types/types' import { formatDateString } from '../../../utils/dateUtils' type revisionProp = { diff --git a/frontend/src/model/overview/TemplatePage.tsx b/frontend/src/model/overview/TemplatePage.tsx index 3c5c6f942..730541fb6 100644 --- a/frontend/src/model/overview/TemplatePage.tsx +++ b/frontend/src/model/overview/TemplatePage.tsx @@ -2,7 +2,7 @@ import { PostAdd } from '@mui/icons-material' import { Box, Button, Card, Divider, Stack, Typography } from '@mui/material' import Link from 'src/Link' -import { ModelInterface } from '../../../types/v2/types' +import { ModelInterface } from '../../../types/types' type TemplatePageProps = { model: ModelInterface diff --git a/frontend/src/model/registry/ModelImageDisplay.tsx b/frontend/src/model/registry/ModelImageDisplay.tsx index 70f28bfa6..fc193a770 100644 --- a/frontend/src/model/registry/ModelImageDisplay.tsx +++ b/frontend/src/model/registry/ModelImageDisplay.tsx @@ -5,7 +5,7 @@ import Loading from 'src/common/Loading' import MessageAlert from 'src/MessageAlert' import CodeLine from 'src/model/registry/CodeLine' -import { ModelImage } from '../../../types/interfaces' +import { ModelImage } from '../../../types/types' type ModelImageDisplayProps = { modelImage: ModelImage diff --git a/frontend/src/model/registry/UploadModelImageDialog.tsx b/frontend/src/model/registry/UploadModelImageDialog.tsx index f604ecbfb..602935a24 100644 --- a/frontend/src/model/registry/UploadModelImageDialog.tsx +++ b/frontend/src/model/registry/UploadModelImageDialog.tsx @@ -15,7 +15,7 @@ import Loading from 'src/common/Loading' import Link from 'src/Link' import MessageAlert from 'src/MessageAlert' import CodeLine from 'src/model/registry/CodeLine' -import { ModelInterface } from 'types/v2/types' +import { ModelInterface } from 'types/types' interface UploadModelImageDialogProps { open: boolean diff --git a/frontend/src/model/releases/EditableRelease.tsx b/frontend/src/model/releases/EditableRelease.tsx index 3d405f502..afa48dd21 100644 --- a/frontend/src/model/releases/EditableRelease.tsx +++ b/frontend/src/model/releases/EditableRelease.tsx @@ -7,9 +7,7 @@ import UnsavedChangesContext from 'src/contexts/unsavedChangesContext' import EditableFormHeading from 'src/Form/EditableFormHeading' import MessageAlert from 'src/MessageAlert' import ReleaseForm from 'src/model/releases/ReleaseForm' -import { FileWithMetadata, FlattenedModelImage } from 'types/interfaces' -import { ReleaseInterface } from 'types/types' -import { FileInterface, isFileInterface } from 'types/v2/types' +import { FileInterface, FileWithMetadata, FlattenedModelImage, isFileInterface, ReleaseInterface } from 'types/types' import { getErrorMessage } from 'utils/fetcher' type EditableReleaseProps = { diff --git a/frontend/src/model/releases/ReleaseDisplay.tsx b/frontend/src/model/releases/ReleaseDisplay.tsx index 139ee1da1..25891f1c3 100644 --- a/frontend/src/model/releases/ReleaseDisplay.tsx +++ b/frontend/src/model/releases/ReleaseDisplay.tsx @@ -6,12 +6,10 @@ import { useRouter } from 'next/router' import prettyBytes from 'pretty-bytes' import { useEffect, useState } from 'react' import UserDisplay from 'src/common/UserDisplay' -import { ReviewRequestInterface, ReviewResponse } from 'types/v2/types' import { formatDateString, sortByCreatedAtAscending } from 'utils/dateUtils' import { useGetReviewRequestsForModel } from '../../../actions/review' -import { ReleaseInterface } from '../../../types/types' -import { ModelInterface } from '../../../types/v2/types' +import { ModelInterface, ReleaseInterface, ReviewRequestInterface, ReviewResponse } from '../../../types/types' import Loading from '../../common/Loading' import Markdown from '../../common/MarkdownDisplay' import Link from '../../Link' diff --git a/frontend/src/model/releases/ReleaseForm.tsx b/frontend/src/model/releases/ReleaseForm.tsx index 0031a46ef..d909a45f7 100644 --- a/frontend/src/model/releases/ReleaseForm.tsx +++ b/frontend/src/model/releases/ReleaseForm.tsx @@ -11,8 +11,7 @@ import ReadOnlyAnswer from 'src/Form/ReadOnlyAnswer' import Link from 'src/Link' import MessageAlert from 'src/MessageAlert' import ModelImageList from 'src/model/ModelImageList' -import { FileWithMetadata, FlattenedModelImage } from 'types/interfaces' -import { FileInterface, isFileInterface, ModelInterface } from 'types/v2/types' +import { FileInterface, FileWithMetadata, FlattenedModelImage, isFileInterface, ModelInterface } from 'types/types' import { isValidSemver } from 'utils/stringUtils' type ReleaseFormData = { diff --git a/frontend/src/model/reviews/ApprovalsDisplay.tsx b/frontend/src/model/reviews/ApprovalsDisplay.tsx index bd3f3a5ee..64b43fb6b 100644 --- a/frontend/src/model/reviews/ApprovalsDisplay.tsx +++ b/frontend/src/model/reviews/ApprovalsDisplay.tsx @@ -5,7 +5,7 @@ import { useGetModelRoles } from 'actions/model' import { useMemo } from 'react' import Loading from 'src/common/Loading' import MessageAlert from 'src/MessageAlert' -import { ReviewResponseWithRole } from 'types/v2/types' +import { ReviewResponseWithRole } from 'types/types' import { plural } from 'utils/stringUtils' interface ApprovalsDisplayProps { diff --git a/frontend/src/model/reviews/ReviewBanner.tsx b/frontend/src/model/reviews/ReviewBanner.tsx index d2be03c3c..510e54211 100644 --- a/frontend/src/model/reviews/ReviewBanner.tsx +++ b/frontend/src/model/reviews/ReviewBanner.tsx @@ -7,13 +7,12 @@ import { useGetAccessRequestsForModelId } from 'actions/accessRequest' import { useMemo, useState } from 'react' import MessageAlert from 'src/MessageAlert' import { mutate } from 'swr' -import { AccessRequestInterface } from 'types/interfaces' import { getErrorMessage } from 'utils/fetcher' import { useGetReleasesForModelId } from '../../../actions/release' import { useGetReviewRequestsForModel } from '../../../actions/review' import { postReviewResponse } from '../../../actions/review' -import { ReleaseInterface } from '../../../types/types' +import { AccessRequestInterface, ReleaseInterface } from '../../../types/types' import ReviewWithComment, { ResponseTypeKeys } from '../../common/ReviewWithComment' export type ReviewBannerProps = diff --git a/frontend/src/model/reviews/ReviewDisplay.tsx b/frontend/src/model/reviews/ReviewDisplay.tsx index 5c8f1f15e..e63bf78ef 100644 --- a/frontend/src/model/reviews/ReviewDisplay.tsx +++ b/frontend/src/model/reviews/ReviewDisplay.tsx @@ -2,7 +2,7 @@ import HourglassEmpty from '@mui/icons-material/HourglassEmpty' import { Stack, Tooltip, Typography } from '@mui/material' import { useEffect, useState } from 'react' import ApprovalsDisplay from 'src/model/reviews/ApprovalsDisplay' -import { ReviewRequestInterface, ReviewResponseWithRole } from 'types/v2/types' +import { ReviewRequestInterface, ReviewResponseWithRole } from 'types/types' import { plural } from 'utils/stringUtils' export interface ReviewDisplayProps { diff --git a/frontend/src/model/settings/AccessRequestSettings.tsx b/frontend/src/model/settings/AccessRequestSettings.tsx index 43b349051..a23fd4e06 100644 --- a/frontend/src/model/settings/AccessRequestSettings.tsx +++ b/frontend/src/model/settings/AccessRequestSettings.tsx @@ -3,7 +3,7 @@ import { Checkbox, Divider, FormControlLabel, Stack, Typography } from '@mui/mat import { patchModel } from 'actions/model' import { useState } from 'react' -import { ModelInterface } from '../../../types/v2/types' +import { ModelInterface } from '../../../types/types' import { getErrorMessage } from '../../../utils/fetcher' import useNotification from '../../hooks/useNotification' import MessageAlert from '../../MessageAlert' diff --git a/frontend/src/model/settings/EntityItem.tsx b/frontend/src/model/settings/EntityItem.tsx index 3931e449a..79c07e634 100644 --- a/frontend/src/model/settings/EntityItem.tsx +++ b/frontend/src/model/settings/EntityItem.tsx @@ -7,7 +7,7 @@ import { useMemo } from 'react' import UserDisplay from 'src/common/UserDisplay' import { useGetModelRoles } from '../../../actions/model' -import { CollaboratorEntry, ModelInterface } from '../../../types/v2/types' +import { CollaboratorEntry, ModelInterface } from '../../../types/types' import Loading from '../../common/Loading' import MessageAlert from '../../MessageAlert' diff --git a/frontend/src/model/settings/ModelAccess.tsx b/frontend/src/model/settings/ModelAccess.tsx index 6b88835c2..5a9fe3bfa 100644 --- a/frontend/src/model/settings/ModelAccess.tsx +++ b/frontend/src/model/settings/ModelAccess.tsx @@ -15,7 +15,7 @@ import { SyntheticEvent, useCallback, useEffect, useMemo, useState } from 'react import { patchModel, useGetModel } from '../../../actions/model' import { useListUsers } from '../../../actions/user' -import { CollaboratorEntry, EntityObject, ModelInterface } from '../../../types/v2/types' +import { CollaboratorEntry, EntityObject, ModelInterface } from '../../../types/types' import { getErrorMessage } from '../../../utils/fetcher' import useNotification from '../../hooks/useNotification' import MessageAlert from '../../MessageAlert' diff --git a/frontend/src/model/settings/ModelDetails.tsx b/frontend/src/model/settings/ModelDetails.tsx index 7793d66a4..d7f868031 100644 --- a/frontend/src/model/settings/ModelDetails.tsx +++ b/frontend/src/model/settings/ModelDetails.tsx @@ -6,10 +6,9 @@ import { FormEvent, useEffect, useState } from 'react' import ModelDescriptionInput from 'src/model/ModelDescriptionInput' import ModelNameInput from 'src/model/ModelNameInput' import TeamSelect from 'src/TeamSelect' -import { TeamInterface } from 'types/interfaces' +import { ModelForm, ModelInterface, TeamInterface } from 'types/types' import { patchModel } from '../../../actions/model' -import { ModelForm, ModelInterface } from '../../../types/v2/types' import { getErrorMessage } from '../../../utils/fetcher' import useNotification from '../../hooks/useNotification' import MessageAlert from '../../MessageAlert' diff --git a/frontend/src/reviews/ReviewComments.tsx b/frontend/src/reviews/ReviewComments.tsx index 8475441a0..de7b29bd1 100644 --- a/frontend/src/reviews/ReviewComments.tsx +++ b/frontend/src/reviews/ReviewComments.tsx @@ -9,9 +9,14 @@ import RichTextEditor from 'src/common/RichTextEditor' import MessageAlert from 'src/MessageAlert' import ReviewCommentDisplay from 'src/reviews/ReviewCommentDisplay' import ReviewDecisionDisplay from 'src/reviews/ReviewDecisionDisplay' -import { AccessRequestInterface } from 'types/interfaces' -import { isReviewResponse, ReleaseInterface, ReviewComment, ReviewResponseKind } from 'types/types' -import { ReviewResponse } from 'types/v2/types' +import { + AccessRequestInterface, + isReviewResponse, + ReleaseInterface, + ReviewComment, + ReviewResponse, + ReviewResponseKind, +} from 'types/types' import { sortByCreatedAtAscending } from 'utils/dateUtils' import { getErrorMessage } from 'utils/fetcher' diff --git a/frontend/src/reviews/ReviewDecisionDisplay.tsx b/frontend/src/reviews/ReviewDecisionDisplay.tsx index 1ef8176fb..8608fa0bd 100644 --- a/frontend/src/reviews/ReviewDecisionDisplay.tsx +++ b/frontend/src/reviews/ReviewDecisionDisplay.tsx @@ -5,8 +5,7 @@ import { useMemo } from 'react' import MarkdownDisplay from 'src/common/MarkdownDisplay' import UserAvatar from 'src/common/UserAvatar' import UserDisplay from 'src/common/UserDisplay' -import { EntityKind } from 'types/types' -import { ReviewResponse } from 'types/v2/types' +import { EntityKind, ReviewResponse } from 'types/types' import { formatDateString } from 'utils/dateUtils' type ReviewDecisionDisplayProps = { diff --git a/frontend/src/reviews/ReviewItem.tsx b/frontend/src/reviews/ReviewItem.tsx index 00db7aa52..bd4c9bc17 100644 --- a/frontend/src/reviews/ReviewItem.tsx +++ b/frontend/src/reviews/ReviewItem.tsx @@ -2,7 +2,7 @@ import { ListItem, ListItemButton, Stack, Typography } from '@mui/material' import { useRouter } from 'next/router' import ReviewDisplay from 'src/model/reviews/ReviewDisplay' import ReviewRoleDisplay from 'src/reviews/ReviewRoleDisplay' -import { ReviewRequestInterface } from 'types/v2/types' +import { ReviewRequestInterface } from 'types/types' import { timeDifference } from 'utils/dateUtils' type ReviewItemProps = { diff --git a/frontend/src/reviews/ReviewRoleDisplay.tsx b/frontend/src/reviews/ReviewRoleDisplay.tsx index c9e1fbbf7..114a4d39e 100644 --- a/frontend/src/reviews/ReviewRoleDisplay.tsx +++ b/frontend/src/reviews/ReviewRoleDisplay.tsx @@ -1,6 +1,6 @@ import NotificationsNoneOutlinedIcon from '@mui/icons-material/NotificationsNoneOutlined' import { Stack, Typography } from '@mui/material' -import { ReviewRequestInterface } from 'types/v2/types' +import { ReviewRequestInterface } from 'types/types' import { useGetModelRoles } from '../../actions/model' import { getRoleDisplay } from '../../utils/roles' diff --git a/frontend/src/reviews/ReviewsList.tsx b/frontend/src/reviews/ReviewsList.tsx index 0e1037b21..407642def 100644 --- a/frontend/src/reviews/ReviewsList.tsx +++ b/frontend/src/reviews/ReviewsList.tsx @@ -6,7 +6,7 @@ import EmptyBlob from 'src/common/EmptyBlob' import Loading from 'src/common/Loading' import MessageAlert from 'src/MessageAlert' import ReviewItem from 'src/reviews/ReviewItem' -import { ReviewRequestInterface } from 'types/v2/types' +import { ReviewRequestInterface } from 'types/types' type ReviewsListProps = { kind: 'release' | 'access' | 'archived' diff --git a/frontend/src/settings/ProfileTab.tsx b/frontend/src/settings/ProfileTab.tsx index e32533d55..067195108 100644 --- a/frontend/src/settings/ProfileTab.tsx +++ b/frontend/src/settings/ProfileTab.tsx @@ -1,6 +1,6 @@ import Box from '@mui/material/Box' import Typography from '@mui/material/Typography' -import { User } from 'types/v2/types' +import { User } from 'types/types' type ProfileTabProps = { user: User diff --git a/frontend/src/settings/authentication/AuthenticationTab.tsx b/frontend/src/settings/authentication/AuthenticationTab.tsx index d244b553d..734454183 100644 --- a/frontend/src/settings/authentication/AuthenticationTab.tsx +++ b/frontend/src/settings/authentication/AuthenticationTab.tsx @@ -8,7 +8,7 @@ import ConfirmationDialogue from 'src/common/ConfirmationDialogue' import EmptyBlob from 'src/common/EmptyBlob' import Loading from 'src/common/Loading' import MessageAlert from 'src/MessageAlert' -import { TokenInterface } from 'types/v2/types' +import { TokenInterface } from 'types/types' import { formatDateString } from 'utils/dateUtils' import { getErrorMessage } from 'utils/fetcher' diff --git a/frontend/src/settings/authentication/TokenDialog.tsx b/frontend/src/settings/authentication/TokenDialog.tsx index 40c8e88ca..0ff256278 100644 --- a/frontend/src/settings/authentication/TokenDialog.tsx +++ b/frontend/src/settings/authentication/TokenDialog.tsx @@ -15,7 +15,7 @@ import { useTheme } from '@mui/material/styles' import { useRouter } from 'next/router' import { useEffect, useState } from 'react' import MessageAlert from 'src/MessageAlert' -import { TokenInterface } from 'types/v2/types' +import { TokenInterface } from 'types/types' type TokenDialogProps = { token?: TokenInterface diff --git a/frontend/src/wrapper/SideNavigation.tsx b/frontend/src/wrapper/SideNavigation.tsx index 002b01d19..5c4be9738 100644 --- a/frontend/src/wrapper/SideNavigation.tsx +++ b/frontend/src/wrapper/SideNavigation.tsx @@ -13,7 +13,7 @@ import { CSSProperties, useCallback, useEffect, useState } from 'react' import Loading from 'src/common/Loading' import MessageAlert from 'src/MessageAlert' import { NavMenuItem } from 'src/wrapper/NavMenuItem' -import { ReviewRequestInterface, User } from 'types/v2/types' +import { ReviewRequestInterface, User } from 'types/types' import { DRAWER_WIDTH } from '../../utils/constants' diff --git a/frontend/src/wrapper/TopNavigation.tsx b/frontend/src/wrapper/TopNavigation.tsx index e9fb66c50..76912376c 100644 --- a/frontend/src/wrapper/TopNavigation.tsx +++ b/frontend/src/wrapper/TopNavigation.tsx @@ -27,8 +27,7 @@ import { CSSProperties, MouseEvent, useContext, useMemo, useState } from 'react' import ModelSearchField from 'src/wrapper/ModelSearchField' import bailoLogo from '../../public/logo-horizontal-light.png' -import { EntityKind } from '../../types/types' -import { User } from '../../types/v2/types' +import { EntityKind, User } from '../../types/types' import { DRAWER_WIDTH } from '../../utils/constants' import ExpandableButton from '../common/ExpandableButton' import UserAvatar from '../common/UserAvatar' diff --git a/frontend/types/interfaces.ts b/frontend/types/interfaces.ts index 33839677b..49cc8ec28 100644 --- a/frontend/types/interfaces.ts +++ b/frontend/types/interfaces.ts @@ -79,17 +79,39 @@ export const ModelVisibility = { export type ModelVisibilityKeys = (typeof ModelVisibility)[keyof typeof ModelVisibility] +export interface ModelCardInterface { + schemaId: string + version: number + createdBy: string + + metadata: unknown +} + +export interface CollaboratorEntry { + entity: string + roles: Array<'owner' | 'contributor' | 'consumer' | string> +} + export interface ModelInterface { id: string - name: string + teamId: string description: string - + settings: { + ungovernedAccess: boolean + } + card: ModelCardInterface visibility: ModelVisibilityKeys - deleted: boolean - + collaborators: CollaboratorEntry[] + createdBy: string createdAt: Date - updatedAt: Date +} + +export interface ModelForm { + name: string + teamId: string + description: string + visibility: ModelVisibilityKeys } export interface AccessRequestMetadata { @@ -130,3 +152,40 @@ export interface FileWithMetadata { fileName: string metadata?: string } + +export const Decision = { + RequestChanges: 'request_changes', + Approve: 'approve', +} as const +export type DecisionKeys = (typeof Decision)[keyof typeof Decision] + +export interface ReviewResponse { + user: string + decision: DecisionKeys + comment?: string + createdAt: string + updatedAt: string +} + +export interface ReviewResponseWithRole extends ReviewResponse { + role: string +} + +type PartialReviewRequestInterface = + | { + accessRequestId: string + semver?: never + } + | { + accessRequestId?: never + semver: string + } + +export type ReviewRequestInterface = { + model: ModelInterface + role: string + kind: 'release' | 'access' + responses: ReviewResponse[] + createdAt: string + updatedAt: string +} & PartialReviewRequestInterface diff --git a/frontend/types/types.ts b/frontend/types/types.ts index 9ad13aa57..5646e9707 100644 --- a/frontend/types/types.ts +++ b/frontend/types/types.ts @@ -1,98 +1,9 @@ -import { Document, Types } from 'mongoose' -import { ReviewResponse } from 'types/v2/types' +import { UiSchema } from '@rjsf/utils' +import { Dispatch, SetStateAction } from 'react' -import { FlattenedModelImage } from './interfaces' -import { SchemaKindKeys } from './v2/types' - -export enum ModelUploadType { - Zip = 'Code and binaries', - ModelCard = 'Model card only', - Docker = 'Prebuilt Docker image', -} - -export enum UploadModes { - NewModel = 'newModel', - NewVersion = 'newVersion', -} - -export enum ApprovalStates { - Accepted = 'Accepted', - Declined = 'Declined', - NoResponse = 'No Response', -} - -export enum ApprovalCategory { - Upload = 'Upload', - Deployment = 'Deployment', -} - -export type UploadCategory = 'model' | 'deployment' - -export interface DeploymentMetadata { - highLevelDetails: { - name: string - [x: string]: unknown - } - - contacts: { - owner: Array - [x: string]: unknown - } -} - -export interface ModelCardInterface { - schemaId: string - version: number - createdBy: string - - metadata: unknown -} - -export interface ModelMetadata { - highLevelDetails: { - tags: Array - name: string - modelInASentence: string - modelOverview: string - modelCardVersion: string - [x: string]: any - } - - contacts: { - uploader: Array - reviewer: Array - manager: Array - [x: string]: any - } - - buildOptions?: { - uploadType: ModelUploadType - seldonVersion: string - [x: string]: any - } - - // allow other properties - [x: string]: any -} - -export interface LogStatement { - timestamp: Date - level: string - msg: string -} - -export type ModelId = string | Types.ObjectId - -export enum SchemaType { - UPLOAD = 'UPLOAD', - DEPLOYMENT = 'DEPLOYMENT', -} - -export interface Schema { - name: string - reference: string - schema: any - use: SchemaType +export interface BailoError extends Error { + id?: string + documentationUrl?: string } export enum EntityKind { @@ -105,16 +16,6 @@ export interface Entity { data?: unknown } -export interface ParsedEntity { - kind: EntityKind - entity: UserDoc -} - -export interface BailoError extends Error { - id?: string - documentationUrl?: string -} - export interface UiConfig { banner: { enabled: boolean @@ -133,214 +34,226 @@ export interface UiConfig { host: string } - uploadWarning: { - showWarning: boolean - checkboxText: string - } - - deploymentWarning: { - showWarning: boolean - checkboxText: string - } - development: { logUrl: string } - - seldonVersions: Array - - //max model size is calculated in gigabytes - maxModelSizeGB: number } -export type SeldonVersion = { +export interface FileInterface { + _id: string + modelId: string + name: string - image: string -} + size: number + mime: string -export enum LogLevel { - TRACE = 10, - DEBUG = 20, - INFO = 30, - WARN = 40, - ERROR = 50, - FATAL = 60, -} + bucket: string + path: string -export enum LogLevelLabel { - TRACE = 'trace', - DEBUG = 'debug', - INFO = 'info', - WARN = 'warn', - ERROR = 'error', - FATAL = 'fatal', -} + complete: boolean -export enum LogType { - Build = 'build', - Approval = 'approval', - Misc = 'misc', + createdAt: Date + updatedAt: Date } -export interface LogEntry { - _id: string - name: string - hostname: string - pid: number +export type ReviewComment = { + message: string + user: string + createdAt: string +} - level: LogLevel +export type ReviewResponseKind = ReviewComment | ReviewResponse - msg: string +export function isReviewResponse(responseKind: ReviewResponseKind) { + return 'decision' in responseKind +} - time: string +export type ReleaseInterface = { + modelId: string + modelCardVersion: number + semver: string + notes: string + minor?: boolean + draft?: boolean + fileIds: Array + comments: Array + files: Array + images: Array + deleted: boolean + createdBy: string + createdAt: string + updatedAt: string +} - src?: { - file: string - line: number - } +export type ListModelType = 'favourites' | 'user' | 'all' - [x: string]: unknown +export interface SchemaInterface { + id: string + name: string + description: string + active: boolean + hidden: boolean + kind: SchemaKindKeys + meta: unknown + uiSchema: unknown + schema: unknown + createdAt: Date + updatedAt: Date } -export type SchemaQuestion = { - reference: string - title: string - description: string - type: string - format?: string - minLength?: number - maxLength?: number - widget?: string - readOnly?: boolean -} - -export interface MinimalEntry { - compressedSize: number - generalPurposeBitFlag: number - compressionMethod: number - relativeOffsetOfLocalHeader: number - uncompressedSize: number - fileName: string +export interface ModelCardRevisionInterface { + modelId: string + schemaId: string + version: number + metadata: unknown + createdBy: string + createdAt: string + updatedAt: string } -export enum ApprovalTypes { - Manager = 'Manager', - Reviewer = 'Reviewer', +export interface Role { + id: string + name: string + short?: string } -export interface Approval { - _id: any - version: Types.ObjectId | VersionDoc | undefined - deployment: Types.ObjectId | DeploymentDoc | undefined +export const SchemaKind = { + Model: 'model', + AccessRequest: 'accessRequest', +} as const - approvers: Array - status: ApprovalStates +export type SchemaKindKeys = (typeof SchemaKind)[keyof typeof SchemaKind] - approvalType: ApprovalTypes - approvalCategory: ApprovalCategory +export interface FileInterface { + _id: string + modelId: string - createdAt: Date - updatedAt: Date -} + name: string + size: number + mime: string -export type ApprovalDoc = Approval & Document + bucket: string + path: string -export interface Deployment { - _id: any - schemaRef: string | null - uuid: string + complete: boolean - model: Types.ObjectId | ModelDoc - metadata: DeploymentMetadata + createdAt: Date + updatedAt: Date +} - managerApproved: ApprovalStates +export const isFileInterface = (file: File | FileInterface): file is FileInterface => { + return (file as FileInterface).bucket !== undefined +} - logs: Types.Array - built: boolean - ungoverned: boolean +export interface PostSimpleUpload { + file: FileInterface +} - createdAt: Date - updatedAt: Date +export interface User { + dn: string +} - log: (level: string, msg: string) => Promise +export interface EntityObject { + kind: string + id: string } -export type DeploymentDoc = Deployment & Document +export const TokenScope = { + All: 'all', + Models: 'models', +} as const -export interface Model { - _id: any - schemaRef: string - uuid: string +export type TokenScopeKeys = (typeof TokenScope)[keyof typeof TokenScope] - versions: Types.Array - latestVersion: VersionDoc | Types.ObjectId +export const TokenActions = { + ImageRead: 'image:read', + FileRead: 'file:read', +} as const - createdAt: Date - updatedAt: Date -} +export type TokenActionsKeys = (typeof TokenActions)[keyof typeof TokenActions] -export type ModelDoc = Model & Document +export interface TokenInterface { + user: string + description: string + scope: TokenScopeKeys + modelIds: Array + actions: Array + accessKey: string + secretKey?: string + deleted: boolean + createdAt: string + updatedAt: string + compareToken: (candidateToken: string) => Promise +} -export interface User { - _id: any - id: string - email: string +export interface SplitSchema { + reference: string - roles: Types.Array - favourites: Types.Array + steps: Array +} - token?: string | undefined - data?: any +export interface SplitSchemaNoRender { + reference: string - createdAt: Date - updatedAt: Date + steps: Array +} - compareToken: (candidateToken: string) => Promise +export interface RenderInterface { + step: Step + splitSchema: SplitSchema + setSplitSchema: Dispatch> } -export type UserDoc = User & Document +export type StepType = 'Form' | 'Data' | 'Message' -export interface Version { - _id: any - model: ModelDoc | Types.ObjectId - version: string +export interface Step { + schema: any + uiSchema?: UiSchema - metadata: ModelMetadata + state: any + index: number - built: boolean - managerApproved: ApprovalStates - reviewerApproved: ApprovalStates + steps?: Array - managerLastViewed: string - reviewerLastViewed: string + type: StepType + section: string + schemaRef: string - files: { - rawBinaryPath?: string - binary?: { - fileList?: Array - } + render: (RenderInterface) => JSX.Element | null + renderBasic: (RenderInterface) => JSX.Element | null + renderButtons: (RenderButtonsInterface) => JSX.Element | null - rawCodePath?: string - code?: { - fileList?: Array - } + shouldValidate: boolean + isComplete: (step: Step) => boolean +} - rawDockerPath?: string - } +export interface StepNoRender { + schema: any + uiSchema?: UiSchema state: any - logs: Types.Array + index: number - createdAt: Date - updatedAt: Date + steps?: Array + + type: StepType + section: string + schemaRef: string - log: (level: string, msg: string) => Promise + shouldValidate: boolean + isComplete: (step: StepNoRender) => boolean } -export type VersionDoc = Version & Document +export interface TeamInterface { + id: string + + name: string + description: string -export enum MarketPlaceModelSelectType { - MY_MODELS = 'My Models', + deleted: boolean + + createdAt: Date + updatedAt: Date } export const ModelVisibility = { @@ -350,80 +263,113 @@ export const ModelVisibility = { export type ModelVisibilityKeys = (typeof ModelVisibility)[keyof typeof ModelVisibility] +export interface ModelCardInterface { + schemaId: string + version: number + createdBy: string + + metadata: unknown +} + +export interface CollaboratorEntry { + entity: string + roles: Array<'owner' | 'contributor' | 'consumer' | string> +} + export interface ModelInterface { id: string name: string + teamId: string description: string + settings: { + ungovernedAccess: boolean + } + card: ModelCardInterface visibility: ModelVisibilityKeys - entities: Entity[] -} - -export interface FileInterface { - _id: string - modelId: string - - name: string - size: number - mime: string - - bucket: string - path: string - - complete: boolean - + collaborators: CollaboratorEntry[] + createdBy: string createdAt: Date - updatedAt: Date } -export type ReviewComment = { - message: string - user: string - createdAt: string +export interface ModelForm { + name: string + teamId: string + description: string + visibility: ModelVisibilityKeys } -export type ReviewResponseKind = ReviewComment | ReviewResponse - -export function isReviewResponse(responseKind: ReviewResponseKind) { - return 'decision' in responseKind +export interface AccessRequestMetadata { + overview: { + name: string + entities: Array + endDate?: string + [x: string]: unknown + } + [x: string]: unknown } -export type ReleaseInterface = { +export interface AccessRequestInterface { + id: string modelId: string - modelCardVersion: number - semver: string - notes: string - minor?: boolean - draft?: boolean - fileIds: Array - comments: Array - files: Array - images: Array + schemaId: string deleted: boolean + metadata: AccessRequestMetadata + comments: Array createdBy: string createdAt: string updatedAt: string } -export type ListModelType = 'favourites' | 'user' | 'all' +export interface ModelImage { + repository: string + name: string + tags: Array +} -export interface SchemaInterface { - id: string +export interface FlattenedModelImage { + repository: string name: string - description: string - active: boolean - hidden: boolean - kind: SchemaKindKeys - meta: unknown - uiSchema: unknown - schema: unknown - createdAt: Date - updatedAt: Date + tag: string } -export interface ReviewRequestInterface { - model: string - release: string - kind: 'release' | 'access' +export interface FileWithMetadata { + fileName: string + metadata?: string +} + +export const Decision = { + RequestChanges: 'request_changes', + Approve: 'approve', +} as const +export type DecisionKeys = (typeof Decision)[keyof typeof Decision] + +export interface ReviewResponse { + user: string + decision: DecisionKeys + comment?: string createdAt: string updatedAt: string } + +export interface ReviewResponseWithRole extends ReviewResponse { + role: string +} + +type PartialReviewRequestInterface = + | { + accessRequestId: string + semver?: never + } + | { + accessRequestId?: never + semver: string + } + +export type ReviewRequestInterface = { + model: ModelInterface + role: string + kind: 'release' | 'access' + responses: ReviewResponse[] + createdAt: string + updatedAt: string +} & PartialReviewRequestInterface diff --git a/frontend/types/v2/enums.ts b/frontend/types/v2/enums.ts deleted file mode 100644 index 91d8005bb..000000000 --- a/frontend/types/v2/enums.ts +++ /dev/null @@ -1,4 +0,0 @@ -export enum ApprovalStates { - Accepted = 'approve', - RequestChanges = 'request_changes', -} diff --git a/frontend/types/v2/types.ts b/frontend/types/v2/types.ts deleted file mode 100644 index 938cf4c2b..000000000 --- a/frontend/types/v2/types.ts +++ /dev/null @@ -1,164 +0,0 @@ -// TODO Once beta has been completed these types need to be merged back into types/types. -// Please note that some of these types have been duplicated, merge accordingly! - -export const ModelVisibility = { - Private: 'private', - Public: 'public', -} as const - -export type ModelVisibilityKeys = (typeof ModelVisibility)[keyof typeof ModelVisibility] - -export interface ModelInterface { - id: string - name: string - teamId: string - description: string - settings: { - ungovernedAccess: boolean - } - card: ModelCardInterface - visibility: ModelVisibilityKeys - collaborators: CollaboratorEntry[] -} - -export interface ModelCardInterface { - schemaId: string - version: number - createdBy: string - - metadata: unknown -} - -export interface ModelCardRevisionInterface { - modelId: string - schemaId: string - version: number - metadata: unknown - createdBy: string - createdAt: string - updatedAt: string -} - -export interface CollaboratorEntry { - entity: string - roles: Array<'owner' | 'contributor' | 'consumer' | string> -} - -export type ModelForm = { - name: string - teamId: string - description: string - visibility: ModelVisibilityKeys -} - -export interface Role { - id: string - name: string - short?: string -} - -export const SchemaKind = { - Model: 'model', - AccessRequest: 'accessRequest', -} as const - -export type SchemaKindKeys = (typeof SchemaKind)[keyof typeof SchemaKind] - -export interface FileInterface { - _id: string - modelId: string - - name: string - size: number - mime: string - - bucket: string - path: string - - complete: boolean - - createdAt: Date - updatedAt: Date -} - -export const isFileInterface = (file: File | FileInterface): file is FileInterface => { - return (file as FileInterface).bucket !== undefined -} - -export interface PostSimpleUpload { - file: FileInterface -} - -export interface User { - dn: string -} - -export interface EntityObject { - kind: string - id: string -} - -export const TokenScope = { - All: 'all', - Models: 'models', -} as const - -export type TokenScopeKeys = (typeof TokenScope)[keyof typeof TokenScope] - -export const TokenActions = { - ImageRead: 'image:read', - FileRead: 'file:read', -} as const - -export type TokenActionsKeys = (typeof TokenActions)[keyof typeof TokenActions] - -export interface TokenInterface { - user: string - description: string - scope: TokenScopeKeys - modelIds: Array - actions: Array - accessKey: string - secretKey?: string - deleted: boolean - createdAt: string - updatedAt: string - compareToken: (candidateToken: string) => Promise -} - -export const Decision = { - RequestChanges: 'request_changes', - Approve: 'approve', -} as const -export type DecisionKeys = (typeof Decision)[keyof typeof Decision] - -export interface ReviewResponse { - user: string - decision: DecisionKeys - comment?: string - createdAt: string - updatedAt: string -} - -export interface ReviewResponseWithRole extends ReviewResponse { - role: string -} - -type PartialReviewRequestInterface = - | { - accessRequestId: string - semver?: never - } - | { - accessRequestId?: never - semver: string - } - -export type ReviewRequestInterface = { - model: ModelInterface - role: string - kind: 'release' | 'access' - responses: ReviewResponse[] - createdAt: string - updatedAt: string -} & PartialReviewRequestInterface diff --git a/frontend/utils/formUtils.ts b/frontend/utils/formUtils.ts index 4606df6bf..a0b88e173 100644 --- a/frontend/utils/formUtils.ts +++ b/frontend/utils/formUtils.ts @@ -10,7 +10,7 @@ import Nothing from 'src/MuiForms/Nothing' import RichTextInput from 'src/MuiForms/RichTextInput' import TagSelector from 'src/MuiForms/TagSelector' -import { SplitSchemaNoRender, StepNoRender, StepType } from '../types/interfaces' +import { SplitSchemaNoRender, StepNoRender, StepType } from '../types/types' import { createUiSchema } from './uiSchemaUtils' export const widgets = { diff --git a/frontend/utils/roles.ts b/frontend/utils/roles.ts index d005b975d..188b727b8 100644 --- a/frontend/utils/roles.ts +++ b/frontend/utils/roles.ts @@ -1,4 +1,4 @@ -import { Role } from '../types/v2/types' +import { Role } from '../types/types' export function getRoleDisplay(roleId: string, modelRoles: Role[]) { const role = modelRoles.find((role) => role.id === roleId) diff --git a/frontend/utils/test/testModels.ts b/frontend/utils/test/testModels.ts index 716a700e5..6a7a6dd85 100644 --- a/frontend/utils/test/testModels.ts +++ b/frontend/utils/test/testModels.ts @@ -1,111 +1,15 @@ -import { AccessRequestInterface, ModelVisibility, StepNoRender } from 'types/interfaces' import { - ApprovalCategory, - ApprovalStates, - ApprovalTypes, - EntityKind, + AccessRequestInterface, + ModelCardInterface, + ModelInterface, + ModelVisibility, ReviewComment, + ReviewRequestInterface, + ReviewResponse, + Role, SchemaInterface, + StepNoRender, } from 'types/types' -import { ModelCardInterface, ModelInterface, ReviewRequestInterface, ReviewResponse, Role } from 'types/v2/types' - -export const testId = 'testId' - -export const testUser: any = { - _id: 'testUserId', - id: 'user', - email: 'test@example.com', - roles: ['user'], -} - -export const testModel: any = { - _id: 'testModelId', - versions: [], - schemaRef: 'test-schema', - uuid: 'testModelUuid', - latestVersion: 'testVersionId', - createdAt: new Date(), - updatedAt: new Date(), -} - -export const testVersion: any = { - _id: 'testVersionId', - model: testModel, - version: '1', - metadata: { - highLevelDetails: { - name: 'test', - }, - contacts: { - uploader: [ - { - kind: EntityKind.USER, - id: 'user', - }, - ], - reviewer: [ - { - kind: EntityKind.USER, - id: 'reviewer', - }, - ], - manager: [ - { - kind: EntityKind.USER, - id: 'manager', - }, - ], - }, - buildOptions: { - seldonVersion: 'seldonio/seldon-core-s2i-python37:1.10.0', - }, - }, - files: { - rawCodePath: '', - rawBinaryPath: '', - }, - built: false, - managerApproved: ApprovalStates.NoResponse, - reviewerApproved: ApprovalStates.NoResponse, - state: {}, - logs: [], - createdAt: new Date(), - updatedAt: new Date(), -} - -export const testApproval1: any = { - _id: 'testApprovalId1', - version: testVersion, - approvers: [ - { - kind: EntityKind.USER, - id: 'testUserId', - }, - ], - status: ApprovalStates.NoResponse, - approvalType: ApprovalTypes.Reviewer, - approvalCategory: ApprovalCategory.Upload, - createdAt: new Date(), - updatedAt: new Date(), -} - -export const testApproval2: any = { - ...testApproval1, - _id: 'testApprovalId2', - approvalType: ApprovalTypes.Manager, -} - -export const testApproval3: any = { - ...testApproval1, - _id: 'testApprovalId3', - status: ApprovalStates.Accepted, -} - -export const testApproval4: any = { - ...testApproval2, - _id: 'testApprovalId4', - status: ApprovalStates.Accepted, -} /******** V2 ********/ @@ -178,6 +82,8 @@ export const testV2Model: ModelInterface = { }, teamId: 'test-team', card: testModelCard, + createdAt: new Date(), + createdBy: testEntity, } export const testReviewResponse: ReviewResponse = {