New: Show warning for queue when there is a warning

pull/6/head
Mark McDowall 10 years ago
parent f6e4ccda84
commit f8fb37bae8

@ -16,8 +16,6 @@ define(
if (this.cellValue) { if (this.cellValue) {
var status = this.cellValue.get('status').toLowerCase(); var status = this.cellValue.get('status').toLowerCase();
var trackedDownloadStatus = this.cellValue.get('trackedDownloadStatus').toLowerCase(); var trackedDownloadStatus = this.cellValue.get('trackedDownloadStatus').toLowerCase();
var hasError = this.cellValue.get('hasError') || false;
var hasWarning = this.cellValue.get('hasWarning') || false;
var icon = 'icon-nd-downloading'; var icon = 'icon-nd-downloading';
var title = 'Downloading'; var title = 'Downloading';
var itemTitle = this.cellValue.get('title'); var itemTitle = this.cellValue.get('title');
@ -55,7 +53,6 @@ define(
if (trackedDownloadStatus === 'warning') { if (trackedDownloadStatus === 'warning') {
icon += ' icon-nd-warning'; icon += ' icon-nd-warning';
// title = 'Download failed';
this.templateFunction = Marionette.TemplateCache.get(this.template); this.templateFunction = Marionette.TemplateCache.get(this.template);
content = this.templateFunction(this.cellValue.toJSON()); content = this.templateFunction(this.cellValue.toJSON());

@ -22,14 +22,23 @@ define(
var count = QueueCollection.fullCollection.length; var count = QueueCollection.fullCollection.length;
var label = 'label-info'; var label = 'label-info';
var errors = QueueCollection.fullCollection.some(function (model) { var errors = QueueCollection.fullCollection.some(function (model) {
return model.has('errorMessage'); return model.get('trackedDownloadStatus').toLowerCase() === 'error';
});
var warnings = QueueCollection.fullCollection.some(function (model) {
return model.get('trackedDownloadStatus').toLowerCase() === 'warning';
}); });
if (errors) { if (errors) {
label = 'label-danger'; label = 'label-danger';
} }
else if (warnings) {
label = 'label-warning';
}
this.$el.html('<span class="label {0}">{1}</span>'.format(label, count)); this.$el.html('<span class="label {0}">{1}</span>'.format(label, count));
return this; return this;
} }

Loading…
Cancel
Save