Skip to content

Commit

Permalink
#85 Add a Cache configuration UI per analyzer
Browse files Browse the repository at this point in the history
  • Loading branch information
nadouani committed Apr 9, 2018
1 parent 8c12015 commit f81f7f4
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 4 deletions.
1 change: 1 addition & 0 deletions www/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"angular-bootstrap-multiselect": "git+https://github.com/bentorfs/angular-bootstrap-multiselect.git",
"angular-clipboard": "^1.6.2",
"angular-images-resizer": "^2.0.2",
"angular-input-masks": "^4.1.0",
"angular-local-storage": "^0.7.1",
"angular-messages": "1.6.8",
"angular-moment": "^1.2.0",
Expand Down
1 change: 1 addition & 0 deletions www/src/app/index.module.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const App = angular.module('cortex', [
'btorfs.multiselect',
'LocalStorageModule',
'angularUtils.directives.dirPagination',
'ui.utils.masks',

// core
coreModule.name,
Expand Down
2 changes: 2 additions & 0 deletions www/src/app/index.vendor.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ import 'angular-images-resizer';

import 'angular-base64-upload';

import 'angular-input-masks';

// local scripts
//import "../assets/js/...";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ export default class AnalyzerConfigFormController {
this.rateUnits = ['Day', 'Month'];
}

$onInit() {
this.useGlobalCache =
this.analyzer.jobCache === null || this.analyzer.jobCache === undefined;
}

applyConfig(config) {
_.forEach(
_.keys(config),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ <h4>
<div class="form-group">
<label class="col-sm-3 control-label">Rate Limiting</label>
<div class="col-sm-4">
<input class="form-control" type="number" ng-model="$ctrl.analyzer.rate">
<input class="form-control" type="text" ng-model="$ctrl.analyzer.rate" ui-number-mask="0" ui-hide-group-sep>
</div>
<div class="col-sm-5">
<select class="form-control" ng-model="$ctrl.analyzer.rateUnit" ng-options="unit for unit in $ctrl.rateUnits">
Expand All @@ -83,5 +83,21 @@ <h4>
<div class="col-sm-offset-3 col-sm-9">
<p class="help-block">Define the maximum number of requests and the associated unit if applicable.</p>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">Cache</label>
<div class="col-sm-9 form-inline">
<div class="btn-group">
<label uib-btn-radio="true" class="btn btn-default" ng-model="$ctrl.useGlobalCache" ng-click="$ctrl.analyzer.jobCache = null">Use global</label>
<label uib-btn-radio="false" class="btn btn-default" ng-model="$ctrl.useGlobalCache">Custom</label>
</div>
<div class="form-group" style="margin-left: 30px;" ng-show="$ctrl.useGlobalCache === false">
<label>Number of minutes</label>
<input class="form-control" style="width: 200px;" type="text" ng-model="$ctrl.analyzer.jobCache" ui-number-mask="0" ui-hide-group-sep>
</div>
</div>
<div class="col-sm-offset-3 col-sm-9">
<p class="help-block">Define the number minutes for analysis report caching, or use the globally defined value.</p>
</div>
</div>
</section>
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ export default class AnalyzerEditController {
name: this.definition.id,
configuration: {},
rate: undefined,
rateUnit: undefined
rateUnit: undefined,
jobCache: null
};

_.forEach(this.definition.configurationItems, item => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,14 @@ export default class OrganizationAnalyzersController {
} else {
return this.OrganizationService.updateAnalyzer(
analyzer.id,
_.pick(response, 'configuration', 'rate', 'rateUnit', 'name')
_.pick(
response,
'configuration',
'rate',
'rateUnit',
'name',
'jobCache'
)
);
}
})
Expand Down

0 comments on commit f81f7f4

Please sign in to comment.