@cobaltcore-dev/aurora 2.1.0 → 2.1.1
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/DeleteFlavorModal-C4nAi7gY.mjs +724 -0
- package/dist/client/DeleteFlavorModal-C4nAi7gY.mjs.map +1 -0
- package/dist/client/_flavorId-BPvssEzn.mjs +277 -0
- package/dist/client/_flavorId-BPvssEzn.mjs.map +1 -0
- package/dist/client/{_flavorId-CgueqKTs.mjs → _flavorId-CFUBcU-l.mjs} +3 -3
- package/dist/client/{_flavorId-CgueqKTs.mjs.map → _flavorId-CFUBcU-l.mjs.map} +1 -1
- package/dist/client/{_flavorId-B7fp6Nk8.mjs → _flavorId-CZcIp0Ih.mjs} +2 -2
- package/dist/client/{_flavorId-B7fp6Nk8.mjs.map → _flavorId-CZcIp0Ih.mjs.map} +1 -1
- package/dist/client/_imageId-BAezmV0Y.mjs +526 -0
- package/dist/client/_imageId-BAezmV0Y.mjs.map +1 -0
- package/dist/client/{_imageId-Ccv8PedW.mjs → _imageId-D-jqz3e3.mjs} +3 -3
- package/dist/client/_imageId-D-jqz3e3.mjs.map +1 -0
- package/dist/client/{_imageId-D9LR-02T.mjs → _imageId-gMdrdnVt.mjs} +2 -2
- package/dist/client/_imageId-gMdrdnVt.mjs.map +1 -0
- package/dist/client/{_projectId-BDARsteX.mjs → _projectId-BYccdAtX.mjs} +3 -3
- package/dist/client/{_projectId-BDARsteX.mjs.map → _projectId-BYccdAtX.mjs.map} +1 -1
- package/dist/client/{_projectId-ZBk6vka0.mjs → _projectId-CBjZC1tv.mjs} +5 -5
- package/dist/client/{_projectId-ZBk6vka0.mjs.map → _projectId-CBjZC1tv.mjs.map} +1 -1
- package/dist/client/{_projectId-CtyAHqhH.mjs → _projectId-CLEa1zgw.mjs} +2 -2
- package/dist/client/{_projectId-CtyAHqhH.mjs.map → _projectId-CLEa1zgw.mjs.map} +1 -1
- package/dist/client/{flavors-Ce3J-cFa.mjs → flavors-CJVSNz6R.mjs} +2 -2
- package/dist/client/{flavors-Ce3J-cFa.mjs.map → flavors-CJVSNz6R.mjs.map} +1 -1
- package/dist/client/{flavors-D5ThLaXO.mjs → flavors-CflJDIEH.mjs} +25 -24
- package/dist/client/{flavors-D5ThLaXO.mjs.map → flavors-CflJDIEH.mjs.map} +1 -1
- package/dist/client/imageHelpers-DBhL2ebL.mjs +1272 -0
- package/dist/client/imageHelpers-DBhL2ebL.mjs.map +1 -0
- package/dist/client/{images-C8M3ysWR.mjs → images-BsylWUiH.mjs} +836 -848
- package/dist/client/images-BsylWUiH.mjs.map +1 -0
- package/dist/client/{images-Cf5R28NR.mjs → images-zQq1nSVv.mjs} +2 -2
- package/dist/client/{images-Cf5R28NR.mjs.map → images-zQq1nSVv.mjs.map} +1 -1
- package/dist/client/index.js +10 -9
- package/dist/client/index.js.map +1 -1
- package/dist/client/{securitygroups-DXrfyuVF.mjs → securitygroups-CSmsBzUb.mjs} +104 -103
- package/dist/client/securitygroups-CSmsBzUb.mjs.map +1 -0
- package/dist/client/{securitygroups-67fFxiwt.mjs → securitygroups-T7kaNFEp.mjs} +2 -2
- package/dist/client/{securitygroups-67fFxiwt.mjs.map → securitygroups-T7kaNFEp.mjs.map} +1 -1
- package/dist/client/trpcClient.d.ts +0 -1
- package/dist/client/useErrorTranslation-Dc0eE8Zt.mjs +83 -0
- package/dist/client/useErrorTranslation-Dc0eE8Zt.mjs.map +1 -0
- package/dist/server/index.d.ts +0 -1
- package/dist/server/index.js +786 -534
- package/package.json +2 -2
- package/dist/client/DeleteFlavorModal-Be2GFiB_.mjs +0 -802
- package/dist/client/DeleteFlavorModal-Be2GFiB_.mjs.map +0 -1
- package/dist/client/ImageToastNotifications-BWfzOUMc.mjs +0 -1135
- package/dist/client/ImageToastNotifications-BWfzOUMc.mjs.map +0 -1
- package/dist/client/_flavorId-0PioWpEp.mjs +0 -276
- package/dist/client/_flavorId-0PioWpEp.mjs.map +0 -1
- package/dist/client/_imageId-Ccv8PedW.mjs.map +0 -1
- package/dist/client/_imageId-CiqEQB_J.mjs +0 -558
- package/dist/client/_imageId-CiqEQB_J.mjs.map +0 -1
- package/dist/client/_imageId-D9LR-02T.mjs.map +0 -1
- package/dist/client/images-C8M3ysWR.mjs.map +0 -1
- package/dist/client/securitygroups-DXrfyuVF.mjs.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"_imageId-Ccv8PedW.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","errorComponent","$$splitErrorComponentImporter"],"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 PopupMenuSectionSeparator,\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\"\nimport { RouteIdLevelDefaultError } from \"@/client/components/Errors/RouteIdLevelDefaultError\"\n\nfunction ImageErrorComponent() {\n const { t } = useLingui()\n const navigate = useNavigate()\n const { projectId } = Route.useParams()\n\n return (\n <RouteIdLevelDefaultError\n action={\n <Button\n variant=\"primary\"\n onClick={() => navigate({ to: \"/projects/$projectId/compute/images\", params: { projectId } })}\n >\n {t`Back to Images`}\n </Button>\n }\n />\n )\n}\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 errorComponent: ImageErrorComponent,\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 || t`Unknown Error`\n\n return (\n <RouteIdLevelDefaultError\n errorTitle={t`Error Loading Image`}\n errorDescription={errorMessage}\n action={\n <Button onClick={handleBack} variant=\"primary\">\n <Trans>Back to Images</Trans>\n </Button>\n }\n />\n )\n }\n\n // Handle no data state\n if (!image) {\n return <ImageErrorComponent />\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 <>\n <PopupMenuItem\n label={isDeactivated ? t`Activate` : t`Deactivate`}\n onClick={() => (isDeactivated ? setActivateModalOpen(true) : setDeactivateModalOpen(true))}\n />\n <PopupMenuItem\n onClick={() => setEditMetadataModalOpen(true)}\n label={t`Edit Metadata`}\n disabled={isLoading}\n />\n </>\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 {canRejectSharedImage && (\n <PopupMenuItem label={t`Reject`} onClick={() => handleMemberStatusChange(\"rejected\")} />\n )}\n {!isSharedWithMe && permissions.canUpdate && isPrivate && (\n <PopupMenuItem label={t`Set to \"Shared\"`} onClick={() => handleUpdateVisibility(\"shared\")} />\n )}\n {!isSharedWithMe && permissions.canDelete && !image.protected && (\n <>\n <PopupMenuSectionSeparator />\n <PopupMenuItem label={t`Delete`} onClick={() => setDeleteModalOpen(true)} />\n </>\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":";;;AA8DA,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;CACAiB,gBAAcR,2CAAA,gBAAA;AAChB,CAAA"}
|
|
@@ -1,558 +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, r as p, rt as m, s as h, x as g } from "./build-WuxXRAqf.mjs";
|
|
2
|
-
import { a as _ } from "./trpcClient-D7gpR7YG.mjs";
|
|
3
|
-
import { t as v } from "./_imageId-Ccv8PedW.mjs";
|
|
4
|
-
import { t as ee } from "./RouteIdLevelDefaultError-DPF_x2tG.mjs";
|
|
5
|
-
import { n as y, t as te } from "./ContentHeader-fKKZVu-o.mjs";
|
|
6
|
-
import { t as ne } from "./useSetBreadcrumb-tn7lBaQV.mjs";
|
|
7
|
-
import { A as b, C as re, D as ie, E as ae, F as x, I as S, N as oe, O as se, P as C, 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-BWfzOUMc.mjs";
|
|
8
|
-
import { t as w } from "./TwoColumnDescriptionList-DKS42RKa.mjs";
|
|
9
|
-
import { Fragment as T, jsx as E, jsxs as D } from "react/jsx-runtime";
|
|
10
|
-
import O, { useState as k } from "react";
|
|
11
|
-
import { useNavigate as A, useParams as ve, useSearch as ye } from "@tanstack/react-router";
|
|
12
|
-
import { Trans as j, useLingui as M } from "@lingui/react";
|
|
13
|
-
//#region src/client/routes/_auth/projects/$projectId/compute/images/-components/ImageDetailsView.tsx
|
|
14
|
-
var N = ({ image: e, myMemberData: n, canUpdateMember: r, onStatusChange: i, isLoading: o }) => {
|
|
15
|
-
let { i18n: s, _: c } = M(), l = n.status === x.PENDING, d = n.status === x.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 ?? "";
|
|
16
|
-
return /*#__PURE__*/ D(t, { children: [
|
|
17
|
-
l && /*#__PURE__*/ E("p", {
|
|
18
|
-
className: "text-theme-highest font-semibold",
|
|
19
|
-
children: /*#__PURE__*/ E(j, { id: "/EcdUM" })
|
|
20
|
-
}),
|
|
21
|
-
/*#__PURE__*/ E("p", { children: /*#__PURE__*/ E(j, {
|
|
22
|
-
id: "Uwo8Xw",
|
|
23
|
-
values: {
|
|
24
|
-
ownerProject: m,
|
|
25
|
-
sharedAt: f
|
|
26
|
-
},
|
|
27
|
-
components: { 0: /*#__PURE__*/ E("span", { className: "font-semibold" }) }
|
|
28
|
-
}) }),
|
|
29
|
-
/*#__PURE__*/ D("ul", { children: [
|
|
30
|
-
/*#__PURE__*/ D("li", { children: [
|
|
31
|
-
/*#__PURE__*/ E("span", {
|
|
32
|
-
className: "font-semibold",
|
|
33
|
-
children: /*#__PURE__*/ E(j, { id: "azXlY+" })
|
|
34
|
-
}),
|
|
35
|
-
" ",
|
|
36
|
-
n.status
|
|
37
|
-
] }),
|
|
38
|
-
/*#__PURE__*/ D("li", { children: [
|
|
39
|
-
/*#__PURE__*/ E("span", {
|
|
40
|
-
className: "font-semibold",
|
|
41
|
-
children: /*#__PURE__*/ E(j, { id: "G6AP+o" })
|
|
42
|
-
}),
|
|
43
|
-
" ",
|
|
44
|
-
f
|
|
45
|
-
] }),
|
|
46
|
-
/*#__PURE__*/ D("li", { children: [
|
|
47
|
-
/*#__PURE__*/ E("span", {
|
|
48
|
-
className: "font-semibold",
|
|
49
|
-
children: /*#__PURE__*/ E(j, { id: "pFg+7w" })
|
|
50
|
-
}),
|
|
51
|
-
" ",
|
|
52
|
-
p
|
|
53
|
-
] })
|
|
54
|
-
] }),
|
|
55
|
-
r && (l || d) && /*#__PURE__*/ D(a, { children: [/*#__PURE__*/ E(u, {
|
|
56
|
-
onClick: () => i(x.ACCEPTED),
|
|
57
|
-
disabled: o,
|
|
58
|
-
children: /*#__PURE__*/ E(j, { id: "g3UF2V" })
|
|
59
|
-
}), l && /*#__PURE__*/ E(u, {
|
|
60
|
-
onClick: () => i(x.REJECTED),
|
|
61
|
-
disabled: o,
|
|
62
|
-
children: /*#__PURE__*/ E(j, { id: "1t/NnN" })
|
|
63
|
-
})] })
|
|
64
|
-
] });
|
|
65
|
-
}, P = ({ image: t }) => {
|
|
66
|
-
let { i18n: n, _: r } = M(), i = [
|
|
67
|
-
{
|
|
68
|
-
label: n._({ id: "S0kLOH" }),
|
|
69
|
-
value: /*#__PURE__*/ E(y, { text: t.id })
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
label: n._({ id: "6YtxFj" }),
|
|
73
|
-
value: t.name
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
label: n._({ id: "uAQUqI" }),
|
|
77
|
-
value: t.status
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
label: n._({ id: "Cj2Gtd" }),
|
|
81
|
-
value: /*#__PURE__*/ E(S, { size: t.size })
|
|
82
|
-
},
|
|
83
|
-
{
|
|
84
|
-
label: n._({ id: "Cxgv2U" }),
|
|
85
|
-
value: `${t.min_disk} GB`
|
|
86
|
-
},
|
|
87
|
-
{
|
|
88
|
-
label: n._({ id: "B2Czeb" }),
|
|
89
|
-
value: `${t.min_ram} MB`
|
|
90
|
-
},
|
|
91
|
-
{
|
|
92
|
-
label: n._({ id: "NopYGU" }),
|
|
93
|
-
value: /*#__PURE__*/ E("span", {
|
|
94
|
-
className: "uppercase",
|
|
95
|
-
children: t.disk_format
|
|
96
|
-
})
|
|
97
|
-
},
|
|
98
|
-
{
|
|
99
|
-
label: n._({ id: "6/xipy" }),
|
|
100
|
-
value: /*#__PURE__*/ E("span", {
|
|
101
|
-
className: "uppercase",
|
|
102
|
-
children: t.container_format
|
|
103
|
-
})
|
|
104
|
-
},
|
|
105
|
-
{
|
|
106
|
-
label: n._({ id: "88kg0+" }),
|
|
107
|
-
value: t.created_at ? new Date(t.created_at).toLocaleDateString() : n._({ id: "fj5byd" })
|
|
108
|
-
},
|
|
109
|
-
{
|
|
110
|
-
label: n._({ id: "Llcakz" }),
|
|
111
|
-
value: t.updated_at ? new Date(t.updated_at).toLocaleDateString() : n._({ id: "fj5byd" })
|
|
112
|
-
}
|
|
113
|
-
];
|
|
114
|
-
return /*#__PURE__*/ D(e, {
|
|
115
|
-
px: !1,
|
|
116
|
-
py: !0,
|
|
117
|
-
children: [/*#__PURE__*/ E(s, { children: n._({ id: "nW/hX9" }) }), /*#__PURE__*/ E(w, { items: i })]
|
|
118
|
-
});
|
|
119
|
-
}, F = ({ image: t, currentProjectId: n }) => {
|
|
120
|
-
let { i18n: r, _: i } = M(), a = [
|
|
121
|
-
{
|
|
122
|
-
label: t.visibility === "shared" && t.owner !== void 0 && t.owner !== n ? r._({ id: "20axE5" }) : r._({ id: "YsrbQh" }),
|
|
123
|
-
value: t.owner ? /*#__PURE__*/ E(y, { text: t.owner }) : ""
|
|
124
|
-
},
|
|
125
|
-
{
|
|
126
|
-
label: r._({ id: "2q/Q7x" }),
|
|
127
|
-
value: t.visibility
|
|
128
|
-
},
|
|
129
|
-
{
|
|
130
|
-
label: r._({ id: "644xgx" }),
|
|
131
|
-
value: t.protected ? r._({ id: "l75CjT" }) : r._({ id: "1UzENP" })
|
|
132
|
-
},
|
|
133
|
-
{
|
|
134
|
-
label: r._({ id: "PzgYM9" }),
|
|
135
|
-
value: t?.checksum ? t.checksum : ""
|
|
136
|
-
}
|
|
137
|
-
];
|
|
138
|
-
return /*#__PURE__*/ D(e, {
|
|
139
|
-
px: !1,
|
|
140
|
-
py: !0,
|
|
141
|
-
children: [/*#__PURE__*/ E(s, { children: r._({ id: "a3LDKx" }) }), /*#__PURE__*/ E(w, { items: a })]
|
|
142
|
-
});
|
|
143
|
-
}, I = ({ image: t }) => {
|
|
144
|
-
let { i18n: n, _: i } = M(), a = /* @__PURE__ */ new Set([
|
|
145
|
-
"id",
|
|
146
|
-
"name",
|
|
147
|
-
"status",
|
|
148
|
-
"visibility",
|
|
149
|
-
"size",
|
|
150
|
-
"disk_format",
|
|
151
|
-
"container_format",
|
|
152
|
-
"min_disk",
|
|
153
|
-
"min_ram",
|
|
154
|
-
"owner",
|
|
155
|
-
"protected",
|
|
156
|
-
"created_at",
|
|
157
|
-
"updated_at",
|
|
158
|
-
"checksum"
|
|
159
|
-
]), o = Object.entries(t).filter(([e]) => !a.has(e)).sort(([e], [t]) => e.localeCompare(t)), c = o.length > 0;
|
|
160
|
-
return /*#__PURE__*/ D(e, {
|
|
161
|
-
px: !1,
|
|
162
|
-
py: !0,
|
|
163
|
-
children: [/*#__PURE__*/ E(s, { children: n._({ id: "bc67JN" }) }), c ? /*#__PURE__*/ E(h, {
|
|
164
|
-
alignTerms: "right",
|
|
165
|
-
className: "grid-cols-4",
|
|
166
|
-
children: o.map(([e, t]) => /*#__PURE__*/ D(O.Fragment, { children: [/*#__PURE__*/ E(d, {
|
|
167
|
-
className: "col-span-1",
|
|
168
|
-
children: e
|
|
169
|
-
}), /*#__PURE__*/ E(r, {
|
|
170
|
-
className: "col-span-1",
|
|
171
|
-
children: t == null ? /*#__PURE__*/ E("span", { children: "null" }) : typeof t == "object" ? /*#__PURE__*/ E("span", {
|
|
172
|
-
className: "break-all",
|
|
173
|
-
children: JSON.stringify(t)
|
|
174
|
-
}) : typeof t == "boolean" ? t ? n._({ id: "c+xCSz" }) : n._({ id: "ocUvR+" }) : /*#__PURE__*/ E("span", {
|
|
175
|
-
className: "break-all",
|
|
176
|
-
children: String(t)
|
|
177
|
-
})
|
|
178
|
-
})] }, e))
|
|
179
|
-
}) : /*#__PURE__*/ E("p", {
|
|
180
|
-
className: "text-theme-light",
|
|
181
|
-
children: n._({ id: "9v5VLp" })
|
|
182
|
-
})]
|
|
183
|
-
});
|
|
184
|
-
}, L = (e) => {
|
|
185
|
-
let t = "px-6 py-3 font-semibold border-b-2 transition-colors";
|
|
186
|
-
return e ? `${t} border-theme-accent text-theme-highest` : `${t} border-transparent text-theme-secondary hover:text-theme-high`;
|
|
187
|
-
}, R = ({ image: t, permissions: n, currentProjectId: r }) => {
|
|
188
|
-
let [a, o] = k(!1), [s, c] = k(null), { data: l, isLoading: u } = _.compute.listImageMembers.useQuery({
|
|
189
|
-
project_id: r,
|
|
190
|
-
imageId: t.id
|
|
191
|
-
}, { enabled: !!t.id && !!r });
|
|
192
|
-
return /*#__PURE__*/ D(e, {
|
|
193
|
-
px: !1,
|
|
194
|
-
py: !0,
|
|
195
|
-
children: [s && /*#__PURE__*/ E(i, {
|
|
196
|
-
text: s.text,
|
|
197
|
-
variant: s.type,
|
|
198
|
-
onDismiss: () => c(null),
|
|
199
|
-
className: "mb-4"
|
|
200
|
-
}), /*#__PURE__*/ E(b, {
|
|
201
|
-
image: t,
|
|
202
|
-
imageMembers: l,
|
|
203
|
-
isMembersLoading: u,
|
|
204
|
-
canAdd: n?.canCreateMember ?? !1,
|
|
205
|
-
canRemove: n?.canDeleteMember ?? !1,
|
|
206
|
-
isAddingMember: a,
|
|
207
|
-
setIsAddingMember: o,
|
|
208
|
-
setMessage: c,
|
|
209
|
-
projectId: r
|
|
210
|
-
})]
|
|
211
|
-
});
|
|
212
|
-
}, be = ({ image: e, currentProjectId: t, activeTab: n = "details", onTabChange: r, permissions: i, myMemberData: a, onMemberStatusChange: s, isMemberStatusChanging: c, actions: l }) => {
|
|
213
|
-
let { i18n: u, _: d } = M(), f = e.visibility === "shared" && e.owner !== void 0 && e.owner !== t, p = e.owner === t && e.visibility === "shared";
|
|
214
|
-
return /*#__PURE__*/ D(o, {
|
|
215
|
-
direction: "vertical",
|
|
216
|
-
gap: "6",
|
|
217
|
-
children: [
|
|
218
|
-
f && a && s && /*#__PURE__*/ E(N, {
|
|
219
|
-
image: e,
|
|
220
|
-
myMemberData: a,
|
|
221
|
-
canUpdateMember: i?.canUpdateMember ?? !1,
|
|
222
|
-
onStatusChange: s,
|
|
223
|
-
isLoading: c ?? !1
|
|
224
|
-
}),
|
|
225
|
-
p && /*#__PURE__*/ E("div", {
|
|
226
|
-
className: "border-theme-background-lvl-3 border-b",
|
|
227
|
-
children: /*#__PURE__*/ D(o, {
|
|
228
|
-
direction: "horizontal",
|
|
229
|
-
gap: "0",
|
|
230
|
-
children: [/*#__PURE__*/ E("button", {
|
|
231
|
-
className: L(n === "details"),
|
|
232
|
-
onClick: () => r?.("details"),
|
|
233
|
-
children: u._({ id: "URmyfc" })
|
|
234
|
-
}), /*#__PURE__*/ E("button", {
|
|
235
|
-
className: L(n === "sharing"),
|
|
236
|
-
onClick: () => r?.("sharing"),
|
|
237
|
-
children: u._({ id: "aG9OiI" })
|
|
238
|
-
})]
|
|
239
|
-
})
|
|
240
|
-
}),
|
|
241
|
-
(n === "details" || !p) && /*#__PURE__*/ D(T, { children: [
|
|
242
|
-
l,
|
|
243
|
-
/*#__PURE__*/ E(P, { image: e }),
|
|
244
|
-
/*#__PURE__*/ E(F, {
|
|
245
|
-
image: e,
|
|
246
|
-
currentProjectId: t
|
|
247
|
-
}),
|
|
248
|
-
/*#__PURE__*/ E(I, { image: e })
|
|
249
|
-
] }),
|
|
250
|
-
n === "sharing" && p && /*#__PURE__*/ E(R, {
|
|
251
|
-
image: e,
|
|
252
|
-
permissions: i
|
|
253
|
-
})
|
|
254
|
-
]
|
|
255
|
-
});
|
|
256
|
-
};
|
|
257
|
-
//#endregion
|
|
258
|
-
//#region src/client/routes/_auth/projects/$projectId/compute/images/$imageId.tsx?tsr-split=component
|
|
259
|
-
function xe() {
|
|
260
|
-
let { i18n: e, _: t } = M(), n = A(), { projectId: r } = v.useParams();
|
|
261
|
-
return /*#__PURE__*/ E(ee, { action: /*#__PURE__*/ E(u, {
|
|
262
|
-
variant: "primary",
|
|
263
|
-
onClick: () => n({
|
|
264
|
-
to: "/projects/$projectId/compute/images",
|
|
265
|
-
params: { projectId: r }
|
|
266
|
-
}),
|
|
267
|
-
children: e._({ id: "bnql/K" })
|
|
268
|
-
}) });
|
|
269
|
-
}
|
|
270
|
-
function z() {
|
|
271
|
-
let { projectId: e, imageId: t } = ve({ from: "/_auth/projects/$projectId/compute/images/$imageId" }), { tab: r } = ye({ from: "/_auth/projects/$projectId/compute/images/$imageId" }), i = A(), { i18n: a, _: s } = M(), { data: d, status: h, error: y } = _.compute.getImageById.useQuery({
|
|
272
|
-
project_id: e,
|
|
273
|
-
imageId: t
|
|
274
|
-
});
|
|
275
|
-
ne(v.id, d?.name);
|
|
276
|
-
let { data: b } = _.compute.canUser.useQuery({
|
|
277
|
-
project_id: e,
|
|
278
|
-
permission: [
|
|
279
|
-
"images:delete",
|
|
280
|
-
"images:update",
|
|
281
|
-
"images:create_member",
|
|
282
|
-
"images:delete_member",
|
|
283
|
-
"images:update_member"
|
|
284
|
-
]
|
|
285
|
-
}), x = {
|
|
286
|
-
canDelete: b?.[0] ?? !1,
|
|
287
|
-
canUpdate: b?.[1] ?? !1,
|
|
288
|
-
canCreateMember: b?.[2] ?? !1,
|
|
289
|
-
canDeleteMember: b?.[3] ?? !1,
|
|
290
|
-
canUpdateMember: b?.[4] ?? !1
|
|
291
|
-
}, S = _.useUtils(), [w, O] = k(!1), [N, P] = k(!1), [F, I] = k(!1), [L, R] = k(!1), [z, B] = k(!1), V = _.compute.updateImage.useMutation({ onSuccess: (n) => {
|
|
292
|
-
S.compute.getImageById.setData({
|
|
293
|
-
project_id: e,
|
|
294
|
-
imageId: t
|
|
295
|
-
}, n), S.compute.listImagesWithPagination.invalidate();
|
|
296
|
-
} }), H = _.compute.deleteImage.useMutation({ onSuccess: () => {
|
|
297
|
-
S.compute.listImagesWithPagination.invalidate();
|
|
298
|
-
} }), U = _.compute.deactivateImage.useMutation({ onSuccess: () => {
|
|
299
|
-
S.compute.getImageById.invalidate({
|
|
300
|
-
project_id: e,
|
|
301
|
-
imageId: t
|
|
302
|
-
});
|
|
303
|
-
} }), W = _.compute.reactivateImage.useMutation({ onSuccess: () => {
|
|
304
|
-
S.compute.getImageById.invalidate({
|
|
305
|
-
project_id: e,
|
|
306
|
-
imageId: t
|
|
307
|
-
});
|
|
308
|
-
} }), G = _.compute.updateImageVisibility.useMutation({ onSuccess: (n) => {
|
|
309
|
-
S.compute.getImageById.setData({
|
|
310
|
-
project_id: e,
|
|
311
|
-
imageId: t
|
|
312
|
-
}, n);
|
|
313
|
-
} }), K = d?.visibility === C.SHARED && d?.owner !== void 0 && d?.owner !== e, { data: q } = _.compute.getImageMember.useQuery({
|
|
314
|
-
project_id: e,
|
|
315
|
-
imageId: t,
|
|
316
|
-
memberId: e
|
|
317
|
-
}, { enabled: K && !!t && !!e }), J = _.compute.updateImageMember.useMutation({ onSuccess: () => {
|
|
318
|
-
S.compute.getImageMember.invalidate({
|
|
319
|
-
project_id: e,
|
|
320
|
-
imageId: t,
|
|
321
|
-
memberId: e
|
|
322
|
-
}), S.compute.listImageMembers.invalidate({
|
|
323
|
-
project_id: e,
|
|
324
|
-
imageId: t
|
|
325
|
-
}), S.compute.listImagesWithPagination.invalidate(), S.compute.listSharedImagesByMemberStatus.invalidate();
|
|
326
|
-
} }), Y = async (n) => {
|
|
327
|
-
try {
|
|
328
|
-
await J.mutateAsync({
|
|
329
|
-
project_id: e,
|
|
330
|
-
imageId: t,
|
|
331
|
-
memberId: e,
|
|
332
|
-
status: n
|
|
333
|
-
});
|
|
334
|
-
let { message: r, ...i } = de(n);
|
|
335
|
-
f.info(r, i);
|
|
336
|
-
} catch (e) {
|
|
337
|
-
let t = e?.message, { message: n, ...r } = ge(t);
|
|
338
|
-
f.error(n, r);
|
|
339
|
-
}
|
|
340
|
-
}, X = () => {
|
|
341
|
-
i({
|
|
342
|
-
to: "/projects/$projectId/compute/images",
|
|
343
|
-
params: { projectId: e }
|
|
344
|
-
});
|
|
345
|
-
}, Z = V.isPending || H.isPending || U.isPending || W.isPending || G.isPending, Se = (e, t) => {
|
|
346
|
-
let n = [];
|
|
347
|
-
return Object.entries(e).forEach(([e, r]) => {
|
|
348
|
-
let i = `/${e}`;
|
|
349
|
-
if (r == null) e in t && n.push({
|
|
350
|
-
op: "remove",
|
|
351
|
-
path: i
|
|
352
|
-
});
|
|
353
|
-
else {
|
|
354
|
-
let a = e in t;
|
|
355
|
-
n.push({
|
|
356
|
-
op: a ? "replace" : "add",
|
|
357
|
-
path: i,
|
|
358
|
-
value: r
|
|
359
|
-
});
|
|
360
|
-
}
|
|
361
|
-
}), n;
|
|
362
|
-
}, Ce = async (n) => {
|
|
363
|
-
if (!d) return !1;
|
|
364
|
-
let r = Se(n, d);
|
|
365
|
-
try {
|
|
366
|
-
await V.mutateAsync({
|
|
367
|
-
project_id: e,
|
|
368
|
-
imageId: t,
|
|
369
|
-
operations: r
|
|
370
|
-
}), O(!1);
|
|
371
|
-
let { message: n, ...i } = ce(String(d.name ?? d.id));
|
|
372
|
-
return f.success(n, i), !0;
|
|
373
|
-
} catch {
|
|
374
|
-
return !1;
|
|
375
|
-
}
|
|
376
|
-
}, we = async (t) => {
|
|
377
|
-
try {
|
|
378
|
-
await H.mutateAsync({
|
|
379
|
-
project_id: e,
|
|
380
|
-
imageId: t.id
|
|
381
|
-
}), I(!1), X();
|
|
382
|
-
} catch {
|
|
383
|
-
I(!1);
|
|
384
|
-
}
|
|
385
|
-
}, Te = async (t) => {
|
|
386
|
-
try {
|
|
387
|
-
await W.mutateAsync({
|
|
388
|
-
project_id: e,
|
|
389
|
-
imageId: t.id
|
|
390
|
-
}), R(!1);
|
|
391
|
-
let { message: n, ...r } = fe(String(t.name ?? t.id));
|
|
392
|
-
f.success(n, r);
|
|
393
|
-
} catch (e) {
|
|
394
|
-
R(!1);
|
|
395
|
-
let { message: n, ...r } = he(t.id, e?.message ?? "");
|
|
396
|
-
f.error(n, r);
|
|
397
|
-
}
|
|
398
|
-
}, Ee = async (t) => {
|
|
399
|
-
try {
|
|
400
|
-
await U.mutateAsync({
|
|
401
|
-
project_id: e,
|
|
402
|
-
imageId: t.id
|
|
403
|
-
}), B(!1);
|
|
404
|
-
let { message: n, ...r } = pe(String(t.name ?? t.id));
|
|
405
|
-
f.success(n, r);
|
|
406
|
-
} catch (e) {
|
|
407
|
-
B(!1);
|
|
408
|
-
let { message: n, ...r } = ue(t.id, e?.message ?? "");
|
|
409
|
-
f.error(n, r);
|
|
410
|
-
}
|
|
411
|
-
}, De = async (t) => {
|
|
412
|
-
if (d) try {
|
|
413
|
-
await G.mutateAsync({
|
|
414
|
-
project_id: e,
|
|
415
|
-
imageId: d.id,
|
|
416
|
-
visibility: t
|
|
417
|
-
});
|
|
418
|
-
let { message: n, ...r } = _e(String(d.name ?? d.id), t);
|
|
419
|
-
f.success(n, r);
|
|
420
|
-
} catch (e) {
|
|
421
|
-
let { message: t, ...n } = re(String(d.name ?? d.id), e?.message ?? "");
|
|
422
|
-
f.error(t, n);
|
|
423
|
-
}
|
|
424
|
-
};
|
|
425
|
-
if (h === "pending") return /*#__PURE__*/ E(m, {
|
|
426
|
-
status: "progress",
|
|
427
|
-
title: a._({ id: "hH3kDo" })
|
|
428
|
-
});
|
|
429
|
-
if (h === "error") {
|
|
430
|
-
let e = y?.message || a._({ id: "LobdAW" });
|
|
431
|
-
return /*#__PURE__*/ E(ee, {
|
|
432
|
-
errorTitle: a._({ id: "2bUZog" }),
|
|
433
|
-
errorDescription: e,
|
|
434
|
-
action: /*#__PURE__*/ E(u, {
|
|
435
|
-
onClick: X,
|
|
436
|
-
variant: "primary",
|
|
437
|
-
children: /*#__PURE__*/ E(j, { id: "bnql/K" })
|
|
438
|
-
})
|
|
439
|
-
});
|
|
440
|
-
}
|
|
441
|
-
if (!d) return /*#__PURE__*/ E(xe, {});
|
|
442
|
-
let Q = d.status === oe.DEACTIVATED, Oe = d.visibility === C.PRIVATE, ke = q?.status === "accepted", Ae = d.owner === e, je = K && ke && x.canUpdateMember, Me = !K && x.canUpdate, Ne = !K && x.canDelete && !d.protected, Pe = !K && Ae && d.visibility === C.SHARED && (x.canCreateMember || x.canDeleteMember), $ = je || Me || Ne || Pe, Fe = ($ || !K && x.canUpdate) && /*#__PURE__*/ D(o, {
|
|
443
|
-
gap: "0.5",
|
|
444
|
-
alignment: "center",
|
|
445
|
-
children: [($ || !K && x.canUpdate) && /*#__PURE__*/ D(n, {
|
|
446
|
-
className: "flex items-center",
|
|
447
|
-
children: [/*#__PURE__*/ E(c, {
|
|
448
|
-
as: "div",
|
|
449
|
-
children: /*#__PURE__*/ E(u, {
|
|
450
|
-
icon: "moreVert",
|
|
451
|
-
title: a._({ id: "PgNNGl" }),
|
|
452
|
-
disabled: Z
|
|
453
|
-
})
|
|
454
|
-
}), /*#__PURE__*/ D(l, { children: [
|
|
455
|
-
!K && x.canUpdate && /*#__PURE__*/ D(T, { children: [/*#__PURE__*/ E(g, {
|
|
456
|
-
label: Q ? a._({ id: "FQBaXG" }) : a._({ id: "5y3O+A" }),
|
|
457
|
-
onClick: () => Q ? R(!0) : B(!0)
|
|
458
|
-
}), /*#__PURE__*/ E(g, {
|
|
459
|
-
onClick: () => P(!0),
|
|
460
|
-
label: a._({ id: "SIfYq6" }),
|
|
461
|
-
disabled: Z
|
|
462
|
-
})] }),
|
|
463
|
-
!K && Ae && d.visibility === C.SHARED && (x.canCreateMember || x.canDeleteMember) && /*#__PURE__*/ E(g, {
|
|
464
|
-
label: a._({ id: "cWbW6w" }),
|
|
465
|
-
onClick: () => i({
|
|
466
|
-
to: "/projects/$projectId/compute/images/$imageId",
|
|
467
|
-
params: {
|
|
468
|
-
projectId: e,
|
|
469
|
-
imageId: d.id
|
|
470
|
-
},
|
|
471
|
-
search: { tab: "sharing" }
|
|
472
|
-
})
|
|
473
|
-
}),
|
|
474
|
-
je && /*#__PURE__*/ E(g, {
|
|
475
|
-
label: a._({ id: "1t/NnN" }),
|
|
476
|
-
onClick: () => Y("rejected")
|
|
477
|
-
}),
|
|
478
|
-
!K && x.canUpdate && Oe && /*#__PURE__*/ E(g, {
|
|
479
|
-
label: a._({ id: "gMYsdZ" }),
|
|
480
|
-
onClick: () => De("shared")
|
|
481
|
-
}),
|
|
482
|
-
!K && x.canDelete && !d.protected && /*#__PURE__*/ D(T, { children: [/*#__PURE__*/ E(p, {}), /*#__PURE__*/ E(g, {
|
|
483
|
-
label: a._({ id: "cnGeoo" }),
|
|
484
|
-
onClick: () => I(!0)
|
|
485
|
-
})] })
|
|
486
|
-
] })]
|
|
487
|
-
}), !K && x.canUpdate && /*#__PURE__*/ E(u, {
|
|
488
|
-
onClick: () => O(!0),
|
|
489
|
-
variant: "primary",
|
|
490
|
-
disabled: Z,
|
|
491
|
-
children: /*#__PURE__*/ E(j, { id: "Y1YKad" })
|
|
492
|
-
})]
|
|
493
|
-
});
|
|
494
|
-
return /*#__PURE__*/ D(T, { children: [
|
|
495
|
-
/*#__PURE__*/ E(te, {
|
|
496
|
-
title: String(d.name ?? d.id),
|
|
497
|
-
projectId: e,
|
|
498
|
-
actions: Fe
|
|
499
|
-
}),
|
|
500
|
-
/*#__PURE__*/ E("div", {
|
|
501
|
-
className: "mt-3",
|
|
502
|
-
children: /*#__PURE__*/ E(be, {
|
|
503
|
-
image: d,
|
|
504
|
-
currentProjectId: e,
|
|
505
|
-
activeTab: r ?? "details",
|
|
506
|
-
onTabChange: (e) => i({ search: { tab: e === "details" ? void 0 : e } }),
|
|
507
|
-
permissions: {
|
|
508
|
-
canCreateMember: x.canCreateMember,
|
|
509
|
-
canDeleteMember: x.canDeleteMember,
|
|
510
|
-
canUpdateMember: x.canUpdateMember
|
|
511
|
-
},
|
|
512
|
-
myMemberData: q,
|
|
513
|
-
onMemberStatusChange: Y,
|
|
514
|
-
isMemberStatusChanging: J.isPending
|
|
515
|
-
}, d.id)
|
|
516
|
-
}),
|
|
517
|
-
w && /*#__PURE__*/ E(me, {
|
|
518
|
-
image: d,
|
|
519
|
-
isOpen: w,
|
|
520
|
-
isLoading: V.isPending,
|
|
521
|
-
onClose: () => O(!1),
|
|
522
|
-
onSave: Ce
|
|
523
|
-
}),
|
|
524
|
-
N && /*#__PURE__*/ E(se, {
|
|
525
|
-
image: d,
|
|
526
|
-
isOpen: N,
|
|
527
|
-
isLoading: V.isPending,
|
|
528
|
-
onClose: () => P(!1),
|
|
529
|
-
onSave: Ce
|
|
530
|
-
}),
|
|
531
|
-
F && /*#__PURE__*/ E(ie, {
|
|
532
|
-
image: d,
|
|
533
|
-
isOpen: F,
|
|
534
|
-
isLoading: H.isPending,
|
|
535
|
-
isDisabled: !!d.protected,
|
|
536
|
-
onClose: () => I(!1),
|
|
537
|
-
onDelete: we
|
|
538
|
-
}),
|
|
539
|
-
L && /*#__PURE__*/ E(ae, {
|
|
540
|
-
image: d,
|
|
541
|
-
isOpen: L,
|
|
542
|
-
isLoading: W.isPending,
|
|
543
|
-
onClose: () => R(!1),
|
|
544
|
-
onActivate: Te
|
|
545
|
-
}),
|
|
546
|
-
z && /*#__PURE__*/ E(le, {
|
|
547
|
-
image: d,
|
|
548
|
-
isOpen: z,
|
|
549
|
-
isLoading: U.isPending,
|
|
550
|
-
onClose: () => B(!1),
|
|
551
|
-
onDeactivate: Ee
|
|
552
|
-
})
|
|
553
|
-
] });
|
|
554
|
-
}
|
|
555
|
-
//#endregion
|
|
556
|
-
export { z as component };
|
|
557
|
-
|
|
558
|
-
//# sourceMappingURL=_imageId-CiqEQB_J.mjs.map
|