Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit f9c5888

Browse files
author
Akos Kitta
committed
feat: notification progress for pull/push
Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
1 parent 961bffa commit f9c5888

File tree

3 files changed

+18
-27
lines changed

3 files changed

+18
-27
lines changed

‎arduino-ide-extension/src/browser/widgets/cloud-sketchbook/cloud-sketchbook-contributions.ts‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,8 +266,12 @@ export class CloudSketchbookContribution extends CloudSketchContribution {
266266
if (!CurrentSketch.isValid(currentSketch)) {
267267
return undefined;
268268
}
269-
const dataDirUri = this.configServiceClient.tryGetDataDirUri();
270269
// cannot determine if the sketch is in the cloud cache folder
270+
const dataDirUri = this.configServiceClient.tryGetDataDirUri();
271+
if (!dataDirUri) {
272+
return undefined;
273+
}
274+
// sketch is not in the cache folder
271275
if (!this.createFeatures.isCloud(currentSketch, dataDirUri)) {
272276
return undefined;
273277
}

‎arduino-ide-extension/src/browser/widgets/cloud-sketchbook/cloud-sketchbook-tree.ts‎

Lines changed: 11 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import { posix, splitSketchPath } from '../../create/create-paths';
3232
import { Create } from '../../create/typings';
3333
import { nls } from '@theia/core/lib/common';
3434
import { ApplicationConnectionStatusContribution } from '../../theia/core/connection-status-service';
35+
import { ExecuteWithProgress } from '../../../common/protocol/progressible';
3536

3637
const MESSAGE_TIMEOUT = 5 * 1000;
3738
const deepmerge = require('deepmerge').default;
@@ -144,7 +145,7 @@ export class CloudSketchbookTree extends SketchbookTree {
144145
this.messageService.info(
145146
nls.localize(
146147
'arduino/cloud/donePulling',
147-
'Done pulling {0}’.',
148+
"Done pulling '{0}'.",
148149
node.fileStat.name
149150
),
150151
{
@@ -212,7 +213,7 @@ export class CloudSketchbookTree extends SketchbookTree {
212213
this.messageService.info(
213214
nls.localize(
214215
'arduino/cloud/donePushing',
215-
'Done pushing {0}’.',
216+
"Done pushing '{0}'.",
216217
node.fileStat.name
217218
),
218219
{
@@ -324,29 +325,15 @@ export class CloudSketchbookTree extends SketchbookTree {
324325
state: CloudSketchbookTree.CloudSketchDirNode.State,
325326
task: (node: CloudSketchbookTree.CloudSketchDirNode) => MaybePromise<T>
326327
): Promise<T> {
327-
const decoration: WidgetDecoration.TailDecoration = {
328-
data: `${firstToUpperCase(state)}...`,
329-
fontData: {
330-
color: 'var(--theia-list-highlightForeground)',
331-
},
332-
};
333-
try {
334-
node.state = state;
335-
this.mergeDecoration(node, { tailDecorations: [decoration] });
336-
await this.refresh(node);
337-
const result = await task(node);
338-
return result;
339-
} finally {
340-
delete node.state;
341-
// TODO: find a better way to attach and detach decorators. Do we need a proper `TreeDecorator` instead?
342-
const index = node.decorationData?.tailDecorations?.findIndex(
343-
(candidate) => JSON.stringify(decoration) === JSON.stringify(candidate)
344-
);
345-
if (typeof index === 'number' && index !== -1) {
346-
node.decorationData?.tailDecorations?.splice(index, 1);
328+
const name = node.uri.path.name;
329+
return ExecuteWithProgress.withProgress(
330+
`${firstToUpperCase(state)} '${name}'`,
331+
this.messageService,
332+
async (progress) => {
333+
progress.report({ work: { done: 0, total: NaN } });
334+
return task(node);
347335
}
348-
await this.refresh(node);
349-
}
336+
);
350337
}
351338

352339
private async sync(source: URI, dest: URI): Promise<void> {

‎i18n/en.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@
9393
"cloudSketchbook": "Cloud Sketchbook",
9494
"connected": "Connected",
9595
"continue": "Continue",
96-
"donePulling": "Done pulling {0}.",
97-
"donePushing": "Done pushing {0}.",
96+
"donePulling": "Done pulling '{0}'.",
97+
"donePushing": "Done pushing '{0}'.",
9898
"embed": "Embed:",
9999
"emptySketchbook": "Your Sketchbook is empty",
100100
"goToCloud": "Go to Cloud",

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /