diff --git a/src/sunstone/etc/sunstone-views.yaml b/src/sunstone/etc/sunstone-views.yaml index 154746d545..e8d414fb92 100644 --- a/src/sunstone/etc/sunstone-views.yaml +++ b/src/sunstone/etc/sunstone-views.yaml @@ -14,3 +14,5 @@ default: default_groupadmin: - groupadmin - cloud +labels_groups: + default: diff --git a/src/sunstone/models/SunstoneViews.rb b/src/sunstone/models/SunstoneViews.rb index ddc2489651..c131aaf77a 100644 --- a/src/sunstone/models/SunstoneViews.rb +++ b/src/sunstone/models/SunstoneViews.rb @@ -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 diff --git a/src/sunstone/public/app/utils/labels/utils.js b/src/sunstone/public/app/utils/labels/utils.js index 422b48bf1c..bfc8f94d10 100644 --- a/src/sunstone/public/app/utils/labels/utils.js +++ b/src/sunstone/public/app/utils/labels/utils.js @@ -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 = '
' + Locale.tr('System Labels') + '
' + + '
' + + Tree.html(_makeTree(labels_yaml), false) + + '
'; + } labelsDropdown.html( '
' + '
' + Locale.tr('Edit Labels') + '
' + '
' + Tree.html(_makeTree(labels), false) + '
' + - '
' + Locale.tr('System Labels') + '
' + - '
' + - Tree.html(_makeTree(labels_yaml), false) + - '
' + + html_yaml+ '
' + '' + '
' +