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.6.0 #657

Merged
master from
Nov 1, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
cbf87be
build(deps-dev): bump @types/node from 14.11.10 to 14.14.0 in /src
dependabot[bot] Oct 21, 2020
1c93005
build(deps-dev): bump @types/node in /src/projects/media/webview
dependabot[bot] Oct 21, 2020
2a6a423
Merge pull request #621 from q-masters/master
konne Oct 21, 2020
026d7ae
Merge pull request #620 from q-masters/dependabot/npm_and_yarn/src/pr…
konne Oct 21, 2020
d58b2cb
Merge pull request #619 from q-masters/dependabot/npm_and_yarn/src/de…
konne Oct 21, 2020
689912e
feat: improve error messages on load data
r-hannuschka Oct 21, 2020
0d7a930
build(deps-dev): bump @types/node from 14.14.0 to 14.14.2 in /src
dependabot[bot] Oct 22, 2020
94b2611
build(deps-dev): bump @angular/language-service
dependabot[bot] Oct 22, 2020
30e9b82
Merge pull request #623 from q-masters/dependabot/npm_and_yarn/src/de…
dependabot[bot] Oct 22, 2020
7c640df
Merge pull request #624 from q-masters/dependabot/npm_and_yarn/src/pr…
dependabot[bot] Oct 22, 2020
ef965fa
build(deps-dev): bump @types/node in /src/projects/media/webview
dependabot[bot] Oct 22, 2020
ebebaf0
Merge pull request #625 from q-masters/dependabot/npm_and_yarn/src/pr…
dependabot[bot] Oct 22, 2020
a7b1f06
fix: fixed bug openDoc was called multiple times
r-hannuschka Oct 22, 2020
a60e38b
clean up
r-hannuschka Oct 22, 2020
3765d17
build(deps-dev): bump webpack from 5.1.3 to 5.2.0 in /src
dependabot[bot] Oct 23, 2020
d216ae8
build(deps-dev): bump @angular/cli in /src/projects/media/webview
dependabot[bot] Oct 23, 2020
10246bb
Merge pull request #628 from q-masters/dependabot/npm_and_yarn/src/de…
dependabot[bot] Oct 23, 2020
c60aecc
Merge pull request #629 from q-masters/dependabot/npm_and_yarn/src/pr…
dependabot[bot] Oct 23, 2020
5e16041
build(deps-dev): bump @angular-devkit/build-ng-packagr
dependabot[bot] Oct 23, 2020
8b795f1
Merge pull request #631 from q-masters/dependabot/npm_and_yarn/src/pr…
dependabot[bot] Oct 23, 2020
74b268a
build(deps-dev): bump @angular-devkit/build-angular
dependabot[bot] Oct 23, 2020
bf77242
Merge pull request #630 from q-masters/dependabot/npm_and_yarn/src/pr…
dependabot[bot] Oct 23, 2020
43366c5
Merge pull request #622 from q-masters/feat/618_better_error_messages
konne Oct 25, 2020
0029ecf
Merge pull request #627 from q-masters/bug/626_open_doc_called_multip…
konne Oct 25, 2020
8e9f296
[feat #543] show diff app has changed on sever
r-hannuschka Oct 23, 2020
5e22e36
[feat #543] show diff if server script has been changed
r-hannuschka Oct 24, 2020
314b005
[feat #543] switch to qix filesystem provider for diff files
r-hannuschka Oct 25, 2020
5f0dc01
[feat #543] ensure server not override if we reopen the app
r-hannuschka Oct 25, 2020
49b2b76
[feat #543] unlock script if document is closed
r-hannuschka Oct 25, 2020
dba507a
build(deps-dev): bump ts-loader from 8.0.6 to 8.0.7 in /src
dependabot[bot] Oct 26, 2020
3a7793a
build(deps-dev): bump eslint from 7.11.0 to 7.12.0 in /src
dependabot[bot] Oct 26, 2020
0fb5e2e
build(deps-dev): bump @types/node from 14.14.2 to 14.14.3 in /src
dependabot[bot] Oct 26, 2020
30455bc
Merge pull request #633 from q-masters/dependabot/npm_and_yarn/src/de…
dependabot[bot] Oct 26, 2020
127ebe0
Merge pull request #634 from q-masters/dependabot/npm_and_yarn/src/de…
dependabot[bot] Oct 26, 2020
0d4f539
Merge pull request #635 from q-masters/dependabot/npm_and_yarn/src/de…
dependabot[bot] Oct 26, 2020
e20aab9
build(deps-dev): bump @types/jasmine in /src/projects/media/webview
dependabot[bot] Oct 26, 2020
51a913d
Merge pull request #636 from q-masters/dependabot/npm_and_yarn/src/pr…
dependabot[bot] Oct 26, 2020
8ed7604
build(deps-dev): bump @types/node in /src/projects/media/webview
dependabot[bot] Oct 26, 2020
b37df77
Merge pull request #637 from q-masters/dependabot/npm_and_yarn/src/pr…
dependabot[bot] Oct 26, 2020
4c98f57
clean up
r-hannuschka Oct 26, 2020
b585cd9
fix: fixed bug visible elements not shown if not defined
r-hannuschka Oct 26, 2020
10a318f
[feat #543] add some improvements
r-hannuschka Oct 27, 2020
84c9d82
build(deps-dev): bump eslint from 7.12.0 to 7.12.1 in /src
dependabot[bot] Oct 27, 2020
002c6fa
build(deps-dev): bump typescript from 4.0.3 to 4.0.5 in /src
dependabot[bot] Oct 27, 2020
f5569f7
build(deps-dev): bump @types/ws from 7.2.7 to 7.2.8 in /src
dependabot[bot] Oct 27, 2020
8aa464f
build(deps-dev): bump @types/node from 14.14.3 to 14.14.5 in /src
dependabot[bot] Oct 27, 2020
be27e00
Merge pull request #639 from q-masters/dependabot/npm_and_yarn/src/de…
dependabot[bot] Oct 27, 2020
f353abd
Merge pull request #640 from q-masters/dependabot/npm_and_yarn/src/de…
dependabot[bot] Oct 27, 2020
f3528ef
Merge pull request #641 from q-masters/dependabot/npm_and_yarn/src/de…
dependabot[bot] Oct 27, 2020
94771e6
Merge pull request #642 from q-masters/dependabot/npm_and_yarn/src/de…
dependabot[bot] Oct 27, 2020
3cddf06
build(deps-dev): bump @types/node in /src/projects/media/webview
dependabot[bot] Oct 27, 2020
1d2c819
Merge pull request #643 from q-masters/dependabot/npm_and_yarn/src/pr…
dependabot[bot] Oct 27, 2020
1069fe7
[feat #543] some refactoring new logic
r-hannuschka Oct 27, 2020
c321188
build(deps-dev): bump webpack from 5.2.0 to 5.3.0 in /src
dependabot[bot] Oct 28, 2020
a6cf81a
build(deps): bump @angular/material in /src/projects/media/webview
dependabot[bot] Oct 28, 2020
94f9369
Merge pull request #644 from q-masters/dependabot/npm_and_yarn/src/de…
dependabot[bot] Oct 28, 2020
6ff4d60
Merge pull request #645 from q-masters/dependabot/npm_and_yarn/src/pr…
dependabot[bot] Oct 28, 2020
fbc271c
feat: add diff support for qlik script if remote script / local scrip…
r-hannuschka Oct 29, 2020
41d21cc
build(deps-dev): bump @types/ws from 7.2.8 to 7.2.9 in /src
dependabot[bot] Oct 29, 2020
35ce16a
build(deps-dev): bump webpack from 5.3.0 to 5.3.1 in /src
dependabot[bot] Oct 29, 2020
ab3904d
Merge pull request #647 from q-masters/dependabot/npm_and_yarn/src/de…
dependabot[bot] Oct 29, 2020
785b6bf
Merge pull request #649 from q-masters/dependabot/npm_and_yarn/src/de…
dependabot[bot] Oct 29, 2020
addf5fe
build(deps-dev): bump @types/node from 14.14.5 to 14.14.6 in /src
dependabot[bot] Oct 29, 2020
03fac26
build(deps-dev): bump sinon from 9.2.0 to 9.2.1 in /src
dependabot[bot] Oct 29, 2020
ffb94f7
build(deps-dev): bump @angular/language-service
dependabot[bot] Oct 29, 2020
9d71caa
Merge pull request #650 from q-masters/dependabot/npm_and_yarn/src/de…
dependabot[bot] Oct 29, 2020
1aa2650
Merge pull request #648 from q-masters/dependabot/npm_and_yarn/src/de…
dependabot[bot] Oct 29, 2020
566e441
Merge pull request #651 from q-masters/dependabot/npm_and_yarn/src/pr…
dependabot[bot] Oct 29, 2020
9e7cd4f
build(deps-dev): bump @types/node in /src/projects/media/webview
dependabot[bot] Oct 29, 2020
16f2fd4
Merge pull request #652 from q-masters/dependabot/npm_and_yarn/src/pr…
dependabot[bot] Oct 29, 2020
6f39f3b
[feat #543] save last working copy of script (after it has been saved…
r-hannuschka Oct 29, 2020
8656d85
build(deps-dev): bump webpack from 5.3.1 to 5.3.2 in /src
dependabot[bot] Oct 30, 2020
bedb53b
Merge pull request #653 from q-masters/dependabot/npm_and_yarn/src/de…
dependabot[bot] Oct 30, 2020
8615526
fixed bug script was saved before data was on server
r-hannuschka Oct 30, 2020
19bd038
Merge pull request #638 from q-masters/bug/487_visible_elements
konne Nov 1, 2020
bc387be
Merge pull request #646 from q-masters/feat/543_show_diff_on_script_c…
konne Nov 1, 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
feat: add diff support for qlik script if remote script / local scrip…
…t differs

closes #543
  • Loading branch information
r-hannuschka committed Oct 29, 2020
commit fbc271c7fa96ac20f608aa88150de183640f089d
20 changes: 12 additions & 8 deletions src/projects/extension/connection/utils/application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ export class Application {
/** */
private script: string | null = null;

/**
* last script which was persisted on server via vsqlik
*/
private previousScript: string;

public constructor(
private globalContext: EngineAPI.IGlobal,
private name: string,
Expand Down Expand Up @@ -47,18 +52,15 @@ export class Application {

/**
* return script for currrent application
* load only once since we need to persist it.
*
* if we save the script on server side (browser) we will simply override
* everything what exists since we are not aware of any changes
* if force is set to false script will cached
*/
public async getScript(force = false): Promise<string> {
if (!this.script || force) {
const doc = await this.document;
const script = await doc.getScript();

const doc = await this.document;
const script = await doc.getScript();

if (!force) {
console.log(script);
this.script = script;
}
return script;
Expand All @@ -75,13 +77,15 @@ export class Application {

/** update a script */
public async updateScript(content: string, persist = true): Promise<void> {

this.script = content;
const doc = await this.doc;

if (persist) {
const doc = await this.doc;
await doc.setScript(content);
await doc.doSave();
}

}

public get appName(): string {
Expand Down
23 changes: 16 additions & 7 deletions src/projects/extension/connection/utils/connection.helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { create } from "enigma.js";
import schema from "enigma.js/schemas/12.20.0.json";
import WebSocket from "ws";
import { WorkspaceSetting } from "@vsqlik/settings/api";
import { container } from "tsyringe";
import { container, singleton } from "tsyringe";
import { SettingsRepository } from "@vsqlik/settings/settings.repository";
import { VsQlikLoggerWebsocket } from "@vsqlik/logger";
import { ConnectionSetting } from "../api";
Expand All @@ -14,7 +14,8 @@ export interface ConnectionSettingQuickPickItem extends vscode.QuickPickItem {
setting: WorkspaceSetting
}

export abstract class ConnectionHelper {
@singleton()
export class ConnectionHelper {

/**
* build url by a given connection
Expand All @@ -39,9 +40,10 @@ export abstract class ConnectionHelper {
*/
public static createEnigmaSession(
model: ConnectionModel,
id?: string
id?: string,
uniqe = true
): enigmaJS.ISession {
const url = this.buildEnigmaWebsocketUri(model.setting, id);
const url = this.buildEnigmaWebsocketUri(model.setting, id, uniqe);
return create({
schema,
url,
Expand Down Expand Up @@ -94,17 +96,24 @@ export abstract class ConnectionHelper {
/**
* create a websocket url by a given connection
*/
private static buildEnigmaWebsocketUri(connection: ConnectionSetting, id = "engineData"): string {
private static buildEnigmaWebsocketUri(connection: ConnectionSetting, id = "engineData", uniqe = true): string {
const port = Number(connection.port);
const options = {

let options: any = {
appId : id,
host : connection.host,
identity: Math.random().toString(32).substr(2),
secure : connection.secure,
port : port && !isNaN(port) ? port : connection.secure ? 443 : 80,
subpath : connection.path ?? ""
};

if (uniqe) {
options = {
...options,
identity: Math.random().toString(32).substr(2)
};
}

return buildUrl(options);
}

Expand Down
8 changes: 7 additions & 1 deletion src/projects/extension/connection/utils/connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ export class Connection {
return this.stateChange$.asObservable();
}

public get model(): ConnectionModel {
return this.connectionModel;
}

/**
* runs a connection request
*/
Expand Down Expand Up @@ -145,7 +149,9 @@ export class Connection {
if (!this.applications.has(id)) {
const global = await this.engimaProvider.open(id);
if (global) {
const app = new Application(global, id, this.serverSetting.label);

const app = new Application(global, id, this.serverSetting.label);

app.onClose()
.pipe(take(1))
.subscribe(() => this.applications.delete(id));
Expand Down
2 changes: 1 addition & 1 deletion src/projects/extension/connection/utils/enigma.provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ export class EnigmaSession {
do {
id = Math.random().toString(32).substr(2);
} while(this.sessionCache.has(id));

return this.open(EnigmaSession.GLOBAL_SESSION_KEY, keepAlive, id);
}

Expand Down Expand Up @@ -173,7 +174,6 @@ export class EnigmaSession {
private async createSessionObject(id: string, keepAlive = false, cacheId?: string): Promise<enigmaJS.IGeneratedAPI>
{
const cacheKey = cacheId ?? id;

if (!this.connectionQueue.has(cacheKey)) {
this.connectionQueue.set(cacheKey, this.resolveSession(id, keepAlive, cacheKey));
}
Expand Down
29 changes: 29 additions & 0 deletions src/projects/extension/script/commands/sync-script.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { ConnectionHelper, ConnectionProvider } from "@core/public.api";
import { EntryType } from "@vsqlik/fs/data";
import { container } from "tsyringe";
import * as vscode from "vscode";

const connectionProviver = container.resolve(ConnectionProvider);

export async function ScriptSynchronizeCommand(uri: vscode.Uri, script: string): Promise<void> {
try {
/** get required data, connection, app and the text editor which contains the script */
const connection = await connectionProviver.resolve(uri);
const appEntry = connection?.fileSystem.parent(uri, EntryType.APPLICATION);

if (!connection || !appEntry) {
return;
}

const session = ConnectionHelper.createEnigmaSession(connection.model, appEntry.id, false);
const global = await session.open() as EngineAPI.IGlobal;
const app = await global.openDoc(appEntry.id);

await app.setScript(script);
await app.getAppLayout();
await app.doSave();
await session.close();
} catch (error) {
console.log(error);
}
}
6 changes: 6 additions & 0 deletions src/projects/extension/script/data/commands.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export enum ScriptCommands {
CHECK_SYNTAX = 'VsQlik.Script.CheckSyntax',
LOAD_DATA = 'VsQlik.Script.LoadData',
RESOLVE_ACTIVE = 'VsQlik.Script.ResolveActive',
SYNCHRONIZE = 'VsQlik.Script.Synchronize'
}
4 changes: 2 additions & 2 deletions src/projects/extension/script/files/script.file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export class ScriptFileCtrl extends QixFsFileAdapter {

public constructor(
@inject(QixApplicationProvider) private appService: QixApplicationProvider,
@inject(FileSystemHelper) private fileSystemHelper: FileSystemHelper,
@inject(FileSystemHelper) private fileSystemHelper: FileSystemHelper
) {
super();
}
Expand Down Expand Up @@ -73,7 +73,7 @@ export class ScriptFileCtrl extends QixFsFileAdapter {
fileUri = this.convertUri(uri);
}

const connection = await this.getConnection(uri);
const connection = await this.getConnection(uri);
const app = connection?.fileSystem.parent(fileUri, EntryType.APPLICATION);

if (!app || !connection) {
Expand Down
53 changes: 10 additions & 43 deletions src/projects/extension/script/script.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,73 +2,40 @@ import * as vscode from "vscode";
import { QixRouter } from "@core/router";
import { ExtensionContext } from "@data/tokens";
import { inject, singleton } from "tsyringe";
import { EntryType } from "@vsqlik/fs/data";

import { ConnectionProvider } from "../connection/utils/connection.provider";
import { Application } from "../connection/utils/application";

import { CheckScriptSyntax, ScriptLoadDataCommand, ScriptResolveActiveCommand } from "./commands";
import { routes } from "./data/routes";
import { ScriptSynchronizeCommand } from "./commands/sync-script";
import { ScriptCommands } from "./data/commands";
import { ScriptGuard } from "./utils/script.guard";

@singleton()
export class ScriptModule {

constructor(
@inject(ExtensionContext) private extensionContext: vscode.ExtensionContext,
@inject(ConnectionProvider) private connectionProvider: ConnectionProvider,
@inject(QixRouter) private router: QixRouter<any>,
@inject(ScriptGuard) private scriptGuard: ScriptGuard
) { }
) {
}

/**
* bootstrap script module
*/
public bootstrap(): void {
this.router.addRoutes(routes);

this.registerCommands();
this.registerEvents();
}

/**
* a new textdocument has been opened
* check we handle a script file and if we do connect to appChange stream
*/
private async onOpenDocument(doc: vscode.TextDocument) {

if (doc.uri.scheme !== "qix") {
return;
}

/** resolve connection and entry type */
const connection = await this.connectionProvider.resolve(doc.uri);
const fileEntry = connection?.fileSystem.read(doc.uri.toString(true));
const appEntry = connection?.fileSystem.parent(doc.uri, EntryType.APPLICATION);

if (!connection || !appEntry || fileEntry?.type !== EntryType.SCRIPT) {
return;
}

const app = await connection.getApplication(appEntry.id) as Application;
this.scriptGuard.add(doc, app);

vscode.commands.executeCommand(`VsQlik.Script.CheckSyntax`, doc.uri);
this.scriptGuard.init();
}

/**
* register commands for vscode
*/
private registerCommands(): void {
this.extensionContext.subscriptions.push(vscode.commands.registerCommand('VsQlik.Script.CheckSyntax', CheckScriptSyntax));
this.extensionContext.subscriptions.push(vscode.commands.registerCommand('VsQlik.Script.LoadData', ScriptLoadDataCommand));
this.extensionContext.subscriptions.push(vscode.commands.registerCommand('VsQlik.Script.ResolveActive', ScriptResolveActiveCommand));
}

/**
* register connection storage where all sessions are saved to
*/
private registerEvents(): void {
vscode.workspace.onDidOpenTextDocument((document) => this.onOpenDocument(document));
/** @todo move to enum */
this.extensionContext.subscriptions.push(vscode.commands.registerCommand(ScriptCommands.CHECK_SYNTAX , CheckScriptSyntax));
this.extensionContext.subscriptions.push(vscode.commands.registerCommand(ScriptCommands.LOAD_DATA , ScriptLoadDataCommand));
this.extensionContext.subscriptions.push(vscode.commands.registerCommand(ScriptCommands.RESOLVE_ACTIVE, ScriptResolveActiveCommand));
this.extensionContext.subscriptions.push(vscode.commands.registerCommand(ScriptCommands.SYNCHRONIZE , ScriptSynchronizeCommand));
}
}
Loading