mirror of
https://github.com/portainer/portainer.git
synced 2025-07-22 23:09:41 +02:00
Some checks failed
Test / test-server (map[arch:arm64 platform:linux]) (push) Has been cancelled
Test / test-server (map[arch:amd64 platform:windows version:ltsc2022]) (push) Has been cancelled
ci / build_images (map[arch:amd64 platform:linux version:]) (push) Has been cancelled
ci / build_images (map[arch:amd64 platform:windows version:1809]) (push) Has been cancelled
ci / build_images (map[arch:amd64 platform:windows version:ltsc2022]) (push) Has been cancelled
ci / build_images (map[arch:arm platform:linux version:]) (push) Has been cancelled
ci / build_images (map[arch:arm64 platform:linux version:]) (push) Has been cancelled
ci / build_images (map[arch:ppc64le platform:linux version:]) (push) Has been cancelled
ci / build_images (map[arch:s390x platform:linux version:]) (push) Has been cancelled
/ triage (push) Has been cancelled
Lint / Run linters (push) Has been cancelled
Test / test-client (push) Has been cancelled
Test / test-server (map[arch:amd64 platform:linux]) (push) Has been cancelled
Test / test-server (map[arch:amd64 platform:windows version:1809]) (push) Has been cancelled
ci / build_manifests (push) Has been cancelled
63 lines
1.7 KiB
TypeScript
63 lines
1.7 KiB
TypeScript
import { Volume } from 'docker-types/generated/1.41';
|
|
|
|
import { ResourceControlViewModel } from '@/react/portainer/access-control/models/ResourceControlViewModel';
|
|
import { IResource } from '@/react/docker/components/datatable/createOwnershipColumn';
|
|
import { PortainerResponse } from '@/react/docker/types';
|
|
|
|
export class VolumeViewModel implements IResource {
|
|
Id: string;
|
|
|
|
Name: Volume['Name'];
|
|
|
|
CreatedAt?: Volume['CreatedAt'];
|
|
|
|
Driver: Volume['Driver'];
|
|
|
|
Options: Volume['Options'];
|
|
|
|
Labels: Volume['Labels'];
|
|
|
|
Mountpoint: Volume['Mountpoint'];
|
|
|
|
// Portainer properties
|
|
|
|
ResourceId?: string;
|
|
|
|
NodeName?: string;
|
|
|
|
StackName?: string;
|
|
|
|
ResourceControl?: ResourceControlViewModel;
|
|
|
|
constructor(data: PortainerResponse<Volume> & { ResourceID?: string }) {
|
|
this.Name = data.Name;
|
|
this.CreatedAt = data.CreatedAt;
|
|
this.Driver = data.Driver;
|
|
this.Options = data.Options;
|
|
this.Labels = data.Labels;
|
|
if (this.Labels && this.Labels['com.docker.compose.project']) {
|
|
this.StackName = this.Labels['com.docker.compose.project'];
|
|
} else if (this.Labels && this.Labels['com.docker.stack.namespace']) {
|
|
this.StackName = this.Labels['com.docker.stack.namespace'];
|
|
}
|
|
this.Mountpoint = data.Mountpoint;
|
|
|
|
this.ResourceId = data.ResourceID;
|
|
|
|
if (data.Portainer) {
|
|
if (data.Portainer.ResourceControl) {
|
|
this.ResourceControl = new ResourceControlViewModel(
|
|
data.Portainer.ResourceControl
|
|
);
|
|
}
|
|
if (data.Portainer.Agent && data.Portainer.Agent.NodeName) {
|
|
this.NodeName = data.Portainer.Agent.NodeName;
|
|
}
|
|
}
|
|
|
|
this.Id = data.Name;
|
|
if (this.NodeName) {
|
|
this.Id = `${data.Name}-${this.NodeName}`;
|
|
}
|
|
}
|
|
}
|