Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Angular UI: Move SettingTabsService to @abp/ng.setting-management/config package from @abp/ng.core #10164

Merged
merged 6 commits into from
Sep 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/en/Modules/Setting-Management.md
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ Open the `app.component.ts` and modify the file as shown below:

```js
import { Component } from '@angular/core';
import { SettingTabsService } from '@abp/ng.core'; // imported SettingTabsService
import { SettingTabsService } from '@abp/ng.setting-management/config'; // imported SettingTabsService
import { MySettingsComponent } from './my-settings/my-settings.component'; // imported MySettingsComponent

@Component(/* component metadata */)
Expand Down
4 changes: 2 additions & 2 deletions docs/zh-Hans/Modules/Setting-Management.md
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ yarn ng generate component my-settings

```js
import { Component } from '@angular/core';
import { SettingTabsService } from '@abp/ng.core'; // imported SettingTabsService
import { SettingTabsService } from '@abp/ng.setting-management/config'; // imported SettingTabsService
import { MySettingsComponent } from './my-settings/my-settings.component'; // imported MySettingsComponent

@Component(/* component metadata */)
Expand All @@ -273,4 +273,4 @@ export class AppComponent {

导航到 `/setting-management` 路由你会看到以下变化:

![Custom Settings Tab](../images/custom-settings.png)
![Custom Settings Tab](../images/custom-settings.png)
3 changes: 0 additions & 3 deletions npm/ng-packs/packages/core/src/lib/services/routes.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,3 @@ export abstract class AbstractNavTreeService<T extends ABP.Nav>

@Injectable({ providedIn: 'root' })
export class RoutesService extends AbstractNavTreeService<ABP.Route> {}

@Injectable({ providedIn: 'root' })
export class SettingTabsService extends AbstractNavTreeService<ABP.Tab> {}
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,19 @@ import { eThemeSharedRouteNames } from '@abp/ng.theme.shared';
import { APP_INITIALIZER, inject, InjectionToken } from '@angular/core';
import { debounceTime, map } from 'rxjs/operators';
import { eSettingManagementRouteNames } from '../enums/route-names';
import { SettingTabsService } from '../services/settings-tabs.service';
import { Observable } from 'rxjs';

export const SETTING_MANAGEMENT_ROUTE_PROVIDERS = [
{ provide: APP_INITIALIZER, useFactory: configureRoutes, deps: [RoutesService], multi: true },
{
provide: APP_INITIALIZER,
useFactory: hideRoutes,
deps: [RoutesService, SettingTabsService],
multi: true,
},
];

export function configureRoutes(routesService: RoutesService) {
return () => {
routesService.add([
Expand All @@ -19,6 +30,7 @@ export function configureRoutes(routesService: RoutesService) {
]);
};
}

export const SETTING_MANAGEMENT_HAS_SETTING = new InjectionToken<Observable<boolean>>(
'SETTING_MANAGEMENT_HAS_SETTING',
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { SettingTabsService } from '@abp/ng.core';
import { APP_INITIALIZER } from '@angular/core';
import { EmailSettingGroupComponent } from '../components/email-setting-group/email-setting-group.component';
import { eSettingManamagementSettingTabNames } from '../enums/setting-tab-names';
import { SettingTabsService } from '../services/settings-tabs.service';

export const SETTING_MANAGEMENT_SETTING_TAB_PROVIDERS = [
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export * from './components/email-setting-group/email-setting-group.component';
export * from './enums';
export * from './providers';
export * from './setting-management-config.module';
export * from './proxy';
export * from './components/email-setting-group/email-setting-group.component';
export * from './services';
export * from './setting-management-config.module';
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './settings-tabs.service';
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Injectable } from '@angular/core';
import { ABP, AbstractNavTreeService } from '@abp/ng.core';

@Injectable({ providedIn: 'root' })
export class SettingTabsService extends AbstractNavTreeService<ABP.Tab> {}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { ABP, SettingTabsService } from '@abp/ng.core';
import { ABP } from '@abp/ng.core';
import { Component, OnDestroy, OnInit, TrackByFunction } from '@angular/core';
import { SettingTabsService } from '@abp/ng.setting-management/config';
import { Subscription } from 'rxjs';

@Component({
Expand Down