Skip to content

Commit

Permalink
Merge pull request #22 from metrico/devel
Browse files Browse the repository at this point in the history
Devel
  • Loading branch information
RFbkak37y3kIY authored Sep 9, 2022
2 parents f90b8ca + 0ed828e commit 024f6e6
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 1,713 deletions.
14 changes: 8 additions & 6 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,25 @@
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.app.json",
"inlineStyleLanguage": "scss",
"assets": ["src/favicon.ico", "src/assets",
"assets": [
"src/favicon.ico",
"src/assets",
{
"glob": "mode-sql.js",
"input": "./node_modules/ace-builds/src-min/",
"output": "/"
"glob": "mode-sql.js",
"input": "./node_modules/ace-builds/src-min/",
"output": "/"
},
{
"glob": "theme-sqlserver.js",
"input": "./node_modules/ace-builds/src-min/",
"output": "/"
}],
}
],
"styles": [
"./node_modules/@angular/material/prebuilt-themes/indigo-pink.css",
"src/styles.scss"
],
"scripts": [
"src/assets/test-data.js",
"node_modules/ace-builds/src-min/ace.js",
"node_modules/ace-builds/src-min/theme-sqlserver.js",
"node_modules/ace-builds/src-min/mode-sql.js"
Expand Down
3 changes: 2 additions & 1 deletion src/app/helper/error.interceptor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import { catchError } from 'rxjs/operators';

// import { AlertService } from '../services/alert.service';
import { Router } from '@angular/router';
import { AlertService } from '@app/components/controls/alert/alert.service';
import { AlertService } from '@app/services/alert.service';
// import { AlertService } from '@app/components/controls/alert/alert.service';

@Injectable()
export class ErrorInterceptor implements HttpInterceptor {
Expand Down
38 changes: 25 additions & 13 deletions src/app/pages/home.page/home.page.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { promiseWait, cloneObject } from '@app/helper/functions';
import { getParam } from '@app/app.component';
import { MatDialog } from '@angular/material/dialog';
import { DialogKioskComponent } from '../dialogs/dialog-kiosk/dialog-kiosk.component';
import { AlertService } from '@app/services/alert.service';

@Component({
templateUrl: './home.page.component.html',
Expand Down Expand Up @@ -56,7 +57,7 @@ export class HomePageComponent implements OnInit {
dictionary: Dictionary[] = [];

dataForFile: any = null;
isLoadingDetails = false;
isLoadingDetails = true;
details: any = [];
columns: any[] = [];
errorMessage: string = '';
Expand All @@ -68,6 +69,7 @@ export class HomePageComponent implements OnInit {
];
_SqlArchive: any = [];


set SqlArchive(value: any) {
this._SqlArchive[this.checkSqlHistory()] = value;

Expand Down Expand Up @@ -96,7 +98,8 @@ export class HomePageComponent implements OnInit {
private apiService: ApiService,
private docsService: DocsService,
private cdr: ChangeDetectorRef,
public dialog: MatDialog
public dialog: MatDialog,
private alertService: AlertService
) {
if (getParam.kiosk) {
this.isDarkMode = getParam.mode === 'dark';
Expand Down Expand Up @@ -250,7 +253,7 @@ export class HomePageComponent implements OnInit {
}

formatData(data: any) {
data = data || (window as any).data || {};
data = data || { meta: [], data: [] };
console.log(data);
if (typeof data === 'string') {
this.details = data;
Expand Down Expand Up @@ -301,10 +304,15 @@ export class HomePageComponent implements OnInit {

async SQL(sqlStr: string, isAuthenticated: boolean = false) {
await promiseWait(100);
if (!sqlStr) {
// this.alertService.error('ERROR: SQL query is empty!')
return false;
}
if (!isAuthenticated) {
this.sqlRequest = sqlStr;
this.isLoadingDetails = true;
}
this.isLoadingDetails = true;

this.cdr.detectChanges();

this.details = [];
Expand All @@ -323,7 +331,9 @@ export class HomePageComponent implements OnInit {
this.dataForFile = response;
this.formatData(response);
this.errorMessage = '';
this.isLoadingDetails = false;
if (!isAuthenticated) {
this.isLoadingDetails = false;
}
this.cdr.detectChanges();
return true;

Expand All @@ -340,21 +350,23 @@ export class HomePageComponent implements OnInit {
this.cdr.detectChanges();
})
}
this.isLoadingDetails = false;
if (!isAuthenticated) {
this.isLoadingDetails = false;
}
this.cdr.detectChanges();

return false;
}
}

onClickRun(event?: any): void {
if (event) {
console.log(event);
this.sqlRequest = event;
}
console.log(event);
this.sqlRequest = event;

this.SQL(this.sqlRequest);
}
async connectToDB(event?: any, isTestConnection = false) {
this.isLoadingDetails = true;
if (event) {
this.dbLink = event.dbLink;
this.dbLogin = event.dbLogin;
Expand All @@ -377,7 +389,7 @@ export class HomePageComponent implements OnInit {
this.isAccess = true;
this.getHash();

this.isLoadingDetails = true;

this.cdr.detectChanges();

await promiseWait(100);
Expand All @@ -386,7 +398,7 @@ export class HomePageComponent implements OnInit {
await this.initDbTree();
this.cdr.detectChanges();

this.isLoadingDetails = false;
// this.isLoadingDetails = false;
} else {
this.authSuccessMessage = 'Connection is successfully established.';
setTimeout(() => {
Expand Down Expand Up @@ -449,7 +461,7 @@ export class HomePageComponent implements OnInit {
}
})
}
bytesToSize(bytes: any): string | null{
bytesToSize(bytes: any): string | null {
const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB'];
if (bytes === 0) {
return bytes + ' Bytes';
Expand Down
Loading

0 comments on commit 024f6e6

Please sign in to comment.