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

Release 1.4.0 #613

Merged
master from
Oct 20, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
fb33a80
build(deps-dev): bump @types/chai from 4.2.12 to 4.2.13 in /src
dependabot[bot] Oct 13, 2020
9a2af44
build(deps-dev): bump ts-loader from 8.0.4 to 8.0.5 in /src
dependabot[bot] Oct 13, 2020
140ecd6
build(deps-dev): bump webpack from 5.0.0-rc.3 to 5.0.0 in /src
dependabot[bot] Oct 13, 2020
9f76e48
build(deps-dev): bump @types/vscode in /src/projects/media/webview
dependabot[bot] Oct 13, 2020
5963b76
build(deps): bump tslib in /src/projects/media/webview
dependabot[bot] Oct 13, 2020
a4850d0
Merge pull request #587 from q-masters/dependabot/npm_and_yarn/src/de…
konne Oct 13, 2020
a43d24a
Merge pull request #586 from q-masters/dependabot/npm_and_yarn/src/de…
konne Oct 13, 2020
3eecc35
Merge pull request #589 from q-masters/dependabot/npm_and_yarn/src/pr…
konne Oct 13, 2020
8858f0a
Merge pull request #585 from q-masters/dependabot/npm_and_yarn/src/de…
konne Oct 13, 2020
d5cea89
Merge pull request #588 from q-masters/dependabot/npm_and_yarn/src/pr…
konne Oct 13, 2020
3bf97d0
build(deps-dev): bump webpack-cli from 3.3.12 to 4.0.0 in /src
dependabot[bot] Oct 13, 2020
0cec9e6
Merge pull request #584 from q-masters/dependabot/npm_and_yarn/src/de…
konne Oct 13, 2020
a98e12c
build(deps-dev): bump webpack from 5.0.0 to 5.1.0 in /src
dependabot[bot] Oct 14, 2020
b50cbb0
add winston
r-hannuschka Oct 14, 2020
5d34c0c
Merge branch 'development' into feat/124_logger
r-hannuschka Oct 14, 2020
a1f58c2
[feat #124] add base logger and child loggers
r-hannuschka Oct 14, 2020
879d9c2
build(deps): bump @angular/material in /src/projects/media/webview
dependabot[bot] Oct 15, 2020
1ad2462
build(deps-dev): bump @angular-devkit/build-angular
dependabot[bot] Oct 15, 2020
09b47a3
build(deps-dev): bump @angular/cli in /src/projects/media/webview
dependabot[bot] Oct 15, 2020
361fd98
build(deps-dev): bump @angular/language-service
dependabot[bot] Oct 15, 2020
ff41f54
Merge pull request #595 from q-masters/dependabot/npm_and_yarn/src/pr…
konne Oct 15, 2020
47cc9ab
Merge pull request #594 from q-masters/dependabot/npm_and_yarn/src/pr…
konne Oct 15, 2020
82416dd
Merge pull request #593 from q-masters/dependabot/npm_and_yarn/src/pr…
konne Oct 15, 2020
0654800
Merge pull request #592 from q-masters/dependabot/npm_and_yarn/src/pr…
konne Oct 15, 2020
9c21107
Merge pull request #590 from q-masters/dependabot/npm_and_yarn/src/de…
konne Oct 15, 2020
8cff4d8
build(deps-dev): bump @angular-devkit/build-ng-packagr
dependabot[bot] Oct 15, 2020
af2ceb1
[feat #124] add settings, interfaces
r-hannuschka Oct 15, 2020
0701f32
[feat #124] fixed hardcoded path for file logger
r-hannuschka Oct 15, 2020
cc5530a
Merge pull request #591 from q-masters/dependabot/npm_and_yarn/src/pr…
konne Oct 15, 2020
d800919
Merge branch 'master' into development
r-hannuschka Oct 15, 2020
49242e8
Merge branch 'development' into feat/124_logger
r-hannuschka Oct 15, 2020
ea2bdcd
feat: enable logger for vsqlik
r-hannuschka Oct 16, 2020
8067a20
Merge branch 'feat/124_logger' into development
r-hannuschka Oct 16, 2020
aa85ae4
[feat #598] update settings for qlik sense desktop
r-hannuschka Oct 18, 2020
76a2c5b
[feat #598] fixed settings webview isQlikSenseDesktop checkbox was no…
r-hannuschka Oct 18, 2020
b144901
feat: support qlik sense desktop
r-hannuschka Oct 18, 2020
f048aca
refactoring to modules
r-hannuschka Oct 18, 2020
519c265
Merge pull request #601 from q-masters/feat/refactoring_to_modules
r-hannuschka Oct 18, 2020
2011f71
fix: fixed bug we connected twice if we added a qix directory to an e…
r-hannuschka Oct 18, 2020
9b0e38a
Merge branch 'development' into feat/598_connect_qlik_sense_desktop
r-hannuschka Oct 18, 2020
d450b53
Merge branch 'feat/598_connect_qlik_sense_desktop' of github.com:q-ma…
r-hannuschka Oct 18, 2020
460ba2b
build(deps-dev): bump @types/chai from 4.2.13 to 4.2.14 in /src
dependabot[bot] Oct 19, 2020
457d9a3
build(deps-dev): bump @types/node from 14.11.8 to 14.11.10 in /src
dependabot[bot] Oct 19, 2020
5885bfe
build(deps-dev): bump @types/node in /src/projects/media/webview
dependabot[bot] Oct 19, 2020
107ddcf
build(deps-dev): bump webpack from 5.1.0 to 5.1.3 in /src
dependabot[bot] Oct 19, 2020
cc6179c
Merge pull request #609 from q-masters/dependabot/npm_and_yarn/src/de…
konne Oct 19, 2020
086eae6
Merge pull request #608 from q-masters/dependabot/npm_and_yarn/src/pr…
konne Oct 19, 2020
d071620
Merge pull request #607 from q-masters/dependabot/npm_and_yarn/src/de…
konne Oct 19, 2020
422ff85
Merge pull request #606 from q-masters/dependabot/npm_and_yarn/src/de…
konne Oct 19, 2020
160aaa1
build(deps-dev): bump mocha from 8.1.3 to 8.2.0 in /src
dependabot[bot] Oct 19, 2020
6206eac
Merge pull request #605 from q-masters/dependabot/npm_and_yarn/src/de…
konne Oct 19, 2020
6bc9781
Merge pull request #603 from q-masters/bug/602_connected_twice
konne Oct 19, 2020
d52a885
update connect to qlik sense desktop
r-hannuschka Oct 19, 2020
9d0cb99
update connenction
r-hannuschka Oct 19, 2020
136e15b
fix: fixed bug wrong log messages if script error
r-hannuschka Oct 19, 2020
164c3aa
Merge pull request #600 from q-masters/feat/598_connect_qlik_sense_de…
konne Oct 19, 2020
c3bd938
Merge pull request #610 from q-masters/bug/604_load_data_on_error
konne Oct 19, 2020
73c1d5f
build(deps-dev): bump webpack-cli from 4.0.0 to 4.1.0 in /src
dependabot[bot] Oct 20, 2020
760c3f3
Merge pull request #611 from q-masters/dependabot/npm_and_yarn/src/de…
konne Oct 20, 2020
9cba052
build(deps-dev): bump ts-loader from 8.0.5 to 8.0.6 in /src
dependabot[bot] Oct 20, 2020
25ed791
Merge pull request #612 from q-masters/dependabot/npm_and_yarn/src/de…
konne Oct 20, 2020
91c7b77
Update package.json
konne Oct 20, 2020
ed8f336
Add files via upload
konne Oct 20, 2020
dc959da
Update README.md
konne Oct 20, 2020
37ba36c
Update README.md
konne Oct 20, 2020
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
Prev Previous commit
Next Next commit
update connect to qlik sense desktop
- added new method checkUnsecure
- added new method checkSecure
- remove setting for isQlikSenseDesktop if we do not keep it we have wrong data on edit a connection in webview
  • Loading branch information
r-hannuschka committed Oct 19, 2020
commit d52a8855de5a415b4fce67ea8d07ceb2685b12c1
1 change: 0 additions & 1 deletion src/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@
"label": "Localhost",
"connection": {
"host": "127.0.0.1",
"isQlikSenseDesktop": false,
"path": null,
"port": null,
"secure": true,
Expand Down
4 changes: 0 additions & 4 deletions src/projects/extension/connection/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ export interface ConnectionSetting {
authorization: AuthorizationSetting;

ssl_fingerprint?: string;

isQlikSenseDesktop: boolean;
}

export interface ConnectionConfiguration {
Expand Down Expand Up @@ -85,8 +83,6 @@ export interface ConnectionConfiguration {
* storage to write connection specific data
*/
storage?: Storage;

isQlikSenseDesktop: boolean;
}

export const enum COMMANDS {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { throwError, Observable, of, from } from 'rxjs';
import { retryWhen, take, concat, tap, switchMap, map, takeWhile } from 'rxjs/operators';
import { Observable, of, from, concat, throwError } from 'rxjs';
import { retryWhen, take, tap, switchMap, map, takeWhile, catchError } from 'rxjs/operators';
import { Agent } from 'https';
import fetch from 'node-fetch';
import { ConnectionSetting } from '../api';
import { ConnectionSetting, VsQlikLoggerConnection } from '../api';
import { ConnectionHelper } from '../utils/connection.helper';
import { connect as tlsConnect} from "tls";
import { container } from 'tsyringe';

interface ServerInformation {
exists: boolean;
Expand All @@ -14,43 +15,69 @@ interface ServerInformation {

export function fetchServerInformation(setting: ConnectionSetting): Observable<ServerInformation> {

const logger = container.resolve(VsQlikLoggerConnection);
const connect$ = setting.secure ? connectSecure(setting) : connectUnsecure(setting);

return connect$.pipe(
catchError((error) => {
logger.error(`could not connect to ${setting.label}`);
throw error;
}),
take(1)
);
}

/**
* try at least 2 times
*
* first try check qlik sense enterprise
* second try check qlik sense desktop add /hub at the end
*/
function connectUnsecure(setting: ConnectionSetting): Observable<ServerInformation> {

let uri = ConnectionHelper.buildUrl(setting);
let tryCount = 0;

return of(true).pipe(
switchMap(() => fetch(uri, { method: 'GET'})),
retryWhen((errors) => errors.pipe(
tap(() => (tryCount += 1, uri += '/hub')),
takeWhile(() => tryCount < 2),
(o) => concat(o, throwError(`Server not found`))
)),
map(() => ({ exists: true, trusted: true, fingerPrint: '' })));
}

/**
* try at least 2 times for
* Qlik Sense Server / Docker with rejectUnauthorized
*/
function connectSecure(setting: ConnectionSetting): Observable<ServerInformation> {
const url = ConnectionHelper.buildUrl(setting);
let tryCount = 0;

/**
* for https connections try at least 2 times:
*
* 1. run with rejectUnauthorized: true if this works the server exists and has a valid certificate
* 2. run with rejectUnauthorized: false if this works server exists but no valid certificate
*/
return of(true).pipe(
switchMap(() => fetch(url, {
method: 'GET',
...(setting.secure ? {agent: new Agent({rejectUnauthorized: !tryCount})} : {})
agent: new Agent({rejectUnauthorized: tryCount === 0})
})),
retryWhen((errors) => errors.pipe(
tap(() => tryCount += 1),
takeWhile(() => tryCount < 2),
concat(throwError(`Server not found: ${setting.host}`)),
(o) => concat(o, throwError(`Server not found`))
)),
map(() => ({
exists: true,
trusted: tryCount === 0 || !setting.secure,
fingerPrint: ''
})),
switchMap((res) => {
return from(getFingerPrint(setting)).pipe(map((fingerPrint) => Object.assign(res, {fingerPrint})));
}),
take(1)
switchMap(() => {
const result = {exists: true, trusted: tryCount === 0, fingerPrint: ''};
return tryCount > 0
? from(getFingerPrint(setting)).pipe(
map((fingerPrint: string) => Object.assign(result, {fingerPrint})))
: of(result);
})
);
}

function getFingerPrint(setting: ConnectionSetting): Promise<string> {

if (!setting.secure) {
return Promise.resolve('');
}

return new Promise((resolve) => {
const socket = tlsConnect({
port: setting.port ?? 443,
Expand Down
15 changes: 4 additions & 11 deletions src/projects/extension/connection/utils/connection.helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,11 @@ export abstract class ConnectionHelper {

const isSecure = connection.secure;
const protocol = isSecure ? 'https://' : 'http://';
const url = new URL(protocol + connection.host);
url.port = connection.port?.toString() ?? "";
url.pathname = connection.path ?? "";

try {
const url = new URL(protocol + connection.host);
url.port = connection.port?.toString() ?? "";
url.pathname = connection.path ?? "";
url.pathname += connection.isQlikSenseDesktop ? `/hub` : '';

return url.toString();
} catch (error) {
console.dir(error);
throw error;
}
return url.toString();
}

/**
Expand Down
12 changes: 7 additions & 5 deletions src/projects/extension/logger/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ import { AbstractConfigSetLevels } from 'winston/lib/winston/config';

export const VsQlikLogLevels: AbstractConfigSetLevels = {
off : -1,
info : 0,
warn : 1,
error: 2,
debug: 3
fatal : 0,
error : 1,
warn: 2,
info: 3,
debug: 4,
trace: 5
};

declare type LogLevel = 'off' | 'info' | 'warn' | 'error' | 'debug';
declare type LogLevel = 'off' | 'fatal' | 'error' | 'warn' | 'info' | 'debug' | 'trace';

/**
* settings
Expand Down
1 change: 0 additions & 1 deletion src/projects/extension/script/commands/load-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { ConnectionProvider } from 'projects/extension/connection';
import { interval, from, merge } from 'rxjs';
import { switchMap, map, takeWhile, finalize, tap } from 'rxjs/operators';
import { QlikOutputChannel } from '@data/tokens';
import { EOL } from 'os';

export async function ScriptLoadDataCommand(): Promise<void> {

Expand Down
3 changes: 1 addition & 2 deletions src/projects/media/webview/bin/mock/vscode-api-mock.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ window.connectionListCommand = [{
domain: "hannuschkar4fa4\\qlik",
password: "qlik2020"
}
},
isQlikSenseDesktop: true
}
},
fileRender: 1,
display: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,6 @@ export interface ConnectionSetting {
*/
host: string;

/**
* if set to true we handle a qlik sense desktop
*/
isQlikSenseDesktop: boolean;

/**
* setting port to server
* ports used by default:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,6 @@ <h3>Display</h3>

<h3>Connection Settings</h3>

<div class="form-control">
<label class="label">Qlik Sense Desktop</label>
<div class="control">
<input type="checkbox" formControlName="isQlikSenseDesktopCtrl">
<small>enable if we want connect to qlik sense desktop</small>
</div>
</div>

<div class="form-control">
<label class="label">Host Name</label>
<div class="control">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,6 @@ export class ConnectionEditComponent implements OnInit, OnDestroy {
this.initAuthorizationStrategyCtrl();
this.initObjectRenderStrategyCtrl();

this.connectionForm.controls.isQlikSenseDesktopCtrl.valueChanges.subscribe(
(checked: boolean) => this.changeStateQlikSenseDesktop(checked));

this.connectionFormHelper.registerBeforeSave(this.beforeSaveHook.bind(this));
this.connectionFormHelper.connection
.pipe(takeUntil(this.destroy$))
Expand Down Expand Up @@ -144,8 +141,7 @@ export class ConnectionEditComponent implements OnInit, OnDestroy {
portCtrl: this.formbuilder.control(null),
pathCtrl: this.formbuilder.control(null),
secureCtrl: this.formbuilder.control(true),
untrustedCertCtrl: this.formbuilder.control(false),
isQlikSenseDesktopCtrl: this.formbuilder.control(false)
untrustedCertCtrl: this.formbuilder.control(false)
});
}

Expand Down Expand Up @@ -194,12 +190,8 @@ export class ConnectionEditComponent implements OnInit, OnDestroy {
untrustedCertCtrl: this.workspaceFolderSetting.connection.allowUntrusted,
});

if (this.workspaceFolderSetting.connection.isQlikSenseDesktop) {
this.connectionForm.controls.isQlikSenseDesktopCtrl.setValue(true);
} else {
this.authorizationStrategyCtrl.setValue(this.workspaceFolderSetting.connection.authorization.strategy, {emitEvent: false});
this.objectRenderStrategyCtrl.setValue(this.workspaceFolderSetting.fileRenderer, {emitEvent: false});
}
this.authorizationStrategyCtrl.setValue(this.workspaceFolderSetting.connection.authorization.strategy, {emitEvent: false});
this.objectRenderStrategyCtrl.setValue(this.workspaceFolderSetting.fileRenderer, {emitEvent: false});
}

/**
Expand All @@ -216,8 +208,7 @@ export class ConnectionEditComponent implements OnInit, OnDestroy {
port: this.connectionForm.controls.portCtrl.value,
path: this.connectionForm.controls.pathCtrl.value,
secure: this.connectionForm.controls.secureCtrl.value,
allowUntrusted: this.connectionForm.controls.untrustedCertCtrl.value,
isQlikSenseDesktop: this.connectionForm.controls.isQlikSenseDesktopCtrl.value
allowUntrusted: this.connectionForm.controls.untrustedCertCtrl.value
},
fileRenderer: this.connectionForm.controls.fileRendererCtrl.value
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ export class ConnectionFormHelper {
connection: {
allowUntrusted: false,
host: "localhost",
isQlikSenseDesktop: false,
secure: true,
path: null,
port: null,
Expand Down