Skip to content

Commit

Permalink
WINDUP-1382 - Show only MigrationRulesPhase rules (#453)
Browse files Browse the repository at this point in the history
* Show only MigrationRules phase rules

In rules configuration form, show only migration rules.

#close WINDUP-1382

* Add checkbox to show all rules.
  • Loading branch information
klinki authored and jsight committed Aug 25, 2017
1 parent 794fe70 commit c1a9c4b
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ <h1 i18n="Header" style="margin-bottom: 25px">Rules Configuration</h1>
<div [hidden]="rescanInProgress" class="action-button">
<button class="btn btn-primary" (click)="displayAddRulesPathForm()" i18n="Add">Add</button>
</div>
<div class="show-all-checkbox">
<input id="show-all-rules" type="checkbox" [(ngModel)]="showAllRules"/>
<label for="show-all-rules">Show all rules</label>
</div>
<wu-toolbar
[filterConfiguration]="filter"
[sortConfiguration]="sort"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,3 +117,7 @@ h1 {
.panel>.panel-collapse>.list-group:first-child .list-group-item:first-child {
border-top: 1px solid transparent;
}

.show-all-checkbox {
padding-right: 20px;
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ export class ConfigurationComponent implements OnInit, AfterViewInit {
getLabel: filter => `${filter.field}: ${filter.name}`
};

showAllRules: false;

constructor(
private _activatedRoute: ActivatedRoute,
private _configurationService: ConfigurationService,
Expand Down Expand Up @@ -230,13 +232,25 @@ export class ConfigurationComponent implements OnInit, AfterViewInit {
this.filter = Object.assign({}, this.filter);
}

getRuleProvidersByPath(path: RulesPath) {
getOnlyMigrationRules(path: RulesPath) {
const ruleProviders = this.ruleProvidersByPath.get(path) || [];

if (this.showAllRules) {
return ruleProviders;
}

return ruleProviders.filter(provider => {
return provider.phase === 'MIGRATIONRULESPHASE';
});
}

getRuleProvidersByPath(path: RulesPath) {
const ruleProviders = this.getOnlyMigrationRules(path);
return this._sortingService.sort(ruleProviders);
}

getFilteredRuleProvidersByPath(path: RulesPath) {
let filteredRuleProviders = this.ruleProvidersByPath.get(path) || [];
let filteredRuleProviders = this.getOnlyMigrationRules(path);

this.filter.selectedFilters.forEach(filter => {
filteredRuleProviders = filteredRuleProviders.filter((provider) => {
Expand Down

0 comments on commit c1a9c4b

Please sign in to comment.