Initial Commit - NG UI
[osm/NG-UI.git] / src / app / instances / InstancesModule.ts
1 /*
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  */
21 import { CommonModule } from '@angular/common';
22 import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
23 import { FlexLayoutModule } from '@angular/flex-layout';
24 import { FormsModule } from '@angular/forms';
25 import { ReactiveFormsModule } from '@angular/forms';
26 import { RouterModule, Routes } from '@angular/router';
27 import { CodemirrorModule } from '@ctrl/ngx-codemirror';
28 import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
29 import { NgSelectModule } from '@ng-select/ng-select';
30 import { TranslateModule } from '@ngx-translate/core';
31 import { AddPDUInstancesComponent } from 'AddPDUInstancesComponent';
32 import { DataService } from 'DataService';
33 import { HistoryOperationsComponent } from 'HistoryOperationsComponent';
34 import { InstancesComponent } from 'InstancesComponent';
35 import { LoaderModule } from 'LoaderModule';
36 import { NetsliceInstancesComponent } from 'NetsliceInstancesComponent';
37 import { SidebarModule } from 'ng-sidebar';
38 import { Ng2SmartTableModule } from 'ng2-smart-table';
39 import { NSInstancesComponent } from 'NSInstancesComponent';
40 import { NSPrimitiveComponent } from 'NSPrimitiveComponent';
41 import { NSTopologyComponent } from 'NSTopologyComponent';
42 import { PagePerRowModule } from 'PagePerRowModule';
43 import { PageReloadModule } from 'PageReloadModule';
44 import { PDUInstancesComponent } from 'PDUInstancesComponent';
45 import { VNFInstancesComponent } from 'VNFInstancesComponent';
46
47 /** To halndle project information */
48 const projectInfo: {} = { title: '{project}', url: '/' };
49
50 /** Exporting a function using Routes @exports routes */
51 const 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 */
123 export 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 }