mirror of
https://github.com/portainer/portainer.git
synced 2025-08-02 20:35:25 +02:00
This commit is contained in:
parent
e6dee37af0
commit
fa9ba303aa
7 changed files with 464 additions and 5 deletions
|
@ -14,6 +14,7 @@ function TaskViewModel(data, node_data) {
|
|||
this.Updated = data.UpdatedAt;
|
||||
this.Slot = data.Slot;
|
||||
this.Status = data.Status.State;
|
||||
this.Image = data.Spec.ContainerSpec ? data.Spec.ContainerSpec.Image : '';
|
||||
if (node_data) {
|
||||
for (var i = 0; i < node_data.length; ++i) {
|
||||
if (data.NodeID === node_data[i].ID) {
|
||||
|
@ -60,6 +61,42 @@ function ServiceViewModel(data) {
|
|||
this.EditName = false;
|
||||
}
|
||||
|
||||
function NodeViewModel(data) {
|
||||
this.Model = data;
|
||||
this.Id = data.ID;
|
||||
this.Version = data.Version.Index;
|
||||
this.Name = data.Spec.Name;
|
||||
this.Role = data.Spec.Role;
|
||||
this.CreatedAt = data.CreatedAt;
|
||||
this.UpdatedAt = data.UpdatedAt;
|
||||
this.Availability = data.Spec.Availability;
|
||||
|
||||
var labels = data.Spec.Labels;
|
||||
if (labels) {
|
||||
this.Labels = Object.keys(labels).map(function(key) {
|
||||
return { key: key, value: labels[key], originalKey: key, originalValue: labels[key], added: true };
|
||||
});
|
||||
} else {
|
||||
this.Labels = [];
|
||||
}
|
||||
|
||||
this.Hostname = data.Description.Hostname;
|
||||
this.PlatformArchitecture = data.Description.Platform.Architecture;
|
||||
this.PlatformOS = data.Description.Platform.OS;
|
||||
this.CPUs = data.Description.Resources.NanoCPUs;
|
||||
this.Memory = data.Description.Resources.MemoryBytes;
|
||||
this.EngineVersion = data.Description.Engine.EngineVersion;
|
||||
this.EngineLabels = data.Description.Engine.Labels;
|
||||
this.Plugins = data.Description.Engine.Plugins;
|
||||
this.Status = data.Status.State;
|
||||
|
||||
if (data.ManagerStatus) {
|
||||
this.Leader = data.ManagerStatus.Leader;
|
||||
this.Reachability = data.ManagerStatus.Reachability;
|
||||
this.ManagerAddr = data.ManagerStatus.Addr;
|
||||
}
|
||||
}
|
||||
|
||||
function ContainerViewModel(data) {
|
||||
this.Id = data.Id;
|
||||
this.Status = data.Status;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue