Verified Commit e23fbf65 authored by uncol's avatar uncol
Browse files

monitor & admin as modules

parent 0c5449a8
Pipeline #20937 passed with stages
in 16 minutes and 21 seconds
# Editor configuration, see https://editorconfig.org
root = true
[*]
charset = utf-8
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true
[*.md]
max_line_length = off
trim_trailing_whitespace = false
# See http://help.github.com/ignore-files/ for more about ignoring files.
# compiled output
/dist
/tmp
/out-tsc
# Only exists if Bazel was run
/bazel-out
# dependencies
/node_modules
# profiling files
chrome-profiler-events*.json
speed-measure-plugin*.json
# IDEs and editors
/.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace
# IDE - VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
.history/*
# misc
/.sass-cache
/connect.lock
/coverage
/libpeerconnection.log
npm-debug.log
yarn-error.log
testem.log
/typings
# System Files
.DS_Store
Thumbs.db
# Default ignored files
/workspace.xml
\ No newline at end of file
# NocUi
# NocNgrx
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 9.0.3.
use command:
`ng new noc-ui --routing --prefix noc --skip-install --commit --strict --style css`
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 9.0.4.
## Development server
......
......@@ -29,7 +29,8 @@
"src/styles.css"
],
"scripts": [
"node_modules/@webcomponents/custom-elements/custom-elements.min.js",
"node_modules/@webcomponents/webcomponentsjs/custom-elements-es5-adapter.js",
"node_modules/@webcomponents/webcomponentsjs/webcomponents-bundle.js",
"node_modules/@clr/icons/clr-icons.min.js"
]
},
......@@ -127,4 +128,4 @@
}
},
"defaultProject": "noc-ui"
}
\ No newline at end of file
}
......@@ -10,7 +10,7 @@ describe('workspace-project App', () => {
it('should display welcome message', () => {
page.navigateTo();
expect(page.getTitleText()).toEqual('noc-ui app is running!');
expect(page.getTitleText()).toEqual('noc-ngrx app is running!');
});
afterEach(async () => {
......
......@@ -16,7 +16,7 @@ module.exports = function (config) {
clearContext: false // leave Jasmine Spec Runner output visible in browser
},
coverageIstanbulReporter: {
dir: require('path').join(__dirname, './coverage/noc-ui'),
dir: require('path').join(__dirname, './coverage/noc-ngrx'),
reports: ['html', 'lcovonly', 'text-summary'],
fixWebpackSourcePaths: true
},
......
{
"name": "noc-ui",
"name": "noc-ngrx",
"version": "0.0.0",
"scripts": {
"ng": "ng",
......@@ -11,31 +11,35 @@
},
"private": true,
"dependencies": {
"@angular/animations": "~9.0.2",
"@angular/common": "~9.0.2",
"@angular/compiler": "~9.0.2",
"@angular/core": "~9.0.2",
"@angular/forms": "~9.0.2",
"@angular/platform-browser": "~9.0.2",
"@angular/platform-browser-dynamic": "~9.0.2",
"@angular/router": "~9.0.2",
"@clr/angular": "3.0.0-rc.1",
"@angular/animations": "~9.0.3",
"@angular/common": "~9.0.3",
"@angular/compiler": "~9.0.3",
"@angular/core": "~9.0.3",
"@angular/forms": "~9.0.3",
"@angular/platform-browser": "~9.0.3",
"@angular/platform-browser-dynamic": "~9.0.3",
"@angular/router": "~9.0.3",
"@clr/angular": "^3.0.0",
"@ngrx/effects": "^9.0.0-rc.0",
"@ngrx/router-store": "^9.0.0-rc.0",
"@ngrx/store": "^9.0.0-rc.0",
"@ngrx/store-devtools": "^9.0.0-rc.0",
"rxjs": "~6.5.4",
"tslib": "^1.10.0",
"zone.js": "~0.10.2",
"@clr/ui": "3.0.0-rc.1",
"@clr/icons": "3.0.0-rc.1",
"@clr/core": "3.0.0-rc.1",
"@webcomponents/custom-elements": "^1.0.0"
"@clr/ui": "3.0.0",
"@clr/icons": "3.0.0",
"@clr/core": "3.0.0",
"@webcomponents/webcomponentsjs": "^2.0.0"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.900.3",
"@angular/cli": "~9.0.3",
"@angular/compiler-cli": "~9.0.2",
"@angular/language-service": "~9.0.2",
"@angular-devkit/build-angular": "~0.900.4",
"@angular/cli": "~9.0.4",
"@angular/compiler-cli": "~9.0.3",
"@angular/language-service": "~9.0.3",
"@types/node": "^12.11.1",
"@types/jasmine": "~3.5.0",
"@types/jasminewd2": "~2.0.3",
"@types/node": "^12.11.1",
"codelyzer": "^5.1.2",
"jasmine-core": "~3.5.0",
"jasmine-spec-reporter": "~4.2.1",
......@@ -47,6 +51,7 @@
"protractor": "~5.4.3",
"ts-node": "~8.3.0",
"tslint": "~5.18.0",
"typescript": "~3.7.5"
"typescript": "~3.7.5",
"@ngrx/schematics": "^9.0.0-rc.0"
}
}
\ No newline at end of file
}
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { HomeComponent } from './home.component';
import { Item1Component } from './item1.component';
import { Item2Component } from './item2.component';
const routes: Routes = [
{
path: '',
component: HomeComponent
// children: [
// {
// path: '',
// children: [
// {path: 'item1', component: Item1Component},
// {path: 'item2', component: Item2Component}
// ]
// }
// ]
},
{path: 'item1', component: Item1Component},
{path: 'item2', component: Item2Component}
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule]
})
export class AdminRoutingModule {
}
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { AdminRoutingModule } from './admin-routing.module';
import { HomeComponent } from './home.component';
import { Item1Component } from './item1.component';
import { Item2Component } from './item2.component';
export const COMPONENTS = [HomeComponent, Item1Component, Item2Component];
@NgModule({
declarations: COMPONENTS,
imports: [
CommonModule,
AdminRoutingModule
]
})
export class AdminModule {
}
import { Component, OnInit } from '@angular/core';
import { Store } from '@ngrx/store';
import * as fromRoot from '../reducers';
import { VerticalNavItem } from '../core/models';
import { NavigationActions } from '../core/actions';
@Component({
selector: 'noc-admin-home',
template: `
<h3>ADMIN</h3>
<ul class="list">
<li><a routerLink="item1" routerLinkActive="active">Item I</a></li>
<li><a routerLink="item2" routerLinkActive="active">Item II</a></li>
</ul>
`
})
export class HomeComponent implements OnInit {
constructor(private store: Store<fromRoot.State>) {
}
ngOnInit(): void {
console.log('noc-admin-home : OnInit');
const navItems: VerticalNavItem[] = [
new VerticalNavItem({
type: 'navGroup',
icon: 'user',
name: 'Items',
items: [
new VerticalNavItem({type: 'navItem', name: 'Item I', icon: 'bolt', link: 'admin/item1'}),
new VerticalNavItem({type: 'navItem', name: 'Item II', icon: 'bell', link: 'admin/item2'})
]
})
];
setTimeout(() => this.store.dispatch(NavigationActions.loadProjectMenu({verticalItems: navItems})));
}
}
import { Component, OnInit } from '@angular/core';
import { Store } from '@ngrx/store';
import { VerticalNavItem } from '../core/models';
import { NavigationActions } from '../core/actions';
import * as fromRoot from '../reducers';
@Component({
selector: 'noc-admin-item1',
template: `
<p>item 1 works!</p>
`
})
export class Item1Component implements OnInit {
constructor(private store: Store<fromRoot.State>) {
}
ngOnInit(): void {
console.log('noc-admin-item1 : OnInit');
const navItems: VerticalNavItem[] = [
new VerticalNavItem({type: 'navItem', name: 'Edit', icon: 'edit', link: 'xxx1'}),
new VerticalNavItem({type: 'navItem', name: 'Copy', icon: 'copy', link: 'xxx2'})
];
setTimeout(() => this.store.dispatch(NavigationActions.loadProjectMenu({verticalItems: navItems})));
}
}
import { Component, OnInit } from '@angular/core';
import { Store } from '@ngrx/store';
import * as fromRoot from '../reducers';
import { VerticalNavItem } from '../core/models';
import { NavigationActions } from '../core/actions';
@Component({
selector: 'noc-admin-item2',
template: `
<p>item 2 works!</p>
`
})
export class Item2Component implements OnInit {
constructor(private store: Store<fromRoot.State>) {
}
ngOnInit(): void {
console.log('noc-admin-item2 : OnInit');
const navItems: VerticalNavItem[] = [
new VerticalNavItem({type: 'navItem', name: 'Cut', icon: 'scissors', link: 'xxx1'}),
new VerticalNavItem({type: 'navItem', name: 'Paste', icon: 'paste', link: 'xxx2'})
];
setTimeout(() => this.store.dispatch(NavigationActions.loadProjectMenu({verticalItems: navItems})));
}
}
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { RouterModule, Routes } from '@angular/router';
import { WelcomeComponent } from './core/containers';
const routes: Routes = [];
const routes: Routes = [
{path: 'welcome', component: WelcomeComponent},
{
path: 'admin',
loadChildren: () => import('./admin/admin.module').then(m => m.AdminModule)
},
{
path: 'monitoring',
loadChildren: () => import('./monitor/monitor.module').then(m => m.MonitorModule)
},
{path: '', redirectTo: '/welcome', pathMatch: 'full'}
];
@NgModule({
imports: [RouterModule.forRoot(routes)],
exports: [RouterModule]
imports: [RouterModule.forRoot(routes)],
exports: [RouterModule]
})
export class AppRoutingModule { }
export class AppRoutingModule {
}
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { BrowserModule } from '@angular/platform-browser';
import { HttpClientModule } from '@angular/common/http';
import { ClarityModule } from '@clr/angular';
import { StoreModule } from '@ngrx/store';
import { EffectsModule } from '@ngrx/effects';
import { StoreDevtoolsModule } from '@ngrx/store-devtools';
import { metaReducers, ROOT_REDUCERS } from './reducers';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { environment } from '../environments/environment';
import { CoreModule } from './core';
import { AppComponent } from './core/containers';
import { ProjectsLinkEffects, RouterEffects } from './core/effects';
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
BrowserAnimationsModule,
HttpClientModule,
AppRoutingModule,
ClarityModule
HttpClientModule,
CoreModule,
StoreModule.forRoot(ROOT_REDUCERS, {
metaReducers,
runtimeChecks: {
strictStateImmutability: true,
strictActionImmutability: true,
strictStateSerializability: true,
strictActionSerializability: true,
strictActionWithinNgZone: true
}
}),
EffectsModule.forRoot([RouterEffects, ProjectsLinkEffects]),
!environment.production ? StoreDevtoolsModule.instrument() : []
],
providers: [],
bootstrap: [AppComponent]
......
import { NgModule } from '@angular/core';
import { ClarityModule } from '@clr/angular';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
const modules = [BrowserAnimationsModule, ClarityModule];
@NgModule({
declarations: [],
imports: modules,
exports: modules
})
export class ClrModule {
}
export * from './clr.module';
import * as LayoutActions from './layout.actions';
import * as NavigationActions from './navigation.actions';
export { LayoutActions, NavigationActions };
import { createAction, props } from '@ngrx/store';
export const expandSidenav = createAction('[Layout] Expand Sidenav');
export const collapseSidenav = createAction('[Layout] Collapse Sidenav');
export const sidenavChangeTo = createAction('[Layout] Sidenav Change to', props<{ isCollapsed: boolean }>());
import { createAction, props } from '@ngrx/store';
import { VerticalNavItem } from '../models';
export const loadProjects = createAction('[Navigation] Load Projects');
export const loadProjectsSuccess = createAction('[Navigation] Load Projects Success', props<{ projects: VerticalNavItem[] }>());
export const loadProjectsFailure = createAction('[Navigation] Load Projects Failure', props<{ error: string }>());
export const loadProjectMenu = createAction('[Navigation] Load Project Menu Items', props<{ verticalItems: VerticalNavItem[] }>());
export const cleanProjectMenu = createAction('[Navigation] Clean Project Menu');
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment