You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nlpcraft.apache.org by sm...@apache.org on 2020/03/08 18:42:20 UTC
[incubator-nlpcraft-ui] branch master updated: Fix TSLint issues.
This is an automated email from the ASF dual-hosted git repository.
smakov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nlpcraft-ui.git
The following commit(s) were added to refs/heads/master by this push:
new a5787f6 Fix TSLint issues.
a5787f6 is described below
commit a5787f6b0c31335a69e62ab3ae8a5c1eaef5a733
Author: smakov <sm...@apache.org>
AuthorDate: Sun Mar 8 21:41:24 2020 +0300
Fix TSLint issues.
---
e2e/src/app.e2e-spec.ts | 12 ++++----
src/app/app-routing.module.ts | 2 +-
src/app/app.component.ts | 2 +-
src/app/app.module.ts | 8 ++---
src/app/services/rest/rest-error.interceptor.ts | 2 +-
src/app/services/rest/rest-url.interceptor.ts | 2 +-
src/app/services/rest/rest-url.service.ts | 6 ++--
src/app/services/session/session.service.ts | 12 ++++----
src/app/ui/login/login.component.ts | 20 ++++++-------
src/app/ui/main/chat/chat.component.ts | 40 ++++++++++++-------------
src/app/ui/main/main.component.ts | 16 +++++-----
src/app/ui/utils/error.component.ts | 4 +--
src/app/ui/utils/load-spinner.component.ts | 2 +-
src/environments/environment.prod.ts | 2 +-
src/environments/environment.ts | 2 +-
src/main.ts | 2 +-
src/polyfills.ts | 2 +-
src/test.ts | 6 ++--
18 files changed, 71 insertions(+), 71 deletions(-)
diff --git a/e2e/src/app.e2e-spec.ts b/e2e/src/app.e2e-spec.ts
index a189a97..1275481 100644
--- a/e2e/src/app.e2e-spec.ts
+++ b/e2e/src/app.e2e-spec.ts
@@ -19,22 +19,22 @@ import {browser, logging} from 'protractor'
import {AppPage} from './app.po'
describe('workspace-project App', () => {
- let page: AppPage;
+ let page: AppPage
beforeEach(() => {
page = new AppPage()
- });
+ })
it('should display welcome message', () => {
- page.navigateTo();
+ page.navigateTo()
expect(page.getTitleText()).toEqual('Welcome to web-app!')
- });
+ })
afterEach(async () => {
// Assert that there are no errors emitted from the browser
- const logs = await browser.manage().logs().get(logging.Type.BROWSER);
+ const logs = await browser.manage().logs().get(logging.Type.BROWSER)
expect(logs).not.toContain(jasmine.objectContaining({
level: logging.Level.SEVERE
} as logging.Entry))
})
-});
+})
diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts
index f7aa923..b31a945 100644
--- a/src/app/app-routing.module.ts
+++ b/src/app/app-routing.module.ts
@@ -36,7 +36,7 @@ const routes: Routes = [
redirectTo: '/main',
pathMatch: 'full'
}
-];
+]
@NgModule({
imports: [RouterModule.forRoot(routes, {useHash: true})],
diff --git a/src/app/app.component.ts b/src/app/app.component.ts
index 084de73..c432276 100644
--- a/src/app/app.component.ts
+++ b/src/app/app.component.ts
@@ -26,7 +26,7 @@ import {SessionService} from './services/session/session.service'
styleUrls: ['./app.component.css']
})
export class AppComponent implements OnInit, OnDestroy {
- private _sessionSub: Subscription;
+ private _sessionSub: Subscription
constructor(
private _router: RouterService,
diff --git a/src/app/app.module.ts b/src/app/app.module.ts
index 435c1e5..18c6b1f 100644
--- a/src/app/app.module.ts
+++ b/src/app/app.module.ts
@@ -82,9 +82,9 @@ import {LoadSpinnerComponent} from './ui/utils/load-spinner.component'
})
export class AppModule {
constructor() {
- library.add(faSpinner);
- library.add(faSignOutAlt);
- library.add(faTrashAlt);
- library.add(faCommentSlash);
+ library.add(faSpinner)
+ library.add(faSignOutAlt)
+ library.add(faTrashAlt)
+ library.add(faCommentSlash)
}
}
diff --git a/src/app/services/rest/rest-error.interceptor.ts b/src/app/services/rest/rest-error.interceptor.ts
index 90497be..e573502 100644
--- a/src/app/services/rest/rest-error.interceptor.ts
+++ b/src/app/services/rest/rest-error.interceptor.ts
@@ -33,7 +33,7 @@ export class RestErrorInterceptor implements HttpInterceptor {
return next.handle(req)
.pipe(
catchError(err => {
- this.check(err);
+ this.check(err)
return throwError(err)
})
diff --git a/src/app/services/rest/rest-url.interceptor.ts b/src/app/services/rest/rest-url.interceptor.ts
index 73aed6f..57556d3 100644
--- a/src/app/services/rest/rest-url.interceptor.ts
+++ b/src/app/services/rest/rest-url.interceptor.ts
@@ -34,7 +34,7 @@ export class RestUrlInterceptor implements HttpInterceptor {
intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
const nextReq = req.clone({
url: this._rest.url(req.url)
- });
+ })
return next.handle(nextReq)
}
diff --git a/src/app/services/rest/rest-url.service.ts b/src/app/services/rest/rest-url.service.ts
index 2b4c270..265979b 100644
--- a/src/app/services/rest/rest-url.service.ts
+++ b/src/app/services/rest/rest-url.service.ts
@@ -19,9 +19,9 @@ import {Injectable} from '@angular/core'
@Injectable()
export class RestUrlService {
- private static readonly API_ENDPOINT_KEY = 'api_endpoint';
+ private static readonly API_ENDPOINT_KEY = 'api_endpoint'
- private _apiEndpoint: string;
+ private _apiEndpoint: string
constructor() {
this._apiEndpoint = localStorage.getItem(RestUrlService.API_ENDPOINT_KEY)
@@ -36,7 +36,7 @@ export class RestUrlService {
value = value.substring(0, value.length - 1)
}
- this._apiEndpoint = value;
+ this._apiEndpoint = value
if (value) {
localStorage.setItem(RestUrlService.API_ENDPOINT_KEY, value)
diff --git a/src/app/services/session/session.service.ts b/src/app/services/session/session.service.ts
index 5e73cd4..473766a 100644
--- a/src/app/services/session/session.service.ts
+++ b/src/app/services/session/session.service.ts
@@ -23,7 +23,9 @@ import {LoginResponseDto, Session} from './session.model'
@Injectable()
export class SessionService {
- private static readonly STORE_TOKEN_KEY = 'tok';
+ private static readonly STORE_TOKEN_KEY = 'tok'
+
+ private _sessionChanges: BehaviorSubject<Session> = new BehaviorSubject(null)
constructor(
private _http: HttpClient
@@ -31,8 +33,6 @@ export class SessionService {
// No-op.
}
- private _sessionChanges: BehaviorSubject<Session> = new BehaviorSubject(null);
-
get sessionChanges(): Observable<Session> {
return this._sessionChanges.asObservable()
}
@@ -58,7 +58,7 @@ export class SessionService {
}
ping(): Promise<Session> {
- const tok = sessionStorage.getItem(SessionService.STORE_TOKEN_KEY);
+ const tok = sessionStorage.getItem(SessionService.STORE_TOKEN_KEY)
if (tok) {
return this._http
@@ -96,13 +96,13 @@ export class SessionService {
}
clear() {
- sessionStorage.removeItem(SessionService.STORE_TOKEN_KEY);
+ sessionStorage.removeItem(SessionService.STORE_TOKEN_KEY)
this._sessionChanges.next(null)
}
private initSession(session: Session) {
- sessionStorage.setItem(SessionService.STORE_TOKEN_KEY, session.token);
+ sessionStorage.setItem(SessionService.STORE_TOKEN_KEY, session.token)
this._sessionChanges.next(session)
}
diff --git a/src/app/ui/login/login.component.ts b/src/app/ui/login/login.component.ts
index 36764e5..0ef33b9 100644
--- a/src/app/ui/login/login.component.ts
+++ b/src/app/ui/login/login.component.ts
@@ -28,18 +28,18 @@ import {SessionService} from '../../services/session/session.service'
styleUrls: ['./login.component.css']
})
export class LoginComponent implements OnInit {
- apiEndpoint: string;
+ apiEndpoint: string
- email: string;
+ email: string
- password: string;
+ password: string
@ViewChild('loginForm')
- private _loginForm: NgForm;
+ private _loginForm: NgForm
- private _error: any;
+ private _error: any
- private _loading = false;
+ private _loading = false
constructor(
private _restUrl: RestUrlService,
@@ -64,12 +64,12 @@ export class LoginComponent implements OnInit {
public async login() {
if (this._loginForm.valid) {
try {
- this._loading = true;
- this._error = null;
+ this._loading = true
+ this._error = null
- this._restUrl.apiEndpoint = this.apiEndpoint;
+ this._restUrl.apiEndpoint = this.apiEndpoint
- await this._sessions.login(this.email, this.password).toPromise();
+ await this._sessions.login(this.email, this.password).toPromise()
this._routing.goToMain()
} catch (e) {
diff --git a/src/app/ui/main/chat/chat.component.ts b/src/app/ui/main/chat/chat.component.ts
index 45b9721..19bea1e 100644
--- a/src/app/ui/main/chat/chat.component.ts
+++ b/src/app/ui/main/chat/chat.component.ts
@@ -25,20 +25,20 @@ import {NlpService} from '../../../services/nlp/nlp.service'
styleUrls: ['./chat.component.css']
})
export class ChatComponent implements OnInit, OnDestroy {
- queryText: string;
+ queryText: string
- selectedModelId: string;
+ selectedModelId: string
- selectedQuery: NlpQueryState;
+ selectedQuery: NlpQueryState
@Input()
- allProbes: NlpProbe[];
+ allProbes: NlpProbe[]
- private _states: NlpQueryState[];
+ private _states: NlpQueryState[]
- private _error: any;
+ private _error: any
- private _timer: number;
+ private _timer: number
constructor(
private _nlp: NlpService
@@ -59,9 +59,9 @@ export class ChatComponent implements OnInit, OnDestroy {
}
async ngOnInit() {
- this.trySelectDefaultModel();
+ this.trySelectDefaultModel()
- await this.checkStatus();
+ await this.checkStatus()
this._timer = setInterval(async () => {
if (this._states && this._states.find(s => s.status === 'QRY_ENLISTED')) {
@@ -75,20 +75,20 @@ export class ChatComponent implements OnInit, OnDestroy {
}
allModels(): NlpModel[] {
- const allModels: NlpModel[] = [];
+ const allModels: NlpModel[] = []
this.allProbes.forEach(p => {
p.models.forEach(m => {
allModels.push(m)
})
- });
+ })
return allModels
}
async checkStatus() {
try {
- this._states = (await this._nlp.check().toPromise()).states;
+ this._states = (await this._nlp.check().toPromise()).states
if (this.selectedQuery) {
this.selectQuery(this.selectedQuery.srvReqId)
@@ -99,18 +99,18 @@ export class ChatComponent implements OnInit, OnDestroy {
}
async ask() {
- const query = this.queryText.trim();
+ const query = this.queryText.trim()
if (this.selectedModelId && query.length > 0) {
- this.queryText = '';
+ this.queryText = ''
try {
- this._error = null;
- this.selectedQuery = null;
+ this._error = null
+ this.selectedQuery = null
- const reqId = (await this._nlp.ask(query, this.selectedModelId).toPromise()).srvReqId;
+ const reqId = (await this._nlp.ask(query, this.selectedModelId).toPromise()).srvReqId
- await this.checkStatus();
+ await this.checkStatus()
this.selectQuery(reqId)
} catch (e) {
@@ -122,7 +122,7 @@ export class ChatComponent implements OnInit, OnDestroy {
async clear() {
if (this._states) {
try {
- this._error = null;
+ this._error = null
await this._nlp.cancel(this._states.map(it => it.srvReqId)).toPromise()
} catch (e) {
@@ -136,7 +136,7 @@ export class ChatComponent implements OnInit, OnDestroy {
async clearConversation() {
if (this.selectedModelId) {
try {
- this._error = null;
+ this._error = null
await this._nlp.clearConversation(this.selectedModelId).toPromise()
} catch (e) {
diff --git a/src/app/ui/main/main.component.ts b/src/app/ui/main/main.component.ts
index 071a233..a507623 100644
--- a/src/app/ui/main/main.component.ts
+++ b/src/app/ui/main/main.component.ts
@@ -25,13 +25,13 @@ import {NlpService} from '../../services/nlp/nlp.service'
styleUrls: ['./main.component.css']
})
export class MainComponent implements OnInit, OnDestroy {
- private _error: any;
+ private _error: any
- private _loading = false;
+ private _loading = false
- private _allProbes: NlpProbe[];
+ private _allProbes: NlpProbe[]
- private _timer: number;
+ private _timer: number
constructor(
private _nlp: NlpService
@@ -58,10 +58,10 @@ export class MainComponent implements OnInit, OnDestroy {
async ngOnInit() {
this._timer = setInterval(async () => {
await this.loadProbes()
- }, 1000);
+ }, 1000)
try {
- this._loading = true;
+ this._loading = true
await this.loadProbes()
} finally {
@@ -75,7 +75,7 @@ export class MainComponent implements OnInit, OnDestroy {
private async loadProbes() {
try {
- this._allProbes = (await this._nlp.allProbes().toPromise()).probes;
+ this._allProbes = (await this._nlp.allProbes().toPromise()).probes
if (!this.hasProbes) {
this._error = 'No NLPCraft Probe to talk to :('
@@ -83,7 +83,7 @@ export class MainComponent implements OnInit, OnDestroy {
this._error = null
}
} catch (e) {
- this._allProbes = null;
+ this._allProbes = null
this._error = e
}
diff --git a/src/app/ui/utils/error.component.ts b/src/app/ui/utils/error.component.ts
index 5426790..9f59ff7 100644
--- a/src/app/ui/utils/error.component.ts
+++ b/src/app/ui/utils/error.component.ts
@@ -29,10 +29,10 @@ import {Component, Input} from '@angular/core'
})
export class ErrorComponent {
@Input()
- error: any;
+ error: any
@Input()
- authError: string;
+ authError: string
get hasError(): boolean {
return !!this.error
diff --git a/src/app/ui/utils/load-spinner.component.ts b/src/app/ui/utils/load-spinner.component.ts
index 3214c23..6cbcd3e 100644
--- a/src/app/ui/utils/load-spinner.component.ts
+++ b/src/app/ui/utils/load-spinner.component.ts
@@ -31,7 +31,7 @@ import {Component, Input} from '@angular/core'
})
export class LoadSpinnerComponent {
@Input()
- message: string;
+ message: string
resolveMessage(): string {
return this.message ? this.message : 'Loading...'
diff --git a/src/environments/environment.prod.ts b/src/environments/environment.prod.ts
index baa0c22..9071230 100644
--- a/src/environments/environment.prod.ts
+++ b/src/environments/environment.prod.ts
@@ -17,4 +17,4 @@
export const environment = {
production: true
-};
+}
diff --git a/src/environments/environment.ts b/src/environments/environment.ts
index 543bc04..18670f5 100644
--- a/src/environments/environment.ts
+++ b/src/environments/environment.ts
@@ -21,7 +21,7 @@
export const environment = {
production: false
-};
+}
/*
* For easier debugging in development mode, you can import the following file
diff --git a/src/main.ts b/src/main.ts
index df4eecb..76b3ca7 100644
--- a/src/main.ts
+++ b/src/main.ts
@@ -28,4 +28,4 @@ platformBrowserDynamic()
.bootstrapModule(AppModule)
.catch(err =>
console.error(err)
- );
+ )
diff --git a/src/polyfills.ts b/src/polyfills.ts
index 8b82efe..b39bb2f 100644
--- a/src/polyfills.ts
+++ b/src/polyfills.ts
@@ -72,7 +72,7 @@
/***************************************************************************************************
* Zone JS is required by default for Angular itself.
*/
-import 'zone.js/dist/zone' // Included with Angular CLI.
+import 'zone.js/dist/zone' // Included with Angular CLI.
/***************************************************************************************************
* APPLICATION IMPORTS
diff --git a/src/test.ts b/src/test.ts
index 6106d9a..91170f8 100644
--- a/src/test.ts
+++ b/src/test.ts
@@ -22,15 +22,15 @@ import {BrowserDynamicTestingModule} from '@angular/platform-browser-dynamic/tes
import {platformBrowserDynamicTesting} from '@angular/platform-browser-dynamic/testing'
import 'zone.js/dist/zone-testing'
-declare const require: any;
+declare const require: any
// First, initialize the Angular testing environment.
getTestBed().initTestEnvironment(
BrowserDynamicTestingModule,
platformBrowserDynamicTesting()
-);
+)
// Then we find all the tests.
const context = require.context('./', true, /\.spec\.ts$/)
// And load the modules.
-context.keys().map(context);
+context.keys().map(context)