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