2019-03-21 05:46:49 +00:00
|
|
|
import { ResourceControlViewModel } from "../../portainer/models/resourceControl";
|
|
|
|
|
|
|
|
export function NetworkViewModel(data) {
|
2017-09-19 14:58:30 +00:00
|
|
|
this.Id = data.Id;
|
|
|
|
this.Name = data.Name;
|
|
|
|
this.Scope = data.Scope;
|
|
|
|
this.Driver = data.Driver;
|
|
|
|
this.Attachable = data.Attachable;
|
2018-08-22 06:45:14 +00:00
|
|
|
this.Internal = data.Internal;
|
2017-09-19 14:58:30 +00:00
|
|
|
this.IPAM = data.IPAM;
|
|
|
|
this.Containers = data.Containers;
|
|
|
|
this.Options = data.Options;
|
|
|
|
|
2017-10-15 17:24:40 +00:00
|
|
|
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'];
|
|
|
|
}
|
|
|
|
|
2017-09-19 14:58:30 +00:00
|
|
|
if (data.Portainer) {
|
|
|
|
if (data.Portainer.ResourceControl) {
|
|
|
|
this.ResourceControl = new ResourceControlViewModel(data.Portainer.ResourceControl);
|
|
|
|
}
|
2018-05-06 07:15:57 +00:00
|
|
|
if (data.Portainer.Agent && data.Portainer.Agent.NodeName) {
|
|
|
|
this.NodeName = data.Portainer.Agent.NodeName;
|
|
|
|
}
|
2017-09-19 14:58:30 +00:00
|
|
|
}
|
2018-08-16 10:29:15 +00:00
|
|
|
|
|
|
|
this.ConfigFrom = data.ConfigFrom;
|
|
|
|
this.ConfigOnly = data.ConfigOnly;
|
|
|
|
}
|