Files
enm-cli/lib/components/TopologyBrowser/commands/set.js
Vyacheslav.Sviridov 1fb7a6f81b first commit
2022-05-13 18:13:36 +06:00

29 lines
758 B
JavaScript

const colors = require('colors')
const inputByType = require('../inputValue')
async function set() {
const attributeData = this.attributesData.filter(item => item.key === this.attribute)[0]
if (!attributeData) return
if (attributeData.writeBehavior === 'NOT_ALLOWED' || attributeData.immutable) {
console.log('Attribute Is ReadOnly'.yellow)
return
}
if (this.isConfig) {
const found = this.configSet.filter(item => item.key === this.attribute)[0]
const { value } = await inputByType(attributeData)
if (found) {
found.value = value
} else {
this.configSet.push(
{
key: this.attribute,
value,
datatype: attributeData.type,
}
)
}
}
}
module.exports = set