Merge pull request #1396 from opf/feature/ng-feature-flags

Feature flags for Angular app
pull/1405/head
Till Breuer 11 years ago
commit 6030654520
  1. 1
      app/assets/javascripts/angular/directives/components/toolbar.js
  2. 9
      app/assets/javascripts/angular/directives/work_packages/work-packages-table-directive.js
  3. 8
      app/assets/javascripts/angular/openproject-app.js
  4. 1
      app/assets/javascripts/application.js.erb
  5. 1
      bower.json
  6. 8
      public/javascripts/feature-flags.json
  7. 4
      public/templates/work_packages.html
  8. 3
      public/templates/work_packages.list.html

@ -33,7 +33,6 @@ angular.module('openproject.uiComponents')
return { return {
restrict: 'EA', restrict: 'EA',
link: function(scope, element, attributes) { link: function(scope, element, attributes) {
scope.hideWorkPackageDetails = true; // temporarily disable work package details links
} }
}; };
}); });

@ -31,7 +31,8 @@ angular.module('openproject.workPackages.directives')
.directive('workPackagesTable', [ .directive('workPackagesTable', [
'I18n', 'I18n',
'WorkPackagesTableService', 'WorkPackagesTableService',
function(I18n, WorkPackagesTableService){ 'flags',
function(I18n, WorkPackagesTableService, flags){
return { return {
restrict: 'E', restrict: 'E',
@ -86,7 +87,11 @@ angular.module('openproject.workPackages.directives')
} }
}); });
scope.hideWorkPackageDetails = true; // temporarily disable work package details links scope.$watch(function() {
return flags.isOn('detailsView');
}, function(detailsEnabled) {
scope.hideWorkPackageDetails = !detailsEnabled;
});
} }
}; };
}]); }]);

@ -116,7 +116,8 @@ var openprojectApp = angular.module('openproject', [
'openproject.timeEntries', 'openproject.timeEntries',
'ngAnimate', 'ngAnimate',
'ngSanitize', 'ngSanitize',
'truncate' 'truncate',
'feature-flags'
]); ]);
window.appBasePath = jQuery('meta[name=app_base_path]').attr('content') || ''; window.appBasePath = jQuery('meta[name=app_base_path]').attr('content') || '';
@ -139,8 +140,11 @@ openprojectApp
.run([ .run([
'$http', '$http',
'ConfigurationService', 'ConfigurationService',
function($http, ConfigurationService){ 'flags',
function($http, ConfigurationService, flags) {
$http.defaults.headers.common.Accept = 'application/json'; $http.defaults.headers.common.Accept = 'application/json';
ConfigurationService.addConfiguration('accessibilityMode', OpenProject.Helpers.accessibilityModeEnabled()); ConfigurationService.addConfiguration('accessibilityMode', OpenProject.Helpers.accessibilityModeEnabled());
flags.set($http.get('/javascripts/feature-flags.json'));
}]); }]);

@ -64,6 +64,7 @@
//= require angular-ui-date/src/date //= require angular-ui-date/src/date
//= require angular-sanitize //= require angular-sanitize
//= require angular-truncate/dist/angular-truncate //= require angular-truncate/dist/angular-truncate
//= require angular-feature-flags/dist/featureFlags.js
//= require ng-context-menu //= require ng-context-menu

@ -18,6 +18,7 @@
"angular-modal": "~0.3.0", "angular-modal": "~0.3.0",
"angular-sanitize": "~1.2.14", "angular-sanitize": "~1.2.14",
"angular-truncate": "latest", "angular-truncate": "latest",
"angular-feature-flags": "mjt01/angular-feature-flags",
"jquery-migrate": "~1.2.1", "jquery-migrate": "~1.2.1",
"momentjs": "~2.6.0", "momentjs": "~2.6.0",
"moment-timezone": "~0.0.6", "moment-timezone": "~0.0.6",

@ -0,0 +1,8 @@
[
{
"key": "detailsView",
"active": false,
"name": "Details View",
"description": "Displays details for individual work packages."
}
]

@ -22,7 +22,7 @@
<i class="icon-filter icon-buttons"></i>{{ I18n.t('js.toolbar.filter') }} <i class="icon-filter icon-buttons"></i>{{ I18n.t('js.toolbar.filter') }}
</button> </button>
</li> </li>
<li class="toolbar-item" ng-hide="hideWorkPackageDetails"> <li class="toolbar-item" feature-flag="detailsView">
<ul id="work-packages-view-mode-selection" class="toolbar-button-group"> <ul id="work-packages-view-mode-selection" class="toolbar-button-group">
<li> <li>
<button class="button" <button class="button"
@ -31,7 +31,7 @@
<i class="icon-table-view icon-buttons"></i> <i class="icon-table-view icon-buttons"></i>
</button> </button>
</li> </li>
<li ng-hide="hideWorkPackageDetails"> <li feature-flag="detailsView">
<button class="button" <button class="button"
ui-sref="work-packages.list.details({})" ui-sref="work-packages.list.details({})"
ui-sref-active="active"> ui-sref-active="active">

@ -27,5 +27,6 @@
<column-context-menu></column-context-menu> <column-context-menu></column-context-menu>
</div> </div>
<div class="work-packages--details" ui-view></div> <div class="work-packages--details" ui-view
feature-flag="detailsView"></div>
</div> </div>

Loading…
Cancel
Save