Skip to content
This repository has been archived by the owner on Aug 31, 2021. It is now read-only.

Commit

Permalink
fixes and improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
mkloubert committed Apr 9, 2018
1 parent ccd1c39 commit e5a48e2
Show file tree
Hide file tree
Showing 10 changed files with 97 additions and 30 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* extension is build for [Visual Studio Code 1.22](https://code.visualstudio.com/updates/v1_22) now
* using new progress api for deploy operations now
* using emoji icons for deploy operations in output window now
* buttons are shown in the status bar after a deploy operation
* buttons are shown in the status bar after a deploy operation, added `showStatusWhenFinished` to control this ... s. [issue #53](https://github.com/mkloubert/vscode-deploy-reloaded/issues/53)
* added `$lines` function for quick code executions
* updated the following [npm](https://www.npmjs.com/) modules:
* [aws-sdk](https://www.npmjs.com/package/aws-sdk) `2.222.1`
Expand Down
Binary file modified img/demo28.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 20 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1317,6 +1317,26 @@
}
]
},
"showStatusWhenFinished": {
"description": "Show workspace name as prefix in popup messages or not.",
"oneOf": [
{
"description": "Show a button in the status bar, after a deploy operation has been finished or not.",
"type": "boolean",
"default": false
},
{
"description": "Shows a button in the status bar, after a deploy operation has been finished and defines the time, in milliseconds, after it should disapears automatically.",
"type": "integer",
"minimum": 0,
"default": 60000
},
{
"description": "Shows a button in the status bar, after a deploy operation has been finished.",
"type": "null"
}
]
},
"showWorkspaceNameInPopups": {
"description": "Show workspace name as prefix in popup messages or not.",
"type": "boolean",
Expand Down
6 changes: 5 additions & 1 deletion src/contracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ export interface Configuration extends deploy_packages.WithFastFileCheckSettings
/**
* Indicates, if non saved documents will be saved automatically, before they are going to be deployed or not.
*/
readonly saveBeforeDeploy?: boolean;
readonly saveBeforeDeploy?: boolean;
/**
* Show a popup after a successfull deploy operation or not.
*/
Expand All @@ -266,6 +266,10 @@ export interface Configuration extends deploy_packages.WithFastFileCheckSettings
* Shows a popup when a deploy operation has been finished.
*/
readonly showPopupWhenFinished?: deploy_gui.ShowPopupWhenFinishedValue;
/**
* Show a button in the status bar after a deploy operation has been finished.
*/
readonly showStatusWhenFinished?: boolean | number | null;
/**
* Show workspace name as prefix in popup messages or not.
*/
Expand Down
14 changes: 6 additions & 8 deletions src/delete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ export async function deleteFilesIn(files: string[],
}, {
location: vscode.ProgressLocation.Notification,
cancellable: true,
title: ME.t('delete.deletingFiles'),
title: ME.t('DELETE.deletingFiles'),
});
}

Expand Down Expand Up @@ -288,6 +288,8 @@ async function deleteFilesInWithProgress(progress: deploy_helpers.ProgressContex
succeeded: [],
};

const OVERALL_WATCH = deploy_helpers.startWatch();

// "finished button"
await ME.invokeForFinishedButton(
deploy_contracts.DeployOperation.Delete,
Expand Down Expand Up @@ -321,15 +323,11 @@ async function deleteFilesInWithProgress(progress: deploy_helpers.ProgressContex
btn.color = new vscode.ThemeColor(color);
btn.text = `${icon} ` +
`[${NOW.format( ME.t('time.timeWithSeconds') )}] ` +
ME.t('DELETE.finishedButton.text');
ME.t('DELETE.finishedButton.text',
OVERALL_WATCH.stop());
btn.tooltip = ME.t('DELETE.finishedButton.tooltip');

btn.show();

ME.setTimeoutForFinishedButton(
deploy_contracts.DeployOperation.Delete,
(b) => b.hide()
);
ME.showFinishedButton(deploy_contracts.DeployOperation.Delete);
}
);
};
Expand Down
12 changes: 5 additions & 7 deletions src/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,8 @@ async function deployFilesToWithProgress(progress: deploy_helpers.ProgressContex
succeeded: [],
};

const OVERALL_WATCH = deploy_helpers.startWatch();

// "finished button"
await ME.invokeForFinishedButton(
deploy_contracts.DeployOperation.Deploy,
Expand Down Expand Up @@ -585,15 +587,11 @@ async function deployFilesToWithProgress(progress: deploy_helpers.ProgressContex
btn.color = new vscode.ThemeColor(color);
btn.text = `${icon} ` +
`[${NOW.format( ME.t('time.timeWithSeconds') )}] ` +
ME.t('deploy.finishedButton.text');
ME.t('deploy.finishedButton.text',
OVERALL_WATCH.stop());
btn.tooltip = ME.t('deploy.finishedButton.tooltip');

btn.show();

ME.setTimeoutForFinishedButton(
deploy_contracts.DeployOperation.Deploy,
(b) => b.hide()
);
ME.showFinishedButton(deploy_contracts.DeployOperation.Deploy);
}
);
};
Expand Down
6 changes: 3 additions & 3 deletions src/lang/de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export const translation: Translation = {
operationFailed: "Konnte das Löschen nicht durchführen (s. Debugkonsole 'STRG/CMD + SHIFT + Y')!",
},
finishedButton: {
text: "Löschen abgeschlossen",
text: "Löschen abgeschlossen ({0:trim,ending_space}ms)",
tooltip: "Hier klicken, um die Ausgabe zu öffnen ...",
},
finishedOperation: "Das Löschen der Dateien in{0:trim,surround,leading_space} wurde erfolgreich abgeschlossen.",
Expand Down Expand Up @@ -174,7 +174,7 @@ export const translation: Translation = {
label: "Dateiliste",
},
finishedButton: {
text: "Bereitstellen abgeschlossen",
text: "Bereitstellen abgeschlossen ({0:trim,ending_space}ms)",
tooltip: "Hier klicken, um die Ausgabe zu öffnen ...",
},
finishedOperation: "Das Bereitstellen der Dateien in{0:trim,surround,leading_space} wurde erfolgreich abgeschlossen.",
Expand Down Expand Up @@ -473,7 +473,7 @@ export const translation: Translation = {
operationForSourceFailed: "Das Laden der Datei(en) aus der Quelle{0:trim,surround,leading_space} schlug fehl:{1:trim,surround,leading_space}",
},
finishedButton: {
text: "Laden abgeschlossen",
text: "Laden abgeschlossen ({0:trim,ending_space}ms)",
tooltip: "Hier klicken, um die Ausgabe zu öffnen ...",
},
finishedOperation: "Das Laden der Dateien von{0:trim,surround,leading_space} wurde erfolgreich abgeschlossen.",
Expand Down
6 changes: 3 additions & 3 deletions src/lang/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export const translation: Translation = {
operationFailed: "Delete operation failed (s. debug console 'CTRL/CMD + SHIFT + Y')!",
},
finishedButton: {
text: "Delete operation finished",
text: "Delete operation finished ({0:trim,ending_space}ms)",
tooltip: "Click here to open output ...",
},
finishedOperation: "Deleting files in{0:trim,surround,leading_space} has been finished.",
Expand Down Expand Up @@ -168,7 +168,7 @@ export const translation: Translation = {
label: "File list",
},
finishedButton: {
text: "Deploy operation finished",
text: "Deploy operation finished ({0:trim,ending_space}ms)",
tooltip: "Click here to open output ...",
},
finishedOperation: "Deploying files to{0:trim,surround,leading_space} has been finished.",
Expand Down Expand Up @@ -474,7 +474,7 @@ export const translation: Translation = {
operationForSourceFailed: "Pulling file(s) from source{0:trim,surround,leading_space} failed:{1:trim,surround,leading_space}",
},
finishedButton: {
text: "Pull operation finished",
text: "Pull operation finished ({0:trim,ending_space}ms)",
tooltip: "Click here to open output ...",
},
finishedOperation: "Pulling files from{0:trim,surround,leading_space} has been finished.",
Expand Down
12 changes: 5 additions & 7 deletions src/pull.ts
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,8 @@ async function pullFilesFromWithProgress(progress: deploy_helpers.ProgressContex
succeeded: [],
};

const OVERALL_WATCH = deploy_helpers.startWatch();

// "finished button"
await ME.invokeForFinishedButton(
deploy_contracts.DeployOperation.Pull,
Expand Down Expand Up @@ -593,15 +595,11 @@ async function pullFilesFromWithProgress(progress: deploy_helpers.ProgressContex
btn.color = new vscode.ThemeColor(color);
btn.text = `${icon} ` +
`[${NOW.format( ME.t('time.timeWithSeconds') )}] ` +
ME.t('pull.finishedButton.text');
ME.t('pull.finishedButton.text',
OVERALL_WATCH.stop());
btn.tooltip = ME.t('pull.finishedButton.tooltip');

btn.show();

ME.setTimeoutForFinishedButton(
deploy_contracts.DeployOperation.Pull,
(b) => b.hide()
);
ME.showFinishedButton(deploy_contracts.DeployOperation.Pull);
}
);
};
Expand Down
49 changes: 49 additions & 0 deletions src/workspaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4454,6 +4454,55 @@ export class Workspace extends deploy_helpers.WorkspaceBase implements deploy_co
}
}

/**
* Shows a "finished button".
*
* @param {deploy_contracts.DeployOperation} operation The type of deploy operation.
*
* @return {boolean} Operation was successful or not.
*/
public showFinishedButton(operation: deploy_contracts.DeployOperation) {
const CFG = this.config;
if (!CFG) {
return;
}

const BTN = this.getFinishedButton(operation);
if (BTN) {
const SHOW_STATUS_WHEN_FINISHED = CFG.showStatusWhenFinished;

let showButton = true;
let hideAfter: number;
if (null !== SHOW_STATUS_WHEN_FINISHED) {
if (_.isBoolean(SHOW_STATUS_WHEN_FINISHED)) {
showButton = SHOW_STATUS_WHEN_FINISHED;
hideAfter = 60000;
}
else {
hideAfter = parseInt(
deploy_helpers.toStringSafe(SHOW_STATUS_WHEN_FINISHED).trim()
);
}
}

if (showButton) {
BTN.show();

if (!isNaN(hideAfter)) {
this.setTimeoutForFinishedButton(
operation,
(b) => b.hide(),
hideAfter,
);
}
}

return true;
}

return false;
}

/**
* Promise (and safe) version of 'vscode.window.showErrorMessage()' function.
*
Expand Down

0 comments on commit e5a48e2

Please sign in to comment.