mirror of
https://github.com/portainer/portainer.git
synced 2025-08-05 05:45:22 +02:00
refactor(app): move storidge to new 'integrations' module (#2905)
* refactor(app): move storidge to new 'integrations' module * style(storidge): revert TODO note removal
This commit is contained in:
parent
67de71a18f
commit
144e0ae07e
59 changed files with 32 additions and 29 deletions
9
app/integrations/storidge/models/drive.js
Normal file
9
app/integrations/storidge/models/drive.js
Normal file
|
@ -0,0 +1,9 @@
|
|||
export function StoridgeDriveModel(data) {
|
||||
this.Id = data.driveid;
|
||||
this.Node = data.node;
|
||||
this.Use = data.use;
|
||||
this.Status = data.drivestatus.toLowerCase();
|
||||
this.Size = data.size;
|
||||
this.Type = data.type;
|
||||
this.Device = data.device;
|
||||
}
|
6
app/integrations/storidge/models/events.js
Normal file
6
app/integrations/storidge/models/events.js
Normal file
|
@ -0,0 +1,6 @@
|
|||
export function StoridgeEventModel(data) {
|
||||
this.Time = data.time;
|
||||
this.Category = data.category;
|
||||
this.Module = data.module;
|
||||
this.Content = data.content;
|
||||
}
|
17
app/integrations/storidge/models/info.js
Normal file
17
app/integrations/storidge/models/info.js
Normal file
|
@ -0,0 +1,17 @@
|
|||
export function StoridgeInfoModel(data) {
|
||||
this.Domain = data.domain;
|
||||
this.Nodes = data.nodes;
|
||||
this.Condition = data.condition;
|
||||
this.ProvisionedBandwidth = data.provisionedBandwidth;
|
||||
this.UsedBandwidth = data.usedBandwidth;
|
||||
this.FreeBandwidth = data.freeBandwidth;
|
||||
this.TotalBandwidth = data.totalBandwidth;
|
||||
this.ProvisionedIOPS = data.provisionedIOPS;
|
||||
this.UsedIOPS = data.usedIOPS;
|
||||
this.FreeIOPS = data.freeIOPS;
|
||||
this.TotalIOPS = data.totalIOPS;
|
||||
this.ProvisionedCapacity = data.provisionedCapacity;
|
||||
this.UsedCapacity = data.usedCapacity;
|
||||
this.FreeCapacity = data.freeCapacity;
|
||||
this.TotalCapacity = data.totalCapacity;
|
||||
}
|
31
app/integrations/storidge/models/node.js
Normal file
31
app/integrations/storidge/models/node.js
Normal file
|
@ -0,0 +1,31 @@
|
|||
export function StoridgeNodeModel(name, data) {
|
||||
this.Name = name;
|
||||
this.IP = data.ip;
|
||||
this.Role = data.role;
|
||||
this.Status = data.status;
|
||||
}
|
||||
|
||||
export function StoridgeNodeDetailedModel(name, properties) {
|
||||
this.Name = name;
|
||||
this.Condition = properties.condition;
|
||||
this.Domain = properties.domain;
|
||||
this.DomainID = properties.domainID;
|
||||
this.FreeBandwidth = properties.freeBandwidth;
|
||||
this.FreeCapacity = properties.freeCapacity;
|
||||
this.FreeIOPS = properties.freeIOPS;
|
||||
this.Hdds = properties.hdds;
|
||||
this.MetadataVersion = properties.metadataVersion;
|
||||
this.Nodes = properties.nodes;
|
||||
this.ProvisionedBandwidth = properties.provisionedBandwidth;
|
||||
this.ProvisionedCapacity = properties.provisionedCapacity;
|
||||
this.ProvisionedIOPS = properties.provisionedIOPS;
|
||||
this.Ssds = properties.ssds;
|
||||
this.Status = properties.status;
|
||||
this.TotalBandwidth = properties.totalBandwidth;
|
||||
this.TotalCapacity = properties.totalCapacity;
|
||||
this.TotalIOPS = properties.totalIOPS;
|
||||
this.UsedBandwidth = properties.usedBandwidth;
|
||||
this.UsedCapacity = properties.usedCapacity;
|
||||
this.UsedIOPS = properties.usedIOPS;
|
||||
this.Vdisks = properties.vdisks;
|
||||
}
|
133
app/integrations/storidge/models/profile.js
Normal file
133
app/integrations/storidge/models/profile.js
Normal file
|
@ -0,0 +1,133 @@
|
|||
export function StoridgeProfileDefaultModel() {
|
||||
this.Directory = '/cio/';
|
||||
this.Capacity = 20;
|
||||
this.Redundancy = 2;
|
||||
this.Provisioning = 'thin';
|
||||
this.Type = 'ssd';
|
||||
this.MinIOPS = 100;
|
||||
this.MaxIOPS = 2000;
|
||||
this.MinBandwidth = 1;
|
||||
this.MaxBandwidth = 100;
|
||||
this.Filesystem = 'btrfs';
|
||||
this.SnapshotEnabled = false;
|
||||
this.SnapshotInterval = 1440;
|
||||
this.SnapshotMax = 1;
|
||||
this.EncryptionEnabled = false;
|
||||
this.InterfaceType = '';
|
||||
this.InterfaceDriver = '';
|
||||
this.InterfaceNetwork = '';
|
||||
this.InterfaceConf = '';
|
||||
this.Labels = [];
|
||||
}
|
||||
|
||||
export function StoridgeProfileListModel(data) {
|
||||
this.Name = data;
|
||||
this.Checked = false;
|
||||
}
|
||||
|
||||
export function StoridgeProfileModel(name, data) {
|
||||
this.Name = name;
|
||||
this.Directory = data.directory;
|
||||
this.Capacity = data.capacity;
|
||||
this.Provisioning = data.provision;
|
||||
this.Type = data.type;
|
||||
this.Redundancy = data.level;
|
||||
|
||||
if (data.iops) {
|
||||
this.MinIOPS = data.iops.min;
|
||||
this.MaxIOPS = data.iops.max;
|
||||
}
|
||||
|
||||
if (data.bandwidth) {
|
||||
this.MinBandwidth = data.bandwidth.min;
|
||||
this.MaxBandwidth = data.bandwidth.max;
|
||||
}
|
||||
|
||||
if (data.filesystem) {
|
||||
this.Filesystem = data.filesystem.type;
|
||||
}
|
||||
// this.Filesystem = data.filesystem;
|
||||
|
||||
var service = data.service;
|
||||
|
||||
if (service.snapshot) {
|
||||
this.SnapshotEnabled = service.snapshot.enabled;
|
||||
this.SnapshotInterval = service.snapshot.interval;
|
||||
this.SnapshotMax = service.snapshot.max;
|
||||
} else {
|
||||
this.SnapshotEnabled = false;
|
||||
}
|
||||
|
||||
if (service.encryption) {
|
||||
this.EncryptionEnabled = service.encryption.enabled;
|
||||
} else {
|
||||
this.EncryptionEnabled = false;
|
||||
}
|
||||
|
||||
if (data.interface) {
|
||||
this.InterfaceType = data.interface.type;
|
||||
this.InterfaceDriver = data.interface.driver;
|
||||
this.InterfaceNetwork = data.interface.network;
|
||||
this.InterfaceConf = data.interface.conf;
|
||||
}
|
||||
|
||||
if (data.label) {
|
||||
this.Labels = data.label;
|
||||
} else {
|
||||
this.Labels = [];
|
||||
}
|
||||
}
|
||||
|
||||
export function StoridgeCreateProfileRequest(model) {
|
||||
this.name = model.Name;
|
||||
this.capacity = model.Capacity;
|
||||
this.directory = model.Directory;
|
||||
this.provision = model.Provisioning;
|
||||
this.type = model.Type;
|
||||
this.level = model.Redundancy;
|
||||
if (model.MinIOPS && model.MaxIOPS) {
|
||||
this.iops = {
|
||||
min: model.MinIOPS,
|
||||
max: model.MaxIOPS
|
||||
};
|
||||
}
|
||||
|
||||
if (model.MinBandwidth && model.MaxBandwidth) {
|
||||
this.bandwidth = {
|
||||
min: model.MinBandwidth,
|
||||
max: model.MaxBandwidth
|
||||
};
|
||||
}
|
||||
|
||||
this.filesystem = {
|
||||
type: model.Filesystem
|
||||
};
|
||||
|
||||
var service = {};
|
||||
|
||||
service.snapshot = {
|
||||
enabled: model.SnapshotEnabled
|
||||
};
|
||||
if (model.SnapshotEnabled) {
|
||||
service.snapshot.interval = model.SnapshotInterval;
|
||||
service.snapshot.max = model.SnapshotMax;
|
||||
}
|
||||
|
||||
service.encryption = {
|
||||
enabled: model.EncryptionEnabled
|
||||
};
|
||||
|
||||
this.service = service;
|
||||
|
||||
this.interface = {
|
||||
driver: model.InterfaceDriver,
|
||||
network: model.InterfaceNetwork,
|
||||
conf: model.InterfaceConf
|
||||
};
|
||||
|
||||
if (model.InterfaceType) {
|
||||
this.interface.type = model.InterfaceType;
|
||||
}
|
||||
|
||||
this.label = model.Labels;
|
||||
}
|
9
app/integrations/storidge/models/snapshot.js
Normal file
9
app/integrations/storidge/models/snapshot.js
Normal file
|
@ -0,0 +1,9 @@
|
|||
export function StoridgeSnapshotModel(data) {
|
||||
this.Id = data.identifier;
|
||||
this.Date = data.date;
|
||||
this.Description = data.description;
|
||||
this.SourceID = data.sourceid;
|
||||
this.Type = data.type;
|
||||
this.Directory = data.directory;
|
||||
this.Source = data.source;
|
||||
}
|
40
app/integrations/storidge/models/volume.js
Normal file
40
app/integrations/storidge/models/volume.js
Normal file
|
@ -0,0 +1,40 @@
|
|||
export function StoridgeVolumeModel(data) {
|
||||
this.Allocated = data.allocated;
|
||||
this.Capacity = data.capacity;
|
||||
this.Directory = data.directory;
|
||||
this.IOPSMax = data.maximumIOPS;
|
||||
this.IOPSMin = data.minimumIOPS;
|
||||
this.BandwidthMin = data.minimumBandwidth;
|
||||
this.BandwidthMax = data.maximumBandwidth;
|
||||
this.LocalDriveOnly = data.localDriveOnly;
|
||||
this.Name = data.name;
|
||||
this.Node = data.node;
|
||||
this.NodeID = data.nodeid;
|
||||
this.Provisioning = data.provisioning;
|
||||
this.Redundancy = data.redundancy;
|
||||
this.Uuid = data.uuid;
|
||||
this.Vdisk = data.vdisk;
|
||||
this.Labels = data.labels;
|
||||
|
||||
this.IP = data.ipaddr;
|
||||
this.DriveType = data.driveType;
|
||||
this.Encryption = data.encryption;
|
||||
this.SnapshotEnabled = data.snapshot;
|
||||
this.SnapshotInterval = data.snapInterval;
|
||||
this.SnapshotMax = data.maximumSnapshots;
|
||||
this.Filesystem = data.filesystem;
|
||||
}
|
||||
|
||||
export function StoridgeVolumeUpdateModel(data) {
|
||||
this.name = data.Name;
|
||||
this.opts = {
|
||||
node: data.Node,
|
||||
nodeid: data.NodeID,
|
||||
capacity: data.Capacity,
|
||||
iopsmin: data.IOPSMin,
|
||||
iopsmax: data.IOPSMax,
|
||||
bandwidthmin: data.BandwidthMin,
|
||||
bandwidthmax: data.BandwidthMax
|
||||
};
|
||||
this.labels = data.Labels;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue