Use the client API to load servers on the listing page
This commit is contained in:
parent
ad69193ac0
commit
6e5c365018
8 changed files with 98 additions and 9 deletions
40
resources/assets/scripts/models/server.js
Normal file
40
resources/assets/scripts/models/server.js
Normal file
|
@ -0,0 +1,40 @@
|
|||
import Allocation from './allocation';
|
||||
|
||||
const Server = function () {
|
||||
this.identifier = null;
|
||||
this.uuid = null;
|
||||
this.name = '';
|
||||
this.description = '';
|
||||
this.allocation = null;
|
||||
this.limits = {
|
||||
memory: 0,
|
||||
swap: 0,
|
||||
disk: 0,
|
||||
io: 0,
|
||||
cpu: 0,
|
||||
};
|
||||
this.feature_limits = {
|
||||
databases: 0,
|
||||
allocations: 0,
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Return a new server model filled with data from the provided object.
|
||||
*
|
||||
* @param {object} obj
|
||||
* @returns {Server}
|
||||
*/
|
||||
Server.prototype.fill = function (obj) {
|
||||
this.identifier = obj.identifier;
|
||||
this.uuid = obj.uuid;
|
||||
this.name = obj.name;
|
||||
this.description = obj.description;
|
||||
this.allocation = new Allocation().fill(obj.allocation || {});
|
||||
this.limits = obj.limits;
|
||||
this.feature_limits = obj.feature_limits;
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
export default Server;
|
Loading…
Add table
Add a link
Reference in a new issue