make sure user cannot add assign_public_ip and spiffe_id from add user data config
add alert when input spiffe id and assign publi ip names
MODIFY
deploy-board/deploy_board/static/js/components/clusterconfigcomponents.js
deploy-board/deploy_board/static/js/components/clusterconfigcomponents.js
@@ -99,6 +99,15 @@ Vue.component('data-config-field', {
}
});
+Vue.component('data-config-readonly-field', {
+ template: '<div class="form-group">\
+ <label for="properties" class="control-label col-xs-3">{{name}}</label>\
+ <div class="col-xs-6">\
+ <input class="form-control" type="text" v-bind:value="value" v-bind:readonly="readonly ? true : false"></input>\
+ </div>\
+ </div>',
+ props: ['name', 'value', 'readonly']
+});
Vue.component('aws-user-data', {
template: '<div class="form-group">\
@@ -124,6 +133,23 @@ Vue.component('aws-user-data', {
}
});
+Vue.component('aws-readonly-user-data', {
+ template: '<div class="form-group">\
+ <data-config-readonly-field v-for="data in alluserdata" v-bind:name="data.name" v-bind:value="data.value" v-bind:readonly="data.readonly" v-bind:inadvanced="inadvanced"\
+ v-show="shouldShow(data.name)"></data-config-readonly-field>\
+ </div>',
+ props: ['alluserdata', 'inadvanced', 'showcmpgroup'],
+ methods: {
+ shouldShow: function (name) {
+ if (this.inadvanced) {
+ return this.showcmpgroup ? true : name != "cmp_group"
+ }
+ else {
+ return !name.startsWith("pinfo_") && name != "cmp_group"
+ }
+ }
+ }
+});
Vue.component('add-config-button', {
template: '<button type="button" class="deployToolTip btn btn-default btn-sm" data-toggle="modal" v-bind:data-target="target">\
@@ -198,8 +224,13 @@ Vue.component('aws-config-modal', {
},
addConfig: function () {
if (this.useCustomizedName) {
+ if (this.customizedName !='spiffe_id' && this.customizedName!='assign_public_ip'){
this.$emit('click', { name: this.customizedName, value: this.selectedOptionValue })
}
+ else {
+ alert("teletraan currently do not allow user to modify spiffeId and assign public ip")
+ }
+ }
else {
this.$emit('click', { name: this.selectedOption.name, value: this.selectedOptionValue })
}

MODIFY
deploy-board/deploy_board/templates/clusters/cluster_configuration.html
deploy-board/deploy_board/templates/clusters/cluster_configuration.html
</div>
</div>
<aws-user-data v-bind:alluserdata="allUserData" v-on:deleteconfig="deleteConfig" v-on:change="configChange" v-bind:inadvanced="inAdvanced" v-bind:showcmpgroup="showCmpGroup"></aws-user-data>
+ <aws-readonly-user-data v-bind:alluserdata="textUserData" v-bind:inadvanced="inAdvanced" v-bind:showcmpgroup="showCmpGroup"></aws-readonly-user-data>
</div>
</fieldset>
</form>
return {
name: key,
value: currentCluster.configs[key],
- readonly: key === 'spiffe_id' || key === 'assign_public_ip'
}
- }),
+ }).filter(function(item){return item.name!='spiffe_id' && item.name!='assign_public_ip'}),
+ textUserData: Object.keys(currentCluster.configs).map(
+ function(key) {
+ return {
+ name: key,
+ value: currentCluster.configs[key],
+ readonly: true
+ }
+ }).filter(function(item){return item.name ==='spiffe_id' || item.name ==='assign_public_ip'}),
assignPublicIP: currentCluster.configs.assign_public_ip == "true" ? true : false,
awsRole: currentCluster.configs.aws_role,
baseimages: info.baseImages.map(function(o) {
text: key,
default: info.configList[key]
}
- })
+ }).filter(function(item){return item.name!='assign_public_ip'})
if (this.inAdvanced){
return options;
}

MODIFY
deploy-board/deploy_board/templates/configs/new_capacity_adv.html
deploy-board/deploy_board/templates/configs/new_capacity_adv.html
</div>
</div>
<aws-user-data v-bind:alluserdata="allUserData" v-on:deleteconfig="deleteConfig" v-on:change="configChange" inadvanced="inAdvanced"></aws-user-data>
+ <aws-readonly-user-data v-bind:alluserdata="textUserData" inadvanced="inAdvanced"></aws-readonly-user-data>
</div>
</fieldset>
</form>
@@ -107,6 +108,14 @@ var capacitySetting = new Vue({
value: info.defaultCMPConfigs[key]
}
}).filter(function(item){return item.name!='cmp_group'}),
+ textUserData: Object.keys(info.configList).map(
+ function(key) {
+ return {
+ name: key,
+ value: info.configList[key],
+ readonly: true
+ }
+ }).filter(function(item){return item.name ==='assign_public_ip'}),
assignPublicIP: false,
baseImageHelpData: [],
baseimages: info.baseImages.map(
@@ -126,7 +135,7 @@ var capacitySetting = new Vue({
text: key,
default: info.configList[key]
}
- }),
+ }).filter(function(item){return item.name != 'assign_public_ip'}),
confirmDialogTitle: "Confirm New Capacity Creation",
confirmDialogId: "createHostGroup",
currentProvider: info.defaultProvider,

make sure user cannot add assign_public_ip and spiffe_id from add user data config (#650)

add alert when input spiffe id and assign publi ip names