fix for spiffe id disappear when user create new cluster
make sure user cannot save data config if they manually modified spiffe_id from UI
MODIFY
deploy-board/deploy_board/static/js/components/clusterconfigcomponents.js
deploy-board/deploy_board/static/js/components/clusterconfigcomponents.js
@@ -99,16 +99,6 @@ 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">\
<data-config-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"\
@@ -133,24 +123,6 @@ 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">\
<span class="glyphicon glyphicon-plus"></span> Add Config\

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'}),
+ }),
+ spiffeId: 'spiffe_id' in currentCluster.configs ? currentCluster.configs['spiffe_id']:null,
assignPublicIP: currentCluster.configs.assign_public_ip == "true" ? true : false,
awsRole: currentCluster.configs.aws_role,
baseimages: info.baseImages.map(function(o) {
return false
}
+ //Validate spiffe_id not modified by user
+ if ('spiffe_id' in clusterInfo.configs && clusterInfo.configs['spiffe_id'] != this.spiffeId){
+ globalNotificationBanner.error = "spiffe id cannot be modified by user"
+ return false
+ }
+
if (imageNameValue.startsWith('cmp_base')){
if (!('pinfo_role' in clusterInfo.configs && clusterInfo.configs['pinfo_role']==='cmp_base')){
globalNotificationBanner.error = "cmp_base image must have pinfo_role set to cmp_base"

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>
@@ -108,14 +107,6 @@ 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(

fix for spiffe id disappear when user create new cluster (#655)

make sure user cannot save data config if they manually modified spiffe_id from UI