Skip to content

Commit 7115d20

Browse files
Scott DoverScott Dover
authored andcommitted
fix: fix remaining issues
Signed-off-by: Scott Dover <[email protected]>
1 parent 5f8b69a commit 7115d20

File tree

5 files changed

+30
-15
lines changed

5 files changed

+30
-15
lines changed

client/src/components/ContentNavigator/ContentModel.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,10 @@ export class ContentModel {
121121
let number = 1;
122122
let newFileName;
123123
do {
124-
newFileName = l10n.t("{basename}_Copy{number}.flw", {
124+
newFileName = l10n.t("{basename}_Copy{number}{ext}", {
125125
basename,
126126
number: number++,
127+
ext,
127128
});
128129
} while (usedFlowNames[newFileName]);
129130

client/src/components/ContentNavigator/index.ts

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,16 +63,16 @@ const folderValidator = (
6363

6464
class ContentNavigator implements SubscriptionProvider {
6565
private contentDataProvider: ContentDataProvider;
66+
private contentModel: ContentModel;
6667
private sourceType: ContentNavigatorConfig["sourceType"];
6768
private treeIdentifier: ContentNavigatorConfig["treeIdentifier"];
6869

69-
get contentModel() {
70-
return new ContentModel(this.contentAdapterForConnectionType());
71-
}
72-
7370
constructor(context: ExtensionContext, config: ContentNavigatorConfig) {
7471
this.sourceType = config.sourceType;
7572
this.treeIdentifier = config.treeIdentifier;
73+
this.contentModel = new ContentModel(
74+
this.contentAdapterForConnectionType(),
75+
);
7676
this.contentDataProvider = new ContentDataProvider(
7777
this.contentModel,
7878
context.extensionUri,
@@ -290,6 +290,7 @@ class ContentNavigator implements SubscriptionProvider {
290290
commands.registerCommand(
291291
`${SAS}.convertNotebookToFlow`,
292292
async (resource: ContentItem | Uri) => {
293+
await this.contentModel.connect(this.viyaEndpoint());
293294
const notebookToFlowConverter = new NotebookToFlowConverter(
294295
resource,
295296
this.contentModel,
@@ -400,7 +401,11 @@ class ContentNavigator implements SubscriptionProvider {
400401
if (event.affectsConfiguration("SAS.connectionProfiles")) {
401402
const endpoint = this.viyaEndpoint();
402403
this.collapseAllContent();
403-
this.contentDataProvider.useModel(this.contentModel);
404+
const contentModel = new ContentModel(
405+
this.contentAdapterForConnectionType(),
406+
);
407+
this.contentDataProvider.useModel(contentModel);
408+
this.contentModel = contentModel;
404409
if (endpoint) {
405410
await this.contentDataProvider.connect(endpoint);
406411
} else {
@@ -412,10 +417,14 @@ class ContentNavigator implements SubscriptionProvider {
412417
];
413418
}
414419

415-
private collapseAllContent() {
416-
commands.executeCommand(
417-
`workbench.actions.treeView.${this.treeIdentifier}.collapseAll`,
420+
private async collapseAllContent() {
421+
const collapeAllCmd = `workbench.actions.treeView.${this.treeIdentifier}.collapseAll`;
422+
const commandExists = (await commands.getCommands()).find(
423+
(c) => c === collapeAllCmd,
418424
);
425+
if (commandExists) {
426+
commands.executeCommand(collapeAllCmd);
427+
}
419428
}
420429

421430
private async uploadResource(

client/src/connection/rest/RestSASServerAdapter.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ class RestSASServerAdapter implements ContentAdapter {
8181
apply: async function (target, _this, argList) {
8282
try {
8383
return await target(...argList);
84+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
8485
} catch (error) {
8586
// If we get any error, lets reconnect and try again. If we fail a second time,
8687
// then we can assume it's a "real" error
@@ -136,6 +137,7 @@ class RestSASServerAdapter implements ContentAdapter {
136137
});
137138

138139
return this.filePropertiesToContentItem(response.data);
140+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
139141
} catch (error) {
140142
return;
141143
}
@@ -167,6 +169,7 @@ class RestSASServerAdapter implements ContentAdapter {
167169
}
168170

169171
return contentItem;
172+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
170173
} catch (error) {
171174
return;
172175
}
@@ -182,7 +185,8 @@ class RestSASServerAdapter implements ContentAdapter {
182185
});
183186
delete this.fileMetadataMap[filePath];
184187
return true;
185-
} catch (e) {
188+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
189+
} catch (error) {
186190
return false;
187191
}
188192
}
@@ -253,7 +257,6 @@ class RestSASServerAdapter implements ContentAdapter {
253257
}
254258

255259
private async getContentOfItemAtPath(path: string) {
256-
await this.setup();
257260
const response = await this.fileSystemApi.getFileContentFromSystem(
258261
{
259262
sessionId: this.sessionId,
@@ -488,7 +491,8 @@ class RestSASServerAdapter implements ContentAdapter {
488491
);
489492
try {
490493
return decodeURIComponent(uriWithoutPrefix);
491-
} catch (e) {
494+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
495+
} catch (error) {
492496
return uriWithoutPrefix;
493497
}
494498
}
@@ -513,7 +517,8 @@ class RestSASServerAdapter implements ContentAdapter {
513517
fileOrDirectoryPath: path,
514518
});
515519
return this.updateFileMetadata(path, response);
516-
} catch (e) {
520+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
521+
} catch (error) {
517522
// Intentionally blank
518523
}
519524

website/docs/Features/sasCodeEditing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
sidebar_position: 6
2+
sidebar_position: 7
33
---
44

55
# SAS Code Editing Features

website/docs/Features/sasNotebook.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
sidebar_position: 7
2+
sidebar_position: 8
33
---
44

55
# SAS Notebook

0 commit comments

Comments
 (0)