Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#736- code quality improvement #39

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"parser": "@typescript-eslint/parser",
"extends": [
"plugin:@typescript-eslint/recommended"
],
"rules": {
}
}

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"start1": "ng serve",
"build": "ng build --prod",
"test": "ng test",
"lint": "ng lint",
"lint": "eslint .",
"e2e": "ng e2e"
},
"private": true,
Expand Down Expand Up @@ -43,6 +43,8 @@
"@ngx-formly/material": "^5.10.22",
"@ngx-translate/core": "^13.0.0",
"@ngx-translate/http-loader": "^7.0.0",
"@typescript-eslint/eslint-plugin": "^5.61.0",
"@typescript-eslint/parser": "^5.61.0",
"@zxing/browser": "0.0.10",
"@zxing/library": "^0.18.6",
"ajv": "^6.10.2",
Expand Down Expand Up @@ -106,4 +108,3 @@
"https": false
}
}

4 changes: 2 additions & 2 deletions src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import { ScanQrCodeComponent } from './documents/scan-qr-code/scan-qr-code.compo
import { BrowseDocumentsComponent } from './documents/browse-documents/browse-documents.component';
import { PagesComponent } from './pages/pages.component';
import { DocDetailViewComponent } from './documents/doc-detail-view/doc-detail-view.component';
// import { CreateCertificateComponent } from './create-certificate/create-certificate.component';
// import { FaqComponent } from './custom-components/faq/faq.component';
import { CreateCertificateComponent } from './create-certificate/create-certificate.component';
import { FaqComponent } from './custom-components/faq/faq.component';
const routes: Routes = [
// Home
{ path: '', component: HomeComponent },
Expand Down
13 changes: 5 additions & 8 deletions src/app/app.config.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
import { Inject, Injectable } from '@angular/core';
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Observable, throwError } from 'rxjs';
import { map } from 'rxjs/operators';
import { catchError } from 'rxjs/operators';
import { Router } from '@angular/router';
import { Title } from '@angular/platform-browser';

@Injectable()
export class AppConfig {

private config: Object = null;
private environment: Object = null;
private config: object = null;
private environment: object = null;

constructor(private http: HttpClient, public router: Router, private titleService: Title) {

Expand Down Expand Up @@ -41,10 +38,10 @@ export class AppConfig {
* b) Loads "config.[environment].json" to get all environment's variables (e.g.: 'config.development.json')
*/
public load() {
return new Promise((resolve, reject) => {
return new Promise((resolve) => {
this.http.get('/assets/config/config.json').subscribe((envResponse) => {
this.environment= envResponse;
let request:any = null;
let request = null;

switch (envResponse['environment']) {
case 'production': {
Expand Down
24 changes: 11 additions & 13 deletions src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,11 @@ import { ScanDocumentComponent } from './documents/scan-document/scan-document.c
import { ScanQrCodeComponent } from './documents/scan-qr-code/scan-qr-code.component';
import {QuarModule} from '@altack/quar';
import { BrowseDocumentsComponent } from './documents/browse-documents/browse-documents.component';

import { TranslateLoader, TranslateModule, TranslateService } from '@ngx-translate/core';
import { TranslateHttpLoader } from '@ngx-translate/http-loader';
import { TranslateModule, TranslateService } from '@ngx-translate/core';
import { HttpClient } from '@angular/common/http';
import { config } from 'process';
import { ColorPickerModule } from 'ngx-color-picker';
import {STEPPER_GLOBAL_OPTIONS} from '@angular/cdk/stepper';

import { SafeHtml } from '@angular/platform-browser';

//form validations
export function minItemsValidationMessage(err, field: FormlyFieldConfig) {
Expand Down Expand Up @@ -116,19 +113,17 @@ function initConfig(config: AppConfig) {
}

import ISO6391 from 'iso-639-1';
import { PagesComponent } from './pages/pages.component';
import { ServiceWorkerModule } from '@angular/service-worker';
import { environment } from '../environments/environment';

import {AuthImagePipe} from '../app/layouts/doc-view/doc-view.component';
import { NgxExtendedPdfViewerModule } from 'ngx-extended-pdf-viewer';
import { DocDetailViewComponent } from './documents/doc-detail-view/doc-detail-view.component';
// import { FaqComponent } from './custom-components/faq/faq.component';
import { SafeHtmlPipe } from './safe-html.pipe';
import { FaqComponent } from './custom-components/faq/faq.component';
import { initTheme } from './theme.config';
import { TooltipType } from './forms/types/tooltip.type';
// import { CreateCertificateComponent } from './create-certificate/create-certificate.component';
import { CreateCertificateComponent } from './create-certificate/create-certificate.component';
import { FormlyFieldStepper } from '../app/forms/types/stepper.type';
import { SafeHtmlPipe } from './safe-html.pipe';

@NgModule({
declarations: [
Expand Down Expand Up @@ -164,7 +159,10 @@ import { FormlyFieldStepper } from '../app/forms/types/stepper.type';
FormlyFieldNgRadioButton,
FormlyTemplateType,
TooltipType,
FormlyFieldStepper
FormlyFieldStepper,
CreateCertificateComponent,
FaqComponent,
SafeHtmlPipe
],
imports: [
BrowserModule,
Expand Down Expand Up @@ -284,7 +282,7 @@ export class AppModule {

authConfig.getConfig().subscribe((config) => {
this.languages = config.languages;
var installed_languages = [];
const installed_languages = [];

for (let i = 0; i < this.languages.length; i++) {
installed_languages.push({
Expand All @@ -301,7 +299,7 @@ export class AppModule {

} else {
const browserLang = translate.getBrowserLang();
let lang = this.languages.includes(browserLang) ? browserLang : 'en';
const lang = this.languages.includes(browserLang) ? browserLang : 'en';
translate.use(lang);
localStorage.setItem('setLanguage', lang);
}
Expand Down
5 changes: 3 additions & 2 deletions src/app/authentication/auth-config.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,19 @@ import { catchError, mergeMap } from 'rxjs/operators';
@Injectable({
providedIn: 'root'
})

export class AuthConfigService {
private config: any;

constructor(private httpClient: HttpClient) {}

public getConfig(): Observable<any> {
public getConfig(): Observable<any | null> {
return this.httpClient
.get('./assets/config/config.json', {
observe: 'response',
})
.pipe(
catchError((error) => {
catchError(() => {
return of(null)
} ),
mergeMap((response) => {
Expand Down
4 changes: 2 additions & 2 deletions src/app/authentication/login/keycloaklogin.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import { AppConfig } from '../../app.config';
styleUrls: ['./keycloaklogin.component.css']
})
export class KeycloakloginComponent implements OnInit {
user : any;
user : string;
entity: string;
profileUrl: string = '';
profileUrl = '';
constructor(
public keycloakService: KeycloakService,
public router: Router, private config: AppConfig
Expand Down
9 changes: 3 additions & 6 deletions src/app/create-certificate/create-certificate.component.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
import { Component, OnInit, ViewChild } from '@angular/core';
import { Component, ViewChild } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';

@Component({
selector: 'app-create-certificate',
templateUrl: './create-certificate.component.html',
styleUrls: ['./create-certificate.component.scss']
})
export class CreateCertificateComponent implements OnInit {
export class CreateCertificateComponent {
@ViewChild("userHtml", { static: false }) userHtml;

constructor(public translate: TranslateService,) { }

ngOnInit(): void {
}
constructor(public translate: TranslateService) { }

}
9 changes: 2 additions & 7 deletions src/app/custom-components/faq/faq.component.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
import { Component, OnInit } from '@angular/core';
import { Component } from '@angular/core';

@Component({
selector: 'app-faq',
templateUrl: './faq.component.html',
styleUrls: ['./faq.component.scss']
})
export class FaqComponent implements OnInit {

constructor() { }

ngOnInit(): void {
}
export class FaqComponent {

}
Loading