Merge pull request #15132 from abpframework/auto-merge/rel-7-0/1590

Merge branch dev with rel-7.0
pull/15141/head
Muhammed Altuğ 2 years ago committed by GitHub
commit 13337ebcf5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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?"
}
}

@ -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?"
}
}

@ -1,5 +1,5 @@
import {
ComponentFactoryResolver,
ComponentRef,
Directive,
Injector,
Input,
@ -44,7 +44,6 @@ export class ReplaceableTemplateDirective implements OnInit, OnChanges {
constructor(
private injector: Injector,
private templateRef: TemplateRef<any>,
private cfRes: ComponentFactoryResolver,
private vcRef: ViewContainerRef,
private replaceableComponents: ReplaceableComponentsService,
private subscription: SubscriptionService,
@ -83,11 +82,10 @@ export class ReplaceableTemplateDirective implements OnInit, OnChanges {
providers: [{ provide: 'REPLACEABLE_DATA', useValue: this.providedData }],
parent: this.injector,
});
this.vcRef.createComponent(
this.cfRes.resolveComponentFactory(res.component),
0,
customInjector,
);
const ref = this.vcRef.createComponent(res.component, {
index: 0,
injector: customInjector,
});
} else {
this.vcRef.createEmbeddedView(this.templateRef, this.context);
}

@ -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>({

@ -1,8 +1,8 @@
<p class="text-wrap">{{ 'FeatureManagement::ManageHostFeaturesText' | abpLocalization }}</p>
<p class="text-wrap">{{ 'AbpFeatureManagement::ManageHostFeaturesText' | abpLocalization }}</p>
<button class="btn btn-primary" type="button" (click)="openFeaturesModal()">
<i class="fa fa-cog"></i>
{{ 'FeatureManagement::ManageHostFeatures' | abpLocalization }}
{{ 'AbpFeatureManagement::ManageHostFeatures' | abpLocalization }}
</button>
<abp-feature-management
*abpReplaceableTemplate="{

@ -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>

@ -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