diff --git a/interactive-mining-angular-frontend/src/app/app-routing.module.ts b/interactive-mining-angular-frontend/src/app/app-routing.module.ts index 99ba12d..e35cbec 100755 --- a/interactive-mining-angular-frontend/src/app/app-routing.module.ts +++ b/interactive-mining-angular-frontend/src/app/app-routing.module.ts @@ -3,7 +3,7 @@ import { RouterModule, Routes } from '@angular/router'; export const AppRoutes: Routes = [ { path: '', redirectTo: '/mining/manage-profiles?communityId=Egi', pathMatch: 'full' }, - { path: 'mining', loadChildren: './interactivemining/interactive-mining.module#InteractiveMiningModule'} + { path: 'mining', loadChildren: './lazy-mining.module#LazyMiningModule'} ]; @NgModule({ diff --git a/interactive-mining-angular-frontend/src/app/app.module.ts b/interactive-mining-angular-frontend/src/app/app.module.ts index f61e18b..394d46f 100755 --- a/interactive-mining-angular-frontend/src/app/app.module.ts +++ b/interactive-mining-angular-frontend/src/app/app.module.ts @@ -4,6 +4,7 @@ import {AppComponent} from './app.component'; import {AppRoutingModule} from './app-routing.module'; import {Router} from '@angular/router'; import {BrowserModule} from '@angular/platform-browser'; +import {InteractiveMiningModule} from './interactivemining/interactive-mining.module'; @NgModule({ declarations: [ @@ -11,7 +12,8 @@ import {BrowserModule} from '@angular/platform-browser'; ], imports: [ BrowserModule, - AppRoutingModule + AppRoutingModule, + InteractiveMiningModule ], bootstrap: [AppComponent] }) diff --git a/interactive-mining-angular-frontend/src/app/configuration/resultspreview/resultspreview.component.ts b/interactive-mining-angular-frontend/src/app/configuration/resultspreview/resultspreview.component.ts index 9e7ae69..d22b71a 100755 --- a/interactive-mining-angular-frontend/src/app/configuration/resultspreview/resultspreview.component.ts +++ b/interactive-mining-angular-frontend/src/app/configuration/resultspreview/resultspreview.component.ts @@ -97,13 +97,13 @@ export class ResultspreviewComponent implements OnInit { } highlightInElement(element: string, text: string): string { - var elementHtml = element; - var tags = []; - var tagLocations = []; - var htmlTagRegEx = /<{1}\/{0,1}\w+>{1}/; + let elementHtml = element; + const tags = []; + const tagLocations = []; + const htmlTagRegEx = /<{1}\/{0,1}\w+>{1}/; // Strip the tags from the elementHtml and keep track of them - var htmlTag; + let htmlTag; while (htmlTag = elementHtml.match(htmlTagRegEx)) { tagLocations[tagLocations.length] = elementHtml.search(htmlTagRegEx); tags[tags.length] = htmlTag; @@ -111,18 +111,18 @@ export class ResultspreviewComponent implements OnInit { } // Search for the text in the stripped html - var textLocation = elementHtml.search(text); + const textLocation = elementHtml.search(text); if (textLocation) { - //Add the highlight - var highlightHTMLStart = ''; - var highlightHTMLEnd = ''; + // Add the highlight + const highlightHTMLStart = ''; + const highlightHTMLEnd = ''; elementHtml = elementHtml.replace(text, highlightHTMLStart + text + highlightHTMLEnd); // Plug back in the HTML tags - var textEndLocation = textLocation + text.length; - for(let i = tagLocations.length - 1; i >= 0; i--) { - var location = tagLocations[i]; - if(location > textEndLocation){ + const textEndLocation = textLocation + text.length; + for (let i = tagLocations.length - 1; i >= 0; i--) { + let location = tagLocations[i]; + if (location > textEndLocation) { location += highlightHTMLStart.length + highlightHTMLEnd.length; } else if (location > textLocation) { location += highlightHTMLStart.length; @@ -147,41 +147,41 @@ export class ResultspreviewComponent implements OnInit { this.runingMining = false; UIkit.modal(document.getElementById('wait-spinner-modal-center')).hide(); // enable sticky - UIkit.sticky(document.getElementById("cm-run-test-section"), { + UIkit.sticky(document.getElementById('cm-run-test-section'), { top: 25, showOnUp: true, - animation: "uk-animation-slide-top", - bottom: ".cm-results-section" + animation: 'uk-animation-slide-top', + bottom: '.cm-results-section' }); this.resultsArray.length = 0; let matchcounter = 0; - for (let title in res.matches) { + for (const title in res.matches) { if (title) { const matches = res.matches[title]; - let resultClass: DocumentResult = new DocumentResult(); + const resultClass: DocumentResult = new DocumentResult(); resultClass.docTitle = title; - let matchesArray: Array = []; + const matchesArray: Array = []; resultClass.matches = matchesArray; - for (let values of matches) { - let match: Match = new Match(); + for (const values of matches) { + const match: Match = new Match(); match.match = values.match; match.extraprev = values.extraprev; match.extranext = values.extranext; let context = values.prev + ' ' + values.middle + ' ' + values.next; // hightlight positive words - for (let posword in JSON.parse(localStorage.getItem('poswords'))) { + for (const posword in JSON.parse(localStorage.getItem('poswords'))) { const search_regexp = new RegExp(posword, 'g'); context = context.replace(search_regexp, function (x) { return '' + x + ''; }); } // hightlight acknowledgment keywords - for (let ackn of values.acknmatch) { + for (const ackn of values.acknmatch) { const search_regexp = new RegExp(ackn.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&'), 'g'); context = context.replace(search_regexp, '' + ackn + ''); } // hightlight negative words - for (let negword in JSON.parse(localStorage.getItem('negwords'))) { + for (const negword in JSON.parse(localStorage.getItem('negwords'))) { const search_regexp = new RegExp(negword, 'g'); context = context.replace(search_regexp, function (x) { return '' + x + ''; diff --git a/interactive-mining-angular-frontend/src/app/configuration/settings/settings.component.ts b/interactive-mining-angular-frontend/src/app/configuration/settings/settings.component.ts index 6766931..e65d4be 100755 --- a/interactive-mining-angular-frontend/src/app/configuration/settings/settings.component.ts +++ b/interactive-mining-angular-frontend/src/app/configuration/settings/settings.component.ts @@ -73,7 +73,7 @@ export class SettingsComponent implements OnInit { // show positive phrases this.positivePhrasesArray.length = 0; const posphrases = JSON.parse(localStorage.getItem('poswords')); - for (let key in posphrases) { + for (const key in posphrases) { if (key) { const content = new Phrase(); content.phrase = key; @@ -84,7 +84,7 @@ export class SettingsComponent implements OnInit { // show negative phrases this.negativePhrasesArray.length = 0; const negphrases = JSON.parse(localStorage.getItem('negwords')); - for (let key in negphrases) { + for (const key in negphrases) { if (key) { const content = new Phrase(); content.phrase = key; @@ -127,7 +127,7 @@ export class SettingsComponent implements OnInit { localStorage.setItem('poswords', phrases); this.positivePhrasesArray.length = 0; const posphrases = JSON.parse(localStorage.getItem('poswords')); - for (let key in posphrases) { + for (const key in posphrases) { if (key) { const content = new Phrase(); content.phrase = key; @@ -139,7 +139,7 @@ export class SettingsComponent implements OnInit { localStorage.setItem('negwords', phrases); this.negativePhrasesArray.length = 0; const negphrases = JSON.parse(localStorage.getItem('negwords')); - for (let key in negphrases) { + for (const key in negphrases) { if (key) { const content = new Phrase(); content.phrase = key; diff --git a/interactive-mining-angular-frontend/src/app/contents/contents.component.ts b/interactive-mining-angular-frontend/src/app/contents/contents.component.ts index 7b3ae02..04567c5 100755 --- a/interactive-mining-angular-frontend/src/app/contents/contents.component.ts +++ b/interactive-mining-angular-frontend/src/app/contents/contents.component.ts @@ -90,8 +90,8 @@ export class ContentComponent implements OnInit { onFilesChange(file: File) { if (file !== null && file !== undefined) { console.log(file); - let ext = file.name.split('.')[file.name.split('.').length - 1]; - let allowedExtensions = ['tsv', 'txt']; + const ext = file.name.split('.')[file.name.split('.').length - 1]; + const allowedExtensions = ['tsv', 'txt']; if (allowedExtensions.lastIndexOf(ext) !== -1 && file.size <= 51200) { this.contentsService.uploadFile(file) .subscribe(contents => { diff --git a/interactive-mining-angular-frontend/src/app/contents/contents.service.ts b/interactive-mining-angular-frontend/src/app/contents/contents.service.ts index 22641bf..759c582 100755 --- a/interactive-mining-angular-frontend/src/app/contents/contents.service.ts +++ b/interactive-mining-angular-frontend/src/app/contents/contents.service.ts @@ -33,7 +33,7 @@ export class ContentsService { contentsJsonToArray(json): Content[] { const contentArray: Array = []; - for (let key in json) { + for (const key in json) { if (key) { const content = new Content(); content.keyword = key; diff --git a/interactive-mining-angular-frontend/src/app/file-upload.directive.ts b/interactive-mining-angular-frontend/src/app/file-upload.directive.ts index 4530970..94d13e4 100755 --- a/interactive-mining-angular-frontend/src/app/file-upload.directive.ts +++ b/interactive-mining-angular-frontend/src/app/file-upload.directive.ts @@ -29,12 +29,12 @@ export class FileUploadDirective { evt.preventDefault(); evt.stopPropagation(); this.background = 'uk-placeholder cm-file-drop-area cm-coloured-text'; - let files: Array = evt.dataTransfer.files; + const files: Array = evt.dataTransfer.files; let valid_file: File = null; let invalid_file: File = null; if (files.length === 1) { - let file = files[0]; - let ext = file.name.split('.')[file.name.split('.').length - 1]; + const file = files[0]; + const ext = file.name.split('.')[file.name.split('.').length - 1]; if (this.allowedExtensions.lastIndexOf(ext) !== -1 && file.size <= this.maxFileSize) { valid_file = file; } else { diff --git a/interactive-mining-angular-frontend/src/app/interactivemining/interactive-mining-routing.module.ts b/interactive-mining-angular-frontend/src/app/interactivemining/interactive-mining-routing.module.ts index 077a3ae..63dec4c 100755 --- a/interactive-mining-angular-frontend/src/app/interactivemining/interactive-mining-routing.module.ts +++ b/interactive-mining-angular-frontend/src/app/interactivemining/interactive-mining-routing.module.ts @@ -4,7 +4,6 @@ import {SaveprofileComponent} from '../saveprofile/saveprofile.component'; import {ConfigurationComponent} from '../configuration/configuration.component'; import {ContentComponent} from '../contents/contents.component'; import {ManageprofilesComponent} from '../manageprofiles/manageprofiles.component'; -import {InteractiveMiningComponent} from './interactive-mining.component'; import {SaveProfileGuard, UploadContentGuard} from './save-profile-guard'; const interactiveMiningRoutes: Routes = [ diff --git a/interactive-mining-angular-frontend/src/app/interactivemining/interactive-mining.module.ts b/interactive-mining-angular-frontend/src/app/interactivemining/interactive-mining.module.ts index 3dd6c91..99804c9 100755 --- a/interactive-mining-angular-frontend/src/app/interactivemining/interactive-mining.module.ts +++ b/interactive-mining-angular-frontend/src/app/interactivemining/interactive-mining.module.ts @@ -5,24 +5,15 @@ import {ManageprofilesModule} from '../manageprofiles/manageprofiles.module'; import {SaveprofileModule} from '../saveprofile/saveprofile.module'; import {ContentModule} from '../contents/contents.module'; import {HttpClientModule} from '@angular/common/http'; -import {InteractiveMiningRoutingModule} from './interactive-mining-routing.module'; -import {InteractiveMiningComponent} from './interactive-mining.component'; @NgModule({ imports: [ CommonModule, - InteractiveMiningRoutingModule, ManageprofilesModule, ContentModule, ConfigurationModule, SaveprofileModule, HttpClientModule - ], - declarations: [ - InteractiveMiningComponent - ], - exports: [ - InteractiveMiningComponent ] }) export class InteractiveMiningModule { diff --git a/interactive-mining-angular-frontend/src/app/lazy-mining.module.ts b/interactive-mining-angular-frontend/src/app/lazy-mining.module.ts new file mode 100644 index 0000000..532cf8a --- /dev/null +++ b/interactive-mining-angular-frontend/src/app/lazy-mining.module.ts @@ -0,0 +1,12 @@ +import {NgModule} from '@angular/core'; +import {InteractiveMiningRoutingModule} from './interactivemining/interactive-mining-routing.module'; +import {InteractiveMiningModule} from './interactivemining/interactive-mining.module'; + +@NgModule({ + imports: [ + InteractiveMiningModule, + InteractiveMiningRoutingModule + ] +}) +export class LazyMiningModule { +}