1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-16 22:50:10 +03:00

F #5043 introduced labels into yaml file and controled errors (#295)

This commit is contained in:
juanmont 2017-05-08 12:36:02 +02:00 committed by Tino Vázquez
parent 163b91d522
commit 2b112fd02a
3 changed files with 27 additions and 16 deletions

View File

@ -14,3 +14,5 @@ default:
default_groupadmin:
- groupadmin
- cloud
labels_groups:
default:

View File

@ -133,11 +133,13 @@ class SunstoneViews
def get_all_labels(group_name)
labels = []
if @views_config['labels_groups'][group_name]
@views_config['labels_groups'][group_name].each{|l| labels.push(l)}
end
if @views_config['labels_groups']['default']
@views_config['labels_groups']['default'].each{|l| labels.push(l)}
if @views_config['labels_groups']
if @views_config['labels_groups'][group_name]
@views_config['labels_groups'][group_name].each{|l| labels.push(l)}
end
if @views_config['labels_groups']['default']
@views_config['labels_groups']['default'].each{|l| labels.push(l)}
end
end
return labels
end

View File

@ -132,13 +132,16 @@ define(function(require) {
var labels = _getLabels(dataTable, labelsColumn);
labels_persis = _deserializeLabels(labels_persis);
var array_labels_yaml = [];
$.each(config['all_labels'], function(index){
array_labels_yaml.push(config['all_labels'][index]+'_YAML');
if(labels[config['all_labels'][index]]){
delete labels[config['all_labels'][index]];
}
})
var labels_yaml = _deserializeLabels(array_labels_yaml.join(','));
var labels_yaml = {};
if(config['all_labels'][0] != ""){
$.each(config['all_labels'], function(index){
array_labels_yaml.push(config['all_labels'][index]+'_YAML');
if(labels[config['all_labels'][index]]){
delete labels[config['all_labels'][index]];
}
})
labels_yaml = _deserializeLabels(array_labels_yaml.join(','));
}
var keys = Object.keys(labels_persis).sort();
for (var i = 0; i < keys.length; i++){
if(labels[keys[i]]){
@ -148,16 +151,20 @@ define(function(require) {
delete labels_persis[keys[i]];
}
$.extend(labels, labels_persis);
var html_yaml = ""
if(!$.isEmptyObject(labels_yaml)){
html_yaml = '<h6>' + Locale.tr('System Labels') + '</h6>' +
'<div class="labeltree-container">' +
Tree.html(_makeTree(labels_yaml), false) +
'</div>';
}
labelsDropdown.html(
'<div>' +
'<h6>' + Locale.tr('Edit Labels') + '</h6>' +
'<div class="labeltree-container">' +
Tree.html(_makeTree(labels), false) +
'</div>' +
'<h6>' + Locale.tr('System Labels') + '</h6>' +
'<div class="labeltree-container">' +
Tree.html(_makeTree(labels_yaml), false) +
'</div>' +
html_yaml+
'<div class="input-container">' +
'<input type="text" class="newLabelInput" placeholder="' + Locale.tr("Add Label") + '"/>' +
'</div>' +