From bf70043249e32c086364262eb65a3d8b8573c3dc Mon Sep 17 00:00:00 2001 From: Scott Dover Date: Fri, 27 Sep 2024 15:54:38 -0400 Subject: [PATCH] chore: add icons --- .../ContentNavigator/ContentDataProvider.ts | 9 +++++++++ client/src/components/ContentNavigator/const.ts | 4 +++- client/src/connection/rest/RestSASServerAdapter.ts | 12 ++++-------- icons/dark/serverDark.svg | 8 ++++++++ icons/dark/userWorkspaceDark.svg | 4 ++++ icons/light/serverLight.svg | 8 ++++++++ icons/light/userWorkspaceLight.svg | 4 ++++ 7 files changed, 40 insertions(+), 9 deletions(-) create mode 100644 icons/dark/serverDark.svg create mode 100644 icons/dark/userWorkspaceDark.svg create mode 100644 icons/light/serverLight.svg create mode 100644 icons/light/userWorkspaceLight.svg diff --git a/client/src/components/ContentNavigator/ContentDataProvider.ts b/client/src/components/ContentNavigator/ContentDataProvider.ts index cea79603b..4fe4ec8e6 100644 --- a/client/src/components/ContentNavigator/ContentDataProvider.ts +++ b/client/src/components/ContentNavigator/ContentDataProvider.ts @@ -45,6 +45,8 @@ import { FAVORITES_FOLDER_TYPE, Messages, ROOT_FOLDER_TYPE, + SERVER_HOME_FOLDER_TYPE, + SERVER_ROOT_FOLDER_TYPE, TRASH_FOLDER_TYPE, } from "./const"; import { @@ -642,6 +644,12 @@ class ContentDataProvider case FAVORITES_FOLDER_TYPE: icon = "favoritesFolder"; break; + case SERVER_HOME_FOLDER_TYPE: + icon = "userWorkspace"; + break; + case SERVER_ROOT_FOLDER_TYPE: + icon = "server"; + break; default: icon = "folder"; break; @@ -652,6 +660,7 @@ class ContentDataProvider icon = "sasProgramFile"; } } + return icon !== "" ? { dark: Uri.joinPath(this.extensionUri, `icons/dark/${icon}Dark.svg`), diff --git a/client/src/components/ContentNavigator/const.ts b/client/src/components/ContentNavigator/const.ts index 04335be93..fa5030a40 100644 --- a/client/src/components/ContentNavigator/const.ts +++ b/client/src/components/ContentNavigator/const.ts @@ -16,10 +16,12 @@ export const ROOT_FOLDER = createStaticFolder( ); export const SERVER_FOLDER_ID = "SERVER_FOLDER_ID"; +export const SERVER_ROOT_FOLDER_TYPE = "ServerRootFolder"; +export const SERVER_HOME_FOLDER_TYPE = "ServerHomeFolder"; export const SAS_SERVER_ROOT_FOLDER = createStaticFolder( SERVER_FOLDER_ID, "SAS Server", - ROOT_FOLDER_TYPE, + SERVER_ROOT_FOLDER_TYPE, "/", "getDirectoryMembers", ); diff --git a/client/src/connection/rest/RestSASServerAdapter.ts b/client/src/connection/rest/RestSASServerAdapter.ts index bcce42909..52f33f9bd 100644 --- a/client/src/connection/rest/RestSASServerAdapter.ts +++ b/client/src/connection/rest/RestSASServerAdapter.ts @@ -10,6 +10,7 @@ import { SAS_SERVER_ROOT_FOLDER, SAS_SERVER_ROOT_FOLDERS, SERVER_FOLDER_ID, + SERVER_HOME_FOLDER_TYPE, } from "../../components/ContentNavigator/const"; import { AddChildItemProperties, @@ -169,7 +170,7 @@ class RestSASServerAdapter implements ContentAdapter { createStaticFolder( SAS_SERVER_HOME_DIRECTORY, "Home", - "userRoot", + SERVER_HOME_FOLDER_TYPE, `/compute/sessions/${this.sessionId}/files/~fs~/members`, "getDirectoryMembers", ), @@ -278,8 +279,6 @@ class RestSASServerAdapter implements ContentAdapter { } public getRootFolder(): ContentItem | undefined { - // TODO (sas-server) Re-implement this if SAS server supports - // recycle bin return undefined; } @@ -394,7 +393,7 @@ class RestSASServerAdapter implements ContentAdapter { } private filePropertiesToContentItem( - fileProperties: FileProperties, + fileProperties: FileProperties & { type?: string }, flags?: ContentItem["flags"], ): ContentItem { const links = fileProperties.links.map((link) => ({ @@ -405,10 +404,6 @@ class RestSASServerAdapter implements ContentAdapter { uri: link.uri, })); - if (!getLink(links, "GET", "self")) { - console.log("OH NBO"); - } - const id = getLink(links, "GET", "self").uri; const isRootFolder = [SERVER_FOLDER_ID, SAS_SERVER_HOME_DIRECTORY].includes( id, @@ -428,6 +423,7 @@ class RestSASServerAdapter implements ContentAdapter { !!getLink(links, "POST", "createFile"), }, flags, + type: fileProperties.type || "", }; const typeName = getTypeName(item); diff --git a/icons/dark/serverDark.svg b/icons/dark/serverDark.svg new file mode 100644 index 000000000..240e7f800 --- /dev/null +++ b/icons/dark/serverDark.svg @@ -0,0 +1,8 @@ + + + + + diff --git a/icons/dark/userWorkspaceDark.svg b/icons/dark/userWorkspaceDark.svg new file mode 100644 index 000000000..94ae1f8f7 --- /dev/null +++ b/icons/dark/userWorkspaceDark.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/icons/light/serverLight.svg b/icons/light/serverLight.svg new file mode 100644 index 000000000..240e7f800 --- /dev/null +++ b/icons/light/serverLight.svg @@ -0,0 +1,8 @@ + + + + + diff --git a/icons/light/userWorkspaceLight.svg b/icons/light/userWorkspaceLight.svg new file mode 100644 index 000000000..18fc00e4e --- /dev/null +++ b/icons/light/userWorkspaceLight.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file