mirror of
https://github.com/CyberL1/dlinux-dashboard.git
synced 2025-01-21 17:09:19 -05:00
refactor: change inspect
functtions to get
functions
This commit is contained in:
parent
928bc2f15e
commit
77ce186675
@ -1,9 +1,10 @@
|
||||
import type { Container } from "#src/types/Container.ts";
|
||||
import { inspectContainer } from "#src/utils/containers.ts";
|
||||
import { getContainer } from "#src/utils/containers.ts";
|
||||
import type { FastifyInstance, FastifyRequest } from "fastify";
|
||||
|
||||
export default (fastify: FastifyInstance) => {
|
||||
fastify.get("/", (req: FastifyRequest<{ Params: Container }>) => {
|
||||
return inspectContainer(req.params.id);
|
||||
const container = getContainer(req.params.id);
|
||||
return container.inspect();
|
||||
});
|
||||
};
|
||||
|
@ -1,9 +1,10 @@
|
||||
import type { Image } from "#src/types.ts";
|
||||
import { inspectImage } from "#src/utils/images.ts";
|
||||
import type { Image } from "#src/types/Image.ts";
|
||||
import { getImage } from "#src/utils/images.ts";
|
||||
import type { FastifyInstance, FastifyRequest } from "fastify";
|
||||
|
||||
export default (fastify: FastifyInstance) => {
|
||||
fastify.get("/", (req: FastifyRequest<{ Params: Image }>) => {
|
||||
return inspectImage(req.params.name);
|
||||
const image = getImage(req.params.name);
|
||||
return image.inspect();
|
||||
});
|
||||
};
|
||||
|
@ -12,9 +12,9 @@ export const getContainers = () => {
|
||||
return containers;
|
||||
};
|
||||
|
||||
export const inspectContainer = (id: string) => {
|
||||
export const getContainer = (id: string) => {
|
||||
const container = dockerode.getContainer(id);
|
||||
return container.inspect();
|
||||
return container;
|
||||
};
|
||||
|
||||
export const createContainer = ({ image }: CreateContainerBody) => {
|
||||
|
@ -10,7 +10,7 @@ export const getImages = () => {
|
||||
return images;
|
||||
};
|
||||
|
||||
export const inspectImage = async (name: string) => {
|
||||
export const getImage = (name: string) => {
|
||||
const image = dockerode.getImage(`code-containers/${name}`);
|
||||
return image.inspect();
|
||||
return image;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user