Skip to content

Conversation

@hbcarlos
Copy link
Member

@hbcarlos hbcarlos commented Jul 24, 2022

Fixes #12755
cc @jtpio @martinRenou

References

Code changes

User-facing changes

Backwards-incompatible changes

Yes, the rename dialog now receives the context instead of the path.

@jupyterlab-probot
Copy link

Thanks for making a pull request to jupyterlab!
To try out this branch on binder, follow this link: Binder

@hbcarlos hbcarlos requested review from jtpio and martinRenou July 24, 2022 19:25
@hbcarlos hbcarlos added bug api-change A change that should be accompanied by a major version increase labels Jul 24, 2022
@fcollonval fcollonval added this to the 4.0.0 milestone Jul 25, 2022
@martinRenou
Copy link
Member

Thanks! If I understand correctly it should close #12755 ?

@jtpio
Copy link
Member

jtpio commented Jul 27, 2022

Thanks @hbcarlos for working on this.

Just tried on Binder after installing the jupyterlab-filesystem-access extension (https://github.com/jupyterlab-contrib/jupyterlab-filesystem-access) and there seems to be some cases where the new name is not propagated (to the file browser or the main area widget title):

rename-drive.mp4

Not sure yet but this might also be related to the extension itself.

@hbcarlos
Copy link
Member Author

Thanks, @jtpio! Let me check what is going on with the update of the title.

Not sure yet but this might also be related to the extension itself.

Yes, I believe when renaming from the file browser, the title is not updated because the file browser doesn't emit the signal fileChanged (or something similar).

But I'm not sure what is going on when renaming from the main menu. I need to check that.

@hbcarlos hbcarlos marked this pull request as draft July 27, 2022 10:38
@hbcarlos hbcarlos marked this pull request as ready for review July 31, 2022 11:21
@hbcarlos
Copy link
Member Author

@jtpio I just tried locally, and if you wait a bit, the file gets renamed.
The remaining issue comes from the jupyterlab-filesystem-access extensions. As you can see here:

async rename(
oldLocalPath: string,
newLocalPath: string
): Promise<Contents.IModel> {
const settings = this.serverSettings;
const url = this._getUrl(oldLocalPath);
const init = {
method: 'PATCH',
body: JSON.stringify({ path: newLocalPath })
};
const response = await ServerConnection.makeRequest(url, init, settings);
if (response.status !== 200) {
const err = await ServerConnection.ResponseError.create(response);
throw err;
}
const data = await response.json();
validate.validateContentsModel(data);
this._fileChanged.emit({
type: 'rename',
oldValue: { path: oldLocalPath },
newValue: data
});
return data;
}

the default drive from lab, emits a signal after renaming the file but that's not the case with the extension, see:
https://github.com/jupyterlab-contrib/jupyterlab-filesystem-access/blob/3c7d326a8de6b79c7f506d02ead949bd54eca384/src/drive.ts#L211-L221
and the issue we are seeing in your screencast is that the file browser doesn't update the list of files until it fetches them.

We can merge this PR and fix the remaining issues in the extension.

@jtpio
Copy link
Member

jtpio commented Aug 2, 2022

Version 0.5.2 of the jupyterlab-filesystem-access extension was just released: https://github.com/jupyterlab-contrib/jupyterlab-filesystem-access/releases/tag/v0.5.2

It includes your fix in jupyterlab-contrib/jupyterlab-filesystem-access#41 @hbcarlos, thanks!

@jtpio
Copy link
Member

jtpio commented Aug 2, 2022

Version 0.5.2 of the jupyterlab-filesystem-access extension was just released: https://github.com/jupyterlab-contrib/jupyterlab-filesystem-access/releases/tag/v0.5.2

Will have a second look on Binder with this new version.

@jtpio
Copy link
Member

jtpio commented Aug 2, 2022

Arf Binder seems to be broken (looks unrelated to this PR):

image

@jtpio
Copy link
Member

jtpio commented Aug 2, 2022

This is likely because of the ypy-websocket issue:

ImportError: cannot import name 'YDoc' from 'ypy_websocket.websocket_server'

@jtpio
Copy link
Member

jtpio commented Aug 2, 2022

Rebasing to make sure we grab the latest state of master.

@jtpio
Copy link
Member

jtpio commented Aug 2, 2022

Looking better after the rebase. Just checked on Binder and it seems to be behaving correctly:

rename-drive-2.mp4

@jtpio
Copy link
Member

jtpio commented Aug 2, 2022

Yes, the rename dialog now receives the context instead of the path.

Just pushed a commit to add this change to https://jupyterlab.readthedocs.io/en/latest/extension/extension_migration.html#jupyterlab-3-x-to-4-x.

image

@hbcarlos
Copy link
Member Author

hbcarlos commented Aug 3, 2022

Thanks, @jtpio!

Copy link
Member

@jtpio jtpio left a comment

Choose a reason for hiding this comment

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

Thanks!

@jtpio jtpio merged commit 7b57518 into jupyterlab:master Aug 3, 2022
@hbcarlos hbcarlos deleted the rename_title branch August 3, 2022 19:23
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 4, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

api-change A change that should be accompanied by a major version increase bug documentation pkg:docmanager pkg:docregistry

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants