Browse Source

add reset to default button

pull/15129/head
Fatih KILIÇ 4 years ago
parent
commit
660d812879
  1. 4
      npm/ng-packs/packages/feature-management/src/lib/components/feature-management/feature-management.component.html
  2. 22
      npm/ng-packs/packages/feature-management/src/lib/components/feature-management/feature-management.component.ts

4
npm/ng-packs/packages/feature-management/src/lib/components/feature-management/feature-management.component.html

@ -111,6 +111,10 @@
</ng-template> </ng-template>
<ng-template #abpFooter> <ng-template #abpFooter>
<abp-button iconClass="fa fa-refresh" [disabled]="modalBusy" (click)="resetToDefault()">
{{ 'AbpFeatureManagement::ResetToDefault' | abpLocalization }}
</abp-button>
<button abpClose type="button" class="btn btn-secondary"> <button abpClose type="button" class="btn btn-secondary">
{{ 'AbpFeatureManagement::Cancel' | abpLocalization }} {{ 'AbpFeatureManagement::Cancel' | abpLocalization }}
</button> </button>

22
npm/ng-packs/packages/feature-management/src/lib/components/feature-management/feature-management.component.ts

@ -5,7 +5,12 @@ import {
FeaturesService, FeaturesService,
UpdateFeatureDto, UpdateFeatureDto,
} from '@abp/ng.feature-management/proxy'; } from '@abp/ng.feature-management/proxy';
import { LocaleDirection } from '@abp/ng.theme.shared'; import {
Confirmation,
ConfirmationService,
LocaleDirection,
ToasterService,
} from '@abp/ng.theme.shared';
import { Component, EventEmitter, Input, Output } from '@angular/core'; import { Component, EventEmitter, Input, Output } from '@angular/core';
import { finalize } from 'rxjs/operators'; import { finalize } from 'rxjs/operators';
import { FeatureManagement } from '../../models/feature-management'; import { FeatureManagement } from '../../models/feature-management';
@ -63,8 +68,10 @@ export class FeatureManagementComponent
constructor( constructor(
public readonly track: TrackByService, public readonly track: TrackByService,
private toasterService: ToasterService,
protected service: FeaturesService, protected service: FeaturesService,
protected configState: ConfigStateService, protected configState: ConfigStateService,
protected confirmationService: ConfirmationService,
) {} ) {}
openModal() { openModal() {
@ -121,6 +128,19 @@ export class FeatureManagementComponent
}); });
} }
resetToDefault() {
this.confirmationService
.warn('AbpFeatureManagement::AreYouSureToResetToDefault', 'AbpFeatureManagement::AreYouSure')
.subscribe((status: Confirmation.Status) => {
if (status === Confirmation.Status.confirm) {
this.service.delete(this.providerName, this.providerKey).subscribe(() => {
this.toasterService.success('AbpFeatureManagement::ResetedToDefault');
this.visible = false;
});
}
});
}
onCheckboxClick(val: boolean, feature: FeatureDto) { onCheckboxClick(val: boolean, feature: FeatureDto) {
if (val) { if (val) {
this.checkToggleAncestors(feature); this.checkToggleAncestors(feature);

Loading…
Cancel
Save