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 = [
|
||||
{ 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({
|
||||
|
|
|
@ -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]
|
||||
})
|
||||
|
|
|
@ -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 = '<span class="highlight">';
|
||||
var highlightHTMLEnd = '</span>';
|
||||
// Add the highlight
|
||||
const highlightHTMLStart = '<span class="highlight">';
|
||||
const highlightHTMLEnd = '</span>';
|
||||
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<Match> = [];
|
||||
const matchesArray: Array<Match> = [];
|
||||
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 '<span class="positive">' + x + '</span>';
|
||||
});
|
||||
}
|
||||
// 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, '<span class="positive">' + ackn + '</span>');
|
||||
}
|
||||
// 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 '<span class="negative">' + x + '</span>';
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 => {
|
||||
|
|
|
@ -33,7 +33,7 @@ export class ContentsService {
|
|||
|
||||
contentsJsonToArray(json): Content[] {
|
||||
const contentArray: Array<Content> = [];
|
||||
for (let key in json) {
|
||||
for (const key in json) {
|
||||
if (key) {
|
||||
const content = new Content();
|
||||
content.keyword = key;
|
||||
|
|
|
@ -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<File> = evt.dataTransfer.files;
|
||||
const files: Array<File> = 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 {
|
||||
|
|
|
@ -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 = [
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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