Initial Commit - NG UI
* Roboto and font-awesome fonts are added in package.json
* Replace Nginx alpine varient to stable
* Devops files are added
* Docker file aligned as per community reviews
* Enhancement - NS primitive, Azure inclusion and domain name
* RWD changes
Change-Id: If543efbf127964cbd8f4be4c5a67260c91407fd9
Signed-off-by: kumaran.m <kumaran.m@tataelxsi.co.in>
diff --git a/src/app/layouts/LayoutComponent.html b/src/app/layouts/LayoutComponent.html
new file mode 100644
index 0000000..96f1302
--- /dev/null
+++ b/src/app/layouts/LayoutComponent.html
@@ -0,0 +1,37 @@
+<!--
+Copyright 2020 TATA ELXSI
+
+Licensed under the Apache License, Version 2.0 (the 'License');
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Author: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.in), BARATH KUMAR R (barath.r@tataelxsi.co.in)
+-->
+<app-header></app-header>
+<div id="main-wrapper" class="container-fluid" dir="ltr" appGottoTop>
+ <div class="layout-wrapper mt-2">
+ <app-sidebar></app-sidebar>
+ <div class="content-section pl-4">
+ <app-breadcrumb></app-breadcrumb>
+ <div class="mt-2">
+ <div class="card custom-card shadow">
+ <div class="card-body custom-card-body">
+ <router-outlet></router-outlet>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ <button class="btn btn-sm btn-primary border border-radius-default goto-top" type="button"
+ *ngIf="sharedService.showGotoTop" (click)="gotoTop()">
+ <i class="fas fa-angle-up"></i>
+ </button>
+</div>
\ No newline at end of file
diff --git a/src/app/layouts/LayoutComponent.scss b/src/app/layouts/LayoutComponent.scss
new file mode 100644
index 0000000..649387a
--- /dev/null
+++ b/src/app/layouts/LayoutComponent.scss
@@ -0,0 +1,36 @@
+/*
+ Copyright 2020 TATA ELXSI
+
+ Licensed under the Apache License, Version 2.0 (the 'License');
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+ Author: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.in), BARATH KUMAR R (barath.r@tataelxsi.co.in)
+*/
+@import "../../assets/scss/mixins/mixin";
+@import "../../assets/scss/variable";
+#main-wrapper {
+ @include wh-value(100%, null);
+ .layout-wrapper {
+ @include flexbox(flex, null, null, null, stretch, null);
+ .content-section {
+ @include wh-value(100%, null);
+ @include transition(all, 0.3s, null, null);
+ overflow-x: auto;
+ }
+ }
+ .goto-top {
+ @include position_value(fixed, null, 30px, 10px, null);
+ @include font(null, 20px, null);
+ outline: none;
+ @include wh-value(40px, 40px);
+ }
+}
\ No newline at end of file
diff --git a/src/app/layouts/LayoutComponent.ts b/src/app/layouts/LayoutComponent.ts
new file mode 100644
index 0000000..b99221a
--- /dev/null
+++ b/src/app/layouts/LayoutComponent.ts
@@ -0,0 +1,44 @@
+/*
+ Copyright 2020 TATA ELXSI
+
+ Licensed under the Apache License, Version 2.0 (the 'License');
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+ Author: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.in), BARATH KUMAR R (barath.r@tataelxsi.co.in)
+*/
+/**
+ * @file NS Instance Component
+ */
+import { Component } from '@angular/core';
+import { SharedService } from 'SharedService';
+/**
+ * Creating component
+ * @Component takes LayoutComponent.html as template url
+ */
+@Component({
+ selector: 'app-layout',
+ templateUrl: './LayoutComponent.html',
+ styleUrls: ['./LayoutComponent.scss']
+})
+/** Exporting a class @exports LayoutComponent */
+export class LayoutComponent {
+ /** Contains all methods related to shared @private */
+ public sharedService: SharedService;
+
+ constructor(sharedService: SharedService) {
+ this.sharedService = sharedService;
+ }
+ /** method to handle go to top event @public */
+ public gotoTop(): void {
+ window.scroll({ behavior: 'smooth', top: 0, left: 0 });
+ }
+}
diff --git a/src/app/layouts/breadcrumb/BreadcrumbComponent.html b/src/app/layouts/breadcrumb/BreadcrumbComponent.html
new file mode 100644
index 0000000..9d028b3
--- /dev/null
+++ b/src/app/layouts/breadcrumb/BreadcrumbComponent.html
@@ -0,0 +1,27 @@
+<!--
+Copyright 2020 TATA ELXSI
+
+Licensed under the Apache License, Version 2.0 (the 'License');
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Author: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.in), BARATH KUMAR R (barath.r@tataelxsi.co.in)
+-->
+<nav aria-label="breadcrumb" class="breadcrumb-holder">
+ <ul class="breadcrumb-custom pl-0">
+ <li class="breadcrumb-item-custom" [routerLink]="item.url" *ngFor="let item of menuItems; let i = index" [class.active]="i===menuItems.length-1">
+ <a *ngIf="i!==menuItems.length-1">
+ <i *ngIf="i==0" class="fas fa-th-large"></i> {{item.title | translate}}
+ </a>
+ <span *ngIf="i===menuItems.length-1"><i *ngIf="i==0" class="fas fa-th-large"></i> {{item.title | translate}}</span>
+ </li>
+ </ul>
+</nav>
\ No newline at end of file
diff --git a/src/app/layouts/breadcrumb/BreadcrumbComponent.scss b/src/app/layouts/breadcrumb/BreadcrumbComponent.scss
new file mode 100644
index 0000000..7ed3da6
--- /dev/null
+++ b/src/app/layouts/breadcrumb/BreadcrumbComponent.scss
@@ -0,0 +1,81 @@
+/*
+Copyright 2020 TATA ELXSI
+
+Licensed under the Apache License, Version 2.0 (the 'License');
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Author: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.in), BARATH KUMAR R (barath.r@tataelxsi.co.in)
+*/
+@import "../../../assets/scss/mixins/mixin";
+@import "../../../assets/scss/variable";
+.breadcrumb-holder {
+ .breadcrumb-custom {
+ @include box-shadow(0, 2px, 5px, 0, rgba(0, 0, 0, 0.25));
+ @include roundedCorners(5);
+ @include background(null, $white, null, null, null);
+ @include margin-value(0, 0, 0, 0);
+ @include flexbox(inline-block, null, null, null, null, null);
+ overflow: hidden;
+ .breadcrumb-item-custom {
+ @include flexbox(block, null, null, null, null, null);
+ @include line-height(35px);
+ @include font(null, 12px, null);
+ @include padding-value(0, 10, 0, 30);
+ @include position_value(relative, null, null, null, null);
+ float: left;
+ cursor: pointer;
+ &:hover {
+ @include background(null, $secondary, null, null, null);
+ a {
+ color: $white;
+ }
+ &::after {
+ @include background(null, $secondary, null, null, null);
+ }
+ }
+ a {
+ color: $primary;
+ }
+ &:first-child {
+ padding-left: 20px;
+ @include roundedTopLeftRadius(5);
+ @include roundedBottomLeftRadius(5);
+ &::before {
+ @include position_value(null, null, null, null, 14px);
+ }
+ }
+ &:last-child {
+ @include roundedTopRightRadius(5);
+ @include roundedBottomRightRadius(5);
+ padding-right: 20px;
+ &::after {
+ content: none;
+ }
+ }
+ &::after {
+ content: "";
+ @include position_value(absolute, 0, -18px, null, null);
+ @include wh-value(36px, 36px);
+ @include background(null, $white, null, null, null);
+ @include box-shadow(2px, -2px, 0, 1px, $breadcrumb-after-color);
+ transform: scale(0.707) rotate(45deg);
+ z-index: 1;
+ @include roundedTopRightRadius(5);
+ @include roundedBottomLeftRadius(50);
+ }
+ &.active {
+ @include background(null, $primary, null, null, null);
+ color: $white;
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/app/layouts/breadcrumb/BreadcrumbComponent.ts b/src/app/layouts/breadcrumb/BreadcrumbComponent.ts
new file mode 100644
index 0000000..ccb9588
--- /dev/null
+++ b/src/app/layouts/breadcrumb/BreadcrumbComponent.ts
@@ -0,0 +1,140 @@
+/*
+ Copyright 2020 TATA ELXSI
+
+ Licensed under the Apache License, Version 2.0 (the 'License');
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+ Author: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.in), BARATH KUMAR R (barath.r@tataelxsi.co.in)
+*/
+/**
+ * @file Bread Crumb component.
+ */
+import { Component, Injector, OnInit } from '@angular/core';
+import { ActivatedRoute, NavigationEnd, Router, RouterEvent, UrlSegment } from '@angular/router';
+import { TranslateService } from '@ngx-translate/core';
+import { BREADCRUMBITEM } from 'CommonModel';
+import { filter, startWith } from 'rxjs/operators';
+import { isNullOrUndefined } from 'util';
+
+/**
+ * Creating component
+ * @Component takes BreadcrumbComponent.html as template url
+ */
+@Component({
+ selector: 'app-breadcrumb',
+ templateUrl: './BreadcrumbComponent.html',
+ styleUrls: ['./BreadcrumbComponent.scss']
+})
+
+/** Exporting a class @exports BreadcrumbComponent */
+export class BreadcrumbComponent implements OnInit {
+ /** To inject breadCrumb @public */
+ public static readonly ROUTE_DATA_BREADCRUMB: string = 'breadcrumb';
+
+ /** To inject services @public */
+ public injector: Injector;
+
+ /** To inject breadCrumb Default icon and url @public */
+ public readonly home: {} = { icon: 'pi pi-th-large', url: '/' };
+
+ /** To inject breadCrumb Menus @public */
+ public menuItems: BREADCRUMBITEM[];
+
+ /** Service holds the router information @private */
+ private router: Router;
+
+ /** Holds teh instance of AuthService class of type AuthService @private */
+ private activatedRoute: ActivatedRoute;
+
+ /** handle translate service @private */
+ private translateService: TranslateService;
+
+ constructor(injector: Injector) {
+ this.injector = injector;
+ this.router = this.injector.get(Router);
+ this.activatedRoute = this.injector.get(ActivatedRoute);
+ this.translateService = this.injector.get(TranslateService);
+ }
+ /** Lifecyle Hooks the trigger before component is instantiate @public */
+ public ngOnInit(): void {
+ this.router.events
+ .pipe(filter((event: RouterEvent) => event instanceof NavigationEnd), startWith(undefined))
+ .subscribe(() => this.menuItems = this.createBreadcrumbs(this.activatedRoute.root));
+ }
+
+ /** Generate breadcrumbs from data given the module routes @private */
+ private createBreadcrumbs(route: ActivatedRoute, url: string = '', breadcrumbs: BREADCRUMBITEM[] = []):
+ BREADCRUMBITEM[] {
+ const children: ActivatedRoute[] = route.children;
+ if (children.length === 0) {
+ return breadcrumbs;
+ }
+ for (const child of children) {
+ const routeURL: string = child.snapshot.url.map((segment: UrlSegment) => segment.path).join('/');
+ if (routeURL !== '') {
+ url += `/${routeURL}`;
+ }
+ let menuLIst: BREADCRUMBITEM[] = child.snapshot.data[BreadcrumbComponent.ROUTE_DATA_BREADCRUMB];
+ if (!isNullOrUndefined(menuLIst)) {
+ menuLIst = JSON.parse(JSON.stringify(menuLIst));
+ menuLIst.forEach((item: BREADCRUMBITEM) => {
+ if (!isNullOrUndefined(item.title)) {
+ item.title = item.title.replace('{type}', this.checkTitle(item, child.snapshot.params.type));
+ item.title = item.title.replace('{id}', child.snapshot.params.id);
+ item.title = item.title.replace('{project}', localStorage.getItem('project'));
+ }
+ if (!isNullOrUndefined(item.url)) {
+ item.url = item.url.replace('{type}', child.snapshot.params.type);
+ item.url = item.url.replace('{id}', child.snapshot.params.id);
+ }
+ breadcrumbs.push(item);
+ });
+ }
+ return this.createBreadcrumbs(child, url, breadcrumbs);
+ }
+ }
+ /** Check and update title based on type of operations @private */
+ private checkTitle(breadcrumbItem: BREADCRUMBITEM, opertionType: string): string {
+ if (!isNullOrUndefined(breadcrumbItem.url)) {
+ if (breadcrumbItem.url.indexOf('packages') !== -1) {
+ return this.matchPackageTitle(opertionType);
+ }
+ if (breadcrumbItem.url.indexOf('instances') !== -1) {
+ return this.matchInstanceTitle(opertionType);
+ }
+ return breadcrumbItem.title;
+ }
+ }
+ /** check and update package title based on package type @private */
+ private matchPackageTitle(opertionType: string): string {
+ if (opertionType === 'ns') {
+ return this.translateService.instant('NSPACKAGES');
+ } else if (opertionType === 'vnf') {
+ return this.translateService.instant('VNFPACKAGES');
+ } else {
+ return this.translateService.instant('PAGE.DASHBOARD.NETSLICETEMPLATE');
+ }
+ }
+ /** check and update package title based on instance type @private */
+ private matchInstanceTitle(opertionType: string): string {
+ if (opertionType === 'ns') {
+ return this.translateService.instant('NSINSTANCES');
+ } else if (opertionType === 'vnf') {
+ return this.translateService.instant('VNFINSTANCES');
+ } else if (opertionType === 'pdu') {
+ return this.translateService.instant('PDUINSTANCES');
+ } else {
+ return this.translateService.instant('PAGE.DASHBOARD.NETSLICEINSTANCE');
+ }
+ }
+
+}
diff --git a/src/app/layouts/header/HeaderComponent.html b/src/app/layouts/header/HeaderComponent.html
new file mode 100644
index 0000000..a9ff5ac
--- /dev/null
+++ b/src/app/layouts/header/HeaderComponent.html
@@ -0,0 +1,71 @@
+<!--
+Copyright 2020 TATA ELXSI
+
+Licensed under the Apache License, Version 2.0 (the 'License');
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Author: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.in), BARATH KUMAR R (barath.r@tataelxsi.co.in)
+-->
+<span class="d-none px-3 py-2 text-center text-bold bg-primary text-white">Here is a newer {{'APPVERSION' | translate}} {{PACKAGEVERSION}}
+ of OSM!</span>
+
+<nav class="navbar navbar-expand-md sticky-top bg-white" role="navigation">
+ <a class="navbar-brand">
+ <img routerLink="/" src="assets/images/logo.png" class="osm-logo"
+ alt="OPEN SOURCE MANO" draggable="false">
+ </a>
+ <div class="nav navbar-nav nav-flex-icons ml-auto">
+ <ul class="navbar-nav cursor-pointer" ngbDropdown display="dynamic" placement="bottom-right">
+ <li class="nav-item dropdown">
+ <a class="nav-link dropdown-toggle" id="navbarDropdownProject" ngbDropdownToggle>
+ <i class="fas fa-folder-open"></i> {{'PAGE.DASHBOARD.PROJECTS' | translate}}
+ ({{selectedProject | async}})
+ </a>
+ <div class="dropdown-menu custom-dropdown-menu m-0 p-0" ngbDropdownMenu *ngIf="getSelectedProject"
+ aria-labelledby="navbarDropdownProject">
+ <a ngbDropdownItem class="dropdown-item project-item"
+ [ngClass]="list.project_name === getSelectedProject ? 'activeProject' : ''"
+ (click)="list.project_name === getSelectedProject ? '' : this.projectService.switchProjectModal(list)"
+ *ngFor="let list of projectList$ | async" placement="left" container="body"
+ ngbTooltip="{{ (list.project_name === getSelectedProject ? 'CURRENTPROJECT' : 'SWITCHPROJECT') | translate}}">
+ <span>{{list.project_name}}</span>
+ <i *ngIf="list.project_name === getSelectedProject"
+ class="fas fa-check-circle text-success"></i>
+ <i *ngIf="list.project_name !== getSelectedProject" class="fas fa-exchange-alt text-danger"></i>
+ </a>
+ </div>
+ </li>
+ </ul>
+ <ul class="navbar-nav cursor-pointer text-right" ngbDropdown display="dynamic" placement="bottom-right">
+ <li class="nav-item dropdown">
+ <a class="nav-link dropdown-toggle" id="navbarDropdown" ngbDropdownToggle>
+ <i class="fas fa-user-circle"></i> {{'USER' | translate}} ({{username$ | async}})
+ </a>
+ <div class="dropdown-menu custom-dropdown-menu m-0 p-0" ngbDropdownMenu
+ aria-labelledby="navbarDropdown">
+ <a ngbDropdownItem class="dropdown-item project-item" (click)="userSettings()">
+ <span>{{'PAGE.DASHBOARD.USERSETTINGS' | translate}}</span>
+ <i class="fas fa-users-cog"></i>
+ </a>
+ <a ngbDropdownItem class="dropdown-item project-item" (click)="logout()">
+ <span>{{'PAGE.DASHBOARD.LOGOUT' | translate}}</span>
+ <i class="fas fa-sign-out-alt"></i>
+ </a>
+ <div class="custom-divider"></div>
+ <a *ngIf="sharedService.osmVersion" ngbDropdownItem class="dropdown-item project-item osm-version" href="javascript:void(0);">
+ <span>{{'OSMVERSION' | translate}} {{sharedService.osmVersion}}</span>
+ </a>
+ </div>
+ </li>
+ </ul>
+ </div>
+</nav>
\ No newline at end of file
diff --git a/src/app/layouts/header/HeaderComponent.scss b/src/app/layouts/header/HeaderComponent.scss
new file mode 100644
index 0000000..86200b7
--- /dev/null
+++ b/src/app/layouts/header/HeaderComponent.scss
@@ -0,0 +1,51 @@
+/*
+ Copyright 2020 TATA ELXSI
+
+ Licensed under the Apache License, Version 2.0 (the 'License');
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+ Author: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.in), BARATH KUMAR R (barath.r@tataelxsi.co.in)
+*/
+@import '../../../assets/scss/mixins/mixin';
+@import '../../../assets/scss/variable';
+
+.navbar{
+ @include box-shadow(0px, 0px, 12px, 0px, rgba($black,0.14));
+ @include border(all, 0, solid, $gray-80);
+ .osm-logo{
+ cursor: pointer;
+ }
+ .custom-dropdown-menu {
+ .dropdown-item{
+ &.project-item{
+ @include flexbox(flex, space-between, row, null, center, null);
+ }
+ &:active, &:hover, &.active{
+ @include background(null, $theme-bg-color, null, null, null);
+ color: $primary;
+ }
+ &.activeProject{
+ cursor: default;
+ }
+ }
+ .custom-divider{
+ @include wh-value(null, 0);
+ @include border(top, 2, solid, $primary);
+ overflow: hidden;
+ }
+ }
+ .osm-version{
+ @include background(null, $theme-bg-color, null, null, null);
+ color: $primary;
+ cursor: default;
+ }
+}
\ No newline at end of file
diff --git a/src/app/layouts/header/HeaderComponent.ts b/src/app/layouts/header/HeaderComponent.ts
new file mode 100644
index 0000000..4d7f3b1
--- /dev/null
+++ b/src/app/layouts/header/HeaderComponent.ts
@@ -0,0 +1,106 @@
+/*
+ Copyright 2020 TATA ELXSI
+
+ Licensed under the Apache License, Version 2.0 (the 'License');
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+ Author: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.in), BARATH KUMAR R (barath.r@tataelxsi.co.in)
+ */
+
+/**
+ * @file Header Component
+ */
+import { Component, Injector, OnInit } from '@angular/core';
+import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
+import { AuthenticationService } from 'AuthenticationService';
+import { environment } from 'environment';
+import { ProjectService } from 'ProjectService';
+import { Observable } from 'rxjs';
+import { SharedService } from 'SharedService';
+import { ProjectRoleMappings, UserDetail } from 'UserModel';
+import { UserSettingsComponent } from 'UserSettingsComponent';
+
+/**
+ * Creating component
+ * @Component takes HeaderComponent.html as template url
+ */
+@Component({
+ selector: 'app-header',
+ templateUrl: './HeaderComponent.html',
+ styleUrls: ['./HeaderComponent.scss']
+})
+/** Exporting a class @exports HeaderComponent */
+export class HeaderComponent implements OnInit {
+ /** Invoke service injectors @public */
+ public injector: Injector;
+
+ /** Variables holds all the projects @public */
+ public projectList$: Observable<{}[]>;
+
+ /** Observable holds logined value @public */
+ public username$: Observable<string>;
+
+ /** Variables holds admin is logged or not @public */
+ public isAdmin: boolean;
+
+ /** Variables holds the selected project @public */
+ public selectedProject: Observable<string>;
+
+ /** project @public */
+ public getSelectedProject: string;
+
+ /** Version holds packages version @public */
+ public PACKAGEVERSION: string;
+
+ /** Contains all methods related to shared @public */
+ public sharedService: SharedService;
+
+ /** Utilizes auth service for any auth operations @private */
+ private authService: AuthenticationService;
+
+ /** Holds all project details @private */
+ private projectService: ProjectService;
+
+ /** Utilizes modal service for any modal operations @private */
+ private modalService: NgbModal;
+
+ constructor(injector: Injector) {
+ this.injector = injector;
+ this.authService = this.injector.get(AuthenticationService);
+ this.modalService = this.injector.get(NgbModal);
+ this.projectService = this.injector.get(ProjectService);
+ this.sharedService = this.injector.get(SharedService);
+ }
+
+ /** Lifecyle Hooks the trigger before component is instantiate @public */
+ public ngOnInit(): void {
+ this.isAdmin = (localStorage.getItem('isAdmin') === 'true') ? true : false;
+ this.selectedProject = this.authService.ProjectName;
+ this.authService.ProjectName.subscribe((projectNameFinal: string) => {
+ this.getSelectedProject = projectNameFinal;
+ });
+ this.username$ = this.authService.username;
+ this.projectService.setHeaderProjects();
+ this.projectList$ = this.projectService.projectList;
+ this.PACKAGEVERSION = environment.packageVersion;
+ }
+
+ /** Logout function @public */
+ public logout(): void {
+ this.authService.logout();
+ }
+
+ /** Implementation of model for UserSettings options.@public */
+ public userSettings(): void {
+ this.modalService.open(UserSettingsComponent, { backdrop: 'static' });
+ }
+}
diff --git a/src/app/layouts/sidebar/SidebarComponent.html b/src/app/layouts/sidebar/SidebarComponent.html
new file mode 100644
index 0000000..1fa4f82
--- /dev/null
+++ b/src/app/layouts/sidebar/SidebarComponent.html
@@ -0,0 +1,52 @@
+<!--
+Copyright 2020 TATA ELXSI
+
+Licensed under the Apache License, Version 2.0 (the 'License');
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Author: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.in), BARATH KUMAR R (barath.r@tataelxsi.co.in)
+-->
+<div id="sidebar" class="p-2 sidebar-mini" [class.sidebar-collapse]="classAppliedForDesktop" [class.sidebar-open]="classAppliedForMobile">
+ <div class="custom-menu" (click)="sideBarOpenClose()">
+ <button type="button" id="sidebarCollapse" class="btn btn-primary">
+ <i class="fa fa-bars"></i>
+ </button>
+ </div>
+ <nav>
+ <ul class="scrollable-menu">
+ <li *ngFor="let menu of getMenus; let i = index" [ngClass]="{'hasChild': menu.isChildExists }"
+ class="{{menu.liClass}}" id="{{menu.clickFunction}}{{i}}"
+ (click)="handleMenuFunction(i, menu.clickFunction, 'menu-open', menu.isChildExists)"
+ [routerLinkActiveOptions]="{exact: menu.routerLinkActiveOptions !== undefined ? menu.routerLinkActiveOptions : false}"
+ [routerLinkActive]="menu.routerLinkActive !== undefined ? menu.routerLinkActive : ''">
+ <a *ngIf="menu.isChildExists" class="{{menu.anchorTagClass}}">
+ <i class="{{menu.icon}}"></i>
+ <span>{{ menu.menuName | translate}}</span>
+ </a>
+ <a *ngIf="!menu.isChildExists" class="{{menu.anchorTagClass}}" [routerLink]="menu.routerLink">
+ <i class="{{menu.icon}}"></i>
+ <span>{{ menu.menuName | translate}}</span>
+ </a>
+ <ul *ngIf="menu.isChildExists" class="{{menu.ulClass}}">
+ <li *ngFor="let childMenu of menu.childItems"
+ [routerLinkActiveOptions]="{exact: childMenu.routerLinkActiveOptions}"
+ [routerLinkActive]="childMenu.routerLinkActive" (click)="checkAndCloseSideBar(childMenu.isChildExists)">
+ <a class="{{childMenu.anchorTagClass}}" [routerLink]="childMenu.routerLink">
+ <i class="{{childMenu.icon}}"></i>
+ <span>{{childMenu.menuName | translate}}</span>
+ </a>
+ </li>
+ </ul>
+ </li>
+ </ul>
+ </nav>
+</div>
\ No newline at end of file
diff --git a/src/app/layouts/sidebar/SidebarComponent.scss b/src/app/layouts/sidebar/SidebarComponent.scss
new file mode 100644
index 0000000..7b5f92e
--- /dev/null
+++ b/src/app/layouts/sidebar/SidebarComponent.scss
@@ -0,0 +1,225 @@
+/*
+ Copyright 2020 TATA ELXSI
+
+ Licensed under the Apache License, Version 2.0 (the 'License');
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+ Author: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.in), BARATH KUMAR R (barath.r@tataelxsi.co.in)
+*/
+@import "../../../assets/scss/mixins/mixin";
+@import "../../../assets/scss/variable";
+$active-margin-left: -230;
+$minimize-left: 45px;
+.sidebar-mini {
+ @include transition(all, 0.3s, ease-in-out, 0s);
+ @include position_value(relative, null, null, null, null);
+ z-index: 10;
+ .custom-menu {
+ @include flexbox(inline-block, null, null, null, null, null);
+ @include position_value(absolute, 25px, 4px, null, null);
+ @include margin-value(0, -20, 0, 0);
+ .btn {
+ @include wh-value(55px, 55px);
+ @include roundedCornersPercentage(50%);
+ @include position_value(relative, null, null, null, null);
+ @include background(null, transparent, null, null, null);
+ @include border(all, 0, solid, transparent);
+ i {
+ @include margin-value(0, -40, 0, 0);
+ @include font(null, 14px, null);
+ }
+ &.btn-primary {
+ &:after {
+ content: "";
+ @include position_value(absolute, 0, 0, 0, 0);
+ @include background(null, $secondary, null, null, null);
+ @include roundedCorners(10);
+ @include rotate(45);
+ z-index: -1;
+ }
+ }
+ &:hover,
+ &:focus,
+ &:active {
+ @include background(null, transparent !important, null, null, null);
+ }
+ }
+ }
+ nav {
+ @include wh-value(200px, null);
+ @include transition(width, 0.2s, ease-in-out, 0s);
+ ul {
+ @include padding-value(0, 0, 0, 0);
+ @include margin-value(0, 0, 0, 0);
+ @include wh-value(100%, null);
+ @include background(null, $theme-bg-color, null, null, null);
+ li {
+ @include position_value(relative, null, null, null, null);
+ @include background(null, $secondary, null, null, null);
+ @include line-height(14px);
+ list-style-type: none;
+ cursor: pointer;
+ color: $white;
+ &.round-edge-top-3 {
+ @include roundedTopRightRadius(3);
+ @include roundedTopLeftRadius(3);
+ }
+ &.round-edge-bottom-3 {
+ @include roundedBottomLeftRadius(3);
+ @include roundedBottomRightRadius(3);
+ }
+ &.border-bottom-none {
+ @include border(bottom, 0, !important, null);
+ }
+ &.header-menu {
+ @include background(null, $theme-bg-color, null, null, null);
+ @include padding-value(10, 20, 0, 4);
+ @include font(null, null, bold);
+ cursor: default;
+ .heading {
+ @include border(bottom, 2, solid, $primary);
+ @include font(null, 12px, null);
+ @include line-height(16px);
+ @include flexbox(block, null, null, null, null, null);
+ cursor: default;
+ color: $primary;
+ }
+ }
+ a {
+ &.individual {
+ @include padding-value(12, 5, 12, 15);
+ color: $white;
+ }
+ i {
+ @include wh-value(30px, null);
+ }
+ &.parentlink::after {
+ content: "\f105";
+ @include font("Font Awesome 5 Free", null, 900);
+ @include position_value(absolute, 14px, 15px, null, null);
+ @include transition(all, 0.3s, ease, 0s);
+ -webkit-font-smoothing: antialiased;
+ -moz-osx-font-smoothing: grayscale;
+ }
+ }
+ .sidebar-submenu {
+ opacity: 0;
+ @include transition(opacity, 0.4s, ease-in-out, 0s);
+ li {
+ @include background(null, $secondary, null, null, null);
+ @include wh-value(null, 0);
+ @include transition(height, 200ms, ease-in, 0s);
+ overflow: hidden;
+ &:last-child {
+ @include roundedBottomLeftRadius(4);
+ @include roundedBottomRightRadius(4);
+ }
+ .link {
+ color: $gray-500;
+ }
+ &:hover,
+ &.active {
+ .link {
+ color: $white;
+ }
+ }
+ }
+ }
+ &.menu-open {
+ @include background(null, $primary, null, null, null);
+ a {
+ &::after {
+ @include rotate(90);
+ }
+ }
+ .sidebar-submenu {
+ opacity: 1;
+ li {
+ @include wh-value(null, 45px);
+ }
+ }
+ }
+ &.parentactive {
+ @include background(null, $primary, null, null, null);
+ .parentlink {
+ color: $white;
+ }
+ }
+ .parentlink,
+ .link {
+ @include padding-value(12, 5, 12, 15);
+ @include flexbox(flex, null, null, null, null, null);
+ }
+ }
+ }
+ }
+ &.sidebar-collapse {
+ @include background(null, transparent, null, null, null);
+ nav {
+ transform: translate(0, 0);
+ @include wh-value($minimize-left, null);
+ ul {
+ &.scrollable-menu {
+ li {
+ a {
+ span {
+ @include position_value(null, 0, null, null, null);
+ @include padding-value(12, 5, 12, 20);
+ }
+ &.individual {
+ span {
+ @include roundedBottomRightRadius(4);
+ }
+ }
+ &.parentlink,
+ &.individual {
+ span {
+ @include background(null, $primary, null, null, null);
+ @include roundedTopRightRadius(4);
+ }
+ }
+ }
+ &:hover {
+ .sidebar-submenu {
+ li {
+ @include wh-value(null, 45px);
+ }
+ }
+ .sidebar-submenu,
+ a span {
+ @include flexbox(block !important, null, null, null, null, null);
+ @include position_value(absolute, null, null, null, $minimize-left);
+ @include wh-value(220px, null);
+ opacity: 1;
+ }
+ }
+ &.header-menu,
+ .sidebar-submenu {
+ @include flexbox(none !important, null, null, null, null, null);
+ transform: translateZ(0);
+ }
+ }
+ }
+ li {
+ a::after,
+ span {
+ @include flexbox(none !important, null, null, null, null, null);
+ transform: translateZ(0);
+ }
+ }
+ }
+ }
+ }
+ &.sidebar-open {
+ @include margin-value(0, 0, 0, $active-margin-left);
+ }
+}
\ No newline at end of file
diff --git a/src/app/layouts/sidebar/SidebarComponent.ts b/src/app/layouts/sidebar/SidebarComponent.ts
new file mode 100644
index 0000000..9cae634
--- /dev/null
+++ b/src/app/layouts/sidebar/SidebarComponent.ts
@@ -0,0 +1,148 @@
+/*
+ Copyright 2020 TATA ELXSI
+
+ Licensed under the Apache License, Version 2.0 (the 'License');
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+ Author: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.in), BARATH KUMAR R (barath.r@tataelxsi.co.in)
+*/
+
+/**
+ * @file Sidebar Component
+ */
+import { Component, Injector, OnInit } from '@angular/core';
+import { DeviceCheckService } from 'DeviceCheckService';
+import { MENU_ITEMS, MENUITEMS } from 'src/models/MenuModel';
+import { isNullOrUndefined } from 'util';
+
+/**
+ * Creating component
+ * @Component takes SidebarComponent.html as template url
+ */
+@Component({
+ selector: 'app-sidebar',
+ templateUrl: './SidebarComponent.html',
+ styleUrls: ['./SidebarComponent.scss']
+})
+/** Exporting a class @exports SidebarComponent */
+export class SidebarComponent implements OnInit {
+ /** To inject services @public */
+ public injector: Injector;
+
+ /** submenu router endpoints @public */
+ public routerEndpoint: string;
+
+ /** submenu router endpoints @public */
+ public getMenus: MENUITEMS[];
+
+ /** selected Menu @public */
+ public selectedItem: string;
+
+ /** get the classlist @public */
+ public elementCheck: HTMLCollection;
+
+ /** Apply active class for Desktop @public */
+ public classAppliedForDesktop: boolean = false;
+
+ /** Apply active class for mobile @public */
+ public classAppliedForMobile: boolean = false;
+
+ /** Device Check service @public */
+ public deviceCheckService: DeviceCheckService;
+
+ /** Check for the mobile @public */
+ public isMobile$: boolean;
+
+ constructor(injector: Injector) {
+ this.injector = injector;
+ this.deviceCheckService = this.injector.get(DeviceCheckService);
+ this.getMenus = MENU_ITEMS;
+ }
+
+ /** Lifecyle Hooks the trigger before component is instantiate @public */
+ public ngOnInit(): void {
+ this.deviceCheckService.checkDeviceType();
+ this.deviceCheckService.isMobile.subscribe((checkIsMobile: boolean) => {
+ this.isMobile$ = checkIsMobile;
+ this.getDeviceType();
+ });
+ }
+ /** method to open sideBarOpen in all the views */
+ public sideBarOpenClose(): void {
+ if (this.isMobile$) {
+ this.classAppliedForMobile = !this.classAppliedForMobile;
+ } else {
+ this.classAppliedForDesktop = !this.classAppliedForDesktop;
+ }
+ this.addClassMainWrapper();
+ }
+ /** Add class for mobile/Desktop in main-wrapper @public */
+ public addClassMainWrapper(): void {
+ const elementMain: HTMLElement = document.querySelector('#main-wrapper');
+ if (!isNullOrUndefined(elementMain)) {
+ if (this.isMobile$) {
+ elementMain.classList.toggle('sidebar-mobile');
+ } else {
+ elementMain.classList.toggle('sidebar-desktop');
+ }
+ }
+ }
+ /** Return the Device type @public */
+ public getDeviceType(): void {
+ if (this.isMobile$) {
+ this.classAppliedForMobile = true;
+ this.classAppliedForDesktop = false;
+ } else {
+ this.classAppliedForMobile = false;
+ this.classAppliedForDesktop = false;
+ }
+ this.addClassMainWrapper();
+ }
+ /** Set the SideBar Menus click function @public */
+ public handleMenuFunction(index: number, method: string, className: string, childExists: boolean): void {
+ this.selectedItem = method;
+ if (!isNullOrUndefined(method)) {
+ this.parentactiveClassAddRemove(index, method, className, childExists);
+ }
+ }
+ /** Removing the parentactive class which is already present and add it to current @public */
+ public parentactiveClassAddRemove(index: number, method: string, className: string, childExists: boolean): void {
+ const element: HTMLElement = document.querySelector('#' + method + '' + index);
+ const checkOpenedelement: boolean = element.classList.contains(className);
+ if (!checkOpenedelement) {
+ this.elementCheck = document.getElementsByClassName(className);
+ if (this.elementCheck.length > 0) {
+ this.removeClasses(className);
+ }
+ }
+ if (method !== 'nosubmenu') {
+ element.classList.toggle(className);
+ }
+ if (this.isMobile$ && !childExists) {
+ this.checkAndCloseSideBar(childExists);
+ }
+ }
+ /** Hide / Show Menus based on the clicking in the menus @public */
+ public checkAndCloseSideBar(childExists: boolean): void {
+ event.stopPropagation();
+ if (this.isMobile$ && !childExists) {
+ this.sideBarOpenClose();
+ }
+ }
+ /** remove existing Class @public */
+ public removeClasses(className: string): void {
+ this.elementCheck[0].classList.remove(className);
+ if (this.elementCheck[0]) {
+ this.removeClasses(className);
+ }
+ }
+}