From cedffeca6ea3cabc282b753c62a849ca273dfb42 Mon Sep 17 00:00:00 2001 From: bravof Date: Wed, 5 May 2021 16:50:46 -0400 Subject: [PATCH] bug(chartjs/zonejs): dependency conflict while creating new container Change-Id: I86db7b06a315581bc792a17a3ad81334e5d290d1 Signed-off-by: bravof --- .dockerignore | 24 +++++++++++++++++ .gitignore | 1 + docker/Dockerfile | 6 +++-- package.json | 6 ++--- src/app/dashboard/DashboardComponent.ts | 35 ++++++++++--------------- src/polyfills.ts | 2 +- src/tsconfig.app.json | 2 +- tsconfig.json | 3 +++ 8 files changed, 51 insertions(+), 28 deletions(-) create mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..3abfee1 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- + +# Copyright 2021 Whitestack, LLC +# ************************************************************* + +# This file is part of OSM Monitoring module +# All Rights Reserved to Whitestack, LLC + +# 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. +# For those usages not covered by the Apache License, Version 2.0 please +# contact: fbravo@whitestack.com +## + +node_modules \ No newline at end of file diff --git a/.gitignore b/.gitignore index 9a88115..3ff03e0 100644 --- a/.gitignore +++ b/.gitignore @@ -24,6 +24,7 @@ # dependencies /node_modules package-lock.json +yarn.lock # profiling files chrome-profiler-events.json diff --git a/docker/Dockerfile b/docker/Dockerfile index f89dec2..c554f50 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -25,19 +25,21 @@ RUN apt-get update && apt-get install -y curl xz-utils gnupg2 \ && apt-get update && apt-get install -y nodejs \ && apt-get install -y nginx +RUN npm install -g yarn + # Preparing working environment. RUN mkdir -p /usr/src/osm-angularapp WORKDIR /usr/src/osm-angularapp # Installing dependencies. COPY ./package.json /usr/src/osm-angularapp/ -RUN npm install +RUN yarn install # Copy osm-angularapp source into image. COPY ./ /usr/src/osm-angularapp # Building app. -RUN npm run build +RUN yarn build # Removing nginx default page. RUN rm -rf /usr/share/nginx/html/* diff --git a/package.json b/package.json index 798656e..ca23253 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,7 @@ "@types/ol": "^5.3.5", "angular-notifier": "^6.0.1", "bootstrap": "^4.4.1", - "chart.js": "^2.8.0", + "chart.js": "^3.2.1", "codemirror": "^5.51.0", "core-js": "^2.5.4", "d3": "^5.9.2", @@ -59,7 +59,7 @@ "stream": "0.0.2", "tslib": "^2.0.0", "web-animations-js": "^2.3.2", - "zone.js": "~0.10.3" + "zone.js": "~0.10.0" }, "devDependencies": { "@angular-devkit/build-angular": "^0.1100.2", @@ -79,7 +79,7 @@ "karma-jasmine": "~4.0.0", "karma-jasmine-html-reporter": "^1.5.0", "ng2-completer": "^3.0.3", - "node-sass": "^4.14.1", + "node-sass": "^5.0.0", "protractor": "~7.0.0", "ts-node": "~7.0.0", "tslint": "~6.1.0", diff --git a/src/app/dashboard/DashboardComponent.ts b/src/app/dashboard/DashboardComponent.ts index 56b79a4..4660732 100644 --- a/src/app/dashboard/DashboardComponent.ts +++ b/src/app/dashboard/DashboardComponent.ts @@ -21,7 +21,7 @@ import { Component, Injector, OnInit } from '@angular/core'; import { TranslateService } from '@ngx-translate/core'; import { AuthenticationService } from 'AuthenticationService'; -import { Chart } from 'chart.js'; +import { ActiveElement, Chart, ChartEvent } from 'chart.js'; import { ERRORDATA } from 'CommonModel'; import { environment } from 'environment'; import { NSDDetails } from 'NSDModel'; @@ -303,36 +303,29 @@ export class DashboardComponent implements OnInit { data: this.noOfHours, label: this.translateService.instant('NOOFHOURS'), borderColor: this.backgroundColor, - fill: false, backgroundColor: this.backgroundColor }] }, options: { - hover: { - onHover(evt: Event, item: {}): void { - const el: HTMLElement = document.getElementById('canvas'); - el.style.cursor = item[0] ? 'pointer' : 'default'; - } + onHover: (evt: ChartEvent, elements):void => { + const el: HTMLElement = document.getElementById('canvas'); + el.style.cursor = elements[0] ? 'pointer' : 'default'; + }, + plugins: { + legend: { display: false }, }, - legend: { display: false }, scales: { - xAxes: [{ + x: { display: true, - scaleLabel: { - display: true, - labelString: this.translateService.instant('INSTANCES') - } - }], - yAxes: [{ + labels: [this.translateService.instant('INSTANCES')], + }, + y: { ticks: { - beginAtZero: true + labelOffset: 0, }, display: true, - scaleLabel: { - display: true, - labelString: this.translateService.instant('NOOFHOURS') - } - }] + labels: [this.translateService.instant('NOOFHOURS')] + }, } } }); diff --git a/src/polyfills.ts b/src/polyfills.ts index 5167690..9d349d1 100644 --- a/src/polyfills.ts +++ b/src/polyfills.ts @@ -77,7 +77,7 @@ import 'web-animations-js'; // Run `npm install --save web-animations-js`. /*************************************************************************************************** * Zone JS is required by default for Angular itself. */ -import 'zone.js/dist/zone'; // Included with Angular CLI. +import 'zone.js'; // Included with Angular CLI. /*************************************************************************************************** * APPLICATION IMPORTS diff --git a/src/tsconfig.app.json b/src/tsconfig.app.json index 384c218..e4f7c71 100644 --- a/src/tsconfig.app.json +++ b/src/tsconfig.app.json @@ -2,7 +2,7 @@ "extends": "../tsconfig.json", "compilerOptions": { "outDir": "../out-tsc/app", - "types": [] + "types": ["node"] }, "exclude": [ "test.ts", diff --git a/tsconfig.json b/tsconfig.json index 4ca53c1..6397742 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -13,6 +13,9 @@ "experimentalDecorators": true, "importHelpers": true, "target": "es5", + "types": [ + "node" + ], "typeRoots": [ "node_modules/@types" ], -- 2.25.1