1. Fix a bug with lazy-routing.
2. Fix some tslint issues.
This commit is contained in:
parent
dc977a3473
commit
e3b320f834
|
@ -3,7 +3,7 @@ import { RouterModule, Routes } from '@angular/router';
|
||||||
|
|
||||||
export const AppRoutes: Routes = [
|
export const AppRoutes: Routes = [
|
||||||
{ path: '', redirectTo: '/mining/manage-profiles?communityId=Egi', pathMatch: 'full' },
|
{ 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({
|
@NgModule({
|
||||||
|
|
|
@ -4,6 +4,7 @@ import {AppComponent} from './app.component';
|
||||||
import {AppRoutingModule} from './app-routing.module';
|
import {AppRoutingModule} from './app-routing.module';
|
||||||
import {Router} from '@angular/router';
|
import {Router} from '@angular/router';
|
||||||
import {BrowserModule} from '@angular/platform-browser';
|
import {BrowserModule} from '@angular/platform-browser';
|
||||||
|
import {InteractiveMiningModule} from './interactivemining/interactive-mining.module';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
declarations: [
|
declarations: [
|
||||||
|
@ -11,7 +12,8 @@ import {BrowserModule} from '@angular/platform-browser';
|
||||||
],
|
],
|
||||||
imports: [
|
imports: [
|
||||||
BrowserModule,
|
BrowserModule,
|
||||||
AppRoutingModule
|
AppRoutingModule,
|
||||||
|
InteractiveMiningModule
|
||||||
],
|
],
|
||||||
bootstrap: [AppComponent]
|
bootstrap: [AppComponent]
|
||||||
})
|
})
|
||||||
|
|
|
@ -97,13 +97,13 @@ export class ResultspreviewComponent implements OnInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
highlightInElement(element: string, text: string): string {
|
highlightInElement(element: string, text: string): string {
|
||||||
var elementHtml = element;
|
let elementHtml = element;
|
||||||
var tags = [];
|
const tags = [];
|
||||||
var tagLocations = [];
|
const tagLocations = [];
|
||||||
var htmlTagRegEx = /<{1}\/{0,1}\w+>{1}/;
|
const htmlTagRegEx = /<{1}\/{0,1}\w+>{1}/;
|
||||||
|
|
||||||
// Strip the tags from the elementHtml and keep track of them
|
// Strip the tags from the elementHtml and keep track of them
|
||||||
var htmlTag;
|
let htmlTag;
|
||||||
while (htmlTag = elementHtml.match(htmlTagRegEx)) {
|
while (htmlTag = elementHtml.match(htmlTagRegEx)) {
|
||||||
tagLocations[tagLocations.length] = elementHtml.search(htmlTagRegEx);
|
tagLocations[tagLocations.length] = elementHtml.search(htmlTagRegEx);
|
||||||
tags[tags.length] = htmlTag;
|
tags[tags.length] = htmlTag;
|
||||||
|
@ -111,18 +111,18 @@ export class ResultspreviewComponent implements OnInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Search for the text in the stripped html
|
// Search for the text in the stripped html
|
||||||
var textLocation = elementHtml.search(text);
|
const textLocation = elementHtml.search(text);
|
||||||
if (textLocation) {
|
if (textLocation) {
|
||||||
//Add the highlight
|
// Add the highlight
|
||||||
var highlightHTMLStart = '<span class="highlight">';
|
const highlightHTMLStart = '<span class="highlight">';
|
||||||
var highlightHTMLEnd = '</span>';
|
const highlightHTMLEnd = '</span>';
|
||||||
elementHtml = elementHtml.replace(text, highlightHTMLStart + text + highlightHTMLEnd);
|
elementHtml = elementHtml.replace(text, highlightHTMLStart + text + highlightHTMLEnd);
|
||||||
|
|
||||||
// Plug back in the HTML tags
|
// Plug back in the HTML tags
|
||||||
var textEndLocation = textLocation + text.length;
|
const textEndLocation = textLocation + text.length;
|
||||||
for(let i = tagLocations.length - 1; i >= 0; i--) {
|
for (let i = tagLocations.length - 1; i >= 0; i--) {
|
||||||
var location = tagLocations[i];
|
let location = tagLocations[i];
|
||||||
if(location > textEndLocation){
|
if (location > textEndLocation) {
|
||||||
location += highlightHTMLStart.length + highlightHTMLEnd.length;
|
location += highlightHTMLStart.length + highlightHTMLEnd.length;
|
||||||
} else if (location > textLocation) {
|
} else if (location > textLocation) {
|
||||||
location += highlightHTMLStart.length;
|
location += highlightHTMLStart.length;
|
||||||
|
@ -147,41 +147,41 @@ export class ResultspreviewComponent implements OnInit {
|
||||||
this.runingMining = false;
|
this.runingMining = false;
|
||||||
UIkit.modal(document.getElementById('wait-spinner-modal-center')).hide();
|
UIkit.modal(document.getElementById('wait-spinner-modal-center')).hide();
|
||||||
// enable sticky
|
// enable sticky
|
||||||
UIkit.sticky(document.getElementById("cm-run-test-section"), {
|
UIkit.sticky(document.getElementById('cm-run-test-section'), {
|
||||||
top: 25,
|
top: 25,
|
||||||
showOnUp: true,
|
showOnUp: true,
|
||||||
animation: "uk-animation-slide-top",
|
animation: 'uk-animation-slide-top',
|
||||||
bottom: ".cm-results-section"
|
bottom: '.cm-results-section'
|
||||||
});
|
});
|
||||||
this.resultsArray.length = 0;
|
this.resultsArray.length = 0;
|
||||||
let matchcounter = 0;
|
let matchcounter = 0;
|
||||||
for (let title in res.matches) {
|
for (const title in res.matches) {
|
||||||
if (title) {
|
if (title) {
|
||||||
const matches = res.matches[title];
|
const matches = res.matches[title];
|
||||||
let resultClass: DocumentResult = new DocumentResult();
|
const resultClass: DocumentResult = new DocumentResult();
|
||||||
resultClass.docTitle = title;
|
resultClass.docTitle = title;
|
||||||
let matchesArray: Array<Match> = [];
|
const matchesArray: Array<Match> = [];
|
||||||
resultClass.matches = matchesArray;
|
resultClass.matches = matchesArray;
|
||||||
for (let values of matches) {
|
for (const values of matches) {
|
||||||
let match: Match = new Match();
|
const match: Match = new Match();
|
||||||
match.match = values.match;
|
match.match = values.match;
|
||||||
match.extraprev = values.extraprev;
|
match.extraprev = values.extraprev;
|
||||||
match.extranext = values.extranext;
|
match.extranext = values.extranext;
|
||||||
let context = values.prev + ' ' + values.middle + ' ' + values.next;
|
let context = values.prev + ' ' + values.middle + ' ' + values.next;
|
||||||
// hightlight positive words
|
// 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');
|
const search_regexp = new RegExp(posword, 'g');
|
||||||
context = context.replace(search_regexp, function (x) {
|
context = context.replace(search_regexp, function (x) {
|
||||||
return '<span class="positive">' + x + '</span>';
|
return '<span class="positive">' + x + '</span>';
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// hightlight acknowledgment keywords
|
// hightlight acknowledgment keywords
|
||||||
for (let ackn of values.acknmatch) {
|
for (const ackn of values.acknmatch) {
|
||||||
const search_regexp = new RegExp(ackn.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&'), 'g');
|
const search_regexp = new RegExp(ackn.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&'), 'g');
|
||||||
context = context.replace(search_regexp, '<span class="positive">' + ackn + '</span>');
|
context = context.replace(search_regexp, '<span class="positive">' + ackn + '</span>');
|
||||||
}
|
}
|
||||||
// hightlight negative words
|
// 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');
|
const search_regexp = new RegExp(negword, 'g');
|
||||||
context = context.replace(search_regexp, function (x) {
|
context = context.replace(search_regexp, function (x) {
|
||||||
return '<span class="negative">' + x + '</span>';
|
return '<span class="negative">' + x + '</span>';
|
||||||
|
|
|
@ -73,7 +73,7 @@ export class SettingsComponent implements OnInit {
|
||||||
// show positive phrases
|
// show positive phrases
|
||||||
this.positivePhrasesArray.length = 0;
|
this.positivePhrasesArray.length = 0;
|
||||||
const posphrases = JSON.parse(localStorage.getItem('poswords'));
|
const posphrases = JSON.parse(localStorage.getItem('poswords'));
|
||||||
for (let key in posphrases) {
|
for (const key in posphrases) {
|
||||||
if (key) {
|
if (key) {
|
||||||
const content = new Phrase();
|
const content = new Phrase();
|
||||||
content.phrase = key;
|
content.phrase = key;
|
||||||
|
@ -84,7 +84,7 @@ export class SettingsComponent implements OnInit {
|
||||||
// show negative phrases
|
// show negative phrases
|
||||||
this.negativePhrasesArray.length = 0;
|
this.negativePhrasesArray.length = 0;
|
||||||
const negphrases = JSON.parse(localStorage.getItem('negwords'));
|
const negphrases = JSON.parse(localStorage.getItem('negwords'));
|
||||||
for (let key in negphrases) {
|
for (const key in negphrases) {
|
||||||
if (key) {
|
if (key) {
|
||||||
const content = new Phrase();
|
const content = new Phrase();
|
||||||
content.phrase = key;
|
content.phrase = key;
|
||||||
|
@ -127,7 +127,7 @@ export class SettingsComponent implements OnInit {
|
||||||
localStorage.setItem('poswords', phrases);
|
localStorage.setItem('poswords', phrases);
|
||||||
this.positivePhrasesArray.length = 0;
|
this.positivePhrasesArray.length = 0;
|
||||||
const posphrases = JSON.parse(localStorage.getItem('poswords'));
|
const posphrases = JSON.parse(localStorage.getItem('poswords'));
|
||||||
for (let key in posphrases) {
|
for (const key in posphrases) {
|
||||||
if (key) {
|
if (key) {
|
||||||
const content = new Phrase();
|
const content = new Phrase();
|
||||||
content.phrase = key;
|
content.phrase = key;
|
||||||
|
@ -139,7 +139,7 @@ export class SettingsComponent implements OnInit {
|
||||||
localStorage.setItem('negwords', phrases);
|
localStorage.setItem('negwords', phrases);
|
||||||
this.negativePhrasesArray.length = 0;
|
this.negativePhrasesArray.length = 0;
|
||||||
const negphrases = JSON.parse(localStorage.getItem('negwords'));
|
const negphrases = JSON.parse(localStorage.getItem('negwords'));
|
||||||
for (let key in negphrases) {
|
for (const key in negphrases) {
|
||||||
if (key) {
|
if (key) {
|
||||||
const content = new Phrase();
|
const content = new Phrase();
|
||||||
content.phrase = key;
|
content.phrase = key;
|
||||||
|
|
|
@ -90,8 +90,8 @@ export class ContentComponent implements OnInit {
|
||||||
onFilesChange(file: File) {
|
onFilesChange(file: File) {
|
||||||
if (file !== null && file !== undefined) {
|
if (file !== null && file !== undefined) {
|
||||||
console.log(file);
|
console.log(file);
|
||||||
let ext = file.name.split('.')[file.name.split('.').length - 1];
|
const ext = file.name.split('.')[file.name.split('.').length - 1];
|
||||||
let allowedExtensions = ['tsv', 'txt'];
|
const allowedExtensions = ['tsv', 'txt'];
|
||||||
if (allowedExtensions.lastIndexOf(ext) !== -1 && file.size <= 51200) {
|
if (allowedExtensions.lastIndexOf(ext) !== -1 && file.size <= 51200) {
|
||||||
this.contentsService.uploadFile(file)
|
this.contentsService.uploadFile(file)
|
||||||
.subscribe(contents => {
|
.subscribe(contents => {
|
||||||
|
|
|
@ -33,7 +33,7 @@ export class ContentsService {
|
||||||
|
|
||||||
contentsJsonToArray(json): Content[] {
|
contentsJsonToArray(json): Content[] {
|
||||||
const contentArray: Array<Content> = [];
|
const contentArray: Array<Content> = [];
|
||||||
for (let key in json) {
|
for (const key in json) {
|
||||||
if (key) {
|
if (key) {
|
||||||
const content = new Content();
|
const content = new Content();
|
||||||
content.keyword = key;
|
content.keyword = key;
|
||||||
|
|
|
@ -29,12 +29,12 @@ export class FileUploadDirective {
|
||||||
evt.preventDefault();
|
evt.preventDefault();
|
||||||
evt.stopPropagation();
|
evt.stopPropagation();
|
||||||
this.background = 'uk-placeholder cm-file-drop-area cm-coloured-text';
|
this.background = 'uk-placeholder cm-file-drop-area cm-coloured-text';
|
||||||
let files: Array<File> = evt.dataTransfer.files;
|
const files: Array<File> = evt.dataTransfer.files;
|
||||||
let valid_file: File = null;
|
let valid_file: File = null;
|
||||||
let invalid_file: File = null;
|
let invalid_file: File = null;
|
||||||
if (files.length === 1) {
|
if (files.length === 1) {
|
||||||
let file = files[0];
|
const file = files[0];
|
||||||
let ext = file.name.split('.')[file.name.split('.').length - 1];
|
const ext = file.name.split('.')[file.name.split('.').length - 1];
|
||||||
if (this.allowedExtensions.lastIndexOf(ext) !== -1 && file.size <= this.maxFileSize) {
|
if (this.allowedExtensions.lastIndexOf(ext) !== -1 && file.size <= this.maxFileSize) {
|
||||||
valid_file = file;
|
valid_file = file;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -4,7 +4,6 @@ import {SaveprofileComponent} from '../saveprofile/saveprofile.component';
|
||||||
import {ConfigurationComponent} from '../configuration/configuration.component';
|
import {ConfigurationComponent} from '../configuration/configuration.component';
|
||||||
import {ContentComponent} from '../contents/contents.component';
|
import {ContentComponent} from '../contents/contents.component';
|
||||||
import {ManageprofilesComponent} from '../manageprofiles/manageprofiles.component';
|
import {ManageprofilesComponent} from '../manageprofiles/manageprofiles.component';
|
||||||
import {InteractiveMiningComponent} from './interactive-mining.component';
|
|
||||||
import {SaveProfileGuard, UploadContentGuard} from './save-profile-guard';
|
import {SaveProfileGuard, UploadContentGuard} from './save-profile-guard';
|
||||||
|
|
||||||
const interactiveMiningRoutes: Routes = [
|
const interactiveMiningRoutes: Routes = [
|
||||||
|
|
|
@ -5,24 +5,15 @@ import {ManageprofilesModule} from '../manageprofiles/manageprofiles.module';
|
||||||
import {SaveprofileModule} from '../saveprofile/saveprofile.module';
|
import {SaveprofileModule} from '../saveprofile/saveprofile.module';
|
||||||
import {ContentModule} from '../contents/contents.module';
|
import {ContentModule} from '../contents/contents.module';
|
||||||
import {HttpClientModule} from '@angular/common/http';
|
import {HttpClientModule} from '@angular/common/http';
|
||||||
import {InteractiveMiningRoutingModule} from './interactive-mining-routing.module';
|
|
||||||
import {InteractiveMiningComponent} from './interactive-mining.component';
|
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
CommonModule,
|
CommonModule,
|
||||||
InteractiveMiningRoutingModule,
|
|
||||||
ManageprofilesModule,
|
ManageprofilesModule,
|
||||||
ContentModule,
|
ContentModule,
|
||||||
ConfigurationModule,
|
ConfigurationModule,
|
||||||
SaveprofileModule,
|
SaveprofileModule,
|
||||||
HttpClientModule
|
HttpClientModule
|
||||||
],
|
|
||||||
declarations: [
|
|
||||||
InteractiveMiningComponent
|
|
||||||
],
|
|
||||||
exports: [
|
|
||||||
InteractiveMiningComponent
|
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class InteractiveMiningModule {
|
export class InteractiveMiningModule {
|
||||||
|
|
|
@ -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 {
|
||||||
|
}
|
Loading…
Reference in New Issue