Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: implement sas file system for viya connections #1203

Merged
merged 30 commits into from
Nov 21, 2024
Merged

Conversation

scottdover
Copy link
Contributor

@scottdover scottdover commented Sep 13, 2024

Summary
This adds sas file system support for viya connections. Notable changes include:

  • Introducing a canRecycleResource function to sas content adapter. This allows us to make a determination about whether or not we should show a dialog for deleted files. Since SAS file system doesn't support recycle bin, we show the deletion message every time a file is deleted (since it's a permanent deletion)
  • Creates a distinct connection for NotebookConverter for connecting to sas studio (instead of re-using content model's connection)
  • Favorites are not implemented in this pull request and will be implemented in a future PR

Testing

  • File/folder creation
    • Create file/folder w/ context menu
    • Create file/folder by upload
    • Create file/folder by drag & drop (create multiple files)
  • File/folder deletion
    • Test file deletion with context menu
    • Test multi-file deletion with context menu
  • File/folder updates
    • Test updating file/folder name
    • Test updating file contents
    • Test moving file/folder (multiple files/folders)
  • Test downloading files/folders
  • Make sure refresh works as expected
    • Make sure connections are automatically refreshed after they become stale
  • Make sure a sas notebook file can be converted to a flow (test with sas content as well)
  • Make sure we're displaying all files/folders for sas server and that items are sorted by type (directories before files), then alphabetically
  • Make sure we can collapse all folders

TODOs

  • Update CHANGELOG
  • Update matrix.md with details about sas server

@scottdover scottdover force-pushed the feat/sas-server-2 branch 2 times, most recently from 96fae54 to c1ad860 Compare October 4, 2024 17:12
@scottdover scottdover marked this pull request as ready for review October 4, 2024 19:02
@scottdover scottdover added this to the 1.12.0 milestone Oct 10, 2024
Copy link
Member

@scnwwu scnwwu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

@scottdover scottdover force-pushed the feat/sas-server-2 branch 2 times, most recently from 9f24d79 to bc7bcf1 Compare October 18, 2024 18:48
@scottdover
Copy link
Contributor Author

Just had to rebase for DCO things

@Zhirong2022
Copy link
Collaborator

Open VSC and the default connection profile is non-Viya initially, switch to a Viya connection and sign in, it will show SAS content instead of SAS Sever stuff.
image

@Zhirong2022
Copy link
Collaborator

Error is thrown if trying to click Collapse All
image

Error running command SAS.server.collapseAllContent: Cannot read properties of undefined (reading 'treeIdentifier'). This is likely caused by the extension that contributes SAS.server.collapseAllContent.

@scnwwu
Copy link
Member

scnwwu commented Oct 24, 2024

@scottdover, you may want to update doc as appropriate, for example
https://github.com/sassoftware/vscode-sas-extension/blob/main/website/docs/matrix.md

@scottdover
Copy link
Contributor Author

@scottdover, you may want to update doc as appropriate, for example https://github.com/sassoftware/vscode-sas-extension/blob/main/website/docs/matrix.md

Ah, I knew I was forgetting something. Will update :)

@Zhirong2022
Copy link
Collaborator

Better error validation for some scenarios:
1.Create a folder with the same name as an existed one under the same directory
Current error message: Error running command SAS.server.addFolderResource: Request failed with status code 409. This is likely caused by the extension that contributes SAS.server.addFolderResource.

2.Folder name having some illegal special character like '/'
Current error message: Error running command SAS.server.addFolderResource: Request failed with status code 404. This is likely caused by the extension that contributes SAS.server.addFolderResource.

@Zhirong2022
Copy link
Collaborator

Create a .txt file named as NewFile+!@$%^&*.txt, it failed to open it in VSC. However it can be opened successfully in SASStudio.

@scottdover
Copy link
Contributor Author

Hey @Zhirong2022 . All comments above should now be addressed.

@scnwwu, I've updated the changelog and documentation

@Zhirong2022
Copy link
Collaborator

It is better to have a consistent file folder name violation with SASStudio. It is successfully to create a file folder with name 'NewFolder/' and it will be shown as 'NewFolder'.
image

@Zhirong2022
Copy link
Collaborator

Multi-selection files or folders through Shift or Ctrl. Suppose to delete all the highlighted files or folders, it will ask the user to confirm the deletion one by one.

@Zhirong2022
Copy link
Collaborator

Zhirong2022 commented Oct 28, 2024

Create a file with the same name
Error Message:
Error running command SAS.server.addFileResource: Request failed with status code 409. This is likely caused by the extension that contributes SAS.server.addFileResource.

Convert a .sasnb file to .flw file with the same name
1.SAS Server
Error message:Request failed with status code 409
2.SAS Content
It will add _CopyX(sequence number) automatically to avoid having errors

Signed-off-by: Scott Dover <[email protected]>
@scottdover
Copy link
Contributor Author

scottdover commented Nov 14, 2024

The following issues have been resolved in 7115d20

Better error validation for scenarios below: 1.Rename a file with the same name as an existed one Error message: Error running command SAS.server.renameResource: Request failed with status code 409. This is likely caused by the extension that contributes SAS.server.renameResource.

2.Rename a file folder with the same name as an existed one Error message:Error running command SAS.server.renameResource: Request failed with status code 409. This is likely caused by the extension that contributes SAS.server.renameResource.

It failed to save a file to the sever 1.Create a file folder named NewFolder 2.Create a file named NewFile.sas under NewFolder 3.Type some code in the NewFile.sas file 4.Delete NewFolder and NewFild.sas was kept unsaved 5.Click SaveAs.. on the prompt message 6.Type the correct path which is authorized image

NOTE: Now open files under a renamed folder will automatically be closed and re-opened when the folder is renamed

Error is thrown if trying to convert the .sasnb file for the second time
1.Select a .sasnb file and convert it to a .flw file with the default given name, it works well
2.Switch the profile to a new one (any connection type)
3.Switch the profile back
4.Delete the newly created .flw file
5.Convert the same .sasnb the second time without change the .flw name

Error 'The file type is unsupported.'is thrown if trying to convert a .sasnb file
1.Launch VSC and make sure the initial active profile is a non-Viya connection
2.Switch the profile to a Viya connection
3.Create a new .sasnb file on file server
4.Convert the .sasnb file to the .flw file

Drag/drop a file or files to a position where they have already been there, it has no prompt error message in such scenario. Perform the same against SAS Content, it has error validation. image

This issue remains unresolved (will be resolved as part of #1271)

Create a new .txt file with name !@$%^&*(.txt, it has error if trying to download it through ContextMenu.
Error message:
Error running command SAS.server.downloadResource: Error: ENOENT: no such file or directory, open 'c:\!@$: > %^&*(.txt'. This is likely caused by the extension that contributes SAS.server.downloadResource.

Can you try this with SAS content? Can you download via that? I'm guessing you can't. Fwiw, it isn't an issue on Mac, but is an issue on Windows. If it's not an issue specific to this story, I'll look at in a future changeset. But, Windows may be the limiting factor here.

Signed-off-by: Scott Dover <[email protected]>
@Zhirong2022
Copy link
Collaborator

Error happened if trying to rename a file.
image

@Zhirong2022
Copy link
Collaborator

Rename a file folder with the same name as an existed one.
image

@scottdover
Copy link
Contributor Author

@Zhirong2022 The rename issues should now be resolved

@Zhirong2022
Copy link
Collaborator

New a file and keep it open, rename the filename
image

Signed-off-by: Scott Dover <[email protected]>
@scottdover
Copy link
Contributor Author

New a file and keep it open, rename the filename image

Resolved in f93ced3

@Zhirong2022
Copy link
Collaborator

It failed to drag and drop a file to a target file folder named with NewFolder; No such issue with SAS Content.

  1. Create a new folder named with NewFolder;
  2. Drag and drop a file to NewFolder;

Error on console for reference:
ERR Request failed with status code 404: AxiosError: Request failed with status code 404

@scottdover
Copy link
Contributor Author

scottdover commented Nov 19, 2024

It failed to drag and drop a file to a target file folder named with NewFolder; No such issue with SAS Content.

1. Create a new folder named with **NewFolder;**

2. Drag and drop a file to **NewFolder;**

Error on console for reference: ERR Request failed with status code 404: AxiosError: Request failed with status code 404

This has been resolved in d7e2e1b.

In my opinion, this seems like a pretty uncommon use-case (along with some of the other naming issues like having a file named NewFile+!@$%^&*.txt). Unless there is opposition from @clangsmith, I propose we aggregate any further issues like this into a separate bug where this PR can move along. I don't want to hold this release up for use cases that most of our users won't encounter.

@scnwwu @smorrisj Thoughts?

@Zhirong2022
Copy link
Collaborator

All issues have been handled appropriately. Some enhancement like multi-deletion will be tracked in a new issue after the PR gets pushed.

@Zhirong2022 Zhirong2022 added testing-complete Complete the pull requests testing and removed testing Test the pull requests labels Nov 20, 2024
@scottdover scottdover merged commit 74d93ad into main Nov 21, 2024
2 checks passed
@scottdover scottdover deleted the feat/sas-server-2 branch November 21, 2024 14:46
@Zhirong2022 Zhirong2022 added ready for release Code pushed, but not released in VS code marketplace yet and removed testing-complete Complete the pull requests testing labels Nov 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready for release Code pushed, but not released in VS code marketplace yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants