Merge pull request #1151 from opf/fix/angular-timelines-show-warning-6364

Fix/angular timelines show warning 6364
pull/1161/head
Alex Coles 11 years ago
commit 9c5b46a751
  1. 11
      app/assets/javascripts/angular/directives/timelines/timeline-table-container-directive.js
  2. 5
      app/assets/javascripts/angular/models/timelines/timeline.js
  3. 2
      public/templates/timelines/timeline_table_container.html
  4. 2
      public/templates/timelines/toolbar.html

@ -65,6 +65,7 @@ angular.module('openproject.timelines.directives')
if(scope.updateToolbar) scope.updateToolbar(); if(scope.updateToolbar) scope.updateToolbar();
scope.underConstruction = false; scope.underConstruction = false;
scope.warning = false;
scope.timeline.getChart().scroll(function() { scope.timeline.getChart().scroll(function() {
scope.timeline.adjustTooltip(); scope.timeline.adjustTooltip();
@ -75,6 +76,12 @@ angular.module('openproject.timelines.directives')
}); });
}; };
showWarning = function(){
scope.underConstruction = false;
scope.warning = true;
scope.$apply();
};
buildWorkPackageTable = function(timeline){ buildWorkPackageTable = function(timeline){
if (timeline.isGrouping() && timeline.options.grouping_two_enabled) { if (timeline.isGrouping() && timeline.options.grouping_two_enabled) {
timeline.secondLevelGroupingAdjustments(); timeline.secondLevelGroupingAdjustments();
@ -98,10 +105,10 @@ angular.module('openproject.timelines.directives')
try { try {
window.clearTimeout(timeline.safetyHook); window.clearTimeout(timeline.safetyHook);
if (rows.length > 0) { if (scope.rows.length > 0) {
completeUI(); completeUI();
} else { } else {
timeline.warn(I18n.t('js.label_no_data'), 'warning'); timeline.warn(I18n.t('js.label_no_data'), 'warning', this.showWarning);
} }
} catch (e) { } catch (e) {
timeline.die(e); timeline.die(e);

@ -290,7 +290,7 @@ angular.module('openproject.timelines.models')
throw error; throw error;
}, },
warn: function(message, classes) { warn: function(message, classes, viewCallback) {
var root = this.getUiRoot(); var root = this.getUiRoot();
window.setTimeout(function() { window.setTimeout(function() {
@ -298,6 +298,9 @@ angular.module('openproject.timelines.models')
// generate and display the error message. // generate and display the error message.
var warning = jQuery('<div class="' + classes + '">' + message + '</div>'); var warning = jQuery('<div class="' + classes + '">' + message + '</div>');
root.empty().append(warning); root.empty().append(warning);
if (viewCallback) {
viewCallback();
}
}, Timeline.DISPLAY_ERROR_DELAY); }, Timeline.DISPLAY_ERROR_DELAY);
}, },

@ -1,4 +1,4 @@
<div ng-class="{timeline: true, 'tl-under-construction': underConstruction}" > <div ng-class="{timeline: !warning, 'tl-under-construction': underConstruction}" >
<div class="tl-left"> <div class="tl-left">
<div class="tl-left-top tl-decoration"></div> <div class="tl-left-top tl-decoration"></div>
<div class="tl-left-main"> <div class="tl-left-main">

@ -1,4 +1,4 @@
<div class="tl-toolbar"> <div class="tl-toolbar" ng-show="!warning">
<div class="tl-toolbar-container"> <div class="tl-toolbar-container">
<a href="javascript://" ng-if='timeline.USE_MODALS' ng-click="timeline.addPlanningElement()" title="{{I18n.t('js.timelines.new_work_package')}}" class="icon icon-add"> <a href="javascript://" ng-if='timeline.USE_MODALS' ng-click="timeline.addPlanningElement()" title="{{I18n.t('js.timelines.new_work_package')}}" class="icon icon-add">
<span class="hidden-for-sighted">{{ I18n.t('js.timelines.new_work_package') }}</span> <span class="hidden-for-sighted">{{ I18n.t('js.timelines.new_work_package') }}</span>

Loading…
Cancel
Save