Skip to content

Commit c614f32

Browse files
Scott DoverScott Dover
authored andcommitted
chore: stub RestSASServerAdapter
Signed-off-by: Scott Dover <[email protected]>
1 parent e3992cf commit c614f32

File tree

6 files changed

+336
-41
lines changed

6 files changed

+336
-41
lines changed

client/src/components/ContentNavigator/ContentAdapterFactory.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// Copyright © 2024, SAS Institute Inc., Cary, NC, USA. All Rights Reserved.
22
// SPDX-License-Identifier: Apache-2.0
3+
import RestSASServerAdapter from "../../connection/rest/RestSASServerAdapter";
34
import SASContentAdapter from "../../connection/rest/SASContentAdapter";
45
import { ConnectionType } from "../profile";
56
import {
@@ -16,6 +17,8 @@ class ContentAdapterFactory {
1617
): ContentAdapter {
1718
const key = `${connectionType}.${sourceType}`;
1819
switch (key) {
20+
case `${ConnectionType.Rest}.${ContentSourceType.SASServer}`:
21+
return new RestSASServerAdapter();
1922
case `${ConnectionType.Rest}.${ContentSourceType.SASContent}`:
2023
default:
2124
return new SASContentAdapter();

client/src/components/ContentNavigator/index.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,11 @@ class ContentNavigator implements SubscriptionProvider {
5454
private contentDataProvider: ContentDataProvider;
5555
private contentModel: ContentModel;
5656
private sourceType: ContentNavigatorConfig["sourceType"];
57+
private treeIdentifier: ContentNavigatorConfig["treeIdentifier"];
5758

5859
constructor(context: ExtensionContext, config: ContentNavigatorConfig) {
60+
this.sourceType = config.sourceType;
61+
this.treeIdentifier = config.treeIdentifier;
5962
this.contentModel = new ContentModel(
6063
this.contentAdapterForConnectionType(),
6164
);
@@ -64,7 +67,6 @@ class ContentNavigator implements SubscriptionProvider {
6467
context.extensionUri,
6568
config,
6669
);
67-
this.sourceType = config.sourceType;
6870

6971
workspace.registerFileSystemProvider(
7072
config.sourceType,
@@ -269,7 +271,7 @@ class ContentNavigator implements SubscriptionProvider {
269271
),
270272
commands.registerCommand(`${SAS}.collapseAllContent`, () => {
271273
commands.executeCommand(
272-
"workbench.actions.treeView.contentdataprovider.collapseAll",
274+
`workbench.actions.treeView.${this.treeIdentifier}.collapseAll`,
273275
);
274276
}),
275277
commands.registerCommand(
Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
import { Uri } from "vscode";
2+
3+
import {
4+
AddChildItemProperties,
5+
ContentAdapter,
6+
ContentItem,
7+
RootFolderMap,
8+
} from "../../components/ContentNavigator/types";
9+
10+
class RestSASServerAdapter implements ContentAdapter {
11+
public async connect(baseUrl: string): Promise<void> {
12+
// TODO
13+
return;
14+
}
15+
public connected(): boolean {
16+
// TODO
17+
return true;
18+
}
19+
20+
public async addChildItem(
21+
childItemUri: string | undefined,
22+
parentItemUri: string | undefined,
23+
properties: AddChildItemProperties,
24+
): Promise<boolean> {
25+
throw new Error("Method not implemented.");
26+
}
27+
28+
public async addItemToFavorites(item: ContentItem): Promise<boolean> {
29+
throw new Error("Method not implemented.");
30+
}
31+
32+
public async createNewFolder(
33+
parentItem: ContentItem,
34+
folderName: string,
35+
): Promise<ContentItem | undefined> {
36+
throw new Error("Method not implemented.");
37+
}
38+
39+
public async createNewItem(
40+
parentItem: ContentItem,
41+
fileName: string,
42+
buffer?: ArrayBufferLike,
43+
): Promise<ContentItem | undefined> {
44+
throw new Error("Method not implemented.");
45+
}
46+
47+
public async deleteItem(item: ContentItem): Promise<boolean> {
48+
throw new Error("Method not implemented.");
49+
}
50+
51+
public async getChildItems(parentItem: ContentItem): Promise<ContentItem[]> {
52+
throw new Error("Method not implemented.");
53+
}
54+
55+
public async getContentOfItem(item: ContentItem): Promise<string> {
56+
throw new Error("Method not implemented.");
57+
}
58+
59+
public async getContentOfUri(uri: Uri): Promise<string> {
60+
throw new Error("Method not implemented.");
61+
}
62+
63+
public async getFolderPathForItem(item: ContentItem): Promise<string> {
64+
throw new Error("Method not implemented.");
65+
}
66+
67+
public async getItemOfId(id: string): Promise<ContentItem> {
68+
throw new Error("Method not implemented.");
69+
}
70+
71+
public async getItemOfUri(uri: Uri): Promise<ContentItem> {
72+
throw new Error("Method not implemented.");
73+
}
74+
75+
public async getParentOfItem(
76+
item: ContentItem,
77+
): Promise<ContentItem | undefined> {
78+
throw new Error("Method not implemented.");
79+
}
80+
81+
public getRootFolder(name: string): ContentItem | undefined {
82+
throw new Error("Method not implemented.");
83+
}
84+
85+
public async getRootItems(): Promise<RootFolderMap> {
86+
// TODO
87+
return {};
88+
}
89+
90+
public async getUriOfItem(
91+
item: ContentItem,
92+
readOnly: boolean,
93+
): Promise<Uri> {
94+
throw new Error("Method not implemented.");
95+
}
96+
97+
public async moveItem(
98+
item: ContentItem,
99+
targetParentFolderUri: string,
100+
): Promise<boolean> {
101+
throw new Error("Method not implemented.");
102+
}
103+
104+
public async recycleItem(
105+
item: ContentItem,
106+
): Promise<{ newUri?: Uri; oldUri?: Uri }> {
107+
throw new Error("Method not implemented.");
108+
}
109+
110+
public async removeItemFromFavorites(item: ContentItem): Promise<boolean> {
111+
throw new Error("Method not implemented.");
112+
}
113+
114+
public async renameItem(
115+
item: ContentItem,
116+
newName: string,
117+
): Promise<ContentItem | undefined> {
118+
throw new Error("Method not implemented.");
119+
}
120+
121+
public async restoreItem(item: ContentItem): Promise<boolean> {
122+
throw new Error("Method not implemented.");
123+
}
124+
125+
public async updateContentOfItem(uri: Uri, content: string): Promise<void> {
126+
throw new Error("Method not implemented.");
127+
}
128+
}
129+
130+
export default RestSASServerAdapter;

client/src/node/extension.ts

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -117,12 +117,22 @@ export function activate(context: ExtensionContext): void {
117117
sourceType: ContentSourceType.SASContent,
118118
treeIdentifier: "contentdataprovider",
119119
});
120-
// TODO #889 Create/use this
121-
// const sasServerNavigator = new ContentNavigator(context, {
122-
// mimeType: "application/vnd.code.tree.serverdataprovider",
123-
// sourceType: "sasServer",
124-
// treeIdentifier: "serverdataprovider",
125-
// });
120+
const sasServerNavigator = new ContentNavigator(context, {
121+
mimeType: "application/vnd.code.tree.serverdataprovider",
122+
sourceType: ContentSourceType.SASServer,
123+
treeIdentifier: "serverdataprovider",
124+
});
125+
const handleFileUpdated = (e) => {
126+
switch (e.type) {
127+
case "rename":
128+
sasDiagnostic.updateDiagnosticUri(e.uri, e.newUri);
129+
break;
130+
case "recycle":
131+
case "delete":
132+
sasDiagnostic.ignoreAll(e.uri);
133+
break;
134+
}
135+
};
126136

127137
const resultPanelSubscriptionProvider = new ResultPanelSubscriptionProvider();
128138

@@ -169,18 +179,10 @@ export function activate(context: ExtensionContext): void {
169179
getStatusBarItem(),
170180
...libraryNavigator.getSubscriptions(),
171181
...sasContentNavigator.getSubscriptions(),
182+
...sasServerNavigator.getSubscriptions(),
172183
...resultPanelSubscriptionProvider.getSubscriptions(),
173-
sasContentNavigator.onDidManipulateFile((e) => {
174-
switch (e.type) {
175-
case "rename":
176-
sasDiagnostic.updateDiagnosticUri(e.uri, e.newUri);
177-
break;
178-
case "recycle":
179-
case "delete":
180-
sasDiagnostic.ignoreAll(e.uri);
181-
break;
182-
}
183-
}),
184+
sasContentNavigator.onDidManipulateFile(handleFileUpdated),
185+
sasServerNavigator.onDidManipulateFile(handleFileUpdated),
184186
// If configFile setting is changed, update watcher to watch new configuration file
185187
workspace.onDidChangeConfiguration((event: ConfigurationChangeEvent) => {
186188
if (event.affectsConfiguration("SAS.connectionProfiles")) {

0 commit comments

Comments
 (0)