blob: 7e47d32824c73326e71bf925ddf82ca35a2db849 [file] [log] [blame]
kumaran.m3b4814a2020-05-01 19:48:54 +05301/*
2 Copyright 2020 TATA ELXSI
3
4 Licensed under the Apache License, Version 2.0 (the 'License');
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15
16 Author: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.in), BARATH KUMAR R (barath.r@tataelxsi.co.in)
17 */
18/**
19 * @file Instance module
20 */
21import { CommonModule } from '@angular/common';
22import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
23import { FlexLayoutModule } from '@angular/flex-layout';
24import { FormsModule } from '@angular/forms';
25import { ReactiveFormsModule } from '@angular/forms';
26import { RouterModule, Routes } from '@angular/router';
27import { CodemirrorModule } from '@ctrl/ngx-codemirror';
28import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
29import { NgSelectModule } from '@ng-select/ng-select';
30import { TranslateModule } from '@ngx-translate/core';
31import { AddPDUInstancesComponent } from 'AddPDUInstancesComponent';
32import { DataService } from 'DataService';
33import { HistoryOperationsComponent } from 'HistoryOperationsComponent';
34import { InstancesComponent } from 'InstancesComponent';
35import { LoaderModule } from 'LoaderModule';
36import { NetsliceInstancesComponent } from 'NetsliceInstancesComponent';
37import { SidebarModule } from 'ng-sidebar';
38import { Ng2SmartTableModule } from 'ng2-smart-table';
39import { NSInstancesComponent } from 'NSInstancesComponent';
40import { NSPrimitiveComponent } from 'NSPrimitiveComponent';
41import { NSTopologyComponent } from 'NSTopologyComponent';
42import { PagePerRowModule } from 'PagePerRowModule';
43import { PageReloadModule } from 'PageReloadModule';
44import { PDUInstancesComponent } from 'PDUInstancesComponent';
45import { VNFInstancesComponent } from 'VNFInstancesComponent';
46
47/** To halndle project information */
48const projectInfo: {} = { title: '{project}', url: '/' };
49
50/** Exporting a function using Routes @exports routes */
51const routes: Routes = [
52 {
53 path: '',
54 component: InstancesComponent,
55 children: [
56 {
57 path: 'ns',
58 data: {
59 breadcrumb: [{ title: 'PAGE.DASHBOARD.DASHBOARD', url: '/' }, { title: 'PAGE.DASHBOARD.PROJECTS', url: '/projects' },
60 projectInfo, { title: 'NSINSTANCES', url: null }]
61 },
62 component: NSInstancesComponent
63 },
64 {
65 path: 'vnf',
66 data: {
67 breadcrumb: [{ title: 'PAGE.DASHBOARD.DASHBOARD', url: '/' }, { title: 'PAGE.DASHBOARD.PROJECTS', url: '/projects' },
68 projectInfo, { title: 'VNFINSTANCES', url: null }]
69 },
70 component: VNFInstancesComponent
71 },
72 {
73 path: 'pdu',
74 data: {
75 breadcrumb: [{ title: 'PAGE.DASHBOARD.DASHBOARD', url: '/' }, { title: 'PAGE.DASHBOARD.PROJECTS', url: '/projects' },
76 projectInfo, { title: 'PDUINSTANCES', url: null }]
77 },
78 component: PDUInstancesComponent
79 },
80 {
81 path: 'netslice',
82 data: {
83 breadcrumb: [{ title: 'PAGE.DASHBOARD.DASHBOARD', url: '/' }, { title: 'PAGE.DASHBOARD.PROJECTS', url: '/projects' },
84 projectInfo, { title: 'PAGE.DASHBOARD.NETSLICEINSTANCE', url: null }]
85 },
86 component: NetsliceInstancesComponent
87 },
88 {
89 path: ':type/history-operations/:id',
90 data: {
91 breadcrumb: [{ title: 'PAGE.DASHBOARD.DASHBOARD', url: '/' }, { title: 'PAGE.DASHBOARD.PROJECTS', url: '/projects' },
92 projectInfo, { title: '{type}', url: '/instances/{type}' }, { title: '{id}', url: null }]
93 },
94 component: HistoryOperationsComponent
95 },
96 {
97 path: 'ns/:id',
98 data: {
99 breadcrumb: [{ title: 'PAGE.DASHBOARD.DASHBOARD', url: '/' }, { title: 'PAGE.DASHBOARD.PROJECTS', url: '/projects' },
100 projectInfo, { title: 'NSINSTANCES', url: '/instances/ns' }, { title: '{id}', url: null }]
101 },
102 component: NSTopologyComponent
103 }
104 ]
105 }
106];
107
108/**
109 * An NgModule is a class adorned with the @NgModule decorator function.
110 * @NgModule takes a metadata object that tells Angular how to compile and run module code.
111 */
112@NgModule({
113 imports: [ReactiveFormsModule.withConfig({ warnOnNgModelWithFormControl: 'never' }), FormsModule, TranslateModule,
114 CodemirrorModule, CommonModule, Ng2SmartTableModule, FlexLayoutModule, RouterModule.forChild(routes), NgbModule,
115 NgSelectModule, PagePerRowModule, LoaderModule, SidebarModule.forRoot(), PageReloadModule],
116 declarations: [InstancesComponent, NSInstancesComponent, VNFInstancesComponent, PDUInstancesComponent, AddPDUInstancesComponent,
117 NetsliceInstancesComponent, HistoryOperationsComponent, NSTopologyComponent, NSPrimitiveComponent],
118 schemas: [CUSTOM_ELEMENTS_SCHEMA],
119 providers: [DataService],
120 entryComponents: [NSPrimitiveComponent, AddPDUInstancesComponent]
121})
122/** Exporting a class @exports InstancesModule */
123export class InstancesModule {
124 /** Resolves state-less class */
125 private instancesModule: string;
126 /**
127 * Lifecyle Hooks the trigger before component is instantiate
128 */
129 public ngOnInit(): void {
130 this.instancesModule = '';
131 }
132}