diff --git a/appserverSchema.d.ts b/appserverSchema.d.ts index e852026a4..8026fd6ef 100644 --- a/appserverSchema.d.ts +++ b/appserverSchema.d.ts @@ -1074,7 +1074,9 @@ export type paths = { * * Args: * secret_filter_model: Filter model used for pagination, sorting, - * filtering + * filtering. + * hydrate: Flag deciding whether to hydrate the output model(s) + * by including metadata fields in the response. * * Returns: * List of secret objects. @@ -1088,6 +1090,8 @@ export type paths = { * * Args: * secret_id: ID of the secret to get. + * hydrate: Flag deciding whether to hydrate the output model(s) + * by including metadata fields in the response. * * Returns: * A specific secret object. @@ -2239,7 +2243,8 @@ export type paths = { * Args: * tag_filter_model: Filter model used for pagination, sorting, * filtering - * + * hydrate: Flag deciding whether to hydrate the output model(s) + * by including metadata fields in the response. * * Returns: * The tags according to query filters. @@ -2264,6 +2269,8 @@ export type paths = { * * Args: * tag_name_or_id: The name or ID of the tag to get. + * hydrate: Flag deciding whether to hydrate the output model(s) + * by including metadata fields in the response. * * Returns: * The tag with the given name or ID. @@ -2509,7 +2516,7 @@ export type components = { */ updated?: string; /** Tags associated with the model */ - tags: components["schemas"]["TagResponseModel"][]; + tags: components["schemas"]["TagResponse"][]; }; /** * ArtifactResponseMetadata @@ -2638,7 +2645,7 @@ export type components = { /** Data type of the artifact. */ data_type: components["schemas"]["Source"]; /** Tags associated with the model */ - tags: components["schemas"]["TagResponseModel"][]; + tags: components["schemas"]["TagResponse"][]; }; /** * ArtifactVersionResponseMetadata @@ -3271,6 +3278,7 @@ export type components = { name?: string; /** Version */ version?: string; + model_version?: components["schemas"]["ModelVersion"]; }; /** * FlavorRequest @@ -3642,7 +3650,7 @@ export type components = { /** The user who created this resource. */ user?: components["schemas"]["UserResponse"]; /** Tags associated with the model */ - tags: components["schemas"]["TagResponseModel"][]; + tags: components["schemas"]["TagResponse"][]; /** Latest Version */ latest_version?: string; }; @@ -3789,10 +3797,10 @@ export type components = { */ is_model_artifact?: boolean; /** - * Is Endpoint Artifact + * Is Deployment Artifact * @default false */ - is_endpoint_artifact?: boolean; + is_deployment_artifact?: boolean; }; /** * ModelVersionArtifactResponse @@ -3846,10 +3854,10 @@ export type components = { */ is_model_artifact?: boolean; /** - * Is Endpoint Artifact + * Is Deployment Artifact * @default false */ - is_endpoint_artifact?: boolean; + is_deployment_artifact?: boolean; }; /** * ModelVersionPipelineRunRequest @@ -4047,11 +4055,11 @@ export type components = { [key: string]: unknown; }; /** - * Endpoint Artifact Ids - * @description Endpoint artifacts linked to the model version + * Deployment Artifact Ids + * @description Deployment artifacts linked to the model version * @default {} */ - endpoint_artifact_ids?: { + deployment_artifact_ids?: { [key: string]: unknown; }; /** @@ -4062,19 +4070,11 @@ export type components = { pipeline_run_ids?: { [key: string]: unknown; }; - /** - * Run Metadata - * @description Metadata linked to the model version - * @default {} - */ - run_metadata?: { - [key: string]: unknown; - }; /** * Tags associated with the model version * @default [] */ - tags?: components["schemas"]["TagResponseModel"][]; + tags?: components["schemas"]["TagResponse"][]; }; /** * ModelVersionResponseMetadata @@ -4089,7 +4089,8 @@ export type components = { */ description?: string; /** - * Metadata associated with this pipeline run. + * Run Metadata + * @description Metadata linked to the model version * @default {} */ run_metadata?: { @@ -4593,10 +4594,10 @@ export type components = { items: components["schemas"]["ScheduleResponse"][]; }; /** - * Page[SecretResponseModel] + * Page[SecretResponse] * @description Return Model for List Models to accommodate pagination. */ - Page_SecretResponseModel_: { + Page_SecretResponse_: { /** Index */ index: number; /** Max Size */ @@ -4606,7 +4607,7 @@ export type components = { /** Total */ total: number; /** Items */ - items: components["schemas"]["SecretResponseModel"][]; + items: components["schemas"]["SecretResponse"][]; }; /** * Page[ServiceAccountResponse] @@ -4673,10 +4674,10 @@ export type components = { items: components["schemas"]["StepRunResponse"][]; }; /** - * Page[TagResponseModel] + * Page[TagResponse] * @description Return Model for List Models to accommodate pagination. */ - Page_TagResponseModel_: { + Page_TagResponse_: { /** Index */ index: number; /** Max Size */ @@ -4686,7 +4687,7 @@ export type components = { /** Total */ total: number; /** Items */ - items: components["schemas"]["TagResponseModel"][]; + items: components["schemas"]["TagResponse"][]; }; /** * Page[UserResponse] @@ -5629,10 +5630,10 @@ export type components = { pipeline_id?: string; }; /** - * SecretRequestModel - * @description Secret request model. + * SecretRequest + * @description Request models for secrets. */ - SecretRequestModel: { + SecretRequest: { /** * The id of the user that created this resource. * Format: uuid @@ -5656,36 +5657,44 @@ export type components = { }; }; /** - * SecretResponseModel - * @description Secret response model with user and workspace hydrated. + * SecretResponse + * @description Response model for secrets. */ - SecretResponseModel: { + SecretResponse: { /** * The unique resource id. * Format: uuid */ id: string; /** - * Time when this resource was created. - * Format: date-time + * Permission Denied + * @default false */ - created: string; + permission_denied?: boolean; + /** The body of the resource. */ + body?: components["schemas"]["SecretResponseBody"]; + /** The metadata related to this resource. */ + metadata?: components["schemas"]["SecretResponseMetadata"]; + /** The name of the secret. */ + name: string; + }; + /** + * SecretResponseBody + * @description Response body for secrets. + */ + SecretResponseBody: { /** - * Time when this resource was last updated. + * The timestamp when this resource was created. * Format: date-time */ - updated: string; + created?: string; /** - * Missing Permissions - * @default false + * The timestamp when this resource was last updated. + * Format: date-time */ - missing_permissions?: boolean; - /** The user that created this resource. */ - user?: components["schemas"]["UserResponse"] | null; - /** The workspace of this resource. */ - workspace: components["schemas"]["WorkspaceResponse"]; - /** The name of the secret. */ - name: string; + updated?: string; + /** The user who created this resource. */ + user?: components["schemas"]["UserResponse"]; /** * The scope of the secret. * @default workspace @@ -5696,6 +5705,14 @@ export type components = { [key: string]: unknown; }; }; + /** + * SecretResponseMetadata + * @description Response metadata for secrets. + */ + SecretResponseMetadata: { + /** The workspace of this resource. */ + workspace: components["schemas"]["WorkspaceResponse"]; + }; /** * SecretScope * @description Enum for the scope of a secret. @@ -5703,10 +5720,10 @@ export type components = { */ SecretScope: "workspace" | "user"; /** - * SecretUpdateModel + * SecretUpdate * @description Secret update model. */ - SecretUpdateModel: { + SecretUpdate: { /** * The id of the user that created this resource. * Format: uuid @@ -6214,7 +6231,7 @@ export type components = { * @description All possible types a `StackComponent` can have. * @enum {string} */ - StackComponentType: "alerter" | "annotator" | "artifact_store" | "container_registry" | "data_validator" | "experiment_tracker" | "feature_store" | "image_builder" | "model_deployer" | "orchestrator" | "secrets_manager" | "step_operator" | "model_registry"; + StackComponentType: "alerter" | "annotator" | "artifact_store" | "container_registry" | "data_validator" | "experiment_tracker" | "feature_store" | "image_builder" | "model_deployer" | "orchestrator" | "step_operator" | "model_registry"; /** * StackRequest * @description Request model for stacks. @@ -6689,10 +6706,10 @@ export type components = { pipeline_parameter_name?: string; }; /** - * TagRequestModel + * TagRequest * @description Request model for tags. */ - TagRequestModel: { + TagRequest: { /** * Name * @description The unique title of the tag. @@ -6702,35 +6719,45 @@ export type components = { color?: components["schemas"]["ColorVariants"]; }; /** - * TagResponseModel + * TagResponse * @description Response model for tags. */ - TagResponseModel: { + TagResponse: { /** * The unique resource id. * Format: uuid */ id: string; /** - * Time when this resource was created. - * Format: date-time - */ - created: string; - /** - * Time when this resource was last updated. - * Format: date-time - */ - updated: string; - /** - * Missing Permissions + * Permission Denied * @default false */ - missing_permissions?: boolean; + permission_denied?: boolean; + /** The body of the resource. */ + body?: components["schemas"]["TagResponseBody"]; + /** The metadata related to this resource. */ + metadata?: components["schemas"]["BaseResponseMetadata"]; /** * Name * @description The unique title of the tag. */ name: string; + }; + /** + * TagResponseBody + * @description Response body for tags. + */ + TagResponseBody: { + /** + * The timestamp when this resource was created. + * Format: date-time + */ + created?: string; + /** + * The timestamp when this resource was last updated. + * Format: date-time + */ + updated?: string; /** @description The color variant assigned to the tag. */ color?: components["schemas"]["ColorVariants"]; /** @@ -6740,10 +6767,10 @@ export type components = { tagged_count: number; }; /** - * TagUpdateModel + * TagUpdate * @description Update model for tags. */ - TagUpdateModel: { + TagUpdate: { /** Name */ name?: string; color?: components["schemas"]["ColorVariants"]; @@ -8957,14 +8984,14 @@ export type operations = { }; requestBody: { content: { - "application/json": components["schemas"]["SecretRequestModel"]; + "application/json": components["schemas"]["SecretRequest"]; }; }; responses: { /** @description Successful Response */ 200: { content: { - "application/json": components["schemas"]["SecretResponseModel"]; + "application/json": components["schemas"]["SecretResponse"]; }; }; /** @description Unauthorized */ @@ -10672,7 +10699,9 @@ export type operations = { * * Args: * secret_filter_model: Filter model used for pagination, sorting, - * filtering + * filtering. + * hydrate: Flag deciding whether to hydrate the output model(s) + * by including metadata fields in the response. * * Returns: * List of secret objects. @@ -10680,6 +10709,7 @@ export type operations = { list_secrets_api_v1_secrets_get: { parameters: { query?: { + hydrate?: boolean; sort_by?: string; logical_operator?: components["schemas"]["LogicalOperators"]; page?: number; @@ -10698,7 +10728,7 @@ export type operations = { /** @description Successful Response */ 200: { content: { - "application/json": components["schemas"]["Page_SecretResponseModel_"]; + "application/json": components["schemas"]["Page_SecretResponse_"]; }; }; /** @description Unauthorized */ @@ -10733,12 +10763,17 @@ export type operations = { * * Args: * secret_id: ID of the secret to get. + * hydrate: Flag deciding whether to hydrate the output model(s) + * by including metadata fields in the response. * * Returns: * A specific secret object. */ get_secret_api_v1_secrets__secret_id__get: { parameters: { + query?: { + hydrate?: boolean; + }; path: { secret_id: string; }; @@ -10747,7 +10782,7 @@ export type operations = { /** @description Successful Response */ 200: { content: { - "application/json": components["schemas"]["SecretResponseModel"]; + "application/json": components["schemas"]["SecretResponse"]; }; }; /** @description Unauthorized */ @@ -10799,14 +10834,14 @@ export type operations = { }; requestBody: { content: { - "application/json": components["schemas"]["SecretUpdateModel"]; + "application/json": components["schemas"]["SecretUpdate"]; }; }; responses: { /** @description Successful Response */ 200: { content: { - "application/json": components["schemas"]["SecretResponseModel"]; + "application/json": components["schemas"]["SecretResponse"]; }; }; /** @description Unauthorized */ @@ -15142,7 +15177,7 @@ export type operations = { artifact_name?: string; only_data_artifacts?: boolean; only_model_artifacts?: boolean; - only_endpoint_artifacts?: boolean; + only_deployment_artifacts?: boolean; }; }; responses: { @@ -15239,7 +15274,8 @@ export type operations = { * Args: * tag_filter_model: Filter model used for pagination, sorting, * filtering - * + * hydrate: Flag deciding whether to hydrate the output model(s) + * by including metadata fields in the response. * * Returns: * The tags according to query filters. @@ -15247,6 +15283,7 @@ export type operations = { list_tags_api_v1_tags_get: { parameters: { query?: { + hydrate?: boolean; sort_by?: string; logical_operator?: components["schemas"]["LogicalOperators"]; page?: number; @@ -15262,7 +15299,7 @@ export type operations = { /** @description Successful Response */ 200: { content: { - "application/json": components["schemas"]["Page_TagResponseModel_"]; + "application/json": components["schemas"]["Page_TagResponse_"]; }; }; /** @description Unauthorized */ @@ -15304,14 +15341,14 @@ export type operations = { create_tag_api_v1_tags_post: { requestBody: { content: { - "application/json": components["schemas"]["TagRequestModel"]; + "application/json": components["schemas"]["TagRequest"]; }; }; responses: { /** @description Successful Response */ 200: { content: { - "application/json": components["schemas"]["TagResponseModel"]; + "application/json": components["schemas"]["TagResponse"]; }; }; /** @description Unauthorized */ @@ -15346,12 +15383,17 @@ export type operations = { * * Args: * tag_name_or_id: The name or ID of the tag to get. + * hydrate: Flag deciding whether to hydrate the output model(s) + * by including metadata fields in the response. * * Returns: * The tag with the given name or ID. */ get_tag_api_v1_tags__tag_name_or_id__get: { parameters: { + query?: { + hydrate?: boolean; + }; path: { tag_name_or_id: string; }; @@ -15360,7 +15402,7 @@ export type operations = { /** @description Successful Response */ 200: { content: { - "application/json": components["schemas"]["TagResponseModel"]; + "application/json": components["schemas"]["TagResponse"]; }; }; /** @description Unauthorized */ @@ -15454,14 +15496,14 @@ export type operations = { }; requestBody: { content: { - "application/json": components["schemas"]["TagUpdateModel"]; + "application/json": components["schemas"]["TagUpdate"]; }; }; responses: { /** @description Successful Response */ 200: { content: { - "application/json": components["schemas"]["TagResponseModel"]; + "application/json": components["schemas"]["TagResponse"]; }; }; /** @description Unauthorized */ diff --git a/src/api/types.ts b/src/api/types.ts index 4f3172303..f1f4299ac 100644 --- a/src/api/types.ts +++ b/src/api/types.ts @@ -18,7 +18,7 @@ export type ServiceConnector = components['schemas']['ServiceConnectorResponse'] export type ServiceConnectorTypes = components['schemas']['ServiceConnectorTypeModel']; //secrets -export type Secret = components['schemas']['SecretResponseModel']; +export type Secret = components['schemas']['SecretResponse']; //runs export type Run = components['schemas']['PipelineRunResponse']; diff --git a/src/ui/layouts/secrets/SecretDetail/Configuration/index.tsx b/src/ui/layouts/secrets/SecretDetail/Configuration/index.tsx index b45285073..4081d099b 100644 --- a/src/ui/layouts/secrets/SecretDetail/Configuration/index.tsx +++ b/src/ui/layouts/secrets/SecretDetail/Configuration/index.tsx @@ -15,13 +15,14 @@ import { useService } from './useService'; import { routePaths } from '../../../../../routes/routePaths'; import { useHistory, useSelector } from '../../../../hooks'; import { workspaceSelectors } from '../../../../../redux/selectors'; +import { Secret } from '../../../../../api/types'; export const Configuration: React.FC<{ secretId: TId; tiles?: any; fetching?: boolean; }> = ({ secretId, fetching }) => { - const { secret } = useService({ secretId }); + const { secret }: { secret: Secret } = useService({ secretId }); const history = useHistory(); const selectedWorkspace = useSelector(workspaceSelectors.selectedWorkspace); @@ -52,7 +53,7 @@ export const Configuration: React.FC<{ label={'Scope'} labelColor="rgba(66, 66, 64, 0.5)" placeholder={'Choose a scope'} - value={secret?.scope} + value={secret?.body?.scope || ''} onChange={() => {}} disabled options={[] as any} @@ -67,7 +68,7 @@ export const Configuration: React.FC<{ - + ( <> - {secret.scope && ( + {secret.body?.scope && ( -
+
- {secret.scope} + {secret.body?.scope}
- + )} @@ -110,13 +110,15 @@ export const GetHeaderCols = ({ ), width: '15%', - renderRow: (secret: any) => { - const initials = getInitialsFromEmail(secret?.user?.name as string); + renderRow: (secret: Secret) => { + const initials = getInitialsFromEmail( + secret?.body?.user?.name as string, + ); return ( -
+
- {secret?.user?.name && ( + {secret?.body?.user?.name && ( {initials} @@ -124,10 +126,13 @@ export const GetHeaderCols = ({ )} - {secret?.user?.name} + {secret?.body?.user?.name}
- + ); }, @@ -141,18 +146,18 @@ export const GetHeaderCols = ({ width: '20%', renderRow: (secret: Secret) => ( <> - {secret.created && ( + {secret.body?.created && ( -
+
- {formatDateToDisplayOnTable(secret.created)} + {formatDateToDisplayOnTable(secret.body?.created)}
)} diff --git a/src/ui/layouts/secrets/Secrets/List/UserName/useService.ts b/src/ui/layouts/secrets/Secrets/List/UserName/useService.ts index 7b3c691a7..cc3c7b9cc 100644 --- a/src/ui/layouts/secrets/Secrets/List/UserName/useService.ts +++ b/src/ui/layouts/secrets/Secrets/List/UserName/useService.ts @@ -19,13 +19,15 @@ export const useService = ({ const dispatch = useDispatch(); const [fetching, setFetching] = useState(false); - const user = useSelector(userSelectors.userForId(secret.user?.id as string)); + const user = useSelector( + userSelectors.userForId(secret.body?.user?.id as string), + ); useEffect(() => { setFetching(true); dispatch( userActions.userForId({ - userId: secret.user?.id as string, + userId: secret.body?.user?.id as string, onSuccess: () => setFetching(false), onFailure: () => setFetching(false), }), diff --git a/src/ui/layouts/secrets/Secrets/List/getHeaderCols.tsx b/src/ui/layouts/secrets/Secrets/List/getHeaderCols.tsx index 31112c71e..d9b0c9079 100644 --- a/src/ui/layouts/secrets/Secrets/List/getHeaderCols.tsx +++ b/src/ui/layouts/secrets/Secrets/List/getHeaderCols.tsx @@ -19,6 +19,7 @@ import { HeaderCol } from '../../../common/Table'; import { SortingHeader } from './ForSorting/SortingHeader'; import { Sorting, SortingDirection } from './ForSorting/types'; import { useService } from './ForSorting/useServiceForSorting'; +import { Secret } from '../../../../../api/types'; export const GetHeaderCols = ({ expendedRow, @@ -76,7 +77,7 @@ export const GetHeaderCols = ({ ), testId: 'Id', width: '20%', - renderRow: (secret: any) => ( + renderRow: (secret: Secret) => (
@@ -118,7 +119,7 @@ export const GetHeaderCols = ({ ), testId: 'Name', width: '30%', - renderRow: (secret: any) => ( + renderRow: (secret: Secret) => (
@@ -152,14 +153,14 @@ export const GetHeaderCols = ({ ), testId: 'Scope', width: '15%', - renderRow: (secret: any) => ( + renderRow: (secret: Secret) => ( -
+
- {secret.scope} + {secret.body?.scope}
- + ), }, @@ -185,13 +186,15 @@ export const GetHeaderCols = ({ ), testId: 'Author', width: '15%', - renderRow: (secret: any) => { - const initials = getInitialsFromEmail(secret?.user?.name as string); + renderRow: (secret: Secret) => { + const initials = getInitialsFromEmail( + secret?.body?.user?.name as string, + ); return ( -
+
- {secret?.user?.name && ( + {secret?.body?.user?.name && ( {initials} @@ -199,10 +202,13 @@ export const GetHeaderCols = ({ )} - {secret?.user?.name} + {secret?.body?.user?.name}
- + ); }, @@ -216,13 +222,15 @@ export const GetHeaderCols = ({ asc: (filteredSecrets: any[]) => _.orderBy( filteredSecrets, - (secret: any) => new Date(secret.created).getTime(), + (secret: Secret) => + new Date(secret.body?.created || '').getTime(), ['asc'], ), desc: (filteredSecrets: any[]) => _.orderBy( filteredSecrets, - (secret: any) => new Date(secret.created).getTime(), + (secret: Secret) => + new Date(secret.body?.created || '').getTime(), ['desc'], ), })} @@ -236,18 +244,18 @@ export const GetHeaderCols = ({ ), testId: 'created_at', width: '20%', - renderRow: (secret: any) => ( + renderRow: (secret: Secret) => ( -
+
- {formatDateToDisplayOnTable(secret.created)} + {formatDateToDisplayOnTable(secret.body?.created || '')}
), diff --git a/src/ui/layouts/secrets/UpdateSecret/UpdateConfig/index.tsx b/src/ui/layouts/secrets/UpdateSecret/UpdateConfig/index.tsx index 6ff83d2b6..d314e1460 100644 --- a/src/ui/layouts/secrets/UpdateSecret/UpdateConfig/index.tsx +++ b/src/ui/layouts/secrets/UpdateSecret/UpdateConfig/index.tsx @@ -36,7 +36,7 @@ export const UpdateConfig: React.FC<{ const workspaces = useSelector(workspaceSelectors.myWorkspaces); const { secret } = useService({ secretId }); const [secretName, setSecretName] = useState(secret?.name); - const [scope, setScope] = useState(secret?.scope); + const [scope, setScope] = useState(secret?.body?.scope); const [inputFields, setInputFields] = useState([]) as any; const [loading, setLoading] = useState(false); const childStateRef = useRef(null); @@ -45,7 +45,7 @@ export const UpdateConfig: React.FC<{ setInputFields(childStateRef.current as any); // eslint-disable-next-line react-hooks/exhaustive-deps }, [childStateRef]); - const valuesIntoArray = Object.entries(secret?.values || {}).map( + const valuesIntoArray = Object.entries(secret?.body?.values || {}).map( ([key, value]) => ({ key, value, diff --git a/src/ui/layouts/secrets/UpdateSecret/getHeaderCols.tsx b/src/ui/layouts/secrets/UpdateSecret/getHeaderCols.tsx index fdde2d581..b25686745 100644 --- a/src/ui/layouts/secrets/UpdateSecret/getHeaderCols.tsx +++ b/src/ui/layouts/secrets/UpdateSecret/getHeaderCols.tsx @@ -78,12 +78,12 @@ export const GetHeaderCols = ({ width: '15%', renderRow: (secret: Secret) => ( -
+
- {secret.scope} + {secret.body?.scope}
- + ), }, @@ -129,16 +129,16 @@ export const GetHeaderCols = ({ width: '20%', renderRow: (secret: Secret) => ( -
+
- {formatDateToDisplayOnTable(secret.created)} + {formatDateToDisplayOnTable(secret.body?.created)}
),