2017-03-12 17:24:15 +01:00
|
|
|
function VolumeViewModel(data) {
|
2017-05-23 20:56:10 +02:00
|
|
|
this.Id = data.Name;
|
2019-03-01 06:59:11 +08:00
|
|
|
this.CreatedAt = data.CreatedAt;
|
2017-03-12 17:24:15 +01:00
|
|
|
this.Driver = data.Driver;
|
2017-05-23 20:56:10 +02:00
|
|
|
this.Options = data.Options;
|
|
|
|
this.Labels = data.Labels;
|
2017-10-15 19:24:40 +02: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 17:24:15 +01:00
|
|
|
this.Mountpoint = data.Mountpoint;
|
2017-05-23 20:56:10 +02:00
|
|
|
|
2017-03-12 17:24:15 +01:00
|
|
|
if (data.Portainer) {
|
|
|
|
if (data.Portainer.ResourceControl) {
|
2017-05-23 20:56:10 +02:00
|
|
|
this.ResourceControl = new ResourceControlViewModel(data.Portainer.ResourceControl);
|
2017-03-12 17:24:15 +01:00
|
|
|
}
|
2018-05-06 09:15:57 +02:00
|
|
|
if (data.Portainer.Agent && data.Portainer.Agent.NodeName) {
|
|
|
|
this.NodeName = data.Portainer.Agent.NodeName;
|
|
|
|
}
|
2017-03-12 17:24:15 +01:00
|
|
|
}
|
|
|
|
}
|