2019-11-12 23:41:42 +00:00
|
|
|
import { ResourceControlViewModel } from 'Portainer/models/resourceControl/resourceControl';
|
2019-03-21 05:46:49 +00:00
|
|
|
|
|
|
|
export function VolumeViewModel(data) {
|
2017-05-23 18:56:10 +00:00
|
|
|
this.Id = data.Name;
|
2019-02-28 22:59:11 +00:00
|
|
|
this.CreatedAt = data.CreatedAt;
|
2017-03-12 16:24:15 +00:00
|
|
|
this.Driver = data.Driver;
|
2017-05-23 18:56:10 +00:00
|
|
|
this.Options = data.Options;
|
|
|
|
this.Labels = data.Labels;
|
2017-10-15 17:24:40 +00:00
|
|
|
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'];
|
|
|
|
}
|
2017-03-12 16:24:15 +00:00
|
|
|
this.Mountpoint = data.Mountpoint;
|
2017-05-23 18:56:10 +00:00
|
|
|
|
2021-07-19 07:43:49 +00:00
|
|
|
this.ResourceId = data.ResourceID;
|
|
|
|
|
2017-03-12 16:24:15 +00:00
|
|
|
if (data.Portainer) {
|
|
|
|
if (data.Portainer.ResourceControl) {
|
2017-05-23 18:56:10 +00:00
|
|
|
this.ResourceControl = new ResourceControlViewModel(data.Portainer.ResourceControl);
|
2017-03-12 16:24:15 +00:00
|
|
|
}
|
2018-05-06 07:15:57 +00:00
|
|
|
if (data.Portainer.Agent && data.Portainer.Agent.NodeName) {
|
|
|
|
this.NodeName = data.Portainer.Agent.NodeName;
|
|
|
|
}
|
2017-03-12 16:24:15 +00:00
|
|
|
}
|
|
|
|
}
|