Skip to content
This repository has been archived by the owner on Mar 8, 2019. It is now read-only.

Commit

Permalink
PROW-194: Modify warning style for bucket addition/deletion & Suppres…
Browse files Browse the repository at this point in the history
…s the warning when creating a new test
  • Loading branch information
yosukey committed May 18, 2016
1 parent df79cc7 commit 6815cba
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 9 deletions.
Expand Up @@ -67,6 +67,6 @@
<ui:grid-columns width="two"><a class="js-add-bucket small button secondary radius" href="#">Add Bucket</a></ui:grid-columns>
</ui:grid-row>
</div>

<div style="display:none;" class="bucket-msg-container alert-box warning"></div>
</div>
</div>
Expand Up @@ -106,9 +106,9 @@ indeed.proctor.editor.BucketsEditor.prototype.onAddBucketClick_ = function(e) {
if (!this.bucketsRemoved) { //add if any original bucket was not removed
if (this.addBucket(bucket['value'], bucket['name'], bucket['description'], bucket['payload'])) {
this.bucketsAdded = true;
indeed.foundation.forms.addError(
this.dom_.getElementByClass('js-buckets', this.container),
'You added a new bucket and can no longer delete any original bucket.');
if (this.originalBucketLength !== 0) {
this.displayMessage_('You added a new bucket and can no longer delete any original bucket.');
}
this.render_();
}
}
Expand Down Expand Up @@ -642,16 +642,13 @@ indeed.proctor.editor.BucketsEditor.prototype.onDeleteBucket_ =

if (bucketIndex < this.originalBucketLength) {
this.bucketsRemoved = true;
indeed.foundation.forms.addError(
this.dom_.getElementByClass('ui-panel-buttons', this.container),
'You deleted an original bucket and can no longer add a new bucket.');
this.displayMessage_('You deleted an original bucket and can no longer add a new bucket.');
}

//if we deleted all the buckets we added
if (this.buckets.length == this.originalBucketLength) {
this.bucketsAdded = false;
indeed.foundation.forms.removeError(
this.dom_.getElementByClass('ui-panel-buttons', this.container));
this.hideMessage_();
}

this.dispatchEvent({'type': 'bucketDeleted', buckets: this.buckets,
Expand Down Expand Up @@ -779,3 +776,25 @@ indeed.proctor.editor.BucketsEditor.prototype.onPayloadTypeChange_ =
}
}
};

/**
* @private
*/
indeed.proctor.editor.BucketsEditor.prototype.hideMessage_ = function() {
var container = goog.dom.getElementByClass('bucket-msg-container',
this.container);
if (container) {
goog.style.showElement(container, false);
}
};

/**
*
* @param {string} message Message to display.
* @private
*/
indeed.proctor.editor.BucketsEditor.prototype.displayMessage_ = function(message) {
var container = goog.dom.getElementByClass('bucket-msg-container', this.container);
container.innerHTML = goog.string.htmlEscape(message, false);
goog.style.showElement(container, true);
};

0 comments on commit 6815cba

Please sign in to comment.