Notify the user that a commit has finished. #578
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -136,6 +136,7 @@ YUI.add('deployer-bar', function(Y) { | |
container.addClass('deployer-bar'); | ||
this._toggleDeployButtonStatus(changes > 0); | ||
ecs.on('changeSetModified', Y.bind(this.update, this)); | ||
ecs.on('currentCommitFinished', Y.bind(this.notifyCommitFinished, this)); | ||
return this; | ||
}, | ||
|
||
|
@@ -367,6 +368,20 @@ YUI.add('deployer-bar', function(Y) { | |
} | ||
}, | ||
|
||
/** | ||
Notify the user that a change-set commit has completed. | ||
|
||
@method notifyCommitFinished | ||
*/ | ||
notifyCommitFinished: function() { | ||
var db = this.get('db'); | ||
db.notifications.add(new Y.juju.models.Notification({ | ||
title: 'All changes committed', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can we id this with the changeset number? Changes completed commit: #3 |
||
message: 'All requested changes have been sent to Juju and committed.', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the idea is that each time a changeset completes we'd note it with a message. In the future the UI would show progress and as each one is done we note it. |
||
level: 'important' | ||
})); | ||
}, | ||
|
||
/** | ||
Hide the summary panel. | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -223,6 +223,17 @@ describe('deployer bar view', function() { | |
assert.equal(called, true); | ||
}); | ||
|
||
it('notifies the user when a change set is completed', function(done) { | ||
var called = false; | ||
view.notifyCommitFinished = function(evt) { | ||
called = true; | ||
done(); | ||
}; | ||
view.render(); | ||
view.get('ecs').fire('currentCommitFinished'); | ||
assert.equal(called, true); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This strikes me as a race condition issue in the making and is unnecessary for the test. If it's called, it'll done() else it'll hang and fail. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as the test below, will re-evaluate both. |
||
}); | ||
|
||
it('displays the most recent change as a notification on update', function() { | ||
var stubGet = utils.makeStubMethod(view, '_getChangeNotification'); | ||
view.render(); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can just pass the object here you don't need to create a new notification instance first.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, right. I was trying to get the notification level set up, so I was shotgunning it, turned out to be the level needed to be important or higher.