Browse Source

Merge pull request #15129 from abpframework/Issue-14470

Add Reset to Default button to manage host  features modal
pull/15131/head
Muhammed Altuğ 4 years ago
committed by GitHub
parent
commit
ac3be7fe07
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      modules/feature-management/src/Volo.Abp.FeatureManagement.Domain.Shared/Volo/Abp/FeatureManagement/Localization/Domain/en.json
  2. 1
      modules/feature-management/src/Volo.Abp.FeatureManagement.Domain.Shared/Volo/Abp/FeatureManagement/Localization/Domain/tr.json
  3. 11
      npm/ng-packs/packages/feature-management/proxy/src/lib/proxy/feature-management/features.service.ts
  4. 5587
      npm/ng-packs/packages/feature-management/proxy/src/lib/proxy/generate-proxy.json
  5. 4
      npm/ng-packs/packages/feature-management/src/lib/components/feature-management/feature-management.component.html
  6. 27
      npm/ng-packs/packages/feature-management/src/lib/components/feature-management/feature-management.component.ts

1
modules/feature-management/src/Volo.Abp.FeatureManagement.Domain.Shared/Volo/Abp/FeatureManagement/Localization/Domain/en.json

@ -11,6 +11,7 @@
"Menu:FeatureManagement": "Feature Management",
"ResetToDefault": "Reset to default",
"ResetedToDefault": "Reseted to default",
"AreYouSure": "Are you sure?",
"AreYouSureToResetToDefault": "Are you sure to reset to default?"
}
}

1
modules/feature-management/src/Volo.Abp.FeatureManagement.Domain.Shared/Volo/Abp/FeatureManagement/Localization/Domain/tr.json

@ -11,6 +11,7 @@
"Menu:FeatureManagement": "Özellik Yönetimi",
"ResetToDefault": "Varsayılana sıfırla",
"ResetedToDefault": "Varsayılana sıfırlandı",
"AreYouSure": "Emin misiniz?",
"AreYouSureToResetToDefault": "Varsayılana sıfırlamak istediğinizden emin misiniz?"
}
}

11
npm/ng-packs/packages/feature-management/proxy/src/lib/proxy/feature-management/features.service.ts

@ -7,6 +7,16 @@ import { Injectable } from '@angular/core';
})
export class FeaturesService {
apiName = 'AbpFeatureManagement';
delete = (providerName: string, providerKey: string) =>
this.restService.request<any, void>({
method: 'DELETE',
url: '/api/feature-management/features',
params: { providerName, providerKey },
},
{ apiName: this.apiName });
get = (providerName: string, providerKey: string) =>
this.restService.request<any, GetFeatureListResultDto>({
@ -15,6 +25,7 @@ export class FeaturesService {
params: { providerName, providerKey },
},
{ apiName: this.apiName });
update = (providerName: string, providerKey: string, input: UpdateFeaturesDto) =>
this.restService.request<any, void>({

5587
npm/ng-packs/packages/feature-management/proxy/src/lib/proxy/generate-proxy.json

File diff suppressed because it is too large

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

@ -111,6 +111,10 @@
</ng-template>
<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">
{{ 'AbpFeatureManagement::Cancel' | abpLocalization }}
</button>

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

@ -5,7 +5,12 @@ import {
FeaturesService,
UpdateFeatureDto,
} 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 { finalize } from 'rxjs/operators';
import { FeatureManagement } from '../../models/feature-management';
@ -63,8 +68,10 @@ export class FeatureManagementComponent
constructor(
public readonly track: TrackByService,
private toasterService: ToasterService,
protected service: FeaturesService,
protected configState: ConfigStateService,
protected confirmationService: ConfirmationService,
) {}
openModal() {
@ -121,6 +128,24 @@ 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;
if (!this.providerKey) {
// to refresh host's features
this.configState.refreshAppState().subscribe();
}
});
}
});
}
onCheckboxClick(val: boolean, feature: FeatureDto) {
if (val) {
this.checkToggleAncestors(feature);

Loading…
Cancel
Save