@cobaltcore-dev/aurora 1.3.0 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/ContentHeader-fKKZVu-o.mjs +116 -0
- package/dist/client/ContentHeader-fKKZVu-o.mjs.map +1 -0
- package/dist/client/DeleteFlavorModal-Be2GFiB_.mjs +802 -0
- package/dist/client/DeleteFlavorModal-Be2GFiB_.mjs.map +1 -0
- package/dist/client/{FiltersInput-CKI6zWnm.mjs → FiltersInput-Becwxo_J.mjs} +36 -33
- package/dist/client/FiltersInput-Becwxo_J.mjs.map +1 -0
- package/dist/client/{FloatingIpActionModals-Ch8uozH9.mjs → FloatingIpActionModals-Cq10WljB.mjs} +2 -2
- package/dist/client/{FloatingIpActionModals-Ch8uozH9.mjs.map → FloatingIpActionModals-Cq10WljB.mjs.map} +1 -1
- package/dist/client/ImageToastNotifications-BWfzOUMc.mjs +1135 -0
- package/dist/client/ImageToastNotifications-BWfzOUMc.mjs.map +1 -0
- package/dist/client/RouteIdLevelDefaultError-DPF_x2tG.mjs +26 -0
- package/dist/client/RouteIdLevelDefaultError-DPF_x2tG.mjs.map +1 -0
- package/dist/client/StorageNotFound-B-zVinVD.mjs +30 -0
- package/dist/client/StorageNotFound-B-zVinVD.mjs.map +1 -0
- package/dist/client/_flavorId-0PioWpEp.mjs +276 -0
- package/dist/client/_flavorId-0PioWpEp.mjs.map +1 -0
- package/dist/client/_flavorId-B7fp6Nk8.mjs +22 -0
- package/dist/client/_flavorId-B7fp6Nk8.mjs.map +1 -0
- package/dist/client/{_flavorId-Dg7MS0Af.mjs → _flavorId-CgueqKTs.mjs} +4 -3
- package/dist/client/_flavorId-CgueqKTs.mjs.map +1 -0
- package/dist/client/{_floatingIpId-DNn6ABCB.mjs → _floatingIpId-B8r64AL9.mjs} +6 -6
- package/dist/client/{_floatingIpId-DNn6ABCB.mjs.map → _floatingIpId-B8r64AL9.mjs.map} +1 -1
- package/dist/client/{_floatingIpId-C9xfRWot.mjs → _floatingIpId-lEobpOER.mjs} +2 -2
- package/dist/client/{_floatingIpId-C9xfRWot.mjs.map → _floatingIpId-lEobpOER.mjs.map} +1 -1
- package/dist/client/{_imageId-8JIbFmGB.mjs → _imageId-Ccv8PedW.mjs} +4 -3
- package/dist/client/_imageId-Ccv8PedW.mjs.map +1 -0
- package/dist/client/_imageId-CiqEQB_J.mjs +558 -0
- package/dist/client/_imageId-CiqEQB_J.mjs.map +1 -0
- package/dist/client/_imageId-D9LR-02T.mjs +22 -0
- package/dist/client/_imageId-D9LR-02T.mjs.map +1 -0
- package/dist/client/{_projectId-DPzv0CCp.mjs → _projectId-BDARsteX.mjs} +4 -4
- package/dist/client/_projectId-BDARsteX.mjs.map +1 -0
- package/dist/client/{_projectId-DfeVJy0G.mjs → _projectId-CtyAHqhH.mjs} +2 -2
- package/dist/client/_projectId-CtyAHqhH.mjs.map +1 -0
- package/dist/client/_projectId-D3VOH5lN.mjs +94 -0
- package/dist/client/_projectId-D3VOH5lN.mjs.map +1 -0
- package/dist/client/{_projectId-B3wmSala.mjs → _projectId-ZBk6vka0.mjs} +83 -81
- package/dist/client/_projectId-ZBk6vka0.mjs.map +1 -0
- package/dist/client/{_securityGroupId-C6eHmrx_.mjs → _securityGroupId-BwgZnoiR.mjs} +2 -2
- package/dist/client/_securityGroupId-BwgZnoiR.mjs.map +1 -0
- package/dist/client/{_securityGroupId-DmplhDgt.mjs → _securityGroupId-Cz2NUHdB.mjs} +750 -741
- package/dist/client/_securityGroupId-Cz2NUHdB.mjs.map +1 -0
- package/dist/client/{_storageType-CzZ4u9x_.mjs → _storageType-BNpP1A2N.mjs} +3 -2
- package/dist/client/_storageType-BNpP1A2N.mjs.map +1 -0
- package/dist/client/_storageType-BxSGKhAI.mjs +15 -0
- package/dist/client/_storageType-BxSGKhAI.mjs.map +1 -0
- package/dist/client/_storageType-DZYCmiLt.mjs +30 -0
- package/dist/client/_storageType-DZYCmiLt.mjs.map +1 -0
- package/dist/client/_storageType-UqAMP-8d.mjs +859 -0
- package/dist/client/_storageType-UqAMP-8d.mjs.map +1 -0
- package/dist/client/_storageType-u51_7OwJ.mjs +7 -0
- package/dist/client/_storageType-u51_7OwJ.mjs.map +1 -0
- package/dist/client/components/{Error → Errors}/RouteError.d.ts +5 -0
- package/dist/client/components/Errors/RouteIdLevelDefaultError.d.ts +18 -0
- package/dist/client/components/Errors/ServiceLevelDefaultError.d.ts +9 -0
- package/dist/client/components/ListToolbar/SelectedFilters.d.ts +7 -2
- package/dist/client/components/ListToolbar/types.d.ts +6 -0
- package/dist/client/components/ListToolbar/valueLabels.d.ts +11 -0
- package/dist/client/{flavors-B1SDOPDu.mjs → flavors-Ce3J-cFa.mjs} +2 -2
- package/dist/client/{flavors-B1SDOPDu.mjs.map → flavors-Ce3J-cFa.mjs.map} +1 -1
- package/dist/client/flavors-D5ThLaXO.mjs +666 -0
- package/dist/client/flavors-D5ThLaXO.mjs.map +1 -0
- package/dist/client/floatingips-Cz9k80cc.mjs.map +1 -1
- package/dist/client/{floatingips-DrCvtXtT.mjs → floatingips-DXnRlLvV.mjs} +7 -7
- package/dist/client/{floatingips-DrCvtXtT.mjs.map → floatingips-DXnRlLvV.mjs.map} +1 -1
- package/dist/client/floatingips-HRbuLxiN.mjs +22 -0
- package/dist/client/floatingips-HRbuLxiN.mjs.map +1 -0
- package/dist/client/floatingips-nN1kQmsu.mjs +14 -0
- package/dist/client/floatingips-nN1kQmsu.mjs.map +1 -0
- package/dist/client/{images-BGQv9kKT.mjs → images-C8M3ysWR.mjs} +810 -770
- package/dist/client/images-C8M3ysWR.mjs.map +1 -0
- package/dist/client/{images-CPmMa4SQ.mjs → images-Cf5R28NR.mjs} +2 -2
- package/dist/client/{images-CPmMa4SQ.mjs.map → images-Cf5R28NR.mjs.map} +1 -1
- package/dist/client/index.js +419 -415
- package/dist/client/index.js.map +1 -1
- package/dist/client/{objects-BR3eeSNH.mjs → objects-BudUAfWY.mjs} +5478 -5519
- package/dist/client/objects-BudUAfWY.mjs.map +1 -0
- package/dist/client/objects-Dc7sKUr8.mjs +67 -0
- package/dist/client/objects-Dc7sKUr8.mjs.map +1 -0
- package/dist/client/objects-Dw7oeTq2.mjs +80 -0
- package/dist/client/objects-Dw7oeTq2.mjs.map +1 -0
- package/dist/client/objects-_g7nGIn5.mjs +25 -0
- package/dist/client/objects-_g7nGIn5.mjs.map +1 -0
- package/dist/client/objects-eBxvY6_n.mjs +78 -0
- package/dist/client/objects-eBxvY6_n.mjs.map +1 -0
- package/dist/client/projects-yiK0HGSA.mjs.map +1 -1
- package/dist/client/{securitygroups-DEJQBcxm.mjs → securitygroups-67fFxiwt.mjs} +2 -2
- package/dist/client/{securitygroups-DEJQBcxm.mjs.map → securitygroups-67fFxiwt.mjs.map} +1 -1
- package/dist/client/securitygroups-CtKne8UQ.mjs.map +1 -1
- package/dist/client/securitygroups-DXrfyuVF.mjs +580 -0
- package/dist/client/securitygroups-DXrfyuVF.mjs.map +1 -0
- package/dist/client/securitygroups-WLB1_IM6.mjs +22 -0
- package/dist/client/securitygroups-WLB1_IM6.mjs.map +1 -0
- package/dist/client/securitygroups-o0IXZM6S.mjs +14 -0
- package/dist/client/securitygroups-o0IXZM6S.mjs.map +1 -0
- package/dist/client/serviceCatalog-B3lKWC9V.mjs +6 -0
- package/dist/client/serviceCatalog-B3lKWC9V.mjs.map +1 -0
- package/dist/client/storageProviders-CJ5rOh13.mjs +15 -0
- package/dist/client/storageProviders-CJ5rOh13.mjs.map +1 -0
- package/dist/client/trpcClient.d.ts +102 -4
- package/dist/client/useModalTracking-BYd37pXm.mjs +37 -0
- package/dist/client/useModalTracking-BYd37pXm.mjs.map +1 -0
- package/dist/client/useSecurityGroupPermissions--hK4aR8Y.mjs +294 -0
- package/dist/client/useSecurityGroupPermissions--hK4aR8Y.mjs.map +1 -0
- package/dist/client/utils/serviceCatalog.d.ts +9 -0
- package/dist/client/utils/storageProviders.d.ts +44 -0
- package/dist/server/index.d.ts +102 -4
- package/dist/server/index.js +1319 -416
- package/package.json +4 -4
- package/dist/client/ContentHeader-CPJbgYWn.mjs +0 -115
- package/dist/client/ContentHeader-CPJbgYWn.mjs.map +0 -1
- package/dist/client/DeleteFlavorModal-V44QCJBd.mjs +0 -773
- package/dist/client/DeleteFlavorModal-V44QCJBd.mjs.map +0 -1
- package/dist/client/FiltersInput-CKI6zWnm.mjs.map +0 -1
- package/dist/client/ImageToastNotifications-m6c3tVPb.mjs +0 -1152
- package/dist/client/ImageToastNotifications-m6c3tVPb.mjs.map +0 -1
- package/dist/client/_flavorId-Dg7MS0Af.mjs.map +0 -1
- package/dist/client/_flavorId-kHl-b8rI.mjs +0 -232
- package/dist/client/_flavorId-kHl-b8rI.mjs.map +0 -1
- package/dist/client/_imageId-8JIbFmGB.mjs.map +0 -1
- package/dist/client/_imageId-BBAlRioC.mjs +0 -574
- package/dist/client/_imageId-BBAlRioC.mjs.map +0 -1
- package/dist/client/_projectId-7Nl1MQTJ.mjs +0 -99
- package/dist/client/_projectId-7Nl1MQTJ.mjs.map +0 -1
- package/dist/client/_projectId-B3wmSala.mjs.map +0 -1
- package/dist/client/_projectId-DPzv0CCp.mjs.map +0 -1
- package/dist/client/_projectId-DfeVJy0G.mjs.map +0 -1
- package/dist/client/_securityGroupId-C6eHmrx_.mjs.map +0 -1
- package/dist/client/_securityGroupId-DmplhDgt.mjs.map +0 -1
- package/dist/client/_storageType-BRWWJtow.mjs +0 -14
- package/dist/client/_storageType-BRWWJtow.mjs.map +0 -1
- package/dist/client/_storageType-C5gS9eut.mjs +0 -845
- package/dist/client/_storageType-C5gS9eut.mjs.map +0 -1
- package/dist/client/_storageType-CzZ4u9x_.mjs.map +0 -1
- package/dist/client/_storageType-zeSZe--V.mjs +0 -7
- package/dist/client/_storageType-zeSZe--V.mjs.map +0 -1
- package/dist/client/flavors-D8_PzQUB.mjs +0 -628
- package/dist/client/flavors-D8_PzQUB.mjs.map +0 -1
- package/dist/client/images-BGQv9kKT.mjs.map +0 -1
- package/dist/client/objects-AERkhfiM.mjs +0 -66
- package/dist/client/objects-AERkhfiM.mjs.map +0 -1
- package/dist/client/objects-BR3eeSNH.mjs.map +0 -1
- package/dist/client/objects-DVccbrL1.mjs +0 -66
- package/dist/client/objects-DVccbrL1.mjs.map +0 -1
- package/dist/client/securitygroups-BjhgLBHm.mjs +0 -620
- package/dist/client/securitygroups-BjhgLBHm.mjs.map +0 -1
- package/dist/client/useModalTracking-BcOKTYRN.mjs +0 -33
- package/dist/client/useModalTracking-BcOKTYRN.mjs.map +0 -1
- package/dist/client/useSecurityGroupPermissions-BOyLQLdC.mjs +0 -227
- package/dist/client/useSecurityGroupPermissions-BOyLQLdC.mjs.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"_imageId-8JIbFmGB.mjs","names":["createFileRoute","redirect","z","getServiceIndex","GlanceImage","MemberStatus","Route","staticData","section","service","analytics","name","RouteInfo","validateSearch","object","tab","enum","optional","loader","context","params","image","trpcClient","compute","getImageById","query","project_id","projectId","imageId","imageTitle","id","head","loaderData","meta","title","component","lazyRouteComponent","$$splitComponentImporter","beforeLoad","availableServices","auth","getAvailableServices","serviceIndex","to"],"sources":["../../src/client/routes/_auth/projects/$projectId/compute/images/$imageId.tsx"],"sourcesContent":["import {\n Button,\n Stack,\n Status,\n PopupMenu,\n PopupMenuToggle,\n PopupMenuOptions,\n PopupMenuItem,\n toast,\n} from \"@cloudoperators/juno-ui-components/index\"\nimport { createFileRoute, redirect, useNavigate, useParams, useSearch } from \"@tanstack/react-router\"\nimport { z } from \"zod\"\nimport type { RouteInfo } from \"@/client/routes/routeInfo\"\nimport { Trans, useLingui } from \"@lingui/react/macro\"\nimport { getServiceIndex } from \"@/server/Authentication/helpers\"\nimport { trpcReact } from \"@/client/trpcClient\"\nimport { useSetBreadcrumb } from \"@/client/hooks/useSetBreadcrumb\"\nimport { ImageDetailsView } from \"./-components/ImageDetailsView\"\nimport { EditImageDetailsModal } from \"./-components/EditImageDetailsModal\"\nimport { EditImageMetadataModal } from \"./-components/EditImageMetadataModal\"\nimport { DeleteImageModal } from \"./-components/DeleteImageModal\"\nimport { ActivateImageModal } from \"./-components/ActivateImageModal\"\nimport { DeactivateImageModal } from \"./-components/DeactivateImageModal\"\nimport { IMAGE_STATUSES, IMAGE_VISIBILITY } from \"../-constants/filters\"\nimport { GlanceImage, MemberStatus } from \"@/server/Compute/types/image\"\nimport { TRPCClientError } from \"@trpc/client\"\nimport { InferrableClientTypes } from \"@trpc/server/unstable-core-do-not-import\"\nimport {\n getImageAccessStatusUpdatedToast,\n getImageAccessStatusErrorToast,\n getImageUpdatedToast,\n getImageActivatedToast,\n getImageActivationErrorToast,\n getImageDeactivatedToast,\n getImageDeactivationErrorToast,\n getImageVisibilityUpdatedToast,\n getImageVisibilityUpdateErrorToast,\n} from \"./-components/ImageToastNotifications\"\nimport { useState } from \"react\"\nimport { ContentHeader } from \"@/client/components/ContentHeader/ContentHeader\"\n\nexport const Route = createFileRoute(\"/_auth/projects/$projectId/compute/images/$imageId\")({\n staticData: {\n section: \"compute\",\n service: \"images\",\n analytics: {\n name: \"compute.images.detail\",\n },\n } satisfies RouteInfo,\n validateSearch: z.object({\n tab: z.enum([\"details\", \"sharing\"]).optional(),\n }),\n loader: async ({ context, params }) => {\n try {\n const image = await context.trpcClient?.compute.getImageById.query({\n project_id: params.projectId,\n imageId: params.imageId,\n })\n return { imageTitle: (image?.name as string | undefined) ?? image?.id ?? null }\n } catch {\n return { imageTitle: null }\n }\n },\n head: ({ loaderData }) => ({\n meta: [{ title: loaderData?.imageTitle ?? \"Image Details\" }],\n }),\n component: RouteComponent,\n beforeLoad: async ({ context, params }) => {\n const { trpcClient } = context\n const { projectId } = params\n\n const availableServices = (await trpcClient?.auth.getAvailableServices.query()) || []\n\n const serviceIndex = getServiceIndex(availableServices)\n\n // Redirect to the \"Projects Overview\" page if none of compute services available\n if (!serviceIndex[\"image\"] && !serviceIndex[\"compute\"]) {\n throw redirect({\n to: \"/projects/$projectId\",\n params: { projectId },\n })\n }\n\n if (!serviceIndex[\"image\"][\"glance\"]) {\n // Redirect to the \"Compute Services Overview\" page if the \"Glance\" service is not available\n throw redirect({\n to: \"/projects/$projectId\",\n params: { projectId: params.projectId },\n })\n }\n },\n})\n\nfunction RouteComponent() {\n const { projectId, imageId } = useParams({\n from: \"/_auth/projects/$projectId/compute/images/$imageId\",\n })\n const { tab } = useSearch({\n from: \"/_auth/projects/$projectId/compute/images/$imageId\",\n })\n\n const navigate = useNavigate()\n const { t } = useLingui()\n\n const {\n data: image,\n status,\n error,\n } = trpcReact.compute.getImageById.useQuery({ project_id: projectId, imageId: imageId })\n\n useSetBreadcrumb(Route.id, image?.name as string | undefined)\n\n const { data: permissionsData } = trpcReact.compute.canUser.useQuery({\n project_id: projectId,\n permission: [\n \"images:delete\",\n \"images:update\",\n \"images:create_member\",\n \"images:delete_member\",\n \"images:update_member\",\n ],\n })\n\n const permissions = {\n canDelete: permissionsData?.[0] ?? false,\n canUpdate: permissionsData?.[1] ?? false,\n canCreateMember: permissionsData?.[2] ?? false,\n canDeleteMember: permissionsData?.[3] ?? false,\n canUpdateMember: permissionsData?.[4] ?? false,\n }\n\n const utils = trpcReact.useUtils()\n\n const [editDetailsModalOpen, setEditDetailsModalOpen] = useState(false)\n const [editMetadataModalOpen, setEditMetadataModalOpen] = useState(false)\n const [deleteModalOpen, setDeleteModalOpen] = useState(false)\n const [activateModalOpen, setActivateModalOpen] = useState(false)\n const [deactivateModalOpen, setDeactivateModalOpen] = useState(false)\n\n const updateImageMutation = trpcReact.compute.updateImage.useMutation({\n onSuccess: (updatedImage) => {\n utils.compute.getImageById.setData({ project_id: projectId, imageId }, updatedImage)\n utils.compute.listImagesWithPagination.invalidate()\n },\n })\n\n const deleteImageMutation = trpcReact.compute.deleteImage.useMutation({\n onSuccess: () => {\n utils.compute.listImagesWithPagination.invalidate()\n },\n })\n\n const deactivateImageMutation = trpcReact.compute.deactivateImage.useMutation({\n onSuccess: () => {\n utils.compute.getImageById.invalidate({ project_id: projectId, imageId })\n },\n })\n\n const reactivateImageMutation = trpcReact.compute.reactivateImage.useMutation({\n onSuccess: () => {\n utils.compute.getImageById.invalidate({ project_id: projectId, imageId })\n },\n })\n\n const updateImageVisibilityMutation = trpcReact.compute.updateImageVisibility.useMutation({\n onSuccess: (updatedImage) => {\n utils.compute.getImageById.setData({ project_id: projectId, imageId }, updatedImage)\n },\n })\n\n const isSharedWithMe =\n image?.visibility === IMAGE_VISIBILITY.SHARED && image?.owner !== undefined && image?.owner !== projectId\n\n const { data: myMemberData } = trpcReact.compute.getImageMember.useQuery(\n { project_id: projectId, imageId: imageId, memberId: projectId },\n { enabled: isSharedWithMe && !!imageId && !!projectId }\n )\n\n const updateMemberMutation = trpcReact.compute.updateImageMember.useMutation({\n onSuccess: () => {\n utils.compute.getImageMember.invalidate({ project_id: projectId, imageId: imageId, memberId: projectId })\n utils.compute.listImageMembers.invalidate({ project_id: projectId, imageId: imageId })\n utils.compute.listImagesWithPagination.invalidate()\n utils.compute.listSharedImagesByMemberStatus.invalidate()\n },\n })\n\n const handleMemberStatusChange = async (newStatus: MemberStatus) => {\n try {\n await updateMemberMutation.mutateAsync({ project_id: projectId, imageId, memberId: projectId, status: newStatus })\n const { message, ...options } = getImageAccessStatusUpdatedToast(newStatus)\n toast.info(message, options)\n } catch (error) {\n const errorMessage = (error as TRPCClientError<InferrableClientTypes>)?.message\n const { message, ...options } = getImageAccessStatusErrorToast(errorMessage)\n toast.error(message, options)\n }\n }\n\n const handleBack = () => {\n navigate({\n to: \"/projects/$projectId/compute/images\",\n params: { projectId },\n })\n }\n\n const isLoading =\n updateImageMutation.isPending ||\n deleteImageMutation.isPending ||\n deactivateImageMutation.isPending ||\n reactivateImageMutation.isPending ||\n updateImageVisibilityMutation.isPending\n\n const convertToJsonPatchOperations = (\n updatedProperties: Partial<GlanceImage>,\n originalImage: GlanceImage\n ): Array<{ op: \"add\" | \"replace\" | \"remove\"; path: string; value?: unknown }> => {\n const operations: Array<{ op: \"add\" | \"replace\" | \"remove\"; path: string; value?: unknown }> = []\n Object.entries(updatedProperties).forEach(([key, value]) => {\n const path = `/${key}`\n if (value === null || value === undefined) {\n if (key in originalImage) operations.push({ op: \"remove\", path })\n } else {\n const propertyExists = key in originalImage\n operations.push({ op: propertyExists ? \"replace\" : \"add\", path, value })\n }\n })\n return operations\n }\n\n const handleSaveEdit = async (updatedProperties: Partial<GlanceImage>): Promise<boolean> => {\n if (!image) return false\n const operations = convertToJsonPatchOperations(updatedProperties, image)\n try {\n await updateImageMutation.mutateAsync({ project_id: projectId, imageId, operations })\n setEditDetailsModalOpen(false)\n const { message, ...options } = getImageUpdatedToast(String(image.name ?? image.id))\n toast.success(message, options)\n return true\n } catch {\n return false\n }\n }\n\n const handleDelete = async (deletedImage: GlanceImage) => {\n try {\n await deleteImageMutation.mutateAsync({ project_id: projectId, imageId: deletedImage.id })\n setDeleteModalOpen(false)\n handleBack()\n } catch {\n setDeleteModalOpen(false)\n }\n }\n\n const handleActivate = async (img: GlanceImage) => {\n try {\n await reactivateImageMutation.mutateAsync({ project_id: projectId, imageId: img.id })\n setActivateModalOpen(false)\n const { message, ...options } = getImageActivatedToast(String(img.name ?? img.id))\n toast.success(message, options)\n } catch (error) {\n setActivateModalOpen(false)\n const { message, ...options } = getImageActivationErrorToast(img.id, (error as Error)?.message ?? \"\")\n toast.error(message, options)\n }\n }\n\n const handleDeactivate = async (img: GlanceImage) => {\n try {\n await deactivateImageMutation.mutateAsync({ project_id: projectId, imageId: img.id })\n setDeactivateModalOpen(false)\n const { message, ...options } = getImageDeactivatedToast(String(img.name ?? img.id))\n toast.success(message, options)\n } catch (error) {\n setDeactivateModalOpen(false)\n const { message, ...options } = getImageDeactivationErrorToast(img.id, (error as Error)?.message ?? \"\")\n toast.error(message, options)\n }\n }\n\n const handleUpdateVisibility = async (newVisibility: \"public\" | \"private\" | \"shared\" | \"community\") => {\n if (!image) return\n try {\n await updateImageVisibilityMutation.mutateAsync({\n project_id: projectId,\n imageId: image.id,\n visibility: newVisibility,\n })\n const { message, ...options } = getImageVisibilityUpdatedToast(String(image.name ?? image.id), newVisibility)\n toast.success(message, options)\n } catch (error) {\n const { message, ...options } = getImageVisibilityUpdateErrorToast(\n String(image.name ?? image.id),\n (error as Error)?.message ?? \"\"\n )\n toast.error(message, options)\n }\n }\n\n // Handle loading state\n if (status === \"pending\") {\n return <Status status=\"progress\" title={t`Loading Image Details...`} />\n }\n\n // Handle error state\n if (status === \"error\") {\n const errorMessage = error?.message || \"Unknown error\"\n\n return (\n <Stack className=\"fixed inset-0\" distribution=\"center\" alignment=\"center\" direction=\"vertical\" gap=\"5\">\n <p className=\"text-theme-error font-semibold\">\n <Trans>Error loading image</Trans>\n </p>\n <p className=\"text-theme-highest\">{errorMessage}</p>\n <Button onClick={handleBack} variant=\"primary\">\n <Trans>Back to Images</Trans>\n </Button>\n </Stack>\n )\n }\n\n // Handle no data state\n if (!image) {\n return (\n <Stack className=\"fixed inset-0\" distribution=\"center\" alignment=\"center\" direction=\"vertical\" gap=\"5\">\n <p className=\"text-theme-highest\">\n <Trans>Image not found</Trans>\n </p>\n <Button onClick={handleBack} variant=\"primary\">\n <Trans>Back to Images</Trans>\n </Button>\n </Stack>\n )\n }\n\n const isDeactivated = image.status === IMAGE_STATUSES.DEACTIVATED\n const isPrivate = image.visibility === IMAGE_VISIBILITY.PRIVATE\n const isMemberAccepted = myMemberData?.status === \"accepted\"\n const isImageOwner = image.owner === projectId\n\n const canRejectSharedImage = isSharedWithMe && isMemberAccepted && permissions.canUpdateMember\n const canUpdateOwnImage = !isSharedWithMe && permissions.canUpdate\n const canDeleteOwnImage = !isSharedWithMe && permissions.canDelete && !image.protected\n const canManageSharing =\n !isSharedWithMe &&\n isImageOwner &&\n image.visibility === IMAGE_VISIBILITY.SHARED &&\n (permissions.canCreateMember || permissions.canDeleteMember)\n\n const hasMoreActions = canRejectSharedImage || canUpdateOwnImage || canDeleteOwnImage || canManageSharing\n\n const headerActions = (hasMoreActions || (!isSharedWithMe && permissions.canUpdate)) && (\n <Stack gap=\"0.5\" alignment=\"center\">\n {(hasMoreActions || (!isSharedWithMe && permissions.canUpdate)) && (\n <PopupMenu className=\"flex items-center\">\n <PopupMenuToggle as=\"div\">\n <Button icon=\"moreVert\" title={t`More Actions`} disabled={isLoading} />\n </PopupMenuToggle>\n <PopupMenuOptions>\n {!isSharedWithMe && permissions.canUpdate && (\n <PopupMenuItem\n onClick={() => setEditMetadataModalOpen(true)}\n label={t`Edit Metadata`}\n disabled={isLoading}\n />\n )}\n {canRejectSharedImage && (\n <PopupMenuItem label={t`Reject`} onClick={() => handleMemberStatusChange(\"rejected\")} />\n )}\n {!isSharedWithMe && permissions.canUpdate && (\n <PopupMenuItem\n label={isDeactivated ? t`Activate` : t`Deactivate`}\n onClick={() => (isDeactivated ? setActivateModalOpen(true) : setDeactivateModalOpen(true))}\n />\n )}\n {!isSharedWithMe && permissions.canUpdate && isPrivate && (\n <PopupMenuItem label={t`Set to \"Shared\"`} onClick={() => handleUpdateVisibility(\"shared\")} />\n )}\n {!isSharedWithMe &&\n isImageOwner &&\n image.visibility === IMAGE_VISIBILITY.SHARED &&\n (permissions.canCreateMember || permissions.canDeleteMember) && (\n <PopupMenuItem\n label={t`Manage Access`}\n onClick={() =>\n navigate({\n to: \"/projects/$projectId/compute/images/$imageId\",\n params: { projectId, imageId: image.id },\n search: { tab: \"sharing\" },\n })\n }\n />\n )}\n {!isSharedWithMe && permissions.canDelete && !image.protected && (\n <PopupMenuItem label={t`Delete`} onClick={() => setDeleteModalOpen(true)} />\n )}\n </PopupMenuOptions>\n </PopupMenu>\n )}\n\n {!isSharedWithMe && permissions.canUpdate && (\n <Button onClick={() => setEditDetailsModalOpen(true)} variant=\"primary\" disabled={isLoading}>\n <Trans>Edit Details</Trans>\n </Button>\n )}\n </Stack>\n )\n\n // Render success state\n return (\n <>\n <ContentHeader title={String(image.name ?? image.id)} projectId={projectId} actions={headerActions} />\n\n <div className=\"mt-3\">\n <ImageDetailsView\n key={image.id}\n image={image}\n currentProjectId={projectId}\n activeTab={tab ?? \"details\"}\n onTabChange={(newTab) =>\n navigate({\n search: { tab: newTab === \"details\" ? undefined : newTab } as unknown as true,\n })\n }\n permissions={{\n canCreateMember: permissions.canCreateMember,\n canDeleteMember: permissions.canDeleteMember,\n canUpdateMember: permissions.canUpdateMember,\n }}\n myMemberData={myMemberData}\n onMemberStatusChange={handleMemberStatusChange}\n isMemberStatusChanging={updateMemberMutation.isPending}\n />\n </div>\n\n {editDetailsModalOpen && (\n <EditImageDetailsModal\n image={image}\n isOpen={editDetailsModalOpen}\n isLoading={updateImageMutation.isPending}\n onClose={() => setEditDetailsModalOpen(false)}\n onSave={handleSaveEdit}\n />\n )}\n\n {editMetadataModalOpen && (\n <EditImageMetadataModal\n image={image}\n isOpen={editMetadataModalOpen}\n isLoading={updateImageMutation.isPending}\n onClose={() => setEditMetadataModalOpen(false)}\n onSave={handleSaveEdit}\n />\n )}\n\n {deleteModalOpen && (\n <DeleteImageModal\n image={image}\n isOpen={deleteModalOpen}\n isLoading={deleteImageMutation.isPending}\n isDisabled={!!image.protected}\n onClose={() => setDeleteModalOpen(false)}\n onDelete={handleDelete}\n />\n )}\n\n {activateModalOpen && (\n <ActivateImageModal\n image={image}\n isOpen={activateModalOpen}\n isLoading={reactivateImageMutation.isPending}\n onClose={() => setActivateModalOpen(false)}\n onActivate={handleActivate}\n />\n )}\n\n {deactivateModalOpen && (\n <DeactivateImageModal\n image={image}\n isOpen={deactivateModalOpen}\n isLoading={deactivateImageMutation.isPending}\n onClose={() => setDeactivateModalOpen(false)}\n onDeactivate={handleDeactivate}\n />\n )}\n </>\n )\n}\n"],"mappings":";;;AAyCA,IAAaM,IAAQN,EAAgB,oDAAA,CAAA,CAAsD;CACzFO,YAAY;EACVC,SAAS;EACTC,SAAS;EACTC,WAAW,EACTC,MAAM,wBACR;CACF;CACAE,gBAAgBX,EAAEY,OAAO,EACvBC,KAAKb,EAAEc,KAAK,CAAC,WAAW,SAAU,CAAA,CAAA,CAAEC,SAAQ,EAC9C,CAAA;CACAC,QAAQ,OAAO,EAAEC,YAASC,gBAAQ;EAChC,IAAI;GACF,IAAMC,IAAQ,MAAMF,EAAQG,YAAYC,QAAQC,aAAaC,MAAM;IACjEC,YAAYN,EAAOO;IACnBC,SAASR,EAAOQ;GAClB,CAAA;GACA,OAAO,EAAEC,YAAaR,GAAOV,QAA+BU,GAAOS,MAAM,KAAK;EAChF,QAAQ;GACN,OAAO,EAAED,YAAY,KAAK;EAC5B;CACF;CACAE,OAAO,EAAEC,qBAAkB,EACzBC,MAAM,CAAC,EAAEC,OAAOF,GAAYH,cAAc,gBAAgB,CAAC,EAC7D;CACAM,WAASC,2CAAA,WAAA;CACTE,YAAY,OAAO,EAAEnB,YAASC,gBAAQ;EACpC,IAAM,EAAEE,kBAAeH,GACjB,EAAEQ,iBAAcP,GAEhBmB,IAAoB,MAAOjB,GAAYkB,KAAKC,qBAAqBhB,MAAAA,KAAY,CAAA,GAE7EiB,IAAevC,EAAgBoC,CAAAA;EAGrC,IAAI,CAACG,EAAa,SAAY,CAACA,EAAa,SAC1C,MAAMzC,EAAS;GACb0C,IAAI;GACJvB,QAAQ,EAAEO,aAAU;EACtB,CAAA;EAGF,IAAI,CAACe,EAAa,MAAS,QAEzB,MAAMzC,EAAS;GACb0C,IAAI;GACJvB,QAAQ,EAAEO,WAAWP,EAAOO,UAAU;EACxC,CAAA;CAEJ;AACF,CAAA"}
|
|
@@ -1,574 +0,0 @@
|
|
|
1
|
-
import { A as e, B as t, D as n, E as r, L as i, M as a, Q as o, at as s, c, g as l, i as u, n as d, ot as f, rt as p, s as m, x as h } from "./build-WuxXRAqf.mjs";
|
|
2
|
-
import { a as g } from "./trpcClient-D7gpR7YG.mjs";
|
|
3
|
-
import { t as ee } from "./_imageId-8JIbFmGB.mjs";
|
|
4
|
-
import { n as _, t as te } from "./ContentHeader-CPJbgYWn.mjs";
|
|
5
|
-
import { t as ne } from "./useSetBreadcrumb-tn7lBaQV.mjs";
|
|
6
|
-
import { t as v } from "./TwoColumnDescriptionList-DKS42RKa.mjs";
|
|
7
|
-
import { A as y, C as re, D as ie, E as ae, F as b, I as x, N as oe, O as se, P as S, S as ce, T as le, _ as ue, d as de, f as fe, g as pe, k as me, p as he, u as ge, w as _e } from "./ImageToastNotifications-m6c3tVPb.mjs";
|
|
8
|
-
import { Fragment as C, jsx as w, jsxs as T } from "react/jsx-runtime";
|
|
9
|
-
import E, { useState as D } from "react";
|
|
10
|
-
import { useNavigate as ve, useParams as ye, useSearch as be } from "@tanstack/react-router";
|
|
11
|
-
import { Trans as O, useLingui as k } from "@lingui/react";
|
|
12
|
-
//#region src/client/routes/_auth/projects/$projectId/compute/images/-components/ImageDetailsView.tsx
|
|
13
|
-
var A = ({ image: e, myMemberData: n, canUpdateMember: r, onStatusChange: i, isLoading: o }) => {
|
|
14
|
-
let { i18n: s, _: c } = k(), l = n.status === b.PENDING, d = n.status === b.REJECTED, f = n.created_at ? new Date(n.created_at).toLocaleString() : s._({ id: "fj5byd" }), p = n.updated_at ? new Date(n.updated_at).toLocaleString() : s._({ id: "fj5byd" }), m = e.owner ?? "";
|
|
15
|
-
return /*#__PURE__*/ T(t, { children: [
|
|
16
|
-
l && /*#__PURE__*/ w("p", {
|
|
17
|
-
className: "text-theme-highest font-semibold",
|
|
18
|
-
children: /*#__PURE__*/ w(O, { id: "/EcdUM" })
|
|
19
|
-
}),
|
|
20
|
-
/*#__PURE__*/ w("p", { children: /*#__PURE__*/ w(O, {
|
|
21
|
-
id: "Uwo8Xw",
|
|
22
|
-
values: {
|
|
23
|
-
ownerProject: m,
|
|
24
|
-
sharedAt: f
|
|
25
|
-
},
|
|
26
|
-
components: { 0: /*#__PURE__*/ w("span", { className: "font-semibold" }) }
|
|
27
|
-
}) }),
|
|
28
|
-
/*#__PURE__*/ T("ul", { children: [
|
|
29
|
-
/*#__PURE__*/ T("li", { children: [
|
|
30
|
-
/*#__PURE__*/ w("span", {
|
|
31
|
-
className: "font-semibold",
|
|
32
|
-
children: /*#__PURE__*/ w(O, { id: "azXlY+" })
|
|
33
|
-
}),
|
|
34
|
-
" ",
|
|
35
|
-
n.status
|
|
36
|
-
] }),
|
|
37
|
-
/*#__PURE__*/ T("li", { children: [
|
|
38
|
-
/*#__PURE__*/ w("span", {
|
|
39
|
-
className: "font-semibold",
|
|
40
|
-
children: /*#__PURE__*/ w(O, { id: "G6AP+o" })
|
|
41
|
-
}),
|
|
42
|
-
" ",
|
|
43
|
-
f
|
|
44
|
-
] }),
|
|
45
|
-
/*#__PURE__*/ T("li", { children: [
|
|
46
|
-
/*#__PURE__*/ w("span", {
|
|
47
|
-
className: "font-semibold",
|
|
48
|
-
children: /*#__PURE__*/ w(O, { id: "pFg+7w" })
|
|
49
|
-
}),
|
|
50
|
-
" ",
|
|
51
|
-
p
|
|
52
|
-
] })
|
|
53
|
-
] }),
|
|
54
|
-
r && (l || d) && /*#__PURE__*/ T(a, { children: [/*#__PURE__*/ w(u, {
|
|
55
|
-
onClick: () => i(b.ACCEPTED),
|
|
56
|
-
disabled: o,
|
|
57
|
-
children: /*#__PURE__*/ w(O, { id: "g3UF2V" })
|
|
58
|
-
}), l && /*#__PURE__*/ w(u, {
|
|
59
|
-
onClick: () => i(b.REJECTED),
|
|
60
|
-
disabled: o,
|
|
61
|
-
children: /*#__PURE__*/ w(O, { id: "1t/NnN" })
|
|
62
|
-
})] })
|
|
63
|
-
] });
|
|
64
|
-
}, j = ({ image: t }) => {
|
|
65
|
-
let { i18n: n, _: r } = k(), i = [
|
|
66
|
-
{
|
|
67
|
-
label: n._({ id: "S0kLOH" }),
|
|
68
|
-
value: /*#__PURE__*/ w(_, { text: t.id })
|
|
69
|
-
},
|
|
70
|
-
{
|
|
71
|
-
label: n._({ id: "6YtxFj" }),
|
|
72
|
-
value: t.name
|
|
73
|
-
},
|
|
74
|
-
{
|
|
75
|
-
label: n._({ id: "uAQUqI" }),
|
|
76
|
-
value: t.status
|
|
77
|
-
},
|
|
78
|
-
{
|
|
79
|
-
label: n._({ id: "Cj2Gtd" }),
|
|
80
|
-
value: /*#__PURE__*/ w(x, { size: t.size })
|
|
81
|
-
},
|
|
82
|
-
{
|
|
83
|
-
label: n._({ id: "Cxgv2U" }),
|
|
84
|
-
value: `${t.min_disk} GB`
|
|
85
|
-
},
|
|
86
|
-
{
|
|
87
|
-
label: n._({ id: "B2Czeb" }),
|
|
88
|
-
value: `${t.min_ram} MB`
|
|
89
|
-
},
|
|
90
|
-
{
|
|
91
|
-
label: n._({ id: "NopYGU" }),
|
|
92
|
-
value: /*#__PURE__*/ w("span", {
|
|
93
|
-
className: "uppercase",
|
|
94
|
-
children: t.disk_format
|
|
95
|
-
})
|
|
96
|
-
},
|
|
97
|
-
{
|
|
98
|
-
label: n._({ id: "6/xipy" }),
|
|
99
|
-
value: /*#__PURE__*/ w("span", {
|
|
100
|
-
className: "uppercase",
|
|
101
|
-
children: t.container_format
|
|
102
|
-
})
|
|
103
|
-
},
|
|
104
|
-
{
|
|
105
|
-
label: n._({ id: "88kg0+" }),
|
|
106
|
-
value: t.created_at ? new Date(t.created_at).toLocaleDateString() : n._({ id: "fj5byd" })
|
|
107
|
-
},
|
|
108
|
-
{
|
|
109
|
-
label: n._({ id: "Llcakz" }),
|
|
110
|
-
value: t.updated_at ? new Date(t.updated_at).toLocaleDateString() : n._({ id: "fj5byd" })
|
|
111
|
-
}
|
|
112
|
-
];
|
|
113
|
-
return /*#__PURE__*/ T(e, {
|
|
114
|
-
px: !1,
|
|
115
|
-
py: !0,
|
|
116
|
-
children: [/*#__PURE__*/ w(s, { children: n._({ id: "nW/hX9" }) }), /*#__PURE__*/ w(v, { items: i })]
|
|
117
|
-
});
|
|
118
|
-
}, M = ({ image: t, currentProjectId: n }) => {
|
|
119
|
-
let { i18n: r, _: i } = k(), a = [
|
|
120
|
-
{
|
|
121
|
-
label: t.visibility === "shared" && t.owner !== void 0 && t.owner !== n ? r._({ id: "20axE5" }) : r._({ id: "YsrbQh" }),
|
|
122
|
-
value: t.owner ? /*#__PURE__*/ w(_, { text: t.owner }) : ""
|
|
123
|
-
},
|
|
124
|
-
{
|
|
125
|
-
label: r._({ id: "2q/Q7x" }),
|
|
126
|
-
value: t.visibility
|
|
127
|
-
},
|
|
128
|
-
{
|
|
129
|
-
label: r._({ id: "644xgx" }),
|
|
130
|
-
value: t.protected ? r._({ id: "l75CjT" }) : r._({ id: "1UzENP" })
|
|
131
|
-
},
|
|
132
|
-
{
|
|
133
|
-
label: r._({ id: "PzgYM9" }),
|
|
134
|
-
value: t?.checksum ? t.checksum : ""
|
|
135
|
-
}
|
|
136
|
-
];
|
|
137
|
-
return /*#__PURE__*/ T(e, {
|
|
138
|
-
px: !1,
|
|
139
|
-
py: !0,
|
|
140
|
-
children: [/*#__PURE__*/ w(s, { children: r._({ id: "a3LDKx" }) }), /*#__PURE__*/ w(v, { items: a })]
|
|
141
|
-
});
|
|
142
|
-
}, N = ({ image: t }) => {
|
|
143
|
-
let { i18n: n, _: i } = k(), a = /* @__PURE__ */ new Set([
|
|
144
|
-
"id",
|
|
145
|
-
"name",
|
|
146
|
-
"status",
|
|
147
|
-
"visibility",
|
|
148
|
-
"size",
|
|
149
|
-
"disk_format",
|
|
150
|
-
"container_format",
|
|
151
|
-
"min_disk",
|
|
152
|
-
"min_ram",
|
|
153
|
-
"owner",
|
|
154
|
-
"protected",
|
|
155
|
-
"created_at",
|
|
156
|
-
"updated_at",
|
|
157
|
-
"checksum"
|
|
158
|
-
]), o = Object.entries(t).filter(([e]) => !a.has(e)).sort(([e], [t]) => e.localeCompare(t)), c = o.length > 0;
|
|
159
|
-
return /*#__PURE__*/ T(e, {
|
|
160
|
-
px: !1,
|
|
161
|
-
py: !0,
|
|
162
|
-
children: [/*#__PURE__*/ w(s, { children: n._({ id: "bc67JN" }) }), c ? /*#__PURE__*/ w(m, {
|
|
163
|
-
alignTerms: "right",
|
|
164
|
-
className: "grid-cols-4",
|
|
165
|
-
children: o.map(([e, t]) => /*#__PURE__*/ T(E.Fragment, { children: [/*#__PURE__*/ w(d, {
|
|
166
|
-
className: "col-span-1",
|
|
167
|
-
children: e
|
|
168
|
-
}), /*#__PURE__*/ w(r, {
|
|
169
|
-
className: "col-span-1",
|
|
170
|
-
children: t == null ? /*#__PURE__*/ w("span", { children: "null" }) : typeof t == "object" ? /*#__PURE__*/ w("span", {
|
|
171
|
-
className: "break-all",
|
|
172
|
-
children: JSON.stringify(t)
|
|
173
|
-
}) : typeof t == "boolean" ? t ? n._({ id: "c+xCSz" }) : n._({ id: "ocUvR+" }) : /*#__PURE__*/ w("span", {
|
|
174
|
-
className: "break-all",
|
|
175
|
-
children: String(t)
|
|
176
|
-
})
|
|
177
|
-
})] }, e))
|
|
178
|
-
}) : /*#__PURE__*/ w("p", {
|
|
179
|
-
className: "text-theme-light",
|
|
180
|
-
children: n._({ id: "9v5VLp" })
|
|
181
|
-
})]
|
|
182
|
-
});
|
|
183
|
-
}, P = (e) => {
|
|
184
|
-
let t = "px-6 py-3 font-semibold border-b-2 transition-colors";
|
|
185
|
-
return e ? `${t} border-theme-accent text-theme-highest` : `${t} border-transparent text-theme-secondary hover:text-theme-high`;
|
|
186
|
-
}, F = ({ image: t, permissions: n, currentProjectId: r }) => {
|
|
187
|
-
let [a, o] = D(!1), [s, c] = D(null), { data: l, isLoading: u } = g.compute.listImageMembers.useQuery({
|
|
188
|
-
project_id: r,
|
|
189
|
-
imageId: t.id
|
|
190
|
-
}, { enabled: !!t.id && !!r });
|
|
191
|
-
return /*#__PURE__*/ T(e, {
|
|
192
|
-
px: !1,
|
|
193
|
-
py: !0,
|
|
194
|
-
children: [s && /*#__PURE__*/ w(i, {
|
|
195
|
-
text: s.text,
|
|
196
|
-
variant: s.type,
|
|
197
|
-
onDismiss: () => c(null),
|
|
198
|
-
className: "mb-4"
|
|
199
|
-
}), /*#__PURE__*/ w(y, {
|
|
200
|
-
image: t,
|
|
201
|
-
imageMembers: l,
|
|
202
|
-
isMembersLoading: u,
|
|
203
|
-
canAdd: n?.canCreateMember ?? !1,
|
|
204
|
-
canRemove: n?.canDeleteMember ?? !1,
|
|
205
|
-
isAddingMember: a,
|
|
206
|
-
setIsAddingMember: o,
|
|
207
|
-
setMessage: c,
|
|
208
|
-
projectId: r
|
|
209
|
-
})]
|
|
210
|
-
});
|
|
211
|
-
}, xe = ({ image: e, currentProjectId: t, activeTab: n = "details", onTabChange: r, permissions: i, myMemberData: a, onMemberStatusChange: s, isMemberStatusChanging: c, actions: l }) => {
|
|
212
|
-
let { i18n: u, _: d } = k(), f = e.visibility === "shared" && e.owner !== void 0 && e.owner !== t, p = e.owner === t && e.visibility === "shared";
|
|
213
|
-
return /*#__PURE__*/ T(o, {
|
|
214
|
-
direction: "vertical",
|
|
215
|
-
gap: "6",
|
|
216
|
-
children: [
|
|
217
|
-
f && a && s && /*#__PURE__*/ w(A, {
|
|
218
|
-
image: e,
|
|
219
|
-
myMemberData: a,
|
|
220
|
-
canUpdateMember: i?.canUpdateMember ?? !1,
|
|
221
|
-
onStatusChange: s,
|
|
222
|
-
isLoading: c ?? !1
|
|
223
|
-
}),
|
|
224
|
-
p && /*#__PURE__*/ w("div", {
|
|
225
|
-
className: "border-theme-background-lvl-3 border-b",
|
|
226
|
-
children: /*#__PURE__*/ T(o, {
|
|
227
|
-
direction: "horizontal",
|
|
228
|
-
gap: "0",
|
|
229
|
-
children: [/*#__PURE__*/ w("button", {
|
|
230
|
-
className: P(n === "details"),
|
|
231
|
-
onClick: () => r?.("details"),
|
|
232
|
-
children: u._({ id: "URmyfc" })
|
|
233
|
-
}), /*#__PURE__*/ w("button", {
|
|
234
|
-
className: P(n === "sharing"),
|
|
235
|
-
onClick: () => r?.("sharing"),
|
|
236
|
-
children: u._({ id: "aG9OiI" })
|
|
237
|
-
})]
|
|
238
|
-
})
|
|
239
|
-
}),
|
|
240
|
-
(n === "details" || !p) && /*#__PURE__*/ T(C, { children: [
|
|
241
|
-
l,
|
|
242
|
-
/*#__PURE__*/ w(j, { image: e }),
|
|
243
|
-
/*#__PURE__*/ w(M, {
|
|
244
|
-
image: e,
|
|
245
|
-
currentProjectId: t
|
|
246
|
-
}),
|
|
247
|
-
/*#__PURE__*/ w(N, { image: e })
|
|
248
|
-
] }),
|
|
249
|
-
n === "sharing" && p && /*#__PURE__*/ w(F, {
|
|
250
|
-
image: e,
|
|
251
|
-
permissions: i
|
|
252
|
-
})
|
|
253
|
-
]
|
|
254
|
-
});
|
|
255
|
-
};
|
|
256
|
-
//#endregion
|
|
257
|
-
//#region src/client/routes/_auth/projects/$projectId/compute/images/$imageId.tsx?tsr-split=component
|
|
258
|
-
function I() {
|
|
259
|
-
let { projectId: e, imageId: t } = ye({ from: "/_auth/projects/$projectId/compute/images/$imageId" }), { tab: r } = be({ from: "/_auth/projects/$projectId/compute/images/$imageId" }), i = ve(), { i18n: a, _: s } = k(), { data: d, status: m, error: _ } = g.compute.getImageById.useQuery({
|
|
260
|
-
project_id: e,
|
|
261
|
-
imageId: t
|
|
262
|
-
});
|
|
263
|
-
ne(ee.id, d?.name);
|
|
264
|
-
let { data: v } = g.compute.canUser.useQuery({
|
|
265
|
-
project_id: e,
|
|
266
|
-
permission: [
|
|
267
|
-
"images:delete",
|
|
268
|
-
"images:update",
|
|
269
|
-
"images:create_member",
|
|
270
|
-
"images:delete_member",
|
|
271
|
-
"images:update_member"
|
|
272
|
-
]
|
|
273
|
-
}), y = {
|
|
274
|
-
canDelete: v?.[0] ?? !1,
|
|
275
|
-
canUpdate: v?.[1] ?? !1,
|
|
276
|
-
canCreateMember: v?.[2] ?? !1,
|
|
277
|
-
canDeleteMember: v?.[3] ?? !1,
|
|
278
|
-
canUpdateMember: v?.[4] ?? !1
|
|
279
|
-
}, b = g.useUtils(), [x, E] = D(!1), [A, j] = D(!1), [M, N] = D(!1), [P, F] = D(!1), [I, L] = D(!1), R = g.compute.updateImage.useMutation({ onSuccess: (n) => {
|
|
280
|
-
b.compute.getImageById.setData({
|
|
281
|
-
project_id: e,
|
|
282
|
-
imageId: t
|
|
283
|
-
}, n), b.compute.listImagesWithPagination.invalidate();
|
|
284
|
-
} }), z = g.compute.deleteImage.useMutation({ onSuccess: () => {
|
|
285
|
-
b.compute.listImagesWithPagination.invalidate();
|
|
286
|
-
} }), B = g.compute.deactivateImage.useMutation({ onSuccess: () => {
|
|
287
|
-
b.compute.getImageById.invalidate({
|
|
288
|
-
project_id: e,
|
|
289
|
-
imageId: t
|
|
290
|
-
});
|
|
291
|
-
} }), V = g.compute.reactivateImage.useMutation({ onSuccess: () => {
|
|
292
|
-
b.compute.getImageById.invalidate({
|
|
293
|
-
project_id: e,
|
|
294
|
-
imageId: t
|
|
295
|
-
});
|
|
296
|
-
} }), H = g.compute.updateImageVisibility.useMutation({ onSuccess: (n) => {
|
|
297
|
-
b.compute.getImageById.setData({
|
|
298
|
-
project_id: e,
|
|
299
|
-
imageId: t
|
|
300
|
-
}, n);
|
|
301
|
-
} }), U = d?.visibility === S.SHARED && d?.owner !== void 0 && d?.owner !== e, { data: W } = g.compute.getImageMember.useQuery({
|
|
302
|
-
project_id: e,
|
|
303
|
-
imageId: t,
|
|
304
|
-
memberId: e
|
|
305
|
-
}, { enabled: U && !!t && !!e }), G = g.compute.updateImageMember.useMutation({ onSuccess: () => {
|
|
306
|
-
b.compute.getImageMember.invalidate({
|
|
307
|
-
project_id: e,
|
|
308
|
-
imageId: t,
|
|
309
|
-
memberId: e
|
|
310
|
-
}), b.compute.listImageMembers.invalidate({
|
|
311
|
-
project_id: e,
|
|
312
|
-
imageId: t
|
|
313
|
-
}), b.compute.listImagesWithPagination.invalidate(), b.compute.listSharedImagesByMemberStatus.invalidate();
|
|
314
|
-
} }), K = async (n) => {
|
|
315
|
-
try {
|
|
316
|
-
await G.mutateAsync({
|
|
317
|
-
project_id: e,
|
|
318
|
-
imageId: t,
|
|
319
|
-
memberId: e,
|
|
320
|
-
status: n
|
|
321
|
-
});
|
|
322
|
-
let { message: r, ...i } = de(n);
|
|
323
|
-
f.info(r, i);
|
|
324
|
-
} catch (e) {
|
|
325
|
-
let t = e?.message, { message: n, ...r } = ge(t);
|
|
326
|
-
f.error(n, r);
|
|
327
|
-
}
|
|
328
|
-
}, q = () => {
|
|
329
|
-
i({
|
|
330
|
-
to: "/projects/$projectId/compute/images",
|
|
331
|
-
params: { projectId: e }
|
|
332
|
-
});
|
|
333
|
-
}, J = R.isPending || z.isPending || B.isPending || V.isPending || H.isPending, Se = (e, t) => {
|
|
334
|
-
let n = [];
|
|
335
|
-
return Object.entries(e).forEach(([e, r]) => {
|
|
336
|
-
let i = `/${e}`;
|
|
337
|
-
if (r == null) e in t && n.push({
|
|
338
|
-
op: "remove",
|
|
339
|
-
path: i
|
|
340
|
-
});
|
|
341
|
-
else {
|
|
342
|
-
let a = e in t;
|
|
343
|
-
n.push({
|
|
344
|
-
op: a ? "replace" : "add",
|
|
345
|
-
path: i,
|
|
346
|
-
value: r
|
|
347
|
-
});
|
|
348
|
-
}
|
|
349
|
-
}), n;
|
|
350
|
-
}, Y = async (n) => {
|
|
351
|
-
if (!d) return !1;
|
|
352
|
-
let r = Se(n, d);
|
|
353
|
-
try {
|
|
354
|
-
await R.mutateAsync({
|
|
355
|
-
project_id: e,
|
|
356
|
-
imageId: t,
|
|
357
|
-
operations: r
|
|
358
|
-
}), E(!1);
|
|
359
|
-
let { message: n, ...i } = ce(String(d.name ?? d.id));
|
|
360
|
-
return f.success(n, i), !0;
|
|
361
|
-
} catch {
|
|
362
|
-
return !1;
|
|
363
|
-
}
|
|
364
|
-
}, Ce = async (t) => {
|
|
365
|
-
try {
|
|
366
|
-
await z.mutateAsync({
|
|
367
|
-
project_id: e,
|
|
368
|
-
imageId: t.id
|
|
369
|
-
}), N(!1), q();
|
|
370
|
-
} catch {
|
|
371
|
-
N(!1);
|
|
372
|
-
}
|
|
373
|
-
}, we = async (t) => {
|
|
374
|
-
try {
|
|
375
|
-
await V.mutateAsync({
|
|
376
|
-
project_id: e,
|
|
377
|
-
imageId: t.id
|
|
378
|
-
}), F(!1);
|
|
379
|
-
let { message: n, ...r } = fe(String(t.name ?? t.id));
|
|
380
|
-
f.success(n, r);
|
|
381
|
-
} catch (e) {
|
|
382
|
-
F(!1);
|
|
383
|
-
let { message: n, ...r } = he(t.id, e?.message ?? "");
|
|
384
|
-
f.error(n, r);
|
|
385
|
-
}
|
|
386
|
-
}, Te = async (t) => {
|
|
387
|
-
try {
|
|
388
|
-
await B.mutateAsync({
|
|
389
|
-
project_id: e,
|
|
390
|
-
imageId: t.id
|
|
391
|
-
}), L(!1);
|
|
392
|
-
let { message: n, ...r } = pe(String(t.name ?? t.id));
|
|
393
|
-
f.success(n, r);
|
|
394
|
-
} catch (e) {
|
|
395
|
-
L(!1);
|
|
396
|
-
let { message: n, ...r } = ue(t.id, e?.message ?? "");
|
|
397
|
-
f.error(n, r);
|
|
398
|
-
}
|
|
399
|
-
}, Ee = async (t) => {
|
|
400
|
-
if (d) try {
|
|
401
|
-
await H.mutateAsync({
|
|
402
|
-
project_id: e,
|
|
403
|
-
imageId: d.id,
|
|
404
|
-
visibility: t
|
|
405
|
-
});
|
|
406
|
-
let { message: n, ...r } = _e(String(d.name ?? d.id), t);
|
|
407
|
-
f.success(n, r);
|
|
408
|
-
} catch (e) {
|
|
409
|
-
let { message: t, ...n } = re(String(d.name ?? d.id), e?.message ?? "");
|
|
410
|
-
f.error(t, n);
|
|
411
|
-
}
|
|
412
|
-
};
|
|
413
|
-
if (m === "pending") return /*#__PURE__*/ w(p, {
|
|
414
|
-
status: "progress",
|
|
415
|
-
title: a._({ id: "hH3kDo" })
|
|
416
|
-
});
|
|
417
|
-
if (m === "error") {
|
|
418
|
-
let e = _?.message || "Unknown error";
|
|
419
|
-
return /*#__PURE__*/ T(o, {
|
|
420
|
-
className: "fixed inset-0",
|
|
421
|
-
distribution: "center",
|
|
422
|
-
alignment: "center",
|
|
423
|
-
direction: "vertical",
|
|
424
|
-
gap: "5",
|
|
425
|
-
children: [
|
|
426
|
-
/*#__PURE__*/ w("p", {
|
|
427
|
-
className: "text-theme-error font-semibold",
|
|
428
|
-
children: /*#__PURE__*/ w(O, { id: "Jh4rAZ" })
|
|
429
|
-
}),
|
|
430
|
-
/*#__PURE__*/ w("p", {
|
|
431
|
-
className: "text-theme-highest",
|
|
432
|
-
children: e
|
|
433
|
-
}),
|
|
434
|
-
/*#__PURE__*/ w(u, {
|
|
435
|
-
onClick: q,
|
|
436
|
-
variant: "primary",
|
|
437
|
-
children: /*#__PURE__*/ w(O, { id: "bnql/K" })
|
|
438
|
-
})
|
|
439
|
-
]
|
|
440
|
-
});
|
|
441
|
-
}
|
|
442
|
-
if (!d) return /*#__PURE__*/ T(o, {
|
|
443
|
-
className: "fixed inset-0",
|
|
444
|
-
distribution: "center",
|
|
445
|
-
alignment: "center",
|
|
446
|
-
direction: "vertical",
|
|
447
|
-
gap: "5",
|
|
448
|
-
children: [/*#__PURE__*/ w("p", {
|
|
449
|
-
className: "text-theme-highest",
|
|
450
|
-
children: /*#__PURE__*/ w(O, { id: "1pdLQw" })
|
|
451
|
-
}), /*#__PURE__*/ w(u, {
|
|
452
|
-
onClick: q,
|
|
453
|
-
variant: "primary",
|
|
454
|
-
children: /*#__PURE__*/ w(O, { id: "bnql/K" })
|
|
455
|
-
})]
|
|
456
|
-
});
|
|
457
|
-
let X = d.status === oe.DEACTIVATED, De = d.visibility === S.PRIVATE, Oe = W?.status === "accepted", Z = d.owner === e, Q = U && Oe && y.canUpdateMember, ke = !U && y.canUpdate, Ae = !U && y.canDelete && !d.protected, je = !U && Z && d.visibility === S.SHARED && (y.canCreateMember || y.canDeleteMember), $ = Q || ke || Ae || je, Me = ($ || !U && y.canUpdate) && /*#__PURE__*/ T(o, {
|
|
458
|
-
gap: "0.5",
|
|
459
|
-
alignment: "center",
|
|
460
|
-
children: [($ || !U && y.canUpdate) && /*#__PURE__*/ T(n, {
|
|
461
|
-
className: "flex items-center",
|
|
462
|
-
children: [/*#__PURE__*/ w(c, {
|
|
463
|
-
as: "div",
|
|
464
|
-
children: /*#__PURE__*/ w(u, {
|
|
465
|
-
icon: "moreVert",
|
|
466
|
-
title: a._({ id: "PgNNGl" }),
|
|
467
|
-
disabled: J
|
|
468
|
-
})
|
|
469
|
-
}), /*#__PURE__*/ T(l, { children: [
|
|
470
|
-
!U && y.canUpdate && /*#__PURE__*/ w(h, {
|
|
471
|
-
onClick: () => j(!0),
|
|
472
|
-
label: a._({ id: "SIfYq6" }),
|
|
473
|
-
disabled: J
|
|
474
|
-
}),
|
|
475
|
-
Q && /*#__PURE__*/ w(h, {
|
|
476
|
-
label: a._({ id: "1t/NnN" }),
|
|
477
|
-
onClick: () => K("rejected")
|
|
478
|
-
}),
|
|
479
|
-
!U && y.canUpdate && /*#__PURE__*/ w(h, {
|
|
480
|
-
label: X ? a._({ id: "FQBaXG" }) : a._({ id: "5y3O+A" }),
|
|
481
|
-
onClick: () => X ? F(!0) : L(!0)
|
|
482
|
-
}),
|
|
483
|
-
!U && y.canUpdate && De && /*#__PURE__*/ w(h, {
|
|
484
|
-
label: a._({ id: "gMYsdZ" }),
|
|
485
|
-
onClick: () => Ee("shared")
|
|
486
|
-
}),
|
|
487
|
-
!U && Z && d.visibility === S.SHARED && (y.canCreateMember || y.canDeleteMember) && /*#__PURE__*/ w(h, {
|
|
488
|
-
label: a._({ id: "cWbW6w" }),
|
|
489
|
-
onClick: () => i({
|
|
490
|
-
to: "/projects/$projectId/compute/images/$imageId",
|
|
491
|
-
params: {
|
|
492
|
-
projectId: e,
|
|
493
|
-
imageId: d.id
|
|
494
|
-
},
|
|
495
|
-
search: { tab: "sharing" }
|
|
496
|
-
})
|
|
497
|
-
}),
|
|
498
|
-
!U && y.canDelete && !d.protected && /*#__PURE__*/ w(h, {
|
|
499
|
-
label: a._({ id: "cnGeoo" }),
|
|
500
|
-
onClick: () => N(!0)
|
|
501
|
-
})
|
|
502
|
-
] })]
|
|
503
|
-
}), !U && y.canUpdate && /*#__PURE__*/ w(u, {
|
|
504
|
-
onClick: () => E(!0),
|
|
505
|
-
variant: "primary",
|
|
506
|
-
disabled: J,
|
|
507
|
-
children: /*#__PURE__*/ w(O, { id: "Y1YKad" })
|
|
508
|
-
})]
|
|
509
|
-
});
|
|
510
|
-
return /*#__PURE__*/ T(C, { children: [
|
|
511
|
-
/*#__PURE__*/ w(te, {
|
|
512
|
-
title: String(d.name ?? d.id),
|
|
513
|
-
projectId: e,
|
|
514
|
-
actions: Me
|
|
515
|
-
}),
|
|
516
|
-
/*#__PURE__*/ w("div", {
|
|
517
|
-
className: "mt-3",
|
|
518
|
-
children: /*#__PURE__*/ w(xe, {
|
|
519
|
-
image: d,
|
|
520
|
-
currentProjectId: e,
|
|
521
|
-
activeTab: r ?? "details",
|
|
522
|
-
onTabChange: (e) => i({ search: { tab: e === "details" ? void 0 : e } }),
|
|
523
|
-
permissions: {
|
|
524
|
-
canCreateMember: y.canCreateMember,
|
|
525
|
-
canDeleteMember: y.canDeleteMember,
|
|
526
|
-
canUpdateMember: y.canUpdateMember
|
|
527
|
-
},
|
|
528
|
-
myMemberData: W,
|
|
529
|
-
onMemberStatusChange: K,
|
|
530
|
-
isMemberStatusChanging: G.isPending
|
|
531
|
-
}, d.id)
|
|
532
|
-
}),
|
|
533
|
-
x && /*#__PURE__*/ w(me, {
|
|
534
|
-
image: d,
|
|
535
|
-
isOpen: x,
|
|
536
|
-
isLoading: R.isPending,
|
|
537
|
-
onClose: () => E(!1),
|
|
538
|
-
onSave: Y
|
|
539
|
-
}),
|
|
540
|
-
A && /*#__PURE__*/ w(se, {
|
|
541
|
-
image: d,
|
|
542
|
-
isOpen: A,
|
|
543
|
-
isLoading: R.isPending,
|
|
544
|
-
onClose: () => j(!1),
|
|
545
|
-
onSave: Y
|
|
546
|
-
}),
|
|
547
|
-
M && /*#__PURE__*/ w(ie, {
|
|
548
|
-
image: d,
|
|
549
|
-
isOpen: M,
|
|
550
|
-
isLoading: z.isPending,
|
|
551
|
-
isDisabled: !!d.protected,
|
|
552
|
-
onClose: () => N(!1),
|
|
553
|
-
onDelete: Ce
|
|
554
|
-
}),
|
|
555
|
-
P && /*#__PURE__*/ w(ae, {
|
|
556
|
-
image: d,
|
|
557
|
-
isOpen: P,
|
|
558
|
-
isLoading: V.isPending,
|
|
559
|
-
onClose: () => F(!1),
|
|
560
|
-
onActivate: we
|
|
561
|
-
}),
|
|
562
|
-
I && /*#__PURE__*/ w(le, {
|
|
563
|
-
image: d,
|
|
564
|
-
isOpen: I,
|
|
565
|
-
isLoading: B.isPending,
|
|
566
|
-
onClose: () => L(!1),
|
|
567
|
-
onDeactivate: Te
|
|
568
|
-
})
|
|
569
|
-
] });
|
|
570
|
-
}
|
|
571
|
-
//#endregion
|
|
572
|
-
export { I as component };
|
|
573
|
-
|
|
574
|
-
//# sourceMappingURL=_imageId-BBAlRioC.mjs.map
|