-
Notifications
You must be signed in to change notification settings - Fork 597
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added container image resource modal
- Loading branch information
1 parent
f28070e
commit 1a80c92
Showing
11 changed files
with
328 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 77 additions & 0 deletions
77
deepfence_frontend/apps/dashboard/src/features/malwares/components/ResourceDetailModal.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
import { useSuspenseQuery } from '@suspensive/react-query'; | ||
import { | ||
SlidingModal, | ||
SlidingModalCloseButton, | ||
SlidingModalContent, | ||
SlidingModalHeader, | ||
} from 'ui-components'; | ||
|
||
import { TruncatedText } from '@/components/TruncatedText'; | ||
import { | ||
Metadata, | ||
toTopologyMetadataString, | ||
} from '@/features/topology/components/node-details/Metadata'; | ||
import { queries } from '@/queries'; | ||
|
||
const useResourceDetails = ({ nodeId }: { nodeId: string }) => { | ||
return useSuspenseQuery({ | ||
...queries.lookup.containerImage({ | ||
nodeId: nodeId, | ||
}), | ||
}); | ||
}; | ||
export const ResourceDetailModal = ({ | ||
nodeId, | ||
open, | ||
onClose, | ||
}: { | ||
nodeId: string; | ||
open: boolean; | ||
onClose: React.Dispatch<React.SetStateAction<boolean>>; | ||
}) => { | ||
const { data } = useResourceDetails({ | ||
nodeId, | ||
}); | ||
|
||
return ( | ||
<SlidingModal | ||
open={open} | ||
onOpenChange={(state) => { | ||
onClose(state); | ||
}} | ||
size="m" | ||
> | ||
<SlidingModalCloseButton /> | ||
<SlidingModalHeader> | ||
<div className="p-4 text-h3 dark:text-text-text-and-icon dark:bg-bg-breadcrumb-bar "> | ||
<div className="overflow-hidden"> | ||
<TruncatedText text="Resource details" /> | ||
</div> | ||
</div> | ||
</SlidingModalHeader> | ||
<SlidingModalContent> | ||
<div className="mx-4 mt-4"> | ||
<Metadata | ||
title="" | ||
data={{ | ||
node_name: toTopologyMetadataString(data?.imageData?.node_name), | ||
docker_image_name: toTopologyMetadataString( | ||
data?.imageData?.docker_image_name, | ||
), | ||
docker_image_tag: toTopologyMetadataString( | ||
data?.imageData?.docker_image_tag, | ||
), | ||
docker_image_size: toTopologyMetadataString( | ||
data?.imageData?.docker_image_size, | ||
), | ||
docker_image_created_at: toTopologyMetadataString( | ||
data?.imageData?.docker_image_created_at, | ||
), | ||
docker_image_id: toTopologyMetadataString(data?.imageData?.docker_image_id), | ||
}} | ||
/> | ||
</div> | ||
</SlidingModalContent> | ||
</SlidingModal> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 77 additions & 0 deletions
77
deepfence_frontend/apps/dashboard/src/features/secrets/components/ResourceDetailModal.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
import { useSuspenseQuery } from '@suspensive/react-query'; | ||
import { | ||
SlidingModal, | ||
SlidingModalCloseButton, | ||
SlidingModalContent, | ||
SlidingModalHeader, | ||
} from 'ui-components'; | ||
|
||
import { TruncatedText } from '@/components/TruncatedText'; | ||
import { | ||
Metadata, | ||
toTopologyMetadataString, | ||
} from '@/features/topology/components/node-details/Metadata'; | ||
import { queries } from '@/queries'; | ||
|
||
const useResourceDetails = ({ nodeId }: { nodeId: string }) => { | ||
return useSuspenseQuery({ | ||
...queries.lookup.containerImage({ | ||
nodeId: nodeId, | ||
}), | ||
}); | ||
}; | ||
export const ResourceDetailModal = ({ | ||
nodeId, | ||
open, | ||
onClose, | ||
}: { | ||
nodeId: string; | ||
open: boolean; | ||
onClose: React.Dispatch<React.SetStateAction<boolean>>; | ||
}) => { | ||
const { data } = useResourceDetails({ | ||
nodeId, | ||
}); | ||
|
||
return ( | ||
<SlidingModal | ||
open={open} | ||
onOpenChange={(state) => { | ||
onClose(state); | ||
}} | ||
size="m" | ||
> | ||
<SlidingModalCloseButton /> | ||
<SlidingModalHeader> | ||
<div className="p-4 text-h3 dark:text-text-text-and-icon dark:bg-bg-breadcrumb-bar "> | ||
<div className="overflow-hidden"> | ||
<TruncatedText text="Resource details" /> | ||
</div> | ||
</div> | ||
</SlidingModalHeader> | ||
<SlidingModalContent> | ||
<div className="mx-4 mt-4"> | ||
<Metadata | ||
title="" | ||
data={{ | ||
node_name: toTopologyMetadataString(data?.imageData?.node_name), | ||
docker_image_name: toTopologyMetadataString( | ||
data?.imageData?.docker_image_name, | ||
), | ||
docker_image_tag: toTopologyMetadataString( | ||
data?.imageData?.docker_image_tag, | ||
), | ||
docker_image_size: toTopologyMetadataString( | ||
data?.imageData?.docker_image_size, | ||
), | ||
docker_image_created_at: toTopologyMetadataString( | ||
data?.imageData?.docker_image_created_at, | ||
), | ||
docker_image_id: toTopologyMetadataString(data?.imageData?.docker_image_id), | ||
}} | ||
/> | ||
</div> | ||
</SlidingModalContent> | ||
</SlidingModal> | ||
); | ||
}; |
Oops, something went wrong.