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/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' });
+ }
+}