yellow team mailing list archive
-
yellow team
-
Mailing list archive
-
Message #01617
Remove ability to remove subordinate relations. (issue 6846060)
Reviewers: mp+134495_code.launchpad.net,
Message:
Please take a look.
Description:
Remove ability to remove subordinate relations.
Attempting to remove a subordinate relation through the standard means
will warn that it's not possible and not let the user remove the
relation.
https://code.launchpad.net/~makyo/juju-gui/no-remove-sub-rels/+merge/134495
(do not edit description out of merge proposal)
Please review this at https://codereview.appspot.com/6846060/
Affected files:
A [revision details]
M app/templates/overview.handlebars
M app/views/environment.js
M test/test_environment_view.js
Index: [revision details]
=== added file '[revision details]'
--- [revision details] 2012-01-01 00:00:00 +0000
+++ [revision details] 2012-01-01 00:00:00 +0000
@@ -0,0 +1,2 @@
+Old revision: thiago.veronezi@xxxxxxxxxxxxx-20121114185953-uifing7gab5nx0ag
+New revision: matthew.scott@xxxxxxxxxxxxx-20121115155506-ld5iy26wt1xamiek
Index: test/test_environment_view.js
=== modified file 'test/test_environment_view.js'
--- test/test_environment_view.js 2012-11-13 21:51:29 +0000
+++ test/test_environment_view.js 2012-11-15 15:55:06 +0000
@@ -369,12 +369,17 @@
db: db,
env: env}).render();
- var relation = container.one('.rel-label'),
+ var relation = container.one('#relation-0000000001 .rel-label'),
dialog_btn,
panel;
relation.simulate('click');
- panel = Y.one('.yui3-panel');
+ panel = Y.one('#rmrelation-modal-panel');
+
+ // There should be a 'remove relation' button and a 'cancel'
button
+ // on the dialog.
+ panel.all('button').size().should.equal(2);
+
dialog_btn = panel.one('.btn-danger');
dialog_btn.simulate('click');
container.all('.to-remove')
@@ -383,6 +388,28 @@
view.get('rmrelation_dialog').hide();
});
+ it('must not allow removing a subordinate relation between services',
+ function() {
+ var view = new views.environment({
+ container: container,
+ db: db,
+ env: env}).render();
+
+ // Get a subordinate relation.
+ var relation = container.one('#relation-0000000007 .rel-label'),
+ dialog_btn,
+ panel;
+
+ relation.simulate('click');
+ panel = Y.one('#rmsubrelation-modal-panel');
+
+ // There should only be a cancel button on the warning dialog.
+ panel.all('button').size().should.equal(1);
+
+ // Clicking cancel will hide the dialog.
+ panel.one('button').simulate('click');
+ });
+
it('should stop creating a relation if the background is clicked',
function() {
var db = new models.Database(),
Index: app/templates/overview.handlebars
=== modified file 'app/templates/overview.handlebars'
--- app/templates/overview.handlebars 2012-10-27 20:06:21 +0000
+++ app/templates/overview.handlebars 2012-11-15 15:55:06 +0000
@@ -50,4 +50,6 @@
Destroy
</div>
</div>
+ <div id="rmrelation-modal-panel"></div>
+ <div id="rmsubrelation-modal-panel"></div>
</div>
Index: app/views/environment.js
=== modified file 'app/views/environment.js'
--- app/views/environment.js 2012-11-13 21:51:29 +0000
+++ app/views/environment.js 2012-11-15 15:55:06 +0000
@@ -434,7 +434,29 @@
},
relationClick: function(d, self) {
- self.removeRelationConfirm(d, this, self);
+ if (d.scope === 'container') {
+ var subRelDialog = views.createModalPanel(
+ 'You may not remove a subordinate relation.',
+ '#rmsubrelation-modal-panel');
+ subRelDialog.addButton(
+ { value: 'Cancel',
+ section: Y.WidgetStdMod.FOOTER,
+ /**
+ * @method action Hides the dialog on click.
+ * @param {object} e The click event.
+ * @return {undefined} nothing.
+ */
+ action: function(e) {
+ e.preventDefault();
+ subRelDialog.hide();
+ },
+ classNames: ['btn']
+ });
+ subRelDialog.get('boundingBox').all('.yui3-button')
+ .removeClass('yui5-button');
+ } else {
+ self.removeRelationConfirm(d, this, self);
+ }
},
/**
--
https://code.launchpad.net/~makyo/juju-gui/no-remove-sub-rels/+merge/134495
Your team Juju GUI Hackers is requested to review the proposed merge of lp:~makyo/juju-gui/no-remove-sub-rels into lp:juju-gui.
References