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 #543] unlock script if document is closed
changed the logic the script will locked as soon it will be opened and unlocked if document is closed again. This will ensure the file is not overridden until it is open, for example editor lost the focus and content will read in again. After document it closed it will unlocked again so next time we get the data from server.
  • Loading branch information
r-hannuschka committed Oct 25, 2020
commit 49b2b76b3db3da33bef599b041525a7c32462916
38 changes: 19 additions & 19 deletions src/projects/extension/connection/utils/application.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
import { Observable, Subject } from "rxjs";

interface FileData {
content: string;
modified: boolean;
}

export class Application {

private close$: Subject<void> = new Subject();
Expand All @@ -22,7 +17,7 @@ export class Application {
private doc: Promise<EngineAPI.IApp>;

/** */
private script: { content: string; modified: boolean };
private script: string | null = null;

public constructor(
private globalContext: EngineAPI.IGlobal,
Expand Down Expand Up @@ -56,30 +51,35 @@ export class Application {
* if we save the script on server side (browser) we will simply override
* everything what exists since we are not aware of any changes
*/
public async getScript(server = false): Promise<FileData> {
if (!this.script || server) {
public async getScript(force = false): Promise<string> {
if (!this.script || force) {
const doc = await this.document;
const script = await doc.getScript();
const data: FileData = { content: script, modified: false};

if(server) {
return data;
}

this.script = { content: script, modified: false };
return await doc.getScript();
}
return this.script;
}

public async lockScript(): Promise<void> {
if (!this.script) {
const doc = await this.document;
this.script = await doc.getScript();
}
}

/**
* set script to null so next time we fetch the script we got it from server
*/
public unlockScript(): void {
this.script = null;
}

/** update a script */
public async updateScript(content: string): Promise<void> {
if (this.script) {
const doc = await this.doc;
await doc.setScript(content);
await doc.doSave();

this.script.modified = true;
this.script.content = content;
this.script = content;
}
}

Expand Down
123 changes: 63 additions & 60 deletions src/projects/extension/script/script.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,35 +36,6 @@ export class ScriptModule {
this.registerEvents();
}

/**
* 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.onDidCloseTextDocument((document) => this.onCloseDocument(document));
vscode.workspace.onDidOpenTextDocument((document) => this.onOpenDocument(document));
}

/**
* register script specific routes
*/
private registerRoutes(): void {
this.router.addRoutes([
{
path: 'remote/:context/:app/script/main.qvs',
ctrl: ReadonlyScriptFileCtrl
}
]);
}

/**
* a new textdocument has been opened
* check we handle a script file and if we do connect to appChange stream
Expand All @@ -85,6 +56,7 @@ export class ScriptModule {
}

const app = await connection?.getApplication(appEntry.id);
await app?.lockScript();

if (!app) {
return;
Expand All @@ -97,38 +69,9 @@ export class ScriptModule {
/** @todo improve */
this.observedDocuments.set(doc, { app, subscription: subscription });

if (await this.remoteScriptIsDifferent(doc)) {
this.openDiff(doc, app);
}

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

/**
* check remote script is diffrent from local source
*/
private async remoteScriptIsDifferent(doc: vscode.TextDocument): Promise<boolean> {

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 (!appEntry || fileEntry?.type !== EntryType.SCRIPT) {
return false;
}

const app = await connection?.getApplication(appEntry.id);

if (!app) {
return false;
}

const remoteScript = (await app.getScript(true)).content;
const localScript = (await app.getScript()).content;

return remoteScript !== localScript;
}

/**
* app has triggered a change check the script from origin
*/
Expand Down Expand Up @@ -167,7 +110,67 @@ export class ScriptModule {
*
*/
private async onCloseDocument(doc: vscode.TextDocument) {
this.observedDocuments.get(doc)?.subscription.unsubscribe();
this.observedDocuments.delete(doc);

const data = this.observedDocuments.get(doc);

if (data) {
data.subscription.unsubscribe();
data.app.unlockScript();
this.observedDocuments.delete(doc);
}
}

/**
* 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.onDidCloseTextDocument((document) => this.onCloseDocument(document));
vscode.workspace.onDidOpenTextDocument((document) => this.onOpenDocument(document));
}

/**
* register script specific routes
*/
private registerRoutes(): void {
this.router.addRoutes([
{
path: 'remote/:context/:app/script/main.qvs',
ctrl: ReadonlyScriptFileCtrl
}
]);
}

/**
* check remote script is diffrent from local source
*/
private async remoteScriptIsDifferent(doc: vscode.TextDocument): Promise<boolean> {

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 (!appEntry || fileEntry?.type !== EntryType.SCRIPT) {
return false;
}

const app = await connection?.getApplication(appEntry.id);

if (!app) {
return false;
}

const remoteScript = await app.getScript(true);
const localScript = await app.getScript();

return remoteScript !== localScript;
}
}
6 changes: 2 additions & 4 deletions src/projects/shared/qix/utils/application.provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,15 @@ export class QixApplicationProvider {
public async openDocument(connection: Connection, id: string): Promise<EngineAPI.IApp | undefined> {
const app = await connection.getApplication(id);
const document = await app?.document;

return document;
}

/**
* read script from app
*/
public async readScript(connection: Connection, id: string): Promise<string | undefined> {
const app = await connection.getApplication(id);
const script = await app?.getScript();
return script?.content;
const app = await connection.getApplication(id);
return app?.getScript();
}

/**
Expand Down