feat(xen-api): name record classes with types
This commit is contained in:
parent
56961b55bd
commit
6c861bfd1f
@ -34,7 +34,7 @@ const EVENT_TIMEOUT = 60
|
|||||||
|
|
||||||
// ===================================================================
|
// ===================================================================
|
||||||
|
|
||||||
const { defineProperties, freeze, keys: getKeys } = Object
|
const { defineProperties, defineProperty, freeze, keys: getKeys } = Object
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
|
|
||||||
@ -1023,7 +1023,8 @@ export class Xapi extends EventEmitter {
|
|||||||
|
|
||||||
const getObjectByRef = ref => this._objectsByRef[ref]
|
const getObjectByRef = ref => this._objectsByRef[ref]
|
||||||
|
|
||||||
Record = function(ref, data) {
|
Record = defineProperty(
|
||||||
|
function(ref, data) {
|
||||||
defineProperties(this, {
|
defineProperties(this, {
|
||||||
$id: { value: data.uuid ?? ref },
|
$id: { value: data.uuid ?? ref },
|
||||||
$ref: { value: ref },
|
$ref: { value: ref },
|
||||||
@ -1033,7 +1034,12 @@ export class Xapi extends EventEmitter {
|
|||||||
const field = fields[i]
|
const field = fields[i]
|
||||||
this[field] = data[field]
|
this[field] = data[field]
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
'name',
|
||||||
|
{
|
||||||
|
value: type,
|
||||||
}
|
}
|
||||||
|
)
|
||||||
|
|
||||||
const getters = { $pool: getPool }
|
const getters = { $pool: getPool }
|
||||||
const props = { $type: type }
|
const props = { $type: type }
|
||||||
|
Loading…
Reference in New Issue
Block a user