mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-22 02:05:41 +01:00
Enhance the module configuration of harbor ui
This commit is contained in:
parent
e8e7f66e91
commit
25004bbd1f
1
.gitignore
vendored
1
.gitignore
vendored
@ -43,3 +43,4 @@ src/ui_ng/aot/**/*.json
|
||||
**/*ngsummary.json
|
||||
**/*ngfactory.ts
|
||||
**/aot
|
||||
**/dist
|
||||
|
@ -35,7 +35,8 @@
|
||||
"core-js": "^2.4.1",
|
||||
"rxjs": "^5.0.1",
|
||||
"ts-helpers": "^1.1.1",
|
||||
"zone.js": "^0.8.4"
|
||||
"zone.js": "^0.8.4",
|
||||
"mutationobserver-shim": "^0.3.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@angular/cli": "^1.0.0",
|
||||
|
@ -2,7 +2,22 @@ import { NgModule, ModuleWithProviders, Provider } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { SYSTEMINFO_DIRECTIVES } from './system/index';
|
||||
import { SERVICE_CONFIG, IServiceConfig } from './service.config';
|
||||
import {
|
||||
AccessLogService,
|
||||
AccessLogDefaultService,
|
||||
EndpointService,
|
||||
EndpointDefaultService,
|
||||
ReplicationService,
|
||||
ReplicationDefaultService,
|
||||
RepositoryService,
|
||||
RepositoryDefaultService,
|
||||
TagService,
|
||||
TagDefaultService
|
||||
} from './service/index';
|
||||
|
||||
/**
|
||||
* Declare default service configuration
|
||||
*/
|
||||
export const DefaultServiceConfig: IServiceConfig = {
|
||||
systemInfoEndpoint: "/api/system",
|
||||
repositoryBaseEndpoint: "",
|
||||
@ -12,8 +27,30 @@ export const DefaultServiceConfig: IServiceConfig = {
|
||||
replicationJobEndpoint: ""
|
||||
};
|
||||
|
||||
/**
|
||||
* Define the configuration for harbor shareable module
|
||||
*
|
||||
* @export
|
||||
* @interface HarborModuleConfig
|
||||
*/
|
||||
export interface HarborModuleConfig {
|
||||
config?: Provider
|
||||
//Service endpoints
|
||||
config?: Provider,
|
||||
|
||||
//Service implementation for log
|
||||
logService?: Provider,
|
||||
|
||||
//Service implementation for endpoint
|
||||
endpointService?: Provider,
|
||||
|
||||
//Service implementation for replication
|
||||
replicationService?: Provider,
|
||||
|
||||
//Service implementation for repository
|
||||
repositoryService?: Provider,
|
||||
|
||||
//Service implementation for tag
|
||||
tagService?: Provider
|
||||
}
|
||||
|
||||
@NgModule({
|
||||
@ -29,7 +66,12 @@ export class HarborLibraryModule {
|
||||
return {
|
||||
ngModule: HarborLibraryModule,
|
||||
providers: [
|
||||
config.config || { provide: SERVICE_CONFIG, useValue: DefaultServiceConfig }
|
||||
config.config || { provide: SERVICE_CONFIG, useValue: DefaultServiceConfig },
|
||||
config.logService || { provide: AccessLogService, useClass: AccessLogDefaultService },
|
||||
config.endpointService || { provide: EndpointService, useClass: EndpointDefaultService },
|
||||
config.replicationService || { provide: ReplicationService, useClass: ReplicationDefaultService },
|
||||
config.repositoryService || { provide: RepositoryService, useClass: RepositoryDefaultService },
|
||||
config.tagService || { provide: TagService, useClass: TagDefaultService }
|
||||
]
|
||||
};
|
||||
}
|
||||
@ -38,7 +80,12 @@ export class HarborLibraryModule {
|
||||
return {
|
||||
ngModule: HarborLibraryModule,
|
||||
providers: [
|
||||
config.config || { provide: SERVICE_CONFIG, useValue: DefaultServiceConfig }
|
||||
config.config || { provide: SERVICE_CONFIG, useValue: DefaultServiceConfig },
|
||||
config.logService || { provide: AccessLogService, useClass: AccessLogDefaultService },
|
||||
config.endpointService || { provide: EndpointService, useClass: EndpointDefaultService },
|
||||
config.replicationService || { provide: ReplicationService, useClass: ReplicationDefaultService },
|
||||
config.repositoryService || { provide: RepositoryService, useClass: RepositoryDefaultService },
|
||||
config.tagService || { provide: TagService, useClass: TagDefaultService }
|
||||
]
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user