You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
portainer/app/docker/models/image.ts

48 lines
1.2 KiB

import { ImageSummary } from 'docker-types/generated/1.41';
import { PortainerResponse } from '@/react/docker/types';
export type ImageId = ImageSummary['Id'];
export type ImageName = string;
/**
* Partial copy of ImageSummary
*/
export class ImageViewModel {
Id: ImageId;
Created: ImageSummary['Created'];
RepoTags: ImageSummary['RepoTags'];
Size: ImageSummary['Size'];
Labels: ImageSummary['Labels'];
// internal
NodeName: string;
Used: boolean = false;
constructor(data: PortainerResponse<ImageSummary>, used: boolean = false) {
this.Id = data.Id;
// this.Tag = data.Tag; // doesn't seem to be used?
// this.Repository = data.Repository; // doesn't seem to be used?
this.Created = data.Created;
this.RepoTags = data.RepoTags;
if ((!this.RepoTags || this.RepoTags.length === 0) && data.RepoDigests) {
this.RepoTags = [];
data.RepoDigests.forEach((digest) => {
const repository = digest.substring(0, digest.indexOf('@'));
this.RepoTags.push(`${repository}:<none>`);
});
}
this.Size = data.Size;
this.NodeName = data.Portainer?.Agent?.NodeName || '';
this.Labels = data.Labels;
this.Used = used;
}
}