mirror of
https://github.com/portainer/portainer.git
synced 2025-08-02 20:35:25 +02:00
refactor(docker/volumes): migrate table to react [EE-4677] (#10312)
This commit is contained in:
parent
8e1417b4e9
commit
5c37ed328f
25 changed files with 402 additions and 395 deletions
56
app/docker/models/volume.ts
Normal file
56
app/docker/models/volume.ts
Normal file
|
@ -0,0 +1,56 @@
|
|||
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 { PortainerMetadata } from '@/react/docker/types';
|
||||
|
||||
export class VolumeViewModel implements IResource {
|
||||
Id: string;
|
||||
|
||||
CreatedAt: string | undefined;
|
||||
|
||||
Driver: string;
|
||||
|
||||
Options: Record<string, string>;
|
||||
|
||||
Labels: Record<string, string>;
|
||||
|
||||
StackName?: string;
|
||||
|
||||
Mountpoint: string;
|
||||
|
||||
ResourceId?: string;
|
||||
|
||||
NodeName?: string;
|
||||
|
||||
ResourceControl?: ResourceControlViewModel;
|
||||
|
||||
constructor(
|
||||
data: Volume & { Portainer?: PortainerMetadata; ResourceID?: string }
|
||||
) {
|
||||
this.Id = 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue