Browse Source

Merge branch 'dev' into aspnetcore-3.0

pull/1810/head
Halil İbrahim Kalkan 7 years ago
parent
commit
2dcb6c7b9d
  1. 38
      npm/ng-packs/packages/setting-management/src/lib/services/setting-management.service.ts
  2. 6
      npm/ng-packs/packages/theme-shared/src/lib/animations/fade.animations.ts
  3. 2
      npm/ng-packs/packages/theme-shared/src/lib/components/button/button.component.ts
  4. 5
      npm/ng-packs/packages/theme-shared/src/lib/components/loader-bar/loader-bar.component.ts

38
npm/ng-packs/packages/setting-management/src/lib/services/setting-management.service.ts

@ -2,9 +2,11 @@ import { SettingTab } from '@abp/ng.theme.shared';
import { Injectable } from '@angular/core';
import { Router } from '@angular/router';
import { Navigate } from '@ngxs/router-plugin';
import { Store } from '@ngxs/store';
import { Store, Actions, ofActionSuccessful } from '@ngxs/store';
import { Subject } from 'rxjs';
import { ConfigState } from '@abp/ng.core';
import { ConfigState, GetAppConfiguration } from '@abp/ng.core';
import { OAuthService } from 'angular-oauth2-oidc';
import { takeUntil } from 'rxjs/operators';
@Injectable({ providedIn: 'root' })
export class SettingManagementService {
@ -14,10 +16,22 @@ export class SettingManagementService {
private destroy$ = new Subject();
constructor(private router: Router, private store: Store) {
setTimeout(() => {
this.setSettings();
}, 0);
constructor(
private actions: Actions,
private router: Router,
private store: Store,
private oAuthService: OAuthService,
) {
setTimeout(() => this.setSettings(), 0);
this.actions
.pipe(ofActionSuccessful(GetAppConfiguration))
.pipe(takeUntil(this.destroy$))
.subscribe(() => {
if (this.oAuthService.hasValidAccessToken()) {
this.setSettings();
}
});
}
ngOnDestroy() {
@ -25,13 +39,11 @@ export class SettingManagementService {
}
setSettings() {
setTimeout(() => {
const route = this.router.config.find(r => r.path === 'setting-management');
this.settings = (route.data.settings as SettingTab[])
.filter(setting => this.store.selectSnapshot(ConfigState.getGrantedPolicy(setting.requiredPolicy)))
.sort((a, b) => a.order - b.order);
this.checkSelected();
}, 0);
const route = this.router.config.find(r => r.path === 'setting-management');
this.settings = (route.data.settings as SettingTab[])
.filter(setting => this.store.selectSnapshot(ConfigState.getGrantedPolicy(setting.requiredPolicy)))
.sort((a, b) => a.order - b.order);
this.checkSelected();
}
checkSelected() {

6
npm/ng-packs/packages/theme-shared/src/lib/animations/fade.animations.ts

@ -6,6 +6,12 @@ export const fade = trigger('fade', [
transition(':leave', animate(250, style({ opacity: 0 }))),
]);
export const fadeWithStates = trigger('fadeInOut', [
state('out', style({ opacity: 0 })),
state('in', style({ opacity: 1 })),
transition('in <=> out', [animate(250)]),
]);
export const fadeIn = trigger('fadeIn', [
state('*', style({ opacity: 1 })),
transition('* => *', [style({ opacity: 0 }), animate(250)]),

2
npm/ng-packs/packages/theme-shared/src/lib/components/button/button.component.ts

@ -25,6 +25,6 @@ export class ButtonComponent {
disabled: boolean = false;
get icon(): string {
return `${this.loading ? 'fa fa-spin fa-spinner' : this.iconClass || 'd-none'}`;
return `${this.loading ? 'fa fa-pulse fa-spinner' : this.iconClass || 'd-none'}`;
}
}

5
npm/ng-packs/packages/theme-shared/src/lib/components/loader-bar/loader-bar.component.ts

@ -4,6 +4,7 @@ import { NavigationEnd, NavigationStart, Router, NavigationError } from '@angula
import { takeUntilDestroy } from '@ngx-validate/core';
import { Actions, ofActionSuccessful } from '@ngxs/store';
import { filter } from 'rxjs/operators';
import { timer } from 'rxjs';
@Component({
selector: 'abp-loader-bar',
@ -92,8 +93,6 @@ export class LoaderBarComponent implements OnDestroy {
this.progressLevel = 100;
this.isLoading = false;
setTimeout(() => {
this.progressLevel = 0;
}, 800);
timer(810).subscribe(() => (this.progressLevel = 0));
}
}

Loading…
Cancel
Save