diff --git a/angular.json b/angular.json index b6483a046..8da15540b 100644 --- a/angular.json +++ b/angular.json @@ -24,9 +24,10 @@ "app/" ], "styles": [ - "app/app.css" + "app/app.css", + "node_modules/bootstrap/dist/css/bootstrap.min.css" ], - "scripts": [] + "scripts": ["node_modules/mathjax/es5/tex-mml-chtml.js"] }, "configurations": { "production": { @@ -89,9 +90,10 @@ "app/favicon.ico" ], "styles": [ - "app/app.css" + "app/app.css", + "node_modules/bootstrap/dist/css/bootstrap.min.css" ], - "scripts": [] + "scripts": ["node_modules/mathjax/es5/tex-mml-chtml.js"] } } } diff --git a/app/app-upgraded-providers.js b/app/app-upgraded-providers.js new file mode 100644 index 000000000..af96cf9e4 --- /dev/null +++ b/app/app-upgraded-providers.js @@ -0,0 +1,130 @@ +export function kommonitorCacheHelperServiceFactory(injector) { + return injector.get('kommonitorCacheHelperService'); +} +export const ajskommonitorCacheHelperServiceProvider = { + deps: ['$injector'], + provide: 'kommonitorCacheHelperService', + useFactory: kommonitorCacheHelperServiceFactory, +}; +export function kommonitorBatchUpdateHelperServiceFactory(injector) { + return injector.get('kommonitorBatchUpdateHelperService'); +} +export const ajskommonitorBatchUpdateHelperServiceProvider = { + deps: ['$injector'], + provide: 'kommonitorBatchUpdateHelperService', + useFactory: kommonitorBatchUpdateHelperServiceFactory, +}; +export function kommonitorConfigStorageServiceFactory(injector) { + return injector.get('kommonitorConfigStorageService'); +} +export const ajskommonitorConfigStorageServiceProvider = { + deps: ['$injector'], + provide: 'kommonitorConfigStorageService', + useFactory: kommonitorConfigStorageServiceFactory, +}; +//data exchange +export function kommonitorDataExchangeServiceFactory(injector) { + return injector.get('kommonitorDataExchangeService'); +} +export const ajskommonitorDataExchangeServiceeProvider = { + deps: ['$injector'], + provide: 'kommonitorDataExchangeService', + useFactory: kommonitorDataExchangeServiceFactory, +}; +//data grid helper +export function kommonitorDataGridHelperServiceFactory(injector) { + return injector.get('kommonitorDataGridHelperService'); +} +export const ajskommonitorDataGridHelperServiceProvider = { + deps: ['$injector'], + provide: 'kommonitorDataGridHelperService', + useFactory: kommonitorDataGridHelperServiceFactory, +}; +//diagram helper +export function kommonitorDiagramHelperServiceFactory(injector) { + return injector.get('kommonitorDiagramHelperService'); +} +export const ajskommonitorDiagramHelperServiceProvider = { + deps: ['$injector'], + provide: 'kommonitorDiagramHelperService', + useFactory: kommonitorDiagramHelperServiceFactory, +}; +//filter helper +export function kommonitorFilterHelperServiceFactory(injector) { + return injector.get('kommonitorFilterHelperService'); +} +export const ajskommonitorFilterHelperServiceProvider = { + deps: ['$injector'], + provide: 'kommonitorFilterHelperService', + useFactory: kommonitorFilterHelperServiceFactory, +}; +//keycloack helper +export function kommonitorKeycloackHelperServiceFactory(injector) { + return injector.get('kommonitorKeycloackHelperService'); +} +export const ajskommonitorKeycloackHelperServiceProvider = { + deps: ['$injector'], + provide: 'kommonitorKeycloackHelperService', + useFactory: kommonitorKeycloackHelperServiceFactory, +}; +//multistep form +export function kommonitorMultiStepFormHelperServiceFactory(injector) { + return injector.get('kommonitorMultiStepFormHelperService'); +} +export const ajskommonitorMultiStepFormHelperServiceProvider = { + deps: ['$injector'], + provide: 'kommonitorMultiStepFormHelperService', + useFactory: kommonitorMultiStepFormHelperServiceFactory, +}; +//script helpet +export function kommonitorScriptHelperServiceFactory(injector) { + return injector.get('kommonitorScriptHelperService'); +} +export const ajskommonitorScriptHelperServiceProvider = { + deps: ['$injector'], + provide: 'kommonitorScriptHelperService', + useFactory: kommonitorScriptHelperServiceFactory, +}; +//share Helper +export function kommonitorShareHelperServiceFactory(injector) { + return injector.get('kommonitorShareHelperService'); +} +export const ajskommonitorShareHelperServiceProvider = { + deps: ['$injector'], + provide: 'kommonitorShareHelperService', + useFactory: kommonitorShareHelperServiceFactory, +}; +//single feature map helper +export function kommonitorSingleFeatureMapServiceFactory(injector) { + return injector.get('kommonitorSingleFeatureMapService'); +} +export const ajskommonitorSingleFeatureMapServiceProvider = { + deps: ['$injector'], + provide: 'kommonitorSingleFeatureMapService', + useFactory: kommonitorSingleFeatureMapServiceFactory, +}; +//visually style helper +export function kommonitorVisualStyleHelperServiceFactory(injector) { + return injector.get('kommonitorVisualStyleHelperService'); +} +export const ajskommonitorVisualStyleHelperServiceProvider = { + deps: ['$injector'], + provide: 'kommonitorVisualStyleHelperService', + useFactory: kommonitorVisualStyleHelperServiceFactory, +}; +export const serviceProviders = [ + ajskommonitorCacheHelperServiceProvider, + ajskommonitorBatchUpdateHelperServiceProvider, + ajskommonitorConfigStorageServiceProvider, + ajskommonitorDataExchangeServiceeProvider, + ajskommonitorDataGridHelperServiceProvider, + ajskommonitorDiagramHelperServiceProvider, + ajskommonitorFilterHelperServiceProvider, + ajskommonitorKeycloackHelperServiceProvider, + ajskommonitorMultiStepFormHelperServiceProvider, + ajskommonitorScriptHelperServiceProvider, + ajskommonitorShareHelperServiceProvider, + ajskommonitorSingleFeatureMapServiceProvider, + ajskommonitorVisualStyleHelperServiceProvider +]; +//# sourceMappingURL=app-upgraded-providers.js.map \ No newline at end of file diff --git a/app/app-upgraded-providers.js.map b/app/app-upgraded-providers.js.map new file mode 100644 index 000000000..2bada0d1b --- /dev/null +++ b/app/app-upgraded-providers.js.map @@ -0,0 +1 @@ +{"version":3,"file":"app-upgraded-providers.js","sourceRoot":"","sources":["app-upgraded-providers.ts"],"names":[],"mappings":"AAiBA,MAAM,UAAU,mCAAmC,CAAC,QAAY;IAC5D,OAAO,QAAQ,CAAC,GAAG,CAAC,8BAA8B,CAAC,CAAC;AACxD,CAAC;AACD,MAAM,CAAC,MAAM,uCAAuC,GAAQ;IACxD,IAAI,EAAE,CAAC,WAAW,CAAC;IACnB,OAAO,EAAE,8BAA8B;IACvC,UAAU,EAAC,mCAAmC;CAC/C,CAAC;AAGJ,MAAM,UAAU,yCAAyC,CAAE,QAAY;IACnE,OAAO,QAAQ,CAAC,GAAG,CAAC,oCAAoC,CAAC,CAAA;AAC7D,CAAC;AAED,MAAM,CAAC,MAAM,6CAA6C,GAAQ;IAC9D,IAAI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,MAAM,UAAU,wCAAwC,CAAE,QAAY;IAClE,OAAO,QAAQ,CAAC,GAAG,CAAC,mCAAmC,CAAC,CAAA;AAC5D,CAAC;AAED,MAAM,CAAC,MAAM,4CAA4C,GAAQ;IAC7D,IAAI,EAAE,CAAC,WAAW,CAAC;IACnB,OAAO,EAAE,mCAAmC;IAC5C,UAAU,EAAC,wCAAwC;CACpD,CAAC;AAIJ,uBAAuB;AAEvB,MAAM,UAAU,yCAAyC,CAAE,QAAY;IACnE,OAAO,QAAQ,CAAC,GAAG,CAAC,oCAAoC,CAAC,CAAA;AAC7D,CAAC;AAED,MAAM,CAAC,MAAM,6CAA6C,GAAQ;IAC9D,IAAI,EAAE,CAAC,WAAW,CAAC;IACnB,OAAO,EAAE,oCAAoC;IAC7C,UAAU,EAAC,yCAAyC;CACrD,CAAC;AAQF,MAAM,CAAC,MAAM,gBAAgB,GAAU;IACrC,uCAAuC;IACxC,6CAA6C;IAC5C,yCAAyC;IACzC,yCAAyC;IACzC,0CAA0C;IAC1C,yCAAyC;IACzC,wCAAwC;IAC5C,2CAA2C;IAC3C,+CAA+C;IAC/C,wCAAwC;IACxC,uCAAuC;IACvC,4CAA4C;IAC5C,6CAA6C;CAC1C,CAAC"} \ No newline at end of file diff --git a/app/app-upgraded-providers.ts b/app/app-upgraded-providers.ts new file mode 100644 index 000000000..025d6c4f0 --- /dev/null +++ b/app/app-upgraded-providers.ts @@ -0,0 +1,178 @@ +import { Injector, Injectable } from '@angular/core'; +import { KommonitorElementVisibilityHelperService } from "util/genericServices/kommonitorElementVisibilityHelperService/kommonitor-element-visibility-helper-service.service"; +import { kommonitorCacheHelperService } from 'util/genericServices/kommonitorCacheHelperService/kommonitor-cache-helper-service.module'; +import {kommonitorBatchUpdateHelperService} from 'util/genericServices/kommonitorBatchUpdateHelperService/kommonitor-batch-update-helper-service.module'; +import {kommonitorConfigStorageService} from 'util/genericServices/kommonitorConfigStorageService/kommonitor-config-storage-service.module'; +import {kommonitorDataExchangeService} from 'util/genericServices/kommonitorDataExchangeService/kommonitor-data-exchange-service.module'; +import {kommonitorDataGridHelperService} from 'util/genericServices/kommonitorDataGridHelperService/kommonitor-data-grid-helper-service.module'; +import {kommonitorDiagramHelperService} from 'util/genericServices/kommonitorDiagramHelperService/kommonitor-diagram-helper-service.module'; +import {kommonitorFilterHelperService} from 'util/genericServices/kommonitorFilterHelperService/kommonitor-filter-helper-service.module'; +import {kommonitorImporterHelperService} from 'util/genericServices/kommonitorImporterHelperService/kommonitor-importer-helper-service.module'; +import {kommonitorKeycloackHelperService} from 'util/genericServices/kommonitorKeycloakHelperService/kommonitor-keycloak-helper-service.module' +import {kommonitorMultistepFormHelperService} from 'util/genericServices/kommonitorMultiStepFormHelperService/kommonitor-multi-step-form-helper-service.module' +import {kommonitorScriptHelperService} from'util/genericServices/kommonitorScriptHelperService/kommonitor-script-helper-service.module'; +import {kommonitorShareHelperService} from 'util/genericServices/kommonitorShareHelperService/kommonitor-share-helper-service.module' +import {kommonitorSingleFeatureMapHelperService} from 'util/genericServices/kommonitorSingleFeatureMapHelperService/kommonitor-single-feature-map-helper-service.module' +import {kommonitorVisualStyleHelperService} from 'util/genericServices/kommonitorVisualStyleHelperService/kommonitor-visual-style-helper-service.module' + +export function kommonitorCacheHelperServiceFactory(injector:any){ + return injector.get('kommonitorCacheHelperService'); +} +export const ajskommonitorCacheHelperServiceProvider: any = { + deps: ['$injector'], + provide: 'kommonitorCacheHelperService', + useFactory:kommonitorCacheHelperServiceFactory , + }; + + +export function kommonitorBatchUpdateHelperServiceFactory (injector:any){ + return injector.get('kommonitorBatchUpdateHelperService') +} + +export const ajskommonitorBatchUpdateHelperServiceProvider: any = { + deps: ['$injector'], + provide: 'kommonitorBatchUpdateHelperService', + useFactory:kommonitorBatchUpdateHelperServiceFactory , + }; + + export function kommonitorConfigStorageServiceFactory (injector:any){ + return injector.get('kommonitorConfigStorageService') +} + +export const ajskommonitorConfigStorageServiceProvider: any = { + deps: ['$injector'], + provide: 'kommonitorConfigStorageService', + useFactory:kommonitorConfigStorageServiceFactory, + }; +//data exchange + export function kommonitorDataExchangeServiceFactory (injector:any){ + return injector.get('kommonitorDataExchangeService') +} + +export const ajskommonitorDataExchangeServiceeProvider: any = { + deps: ['$injector'], + provide: 'kommonitorDataExchangeService', + useFactory:kommonitorDataExchangeServiceFactory, + }; +//data grid helper + export function kommonitorDataGridHelperServiceFactory (injector:any){ + return injector.get('kommonitorDataGridHelperService') +} + +export const ajskommonitorDataGridHelperServiceProvider: any = { + deps: ['$injector'], + provide: 'kommonitorDataGridHelperService', + useFactory:kommonitorDataGridHelperServiceFactory, + }; +//diagram helper + export function kommonitorDiagramHelperServiceFactory (injector:any){ + return injector.get('kommonitorDiagramHelperService') +} + +export const ajskommonitorDiagramHelperServiceProvider: any = { + deps: ['$injector'], + provide: 'kommonitorDiagramHelperService', + useFactory:kommonitorDiagramHelperServiceFactory, + }; + + //filter helper + export function kommonitorFilterHelperServiceFactory (injector:any){ + return injector.get('kommonitorFilterHelperService') +} + +export const ajskommonitorFilterHelperServiceProvider: any = { + deps: ['$injector'], + provide: 'kommonitorFilterHelperService', + useFactory:kommonitorFilterHelperServiceFactory, + }; + +//keycloack helper + export function kommonitorKeycloackHelperServiceFactory (injector:any){ + return injector.get('kommonitorKeycloackHelperService') +} + +export const ajskommonitorKeycloackHelperServiceProvider: any = { + deps: ['$injector'], + provide: 'kommonitorKeycloackHelperService', + useFactory:kommonitorKeycloackHelperServiceFactory, + }; + + //multistep form + export function kommonitorMultiStepFormHelperServiceFactory (injector:any){ + return injector.get('kommonitorMultiStepFormHelperService') +} + +export const ajskommonitorMultiStepFormHelperServiceProvider: any = { + deps: ['$injector'], + provide: 'kommonitorMultiStepFormHelperService', + useFactory:kommonitorMultiStepFormHelperServiceFactory, + }; + +//script helpet + +export function kommonitorScriptHelperServiceFactory (injector:any){ + return injector.get('kommonitorScriptHelperService') +} + +export const ajskommonitorScriptHelperServiceProvider: any = { + deps: ['$injector'], + provide: 'kommonitorScriptHelperService', + useFactory:kommonitorScriptHelperServiceFactory, + }; +//share Helper +export function kommonitorShareHelperServiceFactory (injector:any){ + return injector.get('kommonitorShareHelperService') +} + +export const ajskommonitorShareHelperServiceProvider: any = { + deps: ['$injector'], + provide: 'kommonitorShareHelperService', + useFactory:kommonitorShareHelperServiceFactory, + }; + +//single feature map helper +export function kommonitorSingleFeatureMapServiceFactory (injector:any){ + return injector.get('kommonitorSingleFeatureMapService') +} + +export const ajskommonitorSingleFeatureMapServiceProvider: any = { + deps: ['$injector'], + provide: 'kommonitorSingleFeatureMapService', + useFactory:kommonitorSingleFeatureMapServiceFactory, + }; + + + +//visually style helper + +export function kommonitorVisualStyleHelperServiceFactory (injector:any){ + return injector.get('kommonitorVisualStyleHelperService') +} + +export const ajskommonitorVisualStyleHelperServiceProvider: any = { + deps: ['$injector'], + provide: 'kommonitorVisualStyleHelperService', + useFactory:kommonitorVisualStyleHelperServiceFactory, + }; + + + + + + + + export const serviceProviders: any[] = [ + ajskommonitorCacheHelperServiceProvider, + ajskommonitorBatchUpdateHelperServiceProvider, + ajskommonitorConfigStorageServiceProvider, + ajskommonitorDataExchangeServiceeProvider, + ajskommonitorDataGridHelperServiceProvider, + ajskommonitorDiagramHelperServiceProvider, + ajskommonitorFilterHelperServiceProvider, +ajskommonitorKeycloackHelperServiceProvider, +ajskommonitorMultiStepFormHelperServiceProvider, +ajskommonitorScriptHelperServiceProvider, +ajskommonitorShareHelperServiceProvider, +ajskommonitorSingleFeatureMapServiceProvider, +ajskommonitorVisualStyleHelperServiceProvider + ]; diff --git a/app/app.module.js b/app/app.module.js new file mode 100644 index 000000000..8ce767982 --- /dev/null +++ b/app/app.module.js @@ -0,0 +1,453 @@ +import { __decorate } from "tslib"; +import { NgModule } from '@angular/core'; +import { BrowserModule } from '@angular/platform-browser'; +import { UpgradeModule } from '@angular/upgrade/static'; +import { downgradeComponent } from '@angular/upgrade/static'; +import * as $ from 'jquery'; +import Keycloak from 'keycloak-js'; +import angular from "angular"; +import { RouterModule } from '@angular/router'; +import { HashLocationStrategy, LocationStrategy } from '@angular/common'; +import { NgxEchartsModule } from 'ngx-echarts'; +import { EchartsxModule } from 'echarts-for-angular'; +import { InfoModalComponent } from 'components/kommonitorUserInterface/kommonitorControls/infoModal/info-modal.component'; +import { VersionInfoComponent } from 'components/kommonitorUserInterface/kommonitorControls/versionInfo/version-info.component'; +import { KommonitorDiagramsComponent } from 'components/kommonitorUserInterface/kommonitorControls/kommonitorDiagrams/kommonitor-diagrams.component'; +// import { InfoModalModule } from 'components/kommonitorUserInterface/kommonitorControls/infoModal/info-modal.module'; +// import { VersionInfoModule } from 'components/kommonitorUserInterface/kommonitorControls/versionInfo/version-info.module'; +import { ajskommonitorCacheHelperServiceProvider, ajskommonitorBatchUpdateHelperServiceProvider, ajskommonitorConfigStorageServiceProvider, ajskommonitorDataExchangeServiceeProvider, ajskommonitorDataGridHelperServiceProvider, ajskommonitorDiagramHelperServiceProvider, ajskommonitorFilterHelperServiceProvider, ajskommonitorKeycloackHelperServiceProvider, ajskommonitorMultiStepFormHelperServiceProvider, ajskommonitorSingleFeatureMapServiceProvider } from 'app-upgraded-providers'; +// currently the AngularJS routing is still used as part of kommonitorClient module +const routes = []; +export let AppModule = class AppModule { + constructor(upgrade) { + this.upgrade = upgrade; + this.env = {}; + } + async ngDoBootstrap() { + this.checkBrowser(); + await this.loadConfigs(); + // instantiate env variable + this.env = window.__env || {}; + this.downgradeDependencies(); + // initialize kommonitorClient module + await this.initKomMonitorClientModule(); + // init keycloak authentication + await this.initKeycloak(); + this.upgrade.bootstrap(document.documentElement, ['kommonitorClient']); + // setUpLocationSync(this.upgrade); + } + downgradeDependencies() { + // to inject already upgraded KomMonitor Angular components into "old" AngluarJS components, we must do 2 things + // 1. downgrade the new Angular component and register it as directive within each requiring AngularJS module/component + // --> this especially means all components, where the downgraded component is used within the HTML part as directive + // 2. in order to prevent no module errors we must remove the old module reference within the .module file of the AngularJS modules/components + angular.module('kommonitorUserInterface') + .directive('infoModal', downgradeComponent({ component: InfoModalComponent })); + angular.module('kommonitorUserInterface') + .directive('versionInfo', downgradeComponent({ component: VersionInfoComponent })); + angular.module('kommonitorUserInterface') + .directive('kommonitor-diagrams', downgradeComponent({ component: KommonitorDiagramsComponent })); + console.log("registered downgraded Angular components for AngularJS usage"); + } + checkBrowser() { + if (/MSIE 9/i.test(navigator.userAgent) || /MSIE 10/i.test(navigator.userAgent) || /rv:11.0/i.test(navigator.userAgent)) { + // This is internet explorer 9, 10 or 11 + window.alert('Internet Explorer erkannt. Für eine optimale Nutzung von KomMonitor nutzen Sie nach Möglichkeit die Browser Firefox oder Chrome.'); + } + if (/Edge\/\d./i.test(navigator.userAgent)) { + // This is Microsoft Edge + window.alert('Microsoft Edge erkannt. Für eine optimale Nutzung von KomMonitor nutzen Sie nach Möglichkeit die Browser Firefox oder Chrome.'); + } + } + async loadConfigs() { + console.log("start loading required config files"); + let self = this; + await $.when(this.ajaxCall_keycloakConfig_localBackup(window.__env.configStorageServerConfig), this.ajaxCall_controlsConfig_localBackup(window.__env.configStorageServerConfig)).then(async function (ajax1Results, ajax2Results) { + console.log("local backup configs have been loaded in case config server is not reachable."); + await self.ajaxCall_configServerFile(); + }, async function () { + // on fail + console.log("all configs have been loaded - at least some from local backup values. See console log for details"); + await self.ajaxCall_configServerFile(); + }); + } + ; + /* + LOAD CONFIG FILES FROM CONFIG STORAGE SERVER + */ + ajaxCall_keycloakConfig(configStorageServerConfig) { + console.log("try to fetch keycloak config file"); + return $.ajax({ + url: configStorageServerConfig.targetUrlToConfigStorageServer_keycloakConfig, + success: function (result) { + console.log("keycloak config file fetched"); + window.__env.keycloakConfig = result; + return; + }, + error: function (XMLHttpRequest, textStatus, errorThrown) { + console.log("Use keycloak.json local backup default values"); + } + }); + } + ajaxCall_appConfig(configStorageServerConfig) { + console.log("try to fetch app config file"); + return $.ajax({ + url: configStorageServerConfig.targetUrlToConfigStorageServer_appConfig, + success: function (result) { + console.log("app config file fetched"); + window.__env.appConfig = result; + return; + }, + error: function (XMLHttpRequest, textStatus, errorThrown) { + console.log("Use env.js local backup default values"); + } + }); + } + ajaxCall_controlsConfig(configStorageServerConfig) { + console.log("try to fetch controls config file"); + return $.ajax({ + url: configStorageServerConfig.targetUrlToConfigStorageServer_controlsConfig, + success: function (result) { + console.log("controls config file fetched"); + window.__env.controlsConfig = result; + return; + }, + error: function (XMLHttpRequest, textStatus, errorThrown) { + console.log("Use controls-config.json local backup default values that has no widget restrictions."); + } + }); + } + /* + LOAD CONFIG FILES FROM LOCAL BACKUP FILES + */ + ajaxCall_keycloakConfig_localBackup(configStorageServerConfig) { + return $.ajax({ + url: "./config/keycloak_backup.json", + success: function (result) { + console.log("local keycloak config file with default values fetched"); + window.__env.keycloakConfig = result; + return; + }, + error: function (XMLHttpRequest, textStatus, errorThrown) { + console.log("Error parsing local keycloak.json backup file"); + } + }); + } + ajaxCall_controlsConfig_localBackup(configStorageServerConfig) { + return $.ajax({ + url: "./config/controls-config_backup.json", + success: function (result) { + console.log("local controls-config file with default values fetched"); + window.__env.controlsConfig = result; + return; + }, + error: function (XMLHttpRequest, textStatus, errorThrown) { + console.log("Error parsing local controlsConfig.json backup file"); + } + }); + } + loadAppConfigScriptDynamically(scriptUrl) { + return new Promise(function (res, rej) { + let script = document.createElement('script'); + script.src = scriptUrl; + script.type = 'text/javascript'; + script.onerror = rej; + script.async = true; + script.onload = res; + script.addEventListener('error', rej); + script.addEventListener('load', res); + document.head.appendChild(script); + }); + } + initEnvVariables() { + // Import variables if present (from env.js) + if (window) { + Object.assign(this.env, window.__env); + } + if (!this.env.enableDebug) { + if (window) { + window.console.log = function () { }; + } + } + } + ajaxCall_configServerFile() { + let self = this; + return $.ajax({ + url: "./config/config-storage-server.json", + success: function (result) { + window.__env = window.__env || {}; + window.__env.configStorageServerConfig = result; + // inject script tag dynamically to DOM to load ENV variables + console.log("dynamically load env.js"); + const event = self.loadAppConfigScriptDynamically(window.__env.configStorageServerConfig.targetUrlToConfigStorageServer_appConfig) + .then(() => { console.log("loaded"); }) + .catch(() => { + console.log("Error while loading app config from client config storage server. Will use defaults instead"); + alert("Error while loading app config from client config storage server. Will use defaults instead."); + }); + return $.when(self.ajaxCall_keycloakConfig(window.__env.configStorageServerConfig), self.ajaxCall_controlsConfig(window.__env.configStorageServerConfig), self.ajaxCall_appConfig(window.__env.configStorageServerConfig)).then(function (ajax1Results, ajax2Results, ajax3Results) { + console.log("all configs have been loaded"); + self.initEnvVariables(); + return; + }, function () { + // on fail + console.log("all configs have been loaded - at least some from local backup values. See console log for details"); + self.initEnvVariables(); + return; + }); + } + }); + } + initKomMonitorClientModule() { + let self = this; + // Register environment in AngularJS as constant + angular.module('kommonitorClient').constant('__env', window.__env); + // MathJx directive + angular.module('kommonitorClient').directive("mathjaxBind", function () { + return { + restrict: "EA", + controller: [ + "$scope", + "$element", + "$attrs", + function ($scope, $element, $attrs) { + $scope.$watch($attrs.mathjaxBind, function (texExpression) { + $element.html(texExpression); + // only if texExpression contains the special character '$' which is used to mark tex code + // then call MathJax function + if (texExpression && texExpression.includes("$")) { + MathJax.typesetPromise([$element[0]]); + } + }); + }, + ], + }; + }); + // custom unique filter + angular.module('kommonitorClient').filter('unique', function () { + return function (collection, primaryKey) { + var output = [], keys = []; + var splitKeys = primaryKey.split('.'); //split by period + angular.forEach(collection, function (item) { + let key = ""; + angular.copy(item, key); + for (var i = 0; i < splitKeys.length; i++) { + key = key[splitKeys[i]]; + } + if (keys.indexOf(key) === -1) { + keys.push(key); + output.push(item); + } + }); + return output; + }; + }); + angular.module('kommonitorClient').service("ControlsConfigService", ['$http', function ($http) { + window.__env.config = null; + // var resourcePath = window.__env.configStorageServerConfig ? window.__env.configStorageServerConfig.targetUrlToConfigStorageServer_controlsConfig : './config/controls-config_backup.json'; + var resourcePath = './config/controls-config_backup.json'; + var promise = $http.get(resourcePath).then(function (response) { + // window.__env.config = response.data; + window.__env.config = window.__env.controlsConfig; + }); + return { + promise: promise, + setData: function (response) { + window.__env.config = window.__env.controlsConfig; + }, + getControlsConfig: function () { + return window.__env.config; + } + }; + }]); + // init/configure SPA routing + angular.module('kommonitorClient'). + config(['$routeProvider', '$locationProvider', + function config($routeProvider, $locationProvider) { + $locationProvider.hashPrefix('!'); + $routeProvider. + when('/', { + template: '', + resolve: { + "ControlsConfigService": function (ControlsConfigService) { + return ControlsConfigService.promise; + } + } + }). + when('/administration', { + template: '', + resolve: { + 'auth': function (Auth, $q, $location) { + if (window.__env.enableKeycloakSecurity) { + if (Auth.keycloak.authenticated) { + if (Auth.keycloak.tokenParsed + && Auth.keycloak.tokenParsed.realm_access + && Auth.keycloak.tokenParsed.realm_access.roles + && Auth.keycloak.tokenParsed.realm_access.roles.some(role => role.endsWith("-creator") || role.endsWith("-publisher") || role.endsWith("-editor"))) { + Auth.keycloak.showAdminView = true; + } + if (Auth.keycloak.showAdminView) { + return true; + } + else { + return $q.reject('Not Authenticated'); + } + } + else { + Auth.keycloak.login({ + redirectUri: $location.absUrl() + }); + } + } + } + } + }) + .otherwise('/'); + } + ]); + // register auth interceptor to refresh Keycloak login on each user request + angular.module('kommonitorClient').factory('authInterceptor', ['$q', 'Auth', function ($q, Auth) { + return { + request: function (config) { + var deferred = $q.defer(); + if (Auth.keycloak.token && self.urlRequiresKeycloakAuthHeader(config.url)) { + Auth.keycloak.updateToken(5).then(function () { + config.headers = config.headers || {}; + config.headers.Authorization = 'Bearer ' + Auth.keycloak.token; + deferred.resolve(config); + }).catch(function () { + deferred.reject('Failed to refresh token'); + console.error('Failed to refresh token. Will redirect to Login screen'); + Auth.keycloak.login(); + }); + return deferred.promise; + } + else { + return config; + } + } + }; + }]); + angular.module('kommonitorClient').config(['$httpProvider', function ($httpProvider) { + $httpProvider.interceptors.push('authInterceptor'); + }]); + } + urlRequiresKeycloakAuthHeader(url) { + // /admin/ is used to make admin requests against keycloak + if (url.includes("/admin/")) { + return false; + } + // ORS isochrones and directions requests + if (url.includes("isochrones")) { + return false; + } + if (url.includes("routes")) { + return false; + } + // for KomMonitor public requests we do not need any authentication + if (url.includes("/public/")) { + return false; + } + return true; + } + ; + isBase64(str) { + var notBase64 = /[^A-Z0-9+\/=]/i; + const len = str.length; + if (!len || len % 4 !== 0 || notBase64.test(str)) { + return false; + } + const firstPaddingChar = str.indexOf('='); + return firstPaddingChar === -1 || + firstPaddingChar === len - 1 || + (firstPaddingChar === len - 2 && str[len - 1] === '='); + } + ; + // private decryptAesCBC(encryptedString: string) { + // var hashedKey = CryptoJS.SHA256(this.env.encryption.password); + // // from BASE64 encoded encrypted string + // var encryptedWordArray = CryptoJS.enc.Base64.parse(encryptedString); + // // get IV from beginning + // var iv = CryptoJS.lib.WordArray.create( + // encryptedWordArray.words.slice(0, (this.env.encryption.ivLength_byte) / 4) + // ); + // var decrypted = CryptoJS.AES.decrypt( + // { + // ciphertext: CryptoJS.lib.WordArray.create( + // encryptedWordArray.words.slice(this.env.encryption.ivLength_byte / 4) + // ) + // }, + // hashedKey, + // { iv: iv } + // ); + // var decryptedString = decrypted.toString(CryptoJS.enc.Utf8); + // var decryptedJson = JSON.parse(decryptedString); + // // sometimes a response might still be BASE64 encoded in addition + // // if so, then resolve that + // if (typeof decryptedJson === 'string' && this.isBase64(decryptedJson)) { + // decryptedJson = CryptoJS.enc.Base64.parse(decryptedJson).toString(CryptoJS.enc.Utf8); + // decryptedJson = JSON.parse(decryptedJson); + // } + // return decryptedJson; + // }; + async initKeycloak() { + let auth = { + keycloak: {} + }; + if (window.__env.enableKeycloakSecurity) { + var keycloakAdapter = new Keycloak(window.__env.configStorageServerConfig.targetUrlToConfigStorageServer_keycloakConfig); + // https://www.keycloak.org/docs/latest/securing_apps/#session-status-iframe + // https://www.keycloak.org/docs/latest/securing_apps/#_modern_browsers + return await keycloakAdapter.init({ + onLoad: 'check-sso', + checkLoginIframe: false, + silentCheckSsoFallback: false + }).then(function (authenticated) { + console.log(authenticated ? 'User is authenticated!' : 'User is not authenticated!'); + auth.keycloak = keycloakAdapter; + angular.module('kommonitorClient').factory('Auth', function () { + return auth; + }); + try { + console.debug('Trying to bootstrap application.'); + } + catch (e) { + console.error('Application bootstrapping failed.'); + console.error(e); + } + }).catch(function () { + console.log('Failed to initialize authentication adapter. Will try to bootstrap application without keycloak security'); + alert('Failed to initialize keycloak authentication adapter. Will try to bootstrap application without keycloak security'); + }); + } + } +}; +AppModule = __decorate([ + NgModule({ + imports: [ + BrowserModule, + UpgradeModule, + RouterModule.forRoot(routes, { useHash: true }), + NgxEchartsModule.forRoot({ + echarts: () => import('echarts') + }), + EchartsxModule, + // InfoModalModule, + // VersionInfoModule + ], + providers: [ + { provide: LocationStrategy, useClass: HashLocationStrategy }, + ajskommonitorCacheHelperServiceProvider, ajskommonitorBatchUpdateHelperServiceProvider, + ajskommonitorConfigStorageServiceProvider, ajskommonitorKeycloackHelperServiceProvider, + ajskommonitorMultiStepFormHelperServiceProvider, ajskommonitorDataExchangeServiceeProvider, + ajskommonitorDataGridHelperServiceProvider, ajskommonitorSingleFeatureMapServiceProvider, + ajskommonitorDiagramHelperServiceProvider, ajskommonitorFilterHelperServiceProvider, + ], + declarations: [ + InfoModalComponent, + VersionInfoComponent, + KommonitorDiagramsComponent + ] + }) +], AppModule); +//# sourceMappingURL=app.module.js.map \ No newline at end of file diff --git a/app/app.module.js.map b/app/app.module.js.map new file mode 100644 index 000000000..2c0ce8637 --- /dev/null +++ b/app/app.module.js.map @@ -0,0 +1 @@ +{"version":3,"file":"app.module.js","sourceRoot":"","sources":["app.module.ts"],"names":[],"mappings":";AAAA,OAAO,EAAe,QAAQ,EAAW,MAAM,eAAe,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE7D,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAA;AAC3B,OAAO,QAAQ,MAAM,aAAa,CAAC;AACnC,OAAO,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H,CAAC;CAEF,CAAA;AAteY,SAAS;IA5BrB,QAAQ,CAAC;QACR,OAAO,EAAE;YACP,aAAa;YACb,aAAa;YACb,YAAY,CAAC,OAAO,CAAC,MAAM,EAAG,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;YAClD,gBAAgB,CAAC,OAAO,CAAC;gBACvB,OAAO,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC;aACjC,CAAC;YACF,cAAc;YACZ,mBAAmB;YACnB,oBAAoB;SACrB;QACD,SAAS,EAAC;YACR,EAAC,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,oBAAoB,EAAC;YAC3D,uCAAuC,EAAC,6CAA6C;YACrF,yCAAyC,EAAC,2CAA2C;YACrF,+CAA+C,EAAC,yCAAyC;YACzF,0CAA0C,EAAC,4CAA4C;YACvF,yCAAyC,EAAC,wCAAwC;SACnF;QAED,YAAY,EAAE;YACZ,kBAAkB;YAClB,oBAAoB;YACtB,2BAA2B;SAC1B;KACF,CAAC;GAEW,SAAS,CAserB"} \ No newline at end of file diff --git a/app/app.module.ts b/app/app.module.ts index 6203e5750..1f668d4db 100644 --- a/app/app.module.ts +++ b/app/app.module.ts @@ -1,22 +1,56 @@ -import { DoBootstrap, NgModule } from '@angular/core'; +import { DoBootstrap, NgModule, Version } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; import { UpgradeModule } from '@angular/upgrade/static'; -import $ from 'jquery'; +import { downgradeComponent } from '@angular/upgrade/static'; +import * as bootstrap from 'bootstrap'; +import * as $ from 'jquery' import Keycloak from 'keycloak-js'; import angular from "angular"; +import * as echarts from 'echarts'; import { RouterModule, Routes } from '@angular/router'; import { HashLocationStrategy, LocationStrategy } from '@angular/common'; +import { NgxEchartsModule } from 'ngx-echarts'; +import { EchartsDirective, EchartsxModule } from 'echarts-for-angular'; +import { InfoModalComponent } from 'components/kommonitorUserInterface/kommonitorControls/infoModal/info-modal.component'; +import { VersionInfoComponent } from 'components/kommonitorUserInterface/kommonitorControls/versionInfo/version-info.component'; +import { KommonitorDiagramsComponent } from 'components/kommonitorUserInterface/kommonitorControls/kommonitorDiagrams/kommonitor-diagrams.component'; +// import { InfoModalModule } from 'components/kommonitorUserInterface/kommonitorControls/infoModal/info-modal.module'; +// import { VersionInfoModule } from 'components/kommonitorUserInterface/kommonitorControls/versionInfo/version-info.module'; + +import { ajskommonitorCacheHelperServiceProvider,ajskommonitorBatchUpdateHelperServiceProvider,ajskommonitorConfigStorageServiceProvider,ajskommonitorDataExchangeServiceeProvider,ajskommonitorDataGridHelperServiceProvider,ajskommonitorDiagramHelperServiceProvider,ajskommonitorFilterHelperServiceProvider,ajskommonitorKeycloackHelperServiceProvider,ajskommonitorMultiStepFormHelperServiceProvider, ajskommonitorSingleFeatureMapServiceProvider } from 'app-upgraded-providers'; +//import { KommonitorDiagramsComponent } from 'components/kommonitorUserInterface/kommonitorControls/kommonitorDiagrams/kommonitor-diagrams.component'; // currently the AngularJS routing is still used as part of kommonitorClient module const routes: Routes = []; +declare var MathJax; + @NgModule({ imports: [ BrowserModule, UpgradeModule, - RouterModule.forRoot(routes , { useHash: true }) + RouterModule.forRoot(routes , { useHash: true }), + NgxEchartsModule.forRoot({ + echarts: () => import('echarts') + }), + EchartsxModule, + // InfoModalModule, + // VersionInfoModule + ], + providers:[ + {provide: LocationStrategy, useClass: HashLocationStrategy}, + ajskommonitorCacheHelperServiceProvider,ajskommonitorBatchUpdateHelperServiceProvider, + ajskommonitorConfigStorageServiceProvider,ajskommonitorKeycloackHelperServiceProvider, + ajskommonitorMultiStepFormHelperServiceProvider,ajskommonitorDataExchangeServiceeProvider, + ajskommonitorDataGridHelperServiceProvider,ajskommonitorSingleFeatureMapServiceProvider, + ajskommonitorDiagramHelperServiceProvider,ajskommonitorFilterHelperServiceProvider, ], - providers: [{provide: LocationStrategy, useClass: HashLocationStrategy}], + + declarations: [ + InfoModalComponent, + VersionInfoComponent, +KommonitorDiagramsComponent + ] }) export class AppModule implements DoBootstrap { @@ -34,6 +68,8 @@ export class AppModule implements DoBootstrap { // instantiate env variable this.env = window.__env || {}; + this.downgradeDependencies(); + // initialize kommonitorClient module await this.initKomMonitorClientModule(); @@ -45,6 +81,27 @@ export class AppModule implements DoBootstrap { } + private downgradeDependencies(): void { + + // to inject already upgraded KomMonitor Angular components into "old" AngluarJS components, we must do 2 things + // 1. downgrade the new Angular component and register it as directive within each requiring AngularJS module/component + // --> this especially means all components, where the downgraded component is used within the HTML part as directive + // 2. in order to prevent no module errors we must remove the old module reference within the .module file of the AngularJS modules/components + angular.module('kommonitorUserInterface') + .directive('infoModal', downgradeComponent({ component: InfoModalComponent }) as angular.IDirectiveFactory); + + angular.module('kommonitorUserInterface') + .directive('versionInfo', downgradeComponent({ component: VersionInfoComponent }) as angular.IDirectiveFactory); + + + + + angular.module('kommonitorUserInterface') + .directive('kommonitorDiagrams', downgradeComponent({ component: KommonitorDiagramsComponent }) as angular.IDirectiveFactory); + + console.log("registered downgraded Angular components for AngularJS usage"); + } + private checkBrowser(): void { if (/MSIE 9/i.test(navigator.userAgent) || /MSIE 10/i.test(navigator.userAgent) || /rv:11.0/i.test(navigator.userAgent)) { // This is internet explorer 9, 10 or 11 @@ -243,7 +300,7 @@ export class AppModule implements DoBootstrap { // only if texExpression contains the special character '$' which is used to mark tex code // then call MathJax function if (texExpression && texExpression.includes("$")) { - // MathJax.typesetPromise([$element[0]]); + MathJax.typesetPromise([$element[0]]); } }); }, diff --git a/app/components/kommonitorUserInterface/kommonitorControls/indicatorRadar/indicator-radar.component.ts b/app/components/kommonitorUserInterface/kommonitorControls/indicatorRadar/indicator-radar.component.ts deleted file mode 100644 index 95cceef81..000000000 --- a/app/components/kommonitorUserInterface/kommonitorControls/indicatorRadar/indicator-radar.component.ts +++ /dev/null @@ -1,612 +0,0 @@ -angular - .module('indicatorRadar') - .component( - 'indicatorRadar', - { - templateUrl: "components/kommonitorUserInterface/kommonitorControls/indicatorRadar/indicator-radar.template.html", - - controller: [ - 'kommonitorDataExchangeService', 'kommonitorDiagramHelperService', 'kommonitorFilterHelperService', '$scope', '$rootScope', '$timeout', '$http', '__env', - function indicatorRadarController( - kommonitorDataExchangeService, kommonitorDiagramHelperService, kommonitorFilterHelperService, $scope, $rootScope, $timeout, $http, __env) { - /* - * reference to kommonitorDataExchangeService instances - */ - this.kommonitorDataExchangeServiceInstance = kommonitorDataExchangeService; - this.kommonitorDiagramHelperServiceInstance = kommonitorDiagramHelperService; - - var self = this; - - $scope.activeTab = 0; - - // initialize any adminLTE box widgets - $('.box').boxWidget(); - - $(window).on('resize', function () { - if ($scope.radarChart != null && $scope.radarChart != undefined) { - $scope.radarChart.resize(); - } - }); - - $scope.$on("resizeDiagrams", function (event) { - - setTimeout(function () { - if ($scope.radarChart != null && $scope.radarChart != undefined) { - $scope.radarChart.resize(); - } - }, 350); - }); - - const DATE_PREFIX = __env.indicatorDatePrefix; - - $scope.indicatorNameFilter = undefined; - - $scope.eventsRegistered = false; - - var numberOfDecimals = __env.numberOfDecimals; - - $scope.setupCompleted = true; - - $scope.onChangeFilterSameUnitAndSameTime = function(){ - if($scope.radarChart){ - $scope.radarChart.dispose(); - $scope.radarChart = echarts.init(document.getElementById('radarDiagram')); - } - kommonitorDiagramHelperService.indicatorPropertiesForCurrentSpatialUnitAndTime = []; - - kommonitorDiagramHelperService.setupIndicatorPropertiesForCurrentSpatialUnitAndTime(kommonitorDiagramHelperService.filterSameUnitAndSameTime); - }; - - $scope.date; - $scope.spatialUnitName; - - $scope.$on("updateDiagrams", function (event, indicatorMetadataAndGeoJSON, spatialUnitName, spatialUnitId, date, defaultBrew, gtMeasureOfValueBrew, ltMeasureOfValueBrew, dynamicIncreaseBrew, dynamicDecreaseBrew, isMeasureOfValueChecked, measureOfValue, justRestyling) { - - // if the layer is just restyled (i.e. due to change of measureOfValue) - // then we do not need to costly update the radar diagram - if (justRestyling) { - return; - } - - console.log("updating radar diagram"); - - $scope.setupCompleted = false; - - updateRadarChart(indicatorMetadataAndGeoJSON, spatialUnitName, spatialUnitId, date); - - $rootScope.$broadcast("preserveHighlightedFeatures"); - - }); - - // RADAR CHART TIME SERIES FUNCTION - var updateRadarChart = async function (indicatorMetadataAndGeoJSON, spatialUnitName, spatialUnitId, date) { - // based on prepared DOM, initialize echarts instance - $scope.date = date; - $scope.spatialUnitName = spatialUnitName; - - if (!$scope.radarChart) - $scope.radarChart = echarts.init(document.getElementById('radarDiagram')); - else { - // explicitly kill and reinstantiate radar diagram to avoid zombie states on spatial unit change - $scope.radarChart.dispose(); - $scope.radarChart = echarts.init(document.getElementById('radarDiagram')); - kommonitorDiagramHelperService.indicatorPropertiesForCurrentSpatialUnitAndTime = new Array(); - } - - await $scope.radarChart.showLoading(); - - kommonitorDiagramHelperService.setupIndicatorPropertiesForCurrentSpatialUnitAndTime(); - - $scope.activeTab = 0; - if(kommonitorDataExchangeService.selectedIndicator.creationType == "COMPUTATION"){ - $scope.activeTab = 1; - } - if(kommonitorDataExchangeService.selectedIndicator.isHeadlineIndicator){ - $scope.activeTab = 2; - } - - modifyRadarContent(kommonitorDiagramHelperService.indicatorPropertiesForCurrentSpatialUnitAndTime); - }; - - $scope.onChangeSelectedDate = function(input){ - if(input.isSelected){ - modifyRadarContent(kommonitorDiagramHelperService.indicatorPropertiesForCurrentSpatialUnitAndTime); - } - }; - - var wait = ms => new Promise((r, j) => setTimeout(r, ms)); - - $scope.$on("allIndicatorPropertiesForCurrentSpatialUnitAndTime setup begin", async function (event) { - - await wait(130); - $scope.setupCompleted = false; - - - $timeout(function(){ - $scope.$digest(); - }, 500); - - }); - - $scope.$on("allIndicatorPropertiesForCurrentSpatialUnitAndTime setup completed", async function (event) { - - await wait(130); - $scope.setupCompleted = true; - - - $timeout(function(){ - $scope.$digest(); - self.filterDisplayedIndicatorsOnRadar(); - }, 500); - - }); - - var modifyRadarContent = async function (indicatorsForRadar) { - var indicatorArrayForRadarChart = new Array(); - var defaultSeriesValueArray = new Array(); - - var sampleProperties = null; - - for (var i = 0; i < indicatorsForRadar.length; i++) { - if (indicatorsForRadar[i].isSelected) { - - await kommonitorDiagramHelperService.fetchIndicatorPropertiesIfNotExists(i); - - // make object to hold indicatorName, max value and average value - var indicatorProperties = indicatorsForRadar[i].indicatorProperties; - - if(kommonitorFilterHelperService.completelyRemoveFilteredFeaturesFromDisplay && kommonitorFilterHelperService.filteredIndicatorFeatureIds.size > 0){ - indicatorProperties = indicatorProperties.filter(featureProperties => ! kommonitorFilterHelperService.featureIsCurrentlyFiltered(featureProperties[__env.FEATURE_ID_PROPERTY_NAME])); - } - - sampleProperties = indicatorsForRadar[i].indicatorProperties; - - // var closestApplicableTimestamp = kommonitorDiagramHelperService.findClostestTimestamForTargetDate(indicatorsForRadar[i], $scope.date); - // indicatorsForRadar[i].closestTimestamp = closestApplicableTimestamp; - - var sample = indicatorProperties[0]; - var maxValue = sample[DATE_PREFIX + indicatorsForRadar[i].selectedDate]; - var minValue = sample[DATE_PREFIX + indicatorsForRadar[i].selectedDate]; - var valueSum = 0; - - for (var indicatorPropertyInstance of indicatorProperties) { - // for average only apply real numeric values - if (!kommonitorDataExchangeService.indicatorValueIsNoData(indicatorPropertyInstance[DATE_PREFIX + indicatorsForRadar[i].selectedDate])) { - var value = kommonitorDataExchangeService.getIndicatorValueFromArray_asNumber(indicatorPropertyInstance, indicatorsForRadar[i].selectedDate) - valueSum += value; - - if (value > maxValue) - maxValue = value; - - if (value < minValue) - minValue = value; - } - } - - if (minValue == null) { - minValue = 0; - } - - if (maxValue == null) { - maxValue = 1; - } - - // IT MIGHT HAPPEN THAT AN INDICATOR IS INSPECTED THAT DOES NOT SUPPORT THE DATE - // HENCE ONLY ADD VALUES TO DEFAULT IF THEY SHOW MEANINGFUL VALUES - // if(valueSum != null){ - indicatorArrayForRadarChart.push({ - name: indicatorsForRadar[i].indicatorMetadata.indicatorName + " - " + indicatorsForRadar[i].selectedDate, - unit: indicatorsForRadar[i].indicatorMetadata.unit, - max: maxValue, - min: minValue - }); - - defaultSeriesValueArray.push(kommonitorDataExchangeService.getIndicatorValue_asNumber(Number(valueSum / indicatorProperties.length))); - // } - } - - } - - if (defaultSeriesValueArray.length === 0) { - - if ($scope.radarChart) { - $scope.radarChart.dispose(); - $scope.radarChart = undefined; - } - - } - else { - - if (!$scope.radarChart) - $scope.radarChart = echarts.init(document.getElementById('radarDiagram')); - // else{ - // // explicitly kill and reinstantiate radar diagram to avoid zombie states on spatial unit change - // $scope.radarChart.dispose(); - // $scope.radarChart = echarts.init(document.getElementById('radarDiagram')); - // } - - $scope.radarOption = { - grid: { - left: '4%', - top: 0, - right: '4%', - bottom: 30, - containLabel: true - }, - title: { - text: 'Indikatorenradar - ' + $scope.spatialUnitName + ' - ' + $scope.date, - left: 'center', - top: 0, - show: false - }, - tooltip: { - confine: 'true', - formatter: function (params) { - - var string = "" + params.name + "
"; - - for (var index = 0; index < params.value.length; index++) { - string += $scope.radarOption.radar.indicator[index].name + ": " + kommonitorDataExchangeService.getIndicatorValue_asFormattedText(params.value[index]) + " [" + $scope.radarOption.radar.indicator[index].unit + "]
"; - }; - - return string; - } - // position: ['50%', '50%'] - }, - toolbox: { - show: true, - right: '15', - feature: { - // mark : {show: true}, - dataView: { - show: kommonitorDataExchangeService.showDiagramExportButtons, readOnly: true, title: "Datenansicht", lang: ['Datenansicht - Indikatorenradar', 'schließen', 'refresh'], optionToContent: function (opt) { - - // - // - // - // - // - // - // - // - // - // - // - // - // - //
Indikator-NameBeschreibung der Verknüpfung
{{indicator.referencedIndicatorName}}{{indicator.referencedIndicatorDescription}}
- - var radarSeries = opt.series[0].data; - var indicators = opt.radar[0].indicator; - - var dataTableId = "radarDataTable"; - var tableExportName = opt.title[0].text; - - var htmlString = ''; - htmlString += ""; - htmlString += ""; - htmlString += ""; - - for (var i = 0; i < indicators.length; i++) { - htmlString += ""; - } - - htmlString += ""; - htmlString += ""; - - htmlString += ""; - - - - for (var j = 0; j < radarSeries.length; j++) { - htmlString += ""; - htmlString += ""; - for (var k = 0; k < indicators.length; k++) { - htmlString += ""; - } - htmlString += ""; - } - - htmlString += ""; - htmlString += "
Feature-Name" + indicators[i].name + " [" + indicators[i].unit + "]
" + radarSeries[j].name + "" + kommonitorDataExchangeService.getIndicatorValue_asNumber(radarSeries[j].value[k]) + "
"; - - $rootScope.$broadcast("AppendExportButtonsForTable", dataTableId, tableExportName); - - return htmlString; - } - }, - restore: { show: false, title: "Darstellung erneuern" }, - saveAsImage: { show: true, title: "Export", pixelRatio: 4 } - } - }, - legend: { - type: "scroll", - bottom: 0, - align: 'left', - left: 5, - data: ['Arithmetisches Mittel'] - }, - radar: { - // shape: 'circle', - // name: { - // textStyle: { - // color: '#fff', - // backgroundColor: '#999', - // borderRadius: 3, - // padding: [3, 5] - // } - // }, - name: { - formatter: function (value, indicator) { - - return kommonitorDataExchangeService.formatIndicatorNameForLabel(value, 15); - }, - textStyle: { - color: '#525252' - }, - fontSize: 11 - }, - indicator: indicatorArrayForRadarChart - }, - series: [{ - name: 'Indikatorvergleich', - type: 'radar', - symbolSize: 8, - data: [ - { - value: defaultSeriesValueArray, - name: 'Arithmetisches Mittel', - lineStyle: { - color: 'gray', - type: 'dashed', - width: 3 - }, - itemStyle: { - borderWidth: 2, - color: 'gray' - }, - emphasis: { - lineStyle: { - width: 4 - }, - itemStyle: { - borderType: 'dashed' - } - } - } - ] - }] - }; - - // check if any feature is still clicked/selected - // then append those as series within radar chart - appendSelectedFeaturesIfNecessary(sampleProperties); - - // use configuration item and data specified to show chart - $scope.radarChart.setOption($scope.radarOption); - - $scope.radarChart.hideLoading(); - setTimeout(function () { - $scope.radarChart.resize(); - $scope.$digest(); - }, 350); - registerEventsIfNecessary(); - - } - - } - - var appendSelectedFeaturesIfNecessary = function (sampleProperties) { - - for (var propertiesInstance of sampleProperties) { - if (kommonitorFilterHelperService.featureIsCurrentlySelected(propertiesInstance[__env.FEATURE_ID_PROPERTY_NAME])) { - appendSeriesToRadarChart(propertiesInstance); - } - } - }; - - function registerEventsIfNecessary() { - if (!$scope.eventsRegistered) { - // when hovering over elements of the chart then highlight them in the map. - $scope.radarChart.on('mouseOver', function (params) { - // $scope.userHoveresOverItem = true; - var spatialFeatureName = params.data.name; - // console.log(spatialFeatureName); - if(spatialFeatureName){ - $rootScope.$broadcast("highlightFeatureOnMap", spatialFeatureName); - } - - }); - - $scope.radarChart.on('mouseOut', function (params) { - // $scope.userHoveresOverItem = false; - - var spatialFeatureName = params.data.name; - // console.log(spatialFeatureName); - if(spatialFeatureName){ - $rootScope.$broadcast("unhighlightFeatureOnMap", spatialFeatureName); - } - - }); - - //disable feature removal for radar chart - seems to be unintuititve - // $scope.radarChart.on('click', function(params){ - // var spatialFeatureName = params.data.name; - // // console.log(spatialFeatureName); - // if(spatialFeatureName){ - // $rootScope.$broadcast("switchHighlightFeatureOnMap", spatialFeatureName); - // } - // }); - - $scope.eventsRegistered = true; - } - }; - - - $scope.$on("updateDiagramsForHoveredFeature", function (event, featureProperties) { - - if (!$scope.radarChart || !$scope.radarOption || !$scope.radarOption.legend || !$scope.radarOption.series) { - return; - } - - if (!kommonitorFilterHelperService.featureIsCurrentlySelected(featureProperties[__env.FEATURE_ID_PROPERTY_NAME])) { - appendSeriesToRadarChart(featureProperties); - } - - highlightFeatureInRadarChart(featureProperties); - }); - - var appendSeriesToRadarChart = function (featureProperties) { - // append feature name to legend - $scope.radarOption.legend.data.push(featureProperties[__env.FEATURE_NAME_PROPERTY_NAME]); - - // create feature data series - var featureSeries = {}; - featureSeries.name = featureProperties[__env.FEATURE_NAME_PROPERTY_NAME]; - featureSeries.value = new Array(); - featureSeries.emphasis = { - lineStyle: { - width: 4, - type: 'dotted' - } - }; - featureSeries.lineStyle = { - width: 3, - type: 'solid' - }; - featureSeries.itemStyle = { - borderWidth: 2 - }; - - - // for each indicator create series data entry for feature - for (var i = 0; i < kommonitorDiagramHelperService.indicatorPropertiesForCurrentSpatialUnitAndTime.length; i++) { - if (kommonitorDiagramHelperService.indicatorPropertiesForCurrentSpatialUnitAndTime[i].isSelected) { - // make object to hold indicatorName, max value and average value - var indicatorProperties = kommonitorDiagramHelperService.indicatorPropertiesForCurrentSpatialUnitAndTime[i].indicatorProperties; - var date = kommonitorDiagramHelperService.indicatorPropertiesForCurrentSpatialUnitAndTime[i].selectedDate; - - for (var indicatorPropertyInstance of indicatorProperties) { - if (indicatorPropertyInstance[__env.FEATURE_NAME_PROPERTY_NAME] == featureProperties[__env.FEATURE_NAME_PROPERTY_NAME]) { - if (!kommonitorDataExchangeService.indicatorValueIsNoData(indicatorPropertyInstance[DATE_PREFIX + date])) { - featureSeries.value.push(kommonitorDataExchangeService.getIndicatorValueFromArray_asNumber(indicatorPropertyInstance, date)); - } - else { - featureSeries.value.push(null); - } - break; - } - } - } - - } - - $scope.radarOption.series[0].data.push(featureSeries); - - $scope.radarChart.setOption($scope.radarOption); - setTimeout(function () { - $scope.radarChart.resize(); - }, 350); - registerEventsIfNecessary(); - }; - - var highlightFeatureInRadarChart = function (featureProperties) { - // highlight the corresponding bar diagram item - // get series index of series - var dataIndex = getSeriesDataIndexByFeatureName(featureProperties[__env.FEATURE_NAME_PROPERTY_NAME]); - - if (dataIndex > -1) { - $scope.radarChart.dispatchAction({ - type: 'highlight', - seriesIndex: 0, - dataIndex: dataIndex - }); - } - }; - - $scope.$on("updateDiagramsForUnhoveredFeature", function (event, featureProperties) { - - if (!$scope.radarChart || !$scope.radarOption || !$scope.radarOption.legend || !$scope.radarOption.series) { - return; - } - - unhighlightFeatureInRadarChart(featureProperties); - - if (!kommonitorFilterHelperService.featureIsCurrentlySelected(featureProperties[__env.FEATURE_ID_PROPERTY_NAME])) { - removeSeriesFromRadarChart(featureProperties); - } - }); - - var getSeriesDataIndexByFeatureName = function (featureName) { - for (var index = 0; index < $scope.radarOption.series[0].data.length; index++) { - if ($scope.radarOption.series[0].data[index].name == featureName) - return index; - } - - //return -1 if none was found - return -1; - }; - - var removeSeriesFromRadarChart = function (featureProperties) { - // remove feature from legend - var legendIndex = $scope.radarOption.legend.data.indexOf(featureProperties[__env.FEATURE_NAME_PROPERTY_NAME]); - if (legendIndex > -1) { - $scope.radarOption.legend.data.splice(legendIndex, 1); - } - - // remove feature data series - var dataIndex = getSeriesDataIndexByFeatureName(featureProperties[__env.FEATURE_NAME_PROPERTY_NAME]); - if (dataIndex > -1) { - $scope.radarOption.series[0].data.splice(dataIndex, 1); - } - - // second parameter tells echarts to not merge options with previous data. hence really remove series from graphic - $scope.radarChart.setOption($scope.radarOption, true); - setTimeout(function () { - $scope.radarChart.resize(); - }, 350); - registerEventsIfNecessary(); - }; - - var unhighlightFeatureInRadarChart = function (featureProperties) { - // highlight the corresponding bar diagram item - // get series index of series - var dataIndex = getSeriesDataIndexByFeatureName(featureProperties[__env.FEATURE_NAME_PROPERTY_NAME]); - - if (dataIndex > -1) { - $scope.radarChart.dispatchAction({ - type: 'downplay', - seriesIndex: 0, - dataIndex: dataIndex - }); - } - }; - - this.filterDisplayedIndicatorsOnRadar = function () { - console.log("Filtering indicator radar"); - - modifyRadarContent(kommonitorDiagramHelperService.indicatorPropertiesForCurrentSpatialUnitAndTime); - - } - - this.selectAllIndicatorsForRadar = function () { - - for (var indicator of kommonitorDiagramHelperService.indicatorPropertiesForCurrentSpatialUnitAndTime) { - indicator.isSelected = true; - } - - modifyRadarContent(kommonitorDiagramHelperService.indicatorPropertiesForCurrentSpatialUnitAndTime); - } - - this.deselectAllIndicatorsForRadar = function () { - - for (var indicator of kommonitorDiagramHelperService.indicatorPropertiesForCurrentSpatialUnitAndTime) { - indicator.isSelected = false; - } - - modifyRadarContent(kommonitorDiagramHelperService.indicatorPropertiesForCurrentSpatialUnitAndTime); - } - - - }] - }); diff --git a/app/components/kommonitorUserInterface/kommonitorControls/indicatorRadar/indicator-radar.module.ts b/app/components/kommonitorUserInterface/kommonitorControls/indicatorRadar/indicator-radar.module.ts index 4358673cd..37894ffeb 100644 --- a/app/components/kommonitorUserInterface/kommonitorControls/indicatorRadar/indicator-radar.module.ts +++ b/app/components/kommonitorUserInterface/kommonitorControls/indicatorRadar/indicator-radar.module.ts @@ -1 +1,16 @@ -angular.module('indicatorRadar', [ 'kommonitorDataExchange', 'kommonitorDiagramHelper']); +// indicator-radar.module.ts + +import { NgModule } from '@angular/core'; + +import { kommonitorDiagramHelperServiceFactory } from 'app-upgraded-providers'; +import { kommonitorDataExchangeServiceFactory } from 'app-upgraded-providers'; +import { IndicatorRadarComponent } from './indicator-radar'; +@NgModule({ + imports: [ + + ], + providers:[kommonitorDataExchangeServiceFactory,kommonitorDiagramHelperServiceFactory], + declarations: [IndicatorRadarComponent], + exports: [] +}) +export class IndicatorRadarModule { } diff --git a/app/components/kommonitorUserInterface/kommonitorControls/indicatorRadar/indicator-radar.ts b/app/components/kommonitorUserInterface/kommonitorControls/indicatorRadar/indicator-radar.ts new file mode 100644 index 000000000..e1e71017c --- /dev/null +++ b/app/components/kommonitorUserInterface/kommonitorControls/indicatorRadar/indicator-radar.ts @@ -0,0 +1,473 @@ +import { Component, OnInit, ElementRef } from '@angular/core'; + + +@Component({ + selector: 'indicator-radar', + templateUrl: 'indicator-radar.component.html', + styleUrls: ['indicator-radar.component.css'], +}) +export class IndicatorRadarComponent implements OnInit { + activeTab = 0; + radarChart: any; + indicatorNameFilter: any; + eventsRegistered = false; + numberOfDecimals: number | undefined; + setupCompleted = true; + date: any; + spatialUnitName: any; + $scope: any; + $rootScope: any; + + constructor( + private kommonitorDataExchangeService: KommonitorDataExchangeService, + private kommonitorDiagramHelperService: KommonitorDiagramHelperService, + private elementRef: ElementRef + ) {} + + ngOnInit(): void { + this.$scope.$on("updateDiagramsForHoveredFeature", (event: any, featureProperties: any) => { + if (!this.radarChart || !this.radarOption || !this.radarOption.legend || !this.radarOption.series) { + return; + } + + if (!kommonitorFilterHelperService.featureIsCurrentlySelected(featureProperties[__env.FEATURE_ID_PROPERTY_NAME])) { + this.appendSeriesToRadarChart(featureProperties); + } + + this.highlightFeatureInRadarChart(featureProperties); + }); + + this.$scope.$on('allIndicatorPropertiesForCurrentSpatialUnitAndTime setup begin', async (event) => { + await this.wait(130); + this.setupCompleted = false; + this.$timeout(() => { + this.$scope.$digest(); + }, 500); + }); + + + this.$scope.$on('allIndicatorPropertiesForCurrentSpatialUnitAndTime setup completed', async (event) => { + await this.wait(130); + this.setupCompleted = true; + this.$timeout(() => { + this.$scope.$digest(); + this.filterDisplayedIndicatorsOnRadar(); + }, 500); + }); + // Initialize any adminLTE box widgets + $(this.elementRef.nativeElement).find('.box').boxWidget(); + + $(window).on('resize', () => { + if (this.radarChart != null && this.radarChart != undefined) { + this.radarChart.resize(); + } + }); + + this.kommonitorDiagramHelperService.setupIndicatorPropertiesForCurrentSpatialUnitAndTime(this.kommonitorDiagramHelperService.filterSameUnitAndSameTime); + + + onChangeFilterSameUnitAndSameTime() { + if (this.radarChart) { + this.radarChart.dispose(); + this.radarChart = echarts.init(document.getElementById('radarDiagram')); + } + this.kommonitorDiagramHelperService.indicatorPropertiesForCurrentSpatialUnitAndTime = []; + + this.kommonitorDiagramHelperService.setupIndicatorPropertiesForCurrentSpatialUnitAndTime(this.kommonitorDiagramHelperService.filterSameUnitAndSameTime); + } + + this.$scope.$on('updateDiagrams', (event, indicatorMetadataAndGeoJSON, spatialUnitName, spatialUnitId, date, defaultBrew, gtMeasureOfValueBrew, ltMeasureOfValueBrew, dynamicIncreaseBrew, dynamicDecreaseBrew, isMeasureOfValueChecked, measureOfValue, justRestyling) => { + // if the layer is just restyled (i.e. due to change of measureOfValue) + // then we do not need to costly update the radar diagram + if (justRestyling) { + return; + } + + console.log('Updating radar diagram'); + + this.setupCompleted = false; + + + this.updateRadarChart(indicatorMetadataAndGeoJSON, spatialUnitName, spatialUnitId, date); + + this.$rootScope.$broadcast('preserveHighlightedFeatures'); + }); + + } + $timeout(arg0: () => void, arg1: number) { + throw new Error('Method not implemented.'); + } + + + + updateRadarChart( + indicatorMetadataAndGeoJSON: any, + spatialUnitName: any, + spatialUnitId: any, + date: any + ) { + + this.date = date; + this.spatialUnitName = spatialUnitName; + + if (!this.radarChart) { + this.radarChart = echarts.init(document.getElementById('radarDiagram')); + } else { + + this.radarChart.dispose(); + this.radarChart = echarts.init(document.getElementById('radarDiagram')); + this.kommonitorDiagramHelperService.indicatorPropertiesForCurrentSpatialUnitAndTime = []; + } + + await this.radarChart.showLoading(); + + this.kommonitorDiagramHelperService.setupIndicatorPropertiesForCurrentSpatialUnitAndTime(); + + this.activeTab = 0; + if (this.kommonitorDataExchangeService.selectedIndicator.creationType == 'COMPUTATION') { + this.activeTab = 1; + } + if (this.kommonitorDataExchangeService.selectedIndicator.isHeadlineIndicator) { + this.activeTab = 2; + } + + this.modifyRadarContent(this.kommonitorDiagramHelperService.indicatorPropertiesForCurrentSpatialUnitAndTime); + } + + + + + wait(ms: number) { + return new Promise((resolve, reject) => { + setTimeout(resolve, ms); + }); + } + + +// Add this method inside your TypeScript class +async modifyRadarContent(indicatorsForRadar: any) { + const indicatorArrayForRadarChart = new Array(); + const defaultSeriesValueArray = new Array(); + + let sampleProperties = null; + + for (let i = 0; i < indicatorsForRadar.length; i++) { + if (indicatorsForRadar[i].isSelected) { + await this.kommonitorDiagramHelperService.fetchIndicatorPropertiesIfNotExists(i); + + // Create an object to hold indicatorName, max value, and average value + const indicatorProperties = indicatorsForRadar[i].indicatorProperties; + + if ( + this.kommonitorFilterHelperService.completelyRemoveFilteredFeaturesFromDisplay && + this.kommonitorFilterHelperService.filteredIndicatorFeatureIds.size > 0 + ) { + indicatorProperties = indicatorProperties.filter((featureProperties) => + !this.kommonitorFilterHelperService.featureIsCurrentlyFiltered( + featureProperties[__env.FEATURE_ID_PROPERTY_NAME] + ) + ); + } + + sampleProperties = indicatorsForRadar[i].indicatorProperties; + + // Initialize variables + let maxValue = sampleProperties[0][`${DATE_PREFIX}${indicatorsForRadar[i].selectedDate}`]; + let minValue = sampleProperties[0][`${DATE_PREFIX}${indicatorsForRadar[i].selectedDate}`]; + let valueSum = 0; + + for (const indicatorPropertyInstance of indicatorProperties) { + // For average, only apply real numeric values + if ( + !this.kommonitorDataExchangeService.indicatorValueIsNoData( + indicatorPropertyInstance[`${DATE_PREFIX}${indicatorsForRadar[i].selectedDate}`] + ) + ) { + const value = this.kommonitorDataExchangeService.getIndicatorValueFromArray_asNumber( + indicatorPropertyInstance, + indicatorsForRadar[i].selectedDate + ); + valueSum += value; + + if (value > maxValue) { + maxValue = value; + } + + if (value < minValue) { + minValue = value; + } + } + } + + if (minValue == null) { + minValue = 0; + } + + if (maxValue == null) { + maxValue = 1; + } + + // Push the indicator data to the arrays + indicatorArrayForRadarChart.push({ + name: `${indicatorsForRadar[i].indicatorMetadata.indicatorName} - ${indicatorsForRadar[i].selectedDate}`, + unit: indicatorsForRadar[i].indicatorMetadata.unit, + max: maxValue, + min: minValue, + }); + + defaultSeriesValueArray.push( + this.kommonitorDataExchangeService.getIndicatorValue_asNumber( + Number(valueSum / indicatorProperties.length) + ) + ); + } + } + + if (defaultSeriesValueArray.length === 0) { + if (this.$scope.radarChart) { + this.$scope.radarChart.dispose(); + this.$scope.radarChart = undefined; + } + } else { + if (!this.$scope.radarChart) { + this.$scope.radarChart = echarts.init(this.elementRef.nativeElement.querySelector('#radarDiagram')); + } + + // Define the radarOption here as you did before + + // Check if any feature is still clicked/selected + // then append those as series within radar chart + this.appendSelectedFeaturesIfNecessary(sampleProperties); + + // Use configuration item and data specified to show chart + this.$scope.radarChart.setOption(this.radarOption); + + this.$scope.radarChart.hideLoading(); + setTimeout(() => { + this.$scope.radarChart.resize(); + this.$scope.$digest(); + }, 350); + this.registerEventsIfNecessary(); + } + } + + +appendSelectedFeaturesIfNecessary(sampleProperties: any) { + for (const propertiesInstance of sampleProperties) { + if (this.kommonitorFilterHelperService.featureIsCurrentlySelected(propertiesInstance[__env.FEATURE_ID_PROPERTY_NAME])) { + this.appendSeriesToRadarChart(propertiesInstance); + } + } + } + + + filterDisplayedIndicatorsOnRadar() { + console.log("Filtering indicator radar"); + this.modifyRadarContent(kommonitorDiagramHelperService.indicatorPropertiesForCurrentSpatialUnitAndTime); + } + + selectAllIndicatorsForRadar() { + for (const indicator of kommonitorDiagramHelperService.indicatorPropertiesForCurrentSpatialUnitAndTime) { + indicator.isSelected = true; + } + + this.modifyRadarContent(kommonitorDiagramHelperService.indicatorPropertiesForCurrentSpatialUnitAndTime); + } + + + deselectAllIndicatorsForRadar() { + for (const indicator of kommonitorDiagramHelperService.indicatorPropertiesForCurrentSpatialUnitAndTime) { + indicator.isSelected = false; + } + + this.modifyRadarContent(kommonitorDiagramHelperService.indicatorPropertiesForCurrentSpatialUnitAndTime); + } + +registerEventsIfNecessary() { + if (!this.eventsRegistered) { + // when hovering over elements of the chart then highlight them in the map. + this.radarChart.on('mouseover', (params: any) => { + const spatialFeatureName = params.data.name; + if (spatialFeatureName) { + this.$rootScope.$broadcast("highlightFeatureOnMap", spatialFeatureName); + } + }); + + this.radarChart.on('mouseout', (params: any) => { + const spatialFeatureName = params.data.name; + if (spatialFeatureName) { + this.$rootScope.$broadcast("unhighlightFeatureOnMap", spatialFeatureName); + } + }); + + // Disable feature removal for radar chart - seems to be unintuitive + // this.radarChart.on('click', (params: any) => { + // const spatialFeatureName = params.data.name; + // if (spatialFeatureName) { + // this.$rootScope.$broadcast("switchHighlightFeatureOnMap", spatialFeatureName); + // } + // }); + + this.eventsRegistered = true; + } + } + + + + appendSeriesToRadarChart(featureProperties: any) { + // Append feature name to legend + this.radarOption.legend.data.push(featureProperties[__env.FEATURE_NAME_PROPERTY_NAME]); + + // Create feature data series + const featureSeries: any = {}; + featureSeries.name = featureProperties[__env.FEATURE_NAME_PROPERTY_NAME]; + featureSeries.value = new Array(); + featureSeries.emphasis = { + lineStyle: { + width: 4, + type: 'dotted' + } + }; + featureSeries.lineStyle = { + width: 3, + type: 'solid' + }; + featureSeries.itemStyle = { + borderWidth: 2 + }; + + // For each indicator, create series data entry for the feature + for (let i = 0; i < kommonitorDiagramHelperService.indicatorPropertiesForCurrentSpatialUnitAndTime.length; i++) { + if (kommonitorDiagramHelperService.indicatorPropertiesForCurrentSpatialUnitAndTime[i].isSelected) { + // Make an object to hold indicatorName, max value, and average value + const indicatorProperties = kommonitorDiagramHelperService.indicatorPropertiesForCurrentSpatialUnitAndTime[i].indicatorProperties; + const date = kommonitorDiagramHelperService.indicatorPropertiesForCurrentSpatialUnitAndTime[i].selectedDate; + + for (const indicatorPropertyInstance of indicatorProperties) { + if (indicatorPropertyInstance[__env.FEATURE_NAME_PROPERTY_NAME] === featureProperties[__env.FEATURE_NAME_PROPERTY_NAME]) { + if (!kommonitorDataExchangeService.indicatorValueIsNoData(indicatorPropertyInstance[DATE_PREFIX + date])) { + featureSeries.value.push(kommonitorDataExchangeService.getIndicatorValueFromArray_asNumber(indicatorPropertyInstance, date)); + } else { + featureSeries.value.push(null); + } + break; + } + } + } + } + + this.radarOption.series[0].data.push(featureSeries); + + this.radarChart.setOption(this.radarOption); + setTimeout(() => { + this.radarChart.resize(); + }, 350); + this.registerEventsIfNecessary(); + } + + + // Add the highlightFeatureInRadarChart function inside your TypeScript class +highlightFeatureInRadarChart(featureProperties: any) { + // Highlight the corresponding radar chart item + const dataIndex = this.getSeriesDataIndexByFeatureName(featureProperties[__env.FEATURE_NAME_PROPERTY_NAME]); + + if (dataIndex > -1) { + this.radarChart.dispatchAction({ + type: 'highlight', + seriesIndex: 0, + dataIndex: dataIndex + }); + } + } + + unhighlightFeatureInRadarChart(featureProperties: any) { + // Unhighlight the corresponding radar chart item + const dataIndex = this.getSeriesDataIndexByFeatureName(featureProperties[__env.FEATURE_NAME_PROPERTY_NAME]); + + if (dataIndex > -1) { + this.radarChart.dispatchAction({ + type: 'downplay', + seriesIndex: 0, + dataIndex: dataIndex + }); + } + } + + // Modifies the $scope.$on("updateDiagramsForUnhoveredFeature") function + $scope.$on("updateDiagramsForUnhoveredFeature", (event: any, featureProperties: any) => { + if (!this.radarChart || !this.radarOption || !this.radarOption.legend || !this.radarOption.series) { + return; + } + + this.unhighlightFeatureInRadarChart(featureProperties); + + if (!kommonitorFilterHelperService.featureIsCurrentlySelected(featureProperties[__env.FEATURE_ID_PROPERTY_NAME])) { + this.removeSeriesFromRadarChart(featureProperties); + } + }); + + // Modifies the removeSeriesFromRadarChart function + removeSeriesFromRadarChart(featureProperties: any) { + // Remove feature from legend + const legendIndex = this.radarOption.legend.data.indexOf(featureProperties[__env.FEATURE_NAME_PROPERTY_NAME]); + if (legendIndex > -1) { + this.radarOption.legend.data.splice(legendIndex, 1); + } + + const dataIndex = this.getSeriesDataIndexByFeatureName(featureProperties[__env.FEATURE_NAME_PROPERTY_NAME]); + if (dataIndex > -1) { + this.radarOption.series[0].data.splice(dataIndex, 1); + } + + + this.radarChart.setOption(this.radarOption, true); + setTimeout(() => { + this.radarChart.resize(); + }, 350); + this.registerEventsIfNecessary(); + } + + // Modifies the getSeriesDataIndexByFeatureName function + getSeriesDataIndexByFeatureName(featureName: string) { + for (let index = 0; index < this.radarOption.series[0].data.length; index++) { + if (this.radarOption.series[0].data[index].name === featureName) { + return index; + } + } + + // Return -1 if none was found + return -1; + } + + + + + +} + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/components/kommonitorUserInterface/kommonitorControls/infoModal/info-modal.component.css b/app/components/kommonitorUserInterface/kommonitorControls/infoModal/info-modal.component.css new file mode 100644 index 000000000..e69de29bb diff --git a/app/components/kommonitorUserInterface/kommonitorControls/infoModal/info-modal.component.js b/app/components/kommonitorUserInterface/kommonitorControls/infoModal/info-modal.component.js index 8b665b334..634cc1722 100644 --- a/app/components/kommonitorUserInterface/kommonitorControls/infoModal/info-modal.component.js +++ b/app/components/kommonitorUserInterface/kommonitorControls/infoModal/info-modal.component.js @@ -1,78 +1,85 @@ -"use strict"; -angular.module('infoModal').component('infoModal', { - templateUrl: "components/kommonitorUserInterface/kommonitorControls/infoModal/info-modal.template.html", - controller: [ - 'kommonitorDataExchangeService', '$scope', '$rootScope', '__env', '$timeout', - function InfoModalController(kommonitorDataExchangeService, $scope, $rootScope, __env, $timeout) { - this.kommonitorDataExchangeServiceInstance = kommonitorDataExchangeService; - $scope.isHideGreetings = false; - - //prevent bootrap modals tabs opened by a tag with href elements from adding their anchor location to - // URL - $("a[href^='#']").click(function(e) { - e.preventDefault(); - - }); - - $scope.init = function () { - - - if (!(localStorage.getItem("hideKomMonitorAppGreeting") === "true")) { - $scope.isHideGreetings = false; - $('#infoModal').modal('show'); - } - else { - $scope.isHideGreetings = true; - $("#changeHideGreetingsInput").prop('checked', true); - } - let tab1 = document.getElementById("infoModalTab1"); - tab1.innerHTML = __env.standardInfoModalTabTitle; - tab1.click(); - tab1.focus(); - if (__env.enableExtendedInfoModal) { - let tab3 = document.getElementById("infoModalTab3"); - let tab3content = document.getElementById("infoModalTab3Content"); - tab3.innerHTML = __env.extendedInfoModalTabTitle; - tab3content.innerHTML = __env.extendedInfoModalHTMLMessage; - } - else { - document.getElementById("infoModalTab3").style.display = "none"; - } - $timeout(function () { - $scope.$digest(); - }, 250); - }; - var onChangeHideGreetings = function () { - if ($scope.isHideGreetings) { - localStorage.setItem("hideKomMonitorAppGreeting", "true"); - } - else { - localStorage.setItem("hideKomMonitorAppGreeting", "false"); - } - }; - $('#changeHideGreetingsInput').on('click', function (event) { - if ($scope.isHideGreetings) { - $scope.isHideGreetings = false; +import { __decorate } from "tslib"; +import { Component } from '@angular/core'; +import { environment } from 'env_backup'; +import { kommonitorDataExchangeServiceFactory } from 'app-upgraded-providers'; +export let InfoModalComponent = class InfoModalComponent { + constructor(modalService) { + this.modalService = modalService; + this.isHideGreetings = false; + this.tab1 = 'null'; + this.customGreetingsContact_name = "Test"; + this.customGreetingsContact_organisation = "Test"; + this.customGreetingsContact_mail = "Test"; + this.customGreetingsTextInfoMessage = "Test"; + this.customGreetingsContact_name = "Test"; + this.customGreetingsContact_organisation = "Test"; + this.customGreetingsContact_mail = "Test"; + this.customGreetingsTextInfoMessage = "Test"; + } + ngOnInit() { + this.modalService.startGuidedTour$.subscribe(() => { + // Call a method to handle the guided tour event + this.callStartGuidedTour(); + }); + this.kommonitorDataExchangeServiceInstance = kommonitorDataExchangeServiceFactory; + if (!(localStorage.getItem("hideKomMonitorAppGreeting") === "true")) { + this.isHideGreetings = false; + $('#infoModal').modal('show'); + } + else { + this.isHideGreetings = true; + $("#changeHideGreetingsInput").prop('checked', true); + } + const tab1 = document.getElementById("infoModalTab1"); + if (tab1) { + tab1.innerHTML = environment.standardInfoModalTabTitle; + tab1.click(); + tab1.focus(); + if (environment.enableExtendedInfoModal) { + const tab3 = document.getElementById("infoModalTab3"); + const tab3content = document.getElementById("infoModalTab3Content"); + if (tab3 && tab3content) { + tab3.innerHTML = environment.extendedInfoModalTabTitle; + tab3content.innerHTML = environment.extendedInfoModalHTMLMessage; } else { - $scope.isHideGreetings = true; + alert("not founde"); } - onChangeHideGreetings(); - event.stopPropagation(); - }); - var callStartGuidedTour = function () { - $('#infoModal').modal('hide'); - $rootScope.$broadcast("startGuidedTour"); - }; - $(document).on('click', '#callStartGuidedTourButton', function (e) { - callStartGuidedTour(); - }); - $scope.showFeedbackForm = function () { - $('#infoModal').modal('hide'); - $('#feedbackModal').modal('show'); - }; - $scope.init(); + } + else { + console.log("content hasnt be loaded"); + } + } + setTimeout(() => { + // You might need to use Angular's change detection instead of $digest + }, 250); + } + onChangeHideGreetings() { + if (this.isHideGreetings) { + localStorage.setItem("hideKomMonitorAppGreeting", "true"); + } + else { + localStorage.setItem("hideKomMonitorAppGreeting", "false"); } - ] -}); + } + onToggleHideGreetings() { + this.isHideGreetings = !this.isHideGreetings; + localStorage.setItem("hideKomMonitorAppGreeting", this.isHideGreetings ? "true" : "false"); + } + callStartGuidedTour() { + $('#infoModal').modal('hide'); + this.modalService.startGuidedTour(); + } + showFeedbackForm() { + $('#infoModal').modal('hide'); + $('#feedbackModal').modal('show'); + } +}; +InfoModalComponent = __decorate([ + Component({ + selector: 'info-modal', + templateUrl: 'info-modal.template.html', + styleUrls: ['info-modal.component.css'], + }) +], InfoModalComponent); //# sourceMappingURL=info-modal.component.js.map \ No newline at end of file diff --git a/app/components/kommonitorUserInterface/kommonitorControls/infoModal/info-modal.component.js.map b/app/components/kommonitorUserInterface/kommonitorControls/infoModal/info-modal.component.js.map index cbae76592..70883bd9f 100644 --- a/app/components/kommonitorUserInterface/kommonitorControls/infoModal/info-modal.component.js.map +++ b/app/components/kommonitorUserInterface/kommonitorControls/infoModal/info-modal.component.js.map @@ -1 +1 @@ -{"version":3,"file":"info-modal.component.js","sourceRoot":"","sources":["info-modal.component.ts"],"names":[],"mappings":";AAAA,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,SAAS,CAAC,WAAW,EAAE;IAClD,WAAW,EAAG,0FAA0F;IACxG,UAAU,EAAG;QACZ,+BAA+B,EAAE,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE,UAAU;QAC5E,SAAS,mBAAmB,CAAC,6BAA6B,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,QAAQ;YAE/F,IAAI,CAAC,qCAAqC,GAAG,6BAA6B,CAAC;YAE3E,MAAM,CAAC,eAAe,GAAG,KAAK,CAAC;YAE/B,MAAM,CAAC,IAAI,GAAG;gBACb,IAAG,CAAE,CAAC,YAAY,CAAC,OAAO,CAAC,2BAA2B,CAAC,KAAK,MAAM,CAAC,EAAE;oBAEpE,MAAM,CAAC,eAAe,GAAG,KAAK,CAAC;oBAE/B,CAAC,CAAC,YAAY,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;iBAC9B;qBACG;oBACH,MAAM,CAAC,eAAe,GAAG,IAAI,CAAC;oBAC9B,CAAC,CAAC,2BAA2B,CAAC,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;iBACrD;gBAED,IAAI,IAAI,GAAG,QAAQ,CAAC,cAAc,CAAC,eAAe,CAAC,CAAC;gBACpD,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,yBAAyB,CAAC;gBACjD,IAAI,CAAC,KAAK,EAAE,CAAC;gBACb,IAAI,CAAC,KAAK,EAAE,CAAC;gBAEb,IA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AY,CAAC,OAAO,CAAC,2BAA2B,EAAE,MAAM,CAAC,CAAC;SAC3D;aAAM;YACL,YAAY,CAAC,OAAO,CAAC,2BAA2B,EAAE,OAAO,CAAC,CAAC;SAC5D;IACH,CAAC;IAED,qBAAqB;QACnB,IAAI,CAAC,eAAe,GAAG,CAAC,IAAI,CAAC,eAAe,CAAC;QAC7C,YAAY,CAAC,OAAO,CAAC,2BAA2B,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;IAC7F,CAAC;IAED,mBAAmB;QACjB,CAAC,CAAC,YAAY,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QAC9B,IAAI,CAAC,YAAY,CAAC,eAAe,EAAE,CAAC;IAEtC,CAAC;IAED,gBAAgB;QACd,CAAC,CAAC,YAAY,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QAC9B,CAAC,CAAC,gBAAgB,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IACpC,CAAC;CACF,CAAA;AAjGY,kBAAkB;IAN9B,SAAS,CAAC;QACT,QAAQ,EAAE,YAAY;QACtB,WAAW,EAAE,0BAA0B;QACvC,SAAS,EAAE,CAAC,0BAA0B,CAAC;KAExC,CAAC;GACW,kBAAkB,CAiG9B"} \ No newline at end of file diff --git a/app/components/kommonitorUserInterface/kommonitorControls/infoModal/info-modal.component.ts b/app/components/kommonitorUserInterface/kommonitorControls/infoModal/info-modal.component.ts index 18f493962..03905f2a2 100644 --- a/app/components/kommonitorUserInterface/kommonitorControls/infoModal/info-modal.component.ts +++ b/app/components/kommonitorUserInterface/kommonitorControls/infoModal/info-modal.component.ts @@ -1,88 +1,109 @@ -angular.module('infoModal').component('infoModal', { - templateUrl : "components/kommonitorUserInterface/kommonitorControls/infoModal/info-modal.template.html", - controller : [ - 'kommonitorDataExchangeService', '$scope', '$rootScope', '__env', '$timeout', - function InfoModalController(kommonitorDataExchangeService, $scope, $rootScope, __env, $timeout) { +import { Component, OnInit,AfterViewInit } from '@angular/core'; +import { environment } from 'env_backup'; +import { kommonitorDataExchangeServiceFactory } from 'app-upgraded-providers'; +import { ModalService } from 'util/genericServices/modal.service'; +import { VersionInfoComponent } from '../versionInfo/version-info.component'; +@Component({ + selector: 'info-modal', + templateUrl: 'info-modal.template.html', + styleUrls: ['info-modal.component.css'], + +}) +export class InfoModalComponent implements OnInit{ + kommonitorDataExchangeServiceInstance: any; + isHideGreetings: boolean = false; + tab1:any='null'; - this.kommonitorDataExchangeServiceInstance = kommonitorDataExchangeService; - $scope.isHideGreetings = false; + customGreetingsContact_name = "Test"; + customGreetingsContact_organisation = "Test"; + customGreetingsContact_mail = "Test"; + customGreetingsTextInfoMessage = "Test"; + constructor(private modalService: ModalService) { + this.customGreetingsContact_name = "Test"; + this.customGreetingsContact_organisation = "Test"; + this.customGreetingsContact_mail = "Test"; + this.customGreetingsTextInfoMessage = "Test"; + } + - //prevent bootrap modals tabs opened by a tag with href elements from adding their anchor location to - // URL - $("a[href^='#']").click(function(e) { - e.preventDefault(); - - }); + ngOnInit(): void { - $scope.init = function(){ - if(! (localStorage.getItem("hideKomMonitorAppGreeting") === "true")) { - - $scope.isHideGreetings = false; - $('#infoModal').modal('show'); - } - else{ - $scope.isHideGreetings = true; - $("#changeHideGreetingsInput").prop('checked', true); - } - let tab1 = document.getElementById("infoModalTab1"); - tab1.innerHTML = __env.standardInfoModalTabTitle; - tab1.click(); - tab1.focus(); + this.modalService.startGuidedTour$.subscribe(() => { + // Call a method to handle the guided tour event + this.callStartGuidedTour(); + }); + this.kommonitorDataExchangeServiceInstance = kommonitorDataExchangeServiceFactory; + + if (!(localStorage.getItem("hideKomMonitorAppGreeting") === "true")) { + this.isHideGreetings = false; + $('#infoModal').modal('show'); + } else { + this.isHideGreetings = true; + $("#changeHideGreetingsInput").prop('checked', true); + } - if(__env.enableExtendedInfoModal) { - let tab3 = document.getElementById("infoModalTab3"); - let tab3content = document.getElementById("infoModalTab3Content"); - tab3.innerHTML = __env.extendedInfoModalTabTitle; - tab3content.innerHTML = __env.extendedInfoModalHTMLMessage; - } else { - document.getElementById("infoModalTab3").style.display = "none"; - } - + const tab1 = document.getElementById("infoModalTab1"); + if(tab1 ){ + tab1.innerHTML = environment.standardInfoModalTabTitle; + tab1.click(); + tab1.focus(); + + - $timeout(function(){ - $scope.$digest(); - }, 250); - - }; + if (environment.enableExtendedInfoModal) { + const tab3 = document.getElementById("infoModalTab3"); + const tab3content = document.getElementById("infoModalTab3Content"); - var onChangeHideGreetings = function(){ - if($scope.isHideGreetings){ - localStorage.setItem("hideKomMonitorAppGreeting", "true"); - } - else{ - localStorage.setItem("hideKomMonitorAppGreeting", "false"); - } - }; + if (tab3 && tab3content) { + tab3.innerHTML = environment.extendedInfoModalTabTitle; + tab3content.innerHTML =environment.extendedInfoModalHTMLMessage; + } + else { + alert("not founde") + } + + } + else{ + console.log("content hasnt be loaded") + } + } + setTimeout(() => { + // You might need to use Angular's change detection instead of $digest + }, 250); + + + + + + + + } + - $('#changeHideGreetingsInput').on('click', function(event) { + onChangeHideGreetings(): void { + if (this.isHideGreetings) { + localStorage.setItem("hideKomMonitorAppGreeting", "true"); + } else { + localStorage.setItem("hideKomMonitorAppGreeting", "false"); + } + } - if($scope.isHideGreetings){ - $scope.isHideGreetings = false; - } - else{ - $scope.isHideGreetings = true; - } - onChangeHideGreetings(); - event.stopPropagation(); - }); + onToggleHideGreetings(): void { + this.isHideGreetings = !this.isHideGreetings; + localStorage.setItem("hideKomMonitorAppGreeting", this.isHideGreetings ? "true" : "false"); + } - var callStartGuidedTour = function(){ - $('#infoModal').modal('hide'); - $rootScope.$broadcast("startGuidedTour"); - }; + callStartGuidedTour(): void { + $('#infoModal').modal('hide'); + this.modalService.startGuidedTour(); - $(document).on('click', '#callStartGuidedTourButton', function (e) { - callStartGuidedTour(); - }); + } - $scope.showFeedbackForm = function(){ - $('#infoModal').modal('hide'); - $('#feedbackModal').modal('show'); - }; - - $scope.init(); - } -]}); + showFeedbackForm(): void { + $('#infoModal').modal('hide'); + $('#feedbackModal').modal('show'); + } +} diff --git a/app/components/kommonitorUserInterface/kommonitorControls/infoModal/info-modal.module.js b/app/components/kommonitorUserInterface/kommonitorControls/infoModal/info-modal.module.js index 9c9d0df40..69738db8d 100644 --- a/app/components/kommonitorUserInterface/kommonitorControls/infoModal/info-modal.module.js +++ b/app/components/kommonitorUserInterface/kommonitorControls/infoModal/info-modal.module.js @@ -1,3 +1,16 @@ -"use strict"; -angular.module('infoModal', ['versionInfo']); +import { __decorate } from "tslib"; +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { InfoModalComponent } from './info-modal.component'; +import { VersionInfoModule } from '../versionInfo/version-info.module'; +export let InfoModalModule = class InfoModalModule { +}; +InfoModalModule = __decorate([ + NgModule({ + declarations: [InfoModalComponent], + imports: [CommonModule, VersionInfoModule], + exports: [InfoModalComponent], + bootstrap: [InfoModalComponent] + }) +], InfoModalModule); //# sourceMappingURL=info-modal.module.js.map \ No newline at end of file diff --git a/app/components/kommonitorUserInterface/kommonitorControls/infoModal/info-modal.module.js.map b/app/components/kommonitorUserInterface/kommonitorControls/infoModal/info-modal.module.js.map index c10e24a3d..8f295cf72 100644 --- a/app/components/kommonitorUserInterface/kommonitorControls/infoModal/info-modal.module.js.map +++ b/app/components/kommonitorUserInterface/kommonitorControls/infoModal/info-modal.module.js.map @@ -1 +1 @@ -{"version":3,"file":"info-modal.module.js","sourceRoot":"","sources":["info-modal.module.ts"],"names":[],"mappings":";AAAA,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC"} \ No newline at end of file +{"version":3,"file":"info-modal.module.js","sourceRoot":"","sources":["info-modal.module.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AAShE,WAAM,eAAe,GAArB,MAAM,eAAe;CAE3B,CAAA;AAFY,eAAe;IAR3B,QAAQ,CAAC;QACV,YAAY,EAAC,CAAC,kBAAkB,CAAC;QACjC,OAAO,EAAC,CAAC,YAAY,EAAC,iBAAiB,CAAC;QACxC,OAAO,EAAC,CAAC,kBAAkB,CAAC;QAC5B,SAAS,EAAC,CAAC,kBAAkB,CAAC;KAE7B,CAAC;GAEW,eAAe,CAE3B"} \ No newline at end of file diff --git a/app/components/kommonitorUserInterface/kommonitorControls/infoModal/info-modal.module.ts b/app/components/kommonitorUserInterface/kommonitorControls/infoModal/info-modal.module.ts index 3b47b77ce..f862dfcd0 100644 --- a/app/components/kommonitorUserInterface/kommonitorControls/infoModal/info-modal.module.ts +++ b/app/components/kommonitorUserInterface/kommonitorControls/infoModal/info-modal.module.ts @@ -1 +1,15 @@ -angular.module('infoModal', ['versionInfo']); +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { InfoModalComponent } from './info-modal.component'; +import { VersionInfoModule } from '../versionInfo/version-info.module'; +@NgModule({ +declarations:[InfoModalComponent], +imports:[CommonModule,VersionInfoModule], +exports:[InfoModalComponent], +bootstrap:[InfoModalComponent] + +}) + +export class InfoModalModule{ + +} \ No newline at end of file diff --git a/app/components/kommonitorUserInterface/kommonitorControls/infoModal/info-modal.template.html b/app/components/kommonitorUserInterface/kommonitorControls/infoModal/info-modal.template.html index f77ca3f75..4ee19677f 100644 --- a/app/components/kommonitorUserInterface/kommonitorControls/infoModal/info-modal.template.html +++ b/app/components/kommonitorUserInterface/kommonitorControls/infoModal/info-modal.template.html @@ -21,7 +21,7 @@