|
|
71541a |
From 7c12321d187ce5919ea5e443612321b404be8cab Mon Sep 17 00:00:00 2001
|
|
|
71541a |
From: Ondrej Mular <omular@redhat.com>
|
|
|
71541a |
Date: Tue, 15 Sep 2015 11:03:59 +0200
|
|
|
71541a |
Subject: [PATCH] web UI: fixes in nodes, resources, fence devices
|
|
|
71541a |
|
|
|
71541a |
- fix creating disabled resource
|
|
|
71541a |
- add sorting for cluster list, resource list and fence device list
|
|
|
71541a |
- hide resource (fence device) details when there is no resource (fence device)
|
|
|
71541a |
- in resource list color of resource name depends on its status
|
|
|
71541a |
- fix group selector
|
|
|
71541a |
- disabled autocorrect for ordering set constraints
|
|
|
71541a |
- fix status detection of master/slave resources
|
|
|
71541a |
---
|
|
|
71541a |
pcsd/cluster_entity.rb | 2 +-
|
|
|
71541a |
pcsd/pcsd.rb | 2 +-
|
|
|
71541a |
pcsd/public/css/style.css | 8 +++++++
|
|
|
71541a |
pcsd/public/js/nodes-ember.js | 56 +++++++++++++++++++++++++++++++------------
|
|
|
71541a |
pcsd/public/js/pcsd.js | 5 +++-
|
|
|
71541a |
pcsd/views/main.erb | 4 +++-
|
|
|
71541a |
6 files changed, 58 insertions(+), 19 deletions(-)
|
|
|
71541a |
|
|
|
71541a |
diff --git a/pcsd/cluster_entity.rb b/pcsd/cluster_entity.rb
|
|
|
71541a |
index b5d2719..8f29a40 100644
|
|
|
71541a |
--- a/pcsd/cluster_entity.rb
|
|
|
71541a |
+++ b/pcsd/cluster_entity.rb
|
|
|
71541a |
@@ -914,7 +914,7 @@ module ClusterEntity
|
|
|
71541a |
end
|
|
|
71541a |
@masters, @slaves = get_masters_slaves(primitive_list)
|
|
|
71541a |
if (@masters.empty? and
|
|
|
71541a |
- @member.status != ClusterEntity::ResourceStatus.new(:disabled)
|
|
|
71541a |
+ @member.status == ClusterEntity::ResourceStatus.new(:running)
|
|
|
71541a |
)
|
|
|
71541a |
@status = ClusterEntity::ResourceStatus.new(:partially_running)
|
|
|
71541a |
end
|
|
|
71541a |
diff --git a/pcsd/pcsd.rb b/pcsd/pcsd.rb
|
|
|
71541a |
index 9a07ee8..b7c2a49 100644
|
|
|
71541a |
--- a/pcsd/pcsd.rb
|
|
|
71541a |
+++ b/pcsd/pcsd.rb
|
|
|
71541a |
@@ -178,7 +178,7 @@ helpers do
|
|
|
71541a |
param_line << "#{myparam}=#{val}"
|
|
|
71541a |
end
|
|
|
71541a |
if param == "disabled"
|
|
|
71541a |
- meta_options << "meta target-role=Stopped"
|
|
|
71541a |
+ meta_options << 'meta' << 'target-role=Stopped'
|
|
|
71541a |
end
|
|
|
71541a |
}
|
|
|
71541a |
return param_line + meta_options
|
|
|
71541a |
diff --git a/pcsd/public/css/style.css b/pcsd/public/css/style.css
|
|
|
71541a |
index a3f6638..1c003bd 100644
|
|
|
71541a |
--- a/pcsd/public/css/style.css
|
|
|
71541a |
+++ b/pcsd/public/css/style.css
|
|
|
71541a |
@@ -778,3 +778,11 @@ li.menuheader {
|
|
|
71541a |
.issue_table {
|
|
|
71541a |
margin-top: 1.5em;
|
|
|
71541a |
}
|
|
|
71541a |
+
|
|
|
71541a |
+.status-error {
|
|
|
71541a |
+ color: red;
|
|
|
71541a |
+}
|
|
|
71541a |
+
|
|
|
71541a |
+.status-warning {
|
|
|
71541a |
+ color: #ff6600;
|
|
|
71541a |
+}
|
|
|
71541a |
diff --git a/pcsd/public/js/nodes-ember.js b/pcsd/public/js/nodes-ember.js
|
|
|
71541a |
index bbeed55..1e00a94 100644
|
|
|
71541a |
--- a/pcsd/public/js/nodes-ember.js
|
|
|
71541a |
+++ b/pcsd/public/js/nodes-ember.js
|
|
|
71541a |
@@ -147,8 +147,10 @@ Pcs = Ember.Application.createWithMixins({
|
|
|
71541a |
} else {
|
|
|
71541a |
if (self.get('fence_list').length > 0) {
|
|
|
71541a |
cur_fence = self.get('fence_list')[0];
|
|
|
71541a |
- fence_change = true;
|
|
|
71541a |
+ } else {
|
|
|
71541a |
+ cur_fence = null;
|
|
|
71541a |
}
|
|
|
71541a |
+ fence_change = true;
|
|
|
71541a |
}
|
|
|
71541a |
|
|
|
71541a |
if (cur_resource && cur_resource.get('id') in resource_map) {
|
|
|
71541a |
@@ -158,22 +160,28 @@ Pcs = Ember.Application.createWithMixins({
|
|
|
71541a |
} else {
|
|
|
71541a |
if (self.get('resource_list').length > 0) {
|
|
|
71541a |
cur_resource = self.get('resource_list')[0];
|
|
|
71541a |
- resource_change = true;
|
|
|
71541a |
+ } else {
|
|
|
71541a |
+ cur_resource = null;
|
|
|
71541a |
}
|
|
|
71541a |
+ resource_change = true;
|
|
|
71541a |
}
|
|
|
71541a |
|
|
|
71541a |
self.set('cur_fence', cur_fence);
|
|
|
71541a |
self.set('cur_resource', cur_resource);
|
|
|
71541a |
|
|
|
71541a |
Ember.run.scheduleOnce('afterRender', Pcs, function () {
|
|
|
71541a |
- if (fence_change)
|
|
|
71541a |
- tree_view_onclick(self.get('cur_fence').get('id'), true);
|
|
|
71541a |
- if (resource_change)
|
|
|
71541a |
- tree_view_onclick(self.get('cur_resource').get('id'), true);
|
|
|
71541a |
- if (!fence_change && self.get('cur_fence'))
|
|
|
71541a |
- tree_view_select(self.get('cur_fence').get('id'));
|
|
|
71541a |
- if (!resource_change && self.get('cur_resource'))
|
|
|
71541a |
- tree_view_select(self.get('cur_resource').get('id'));
|
|
|
71541a |
+ if (self.get('cur_fence')) {
|
|
|
71541a |
+ if (fence_change)
|
|
|
71541a |
+ tree_view_onclick(self.get('cur_fence').get('id'), true);
|
|
|
71541a |
+ else
|
|
|
71541a |
+ tree_view_select(self.get('cur_fence').get('id'));
|
|
|
71541a |
+ }
|
|
|
71541a |
+ if (self.get('cur_resource')) {
|
|
|
71541a |
+ if (resource_change)
|
|
|
71541a |
+ tree_view_onclick(self.get('cur_resource').get('id'), true);
|
|
|
71541a |
+ else
|
|
|
71541a |
+ tree_view_select(self.get('cur_resource').get('id'));
|
|
|
71541a |
+ }
|
|
|
71541a |
Pcs.selectedNodeController.reset();
|
|
|
71541a |
disable_checkbox_clicks();
|
|
|
71541a |
});
|
|
|
71541a |
@@ -546,6 +554,11 @@ Pcs.resourcesContainer = Ember.Object.create({
|
|
|
71541a |
}
|
|
|
71541a |
});
|
|
|
71541a |
});
|
|
|
71541a |
+ $.each(resource_map, function(resource_id, resource_obj) {
|
|
|
71541a |
+ resource_obj.set('group_list', self.get('group_list'));
|
|
|
71541a |
+ });
|
|
|
71541a |
+ self.set('resource_list', Ember.copy(self.get('resource_list')).sort(function(a,b){return a.get('id').localeCompare(b.get('id'))}));
|
|
|
71541a |
+ self.set('fence_list', Ember.copy(self.get('fence_list')).sort(function(a,b){return a.get('id').localeCompare(b.get('id'))}));
|
|
|
71541a |
}
|
|
|
71541a |
});
|
|
|
71541a |
|
|
|
71541a |
@@ -565,6 +578,7 @@ Pcs.ResourceObj = Ember.Object.extend({
|
|
|
71541a |
disabled: false,
|
|
|
71541a |
error_list: [],
|
|
|
71541a |
warning_list: [],
|
|
|
71541a |
+ group_list: [],
|
|
|
71541a |
get_group_id: function() {
|
|
|
71541a |
var self = this;
|
|
|
71541a |
var p = self.get('parent');
|
|
|
71541a |
@@ -577,7 +591,7 @@ Pcs.ResourceObj = Ember.Object.extend({
|
|
|
71541a |
var self = this;
|
|
|
71541a |
var cur_group = self.get('get_group_id');
|
|
|
71541a |
var html = '<select>\n<option value="">None</option>\n';
|
|
|
71541a |
- $.each(Pcs.resourcesContainer.get('group_list'), function(_, group) {
|
|
|
71541a |
+ $.each(self.get('group_list'), function(_, group) {
|
|
|
71541a |
html += '
|
|
|
71541a |
if (cur_group === group) {
|
|
|
71541a |
html += 'selected';
|
|
|
71541a |
@@ -586,7 +600,7 @@ Pcs.ResourceObj = Ember.Object.extend({
|
|
|
71541a |
});
|
|
|
71541a |
html += '</select><input type="button" value="Change group" onclick="resource_change_group(curResource(), $(this).prev().prop(\'value\'));">';
|
|
|
71541a |
return html;
|
|
|
71541a |
- }.property('Pcs.resourceContainer.group_list', 'get_group_id'),
|
|
|
71541a |
+ }.property('group_list', 'get_group_id'),
|
|
|
71541a |
status: "unknown",
|
|
|
71541a |
class_type: null, // property to determine type of the resource
|
|
|
71541a |
resource_type: function() { // this property is just for displaying resource type in GUI
|
|
|
71541a |
@@ -641,6 +655,17 @@ Pcs.ResourceObj = Ember.Object.extend({
|
|
|
71541a |
}
|
|
|
71541a |
return out;
|
|
|
71541a |
}.property("error_list.@each", "warning_list.@each"),
|
|
|
71541a |
+ span_class: function() {
|
|
|
71541a |
+ switch (this.get("status_val")) {
|
|
|
71541a |
+ case get_status_value("failed"):
|
|
|
71541a |
+ return "status-error";
|
|
|
71541a |
+ case get_status_value("warning"):
|
|
|
71541a |
+ case get_status_value("disabled"):
|
|
|
71541a |
+ return "status-warning";
|
|
|
71541a |
+ default:
|
|
|
71541a |
+ return "";
|
|
|
71541a |
+ }
|
|
|
71541a |
+ }.property("status_val"),
|
|
|
71541a |
|
|
|
71541a |
location_constraints: [],
|
|
|
71541a |
ordering_constraints: [],
|
|
|
71541a |
@@ -1265,9 +1290,9 @@ Pcs.Cluster = Ember.Object.extend({
|
|
|
71541a |
|
|
|
71541a |
Pcs.clusterController = Ember.Object.create({
|
|
|
71541a |
cluster_list: Ember.ArrayController.create({
|
|
|
71541a |
- content: Ember.A(), sortProperties: ['status', 'name'],
|
|
|
71541a |
- sortAscending: true,
|
|
|
71541a |
- sortFunction: function(a,b){return status_comparator(a,b);}
|
|
|
71541a |
+ content: Ember.A(),
|
|
|
71541a |
+ sortProperties: ['name'],
|
|
|
71541a |
+ sortAscending: true
|
|
|
71541a |
}),
|
|
|
71541a |
cur_cluster: null,
|
|
|
71541a |
show_all_nodes: false,
|
|
|
71541a |
@@ -1779,6 +1804,7 @@ Pcs.nodesController = Ember.ArrayController.createWithMixins({
|
|
|
71541a |
$.each(nodesToRemove, function(k,v) {
|
|
|
71541a |
self.content.removeObject(v);
|
|
|
71541a |
});
|
|
|
71541a |
+ self.set('content', Ember.copy(self.get('content').sort(function(a,b){return a.get('name').localeCompare(b.get('name'))})));
|
|
|
71541a |
}
|
|
|
71541a |
});
|
|
|
71541a |
|
|
|
71541a |
diff --git a/pcsd/public/js/pcsd.js b/pcsd/public/js/pcsd.js
|
|
|
71541a |
index 84db292..23fd316 100644
|
|
|
71541a |
--- a/pcsd/public/js/pcsd.js
|
|
|
71541a |
+++ b/pcsd/public/js/pcsd.js
|
|
|
71541a |
@@ -1526,7 +1526,10 @@ function add_constraint(parent_id, c_type, force) {
|
|
|
71541a |
}
|
|
|
71541a |
|
|
|
71541a |
function add_constraint_set(parent_id, c_type, force) {
|
|
|
71541a |
- var data = {'resources': []};
|
|
|
71541a |
+ var data = {
|
|
|
71541a |
+ resources: [],
|
|
|
71541a |
+ disable_autocorrect: true
|
|
|
71541a |
+ };
|
|
|
71541a |
$(parent_id + " input[name='resource_ids[]']").each(function(index, element) {
|
|
|
71541a |
var resources = element.value.trim();
|
|
|
71541a |
if (resources.length > 0) {
|
|
|
71541a |
diff --git a/pcsd/views/main.erb b/pcsd/views/main.erb
|
|
|
71541a |
index b24c74a..e7e611d 100644
|
|
|
71541a |
--- a/pcsd/views/main.erb
|
|
|
71541a |
+++ b/pcsd/views/main.erb
|
|
|
71541a |
@@ -105,7 +105,9 @@
|
|
|
71541a |
<input type="checkbox" onchange="tree_view_checkbox_onchange(this)">
|
|
|
71541a |
|
|
|
71541a |
{{{node.status_icon}}}
|
|
|
71541a |
- {{node._id}}
|
|
|
71541a |
+
|
|
|
71541a |
+ {{node._id}}
|
|
|
71541a |
+
|
|
|
71541a |
{{node.resource_type}}
|
|
|
71541a |
|
|
|
71541a |
|
|
|
71541a |
--
|
|
|
71541a |
1.9.1
|
|
|
71541a |
|