-
Notifications
You must be signed in to change notification settings - Fork 93
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
Allow Save As and breadcrumb navigation #2060
Conversation
Signed-off-by: worksofliam <[email protected]>
Signed-off-by: Seb Julliand <[email protected]>
Signed-off-by: Seb Julliand <[email protected]>
Signed-off-by: Seb Julliand <[email protected]>
Signed-off-by: Seb Julliand <[email protected]>
Signed-off-by: Seb Julliand <[email protected]>
Signed-off-by: Seb Julliand <[email protected]>
Signed-off-by: Seb Julliand <[email protected]>
Signed-off-by: Seb Julliand <[email protected]>
@sebjulliand AMAZING - AND I HAVEN'T EVEN TESTED IT YET! YOU'RE MY HERO!! 😍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sebjulliand A quick run of this PR shows some issues:
-
I created a library
CODEFORI
and sourcefileTEST
and memberMEMBER
and added some text.Save
went fine, butSave as...
did not: After entering new membernameMEMBER2
, I get this:
But this is the only member:
-
I created a directory
/tmp/a
and a streamfiletesting.rpgle
, entered some text and saved. No issue.
ButSave as...
just shows the directory name:
When I enter a new name for the streamfile, it always shows this:
But it doesn't exist - andOK
gives this error:
* @param timestamp an attr timestamp string | ||
* @returns a Date object | ||
*/ | ||
export function parseAttrDate(timestamp:string){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sebjulliand This code is worrying me a bit - you get the attributes using the PASE command attr
, which can return IBM i object attributes, but it writes the dates in text, which you then have to parse.
The timestamps output from attr
are dependent on the locale, which may vary from system to system - or even user by user.
Wouldn't it be better to get the attributes for an IFS object using the SQL function IFS_OBJECT_STATISTICS
? It can return the same information and returns the timestamps in ISO format - or as EPOCH, if it is specified in the SQL statement. Like we do with member lists...
Then this parse function is irrelevant - and the month name at the top etc.
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, I tried (hard) to use IFS_OBJECT_STATISTICS
, but it doesn't give any information if you don't have enough authority to do so. Every column will be null in this case. For example, there are some files on PUB400 that I can access in read-only mode. For those, IFS_OBJECT_STATISTICS
will not give me any information.
I tried on a few different LPARS and even when I change LC_TIME
before calling attr
, it still returns the dates using the en_US locale.
So for now, I'll take the risk of using attr
and parse the dates empirically. 😅
Signed-off-by: Seb Julliand <[email protected]>
Signed-off-by: Seb Julliand <[email protected]>
@chrjorgensen I think I finally managed to fix Save As for your use case. I had to change a bit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sebjulliand The use case with no member extension does work now. 👍
Only issue is that we require the "." when creating the member but require no "." when Save as... not consistent, but the opposite... but this is due to Microsoft not allowing file/directory names ending in "." in Windows where all other platforms allow it... 😠
I also found that not having /QOpenSys/pkgs/bin in the PATH results in Save as reporting
Adding the yum package directory to the path fixed the problem.
I will do some more testing... 😃
Signed-off-by: Seb Julliand <[email protected]>
@chrjorgensen give it another go. I removed the stat cache...hopefully the performance overhead won't be terrible. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sebjulliand Quick review while watching Le Mans... 😄
Works alright when member is opened for edit - when opened for browse, the error This folder cannot be used as destination. Please choose another folder.
is shown. If this cannot be avoided, maybe the Save As should reject the operation?
There is also an issue with member names with variants - I can't even open these members, even after merging master branch into the PR branch...? Can you make it work with variants?
Ideally the text of the new members should be set to the same as the original member - but this could be implemented in a future change.
@sebjulliand What's the status here? Does it need a lil' TLC or can I review? |
@worksofliam I need to make some changes...this week of the week after 🥲 |
Signed-off-by: Seb Julliand <[email protected]>
Signed-off-by: Seb Julliand <[email protected]>
Signed-off-by: Seb Julliand <[email protected]>
Signed-off-by: Seb Julliand <[email protected]>
@chrjorgensen , it's back for review, finally 😅
I could get
Done! Variant characters needed to be converted to their CSSID 37 counterparts before being fed to the
Sadly, I tried to find a way but since we cannot know which file is being saved as by the time the target is being created and written, we can't copy the description 😑 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like it a lot. Code looks good to me. Tested locally with a variety of cases.
Thanks a lot for looking into this @julesyan ! Let's merge 😄 |
Changes
Resolves #2004
This PR completes the QSYS and IFS FileSystemProviders implementation. By doing so, it allows for
Save As
and the editor breadcrumb navigation to work for members and streamfiles.The
stat
method had to return an actual result,createDirectory
andreadDirectory
had to be implemented,writeFile
had to be modified because Save As first creates an empty file then writes into it.Save As
Streamfiles and members can now be Saved As (using
ctrl+shift+s
or the menu action).For streamfiles, it works like an usual unix file system. browsing the IFS works from there.
If the target path doesn't exist, it will be created.
Overwriting an existing file asks for a confirmation as expected.
For QSYS members, it works the same (navigation, creation of target path, overwriting). But since it's a QSYS path, the path must always be in the form of
/LIBRARY/FILE/MEMBER.TYPE
. The library and/or file will be created if needed when saving as.Breadcrumb navigation
Clicking on the part of a path in an editor with a member or streamfile opened will allow to navigate to another location to open another member/stream.
How to test this PR
Checklist
console.log
s I added