Skip to content

Commit

Permalink
♻️ refactor(configs): 更新应用配置和路由配置中服务引用路径及服务端口号更改为8081
Browse files Browse the repository at this point in the history
  • Loading branch information
vnobo committed Jul 2, 2024
1 parent f475350 commit b7d7766
Show file tree
Hide file tree
Showing 16 changed files with 67 additions and 57 deletions.
2 changes: 1 addition & 1 deletion boot/platform/src/main/resources/application-local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ logging:
org.springframework.r2dbc: debug
io.r2dbc.postgresql.PARAM: debug

server.port: 8080
server.port: 8081

spring:
application.name: plate
Expand Down
5 changes: 0 additions & 5 deletions ui/projects/web/src/app/app.config.server.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
import {ApplicationConfig, mergeApplicationConfig} from '@angular/core';
import {provideServerRendering} from '@angular/platform-server';
import {appConfig} from './app.config';
import {BrowserStorageServerService, BrowserStorageService,} from 'commons';

const serverConfig: ApplicationConfig = {
providers: [
provideServerRendering(),
{
provide: BrowserStorageService,
useClass: BrowserStorageServerService,
},
],
};

Expand Down
22 changes: 17 additions & 5 deletions ui/projects/web/src/app/app.config.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import {ApplicationConfig, importProvidersFrom, provideExperimentalZonelessChangeDetection,} from '@angular/core';
import {provideRouter, TitleStrategy} from '@angular/router';

import {routes} from './app.routes';
import {PageTitleStrategy} from './title-strategy.service';
import {provideNzConfig} from 'ng-zorro-antd/core/config';
import {ngZorroConfig} from '../shared/shared-zorro.module';
import {NzConfig, provideNzConfig} from 'ng-zorro-antd/core/config';
import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
import {provideAnimationsAsync} from '@angular/platform-browser/animations/async';
import {
Expand All @@ -14,7 +11,21 @@ import {
withInterceptorsFromDi,
withXsrfConfiguration,
} from '@angular/common/http';
import {authTokenInterceptor, defaultInterceptor,} from './http.Interceptor';
import {BrowserStorageServerService, BrowserStorageService} from 'commons';
import {authTokenInterceptor, defaultInterceptor} from './http.Interceptor';
import {PageTitleStrategy} from './title-strategy.service';
import {routes} from './app.routes';

export const ngZorroConfig: NzConfig = {
// 注意组件名称没有 nz 前缀
message: {
nzTop: 50,
nzDuration: 5000,
nzAnimate: true,
nzPauseOnHover: true,
},
notification: {nzTop: 240},
};

export const appConfig: ApplicationConfig = {
providers: [
Expand All @@ -33,5 +44,6 @@ export const appConfig: ApplicationConfig = {
headerName: 'X-XSRF-TOKEN',
})
),
{provide: BrowserStorageService, useClass: BrowserStorageServerService},
],
};
2 changes: 1 addition & 1 deletion ui/projects/web/src/app/app.routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const routes: Routes = [
{
path: 'auth',
loadChildren: () =>
import('../core/security/security.module').then(m => m.SecurityModule),
import('../core/security.module').then(m => m.SecurityModule),
},
{path: '', pathMatch: 'full', redirectTo: 'auth'},
{path: '**', component: NotFoundComponent},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
import {Component, OnDestroy, OnInit} from '@angular/core';
import {FormBuilder, FormControl, FormGroup, Validators,} from '@angular/forms';
import {FormBuilder, FormControl, FormGroup, FormsModule, ReactiveFormsModule, Validators,} from '@angular/forms';
import {Credentials, LoginService} from './login.service';
import {ActivatedRoute, Router} from '@angular/router';
import {Subject, takeUntil} from 'rxjs';
import {NzFormModule} from 'ng-zorro-antd/form';
import {NgIf} from '@angular/common';

@Component({
selector: 'app-login',
standalone: true,
imports: [FormsModule, ReactiveFormsModule, NzFormModule, NgIf],
templateUrl: './login.component.html',
styleUrls: ['./login.component.scss'],
})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {HttpClient, HttpHeaders} from '@angular/common/http';
import {Injectable} from '@angular/core';
import {Observable, tap, throwError} from 'rxjs';
import {AuthService} from '../../../core/auth.service';
import {AuthService} from '../../core/auth.service';
import {BrowserStorageService} from 'commons';

export interface Authentication {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,28 @@
import {NgIf} from '@angular/common';
import {Component} from '@angular/core';
import {FormControl, FormGroup, NonNullableFormBuilder, Validators,} from '@angular/forms';
import {
FormControl,
FormGroup,
FormsModule,
NonNullableFormBuilder,
ReactiveFormsModule,
Validators,
} from '@angular/forms';
import {NzButtonModule} from 'ng-zorro-antd/button';
import {NzFormModule} from 'ng-zorro-antd/form';
import {NzInputModule} from 'ng-zorro-antd/input';

@Component({
selector: 'app-login-v1',
standalone: true,
imports: [
FormsModule,
ReactiveFormsModule,
NzFormModule,
NzInputModule,
NzButtonModule,
NgIf,
],
templateUrl: './login.component.html',
styleUrls: ['./login.component.scss'],
})
Expand Down
20 changes: 20 additions & 0 deletions ui/projects/web/src/core/security.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import {NgModule, Optional, SkipSelf} from '@angular/core';
import {BrowserStorageService} from 'commons';

import {SecurityRoutingModule} from './security-routing.module';

@NgModule({
imports: [
SecurityRoutingModule
],
providers: [BrowserStorageService]
})
export class SecurityModule {
constructor(@Optional() @SkipSelf() parentModule?: SecurityModule) {
if (parentModule) {
throw new Error(
'SecurityModule is already loaded. Import it in the AppModule only'
);
}
}
}
30 changes: 0 additions & 30 deletions ui/projects/web/src/core/security/security.module.ts

This file was deleted.

11 changes: 0 additions & 11 deletions ui/projects/web/src/shared/shared-zorro.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,7 @@ import {NzMessageModule} from 'ng-zorro-antd/message';
import {NzModalModule} from 'ng-zorro-antd/modal';
import {NzFormModule} from 'ng-zorro-antd/form';
import {NzInputModule} from 'ng-zorro-antd/input';
import {NzConfig} from 'ng-zorro-antd/core/config';

export const ngZorroConfig: NzConfig = {
// 注意组件名称没有 nz 前缀
message: {
nzTop: 50,
nzDuration: 5000,
nzAnimate: true,
nzPauseOnHover: true,
},
notification: {nzTop: 240},
};

@NgModule({
exports: [
Expand Down
2 changes: 1 addition & 1 deletion ui/proxy.conf.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"/api": {
"target": "http://localhost:8080",
"target": "http://localhost:8081",
"secure": false,
"pathRewrite": {
"^/api": ""
Expand Down

0 comments on commit b7d7766

Please sign in to comment.