Nodedit-core icon indicating copy to clipboard operation
Nodedit-core copied to clipboard

Quick File finder

Open pradeepmurugesan opened this issue 12 years ago • 15 comments

Don't we need a quick file finder ? or is it decided as a not to have feature ?

pradeepmurugesan avatar Jul 26 '13 12:07 pradeepmurugesan

Yes, this is something I would definitely like to have. Just trying to decide whether to deploy it in the core or as a plugin.

ksafranski avatar Jul 26 '13 12:07 ksafranski

I think it should be a core feature, it's a need when working with huge projects. If you want an advice we can implement something like in sublime text ( looks really cool and it's really simple ). If you don't know how I mean this, take a look at the website sublimetext.com and look the 4th described feature.

newsocialifecom avatar Jul 27 '13 14:07 newsocialifecom

I love that example, looks really nice and simple to use. My concern is the rapid-fire requests to the API, so perhaps caching on that specific request that is stored only for the duration of the search.

I'm hoping to launch the core on Monday, so I don't know if this will make it in, but definitely want to get this added. Any help would be greatly appreciated as I'm currently swamped trying to get everything prod-ready.

ksafranski avatar Jul 27 '13 14:07 ksafranski

@Fluidbyte I would like to help on that. but do we need to have a sublime text like filtering as and when we type a letter ? that will increase the calls to the server since we will be sending an ajax call for every keystroke.

Instead we can send an ajax once after the user is done typing the keyword by typing the "enter/return" key or clicking the search button ?

pradeepmurugesan avatar Jul 29 '13 05:07 pradeepmurugesan

I'm actually thinking it may be best to create a call and then cache the results when you load up the finder - that way you're not making a bunch of requests against the server and instead keeping the processing on the client-side.

ksafranski avatar Jul 29 '13 12:07 ksafranski

I am sorry What do you mean by call here ? is it something which will fetch the directories and files from the server ? Well if that is the case we will get the structure when loading the file manager part. Cant we reuse the json (I am not sure about the JSON for that request though) ?

pradeepmurugesan avatar Jul 29 '13 13:07 pradeepmurugesan

@Fluidbyte can you please clarify the above question, so that i can start on this ?

pradeepmurugesan avatar Aug 13 '13 04:08 pradeepmurugesan

Ok, here's my thought - and it's not at all set in stone:

When you bring up the "quick finder" have the system run a recursive listing of all of the files on the remote server and save it to an array (full path). This would allow minimal calls to the backend. This may require a modification of the server, perhaps a GET call with a recursive listing on the server that returns a JSON object.

Basically, I just don't know how efficient it would be to make an AJAX request on every single keyup that checks the file structure for matching entries.

ksafranski avatar Aug 13 '13 13:08 ksafranski

Why not generate a json file tree, which can be searched through after being loaded once?

ir-g avatar Aug 17 '13 15:08 ir-g

That's essentially what I'm suggesting, it will just need to be added as a call to the server since the client doesn't know about file/directory structure until it's been retruned.

ksafranski avatar Aug 17 '13 16:08 ksafranski

Yeah that's exactly what i am doing.. I wrote a get call to the server asking for the structure. Now working on the client filter. Will update you with a pull req soon after completion.

pradeepmurugesan avatar Aug 17 '13 17:08 pradeepmurugesan

@Fluidbyte A couple of questions.

  1. I am not able to bind a key for this ("ctrl q"). If I am binding it in the editor just below the save bind. the "ctrl s" bind is lost. please see the code below
quickFileFind = new nodedit.keybind({
            code: "ctrl q",
            callback: function() {
                alert("I am called");
            }
        });
  1. Also I am having a text input to type for search the file name. But I am not able to transfer the control to my text box. I think the focus is not going away from the editor. the "ctrl f" just works great. Any idea for that would be great.

I thought would get some clue from the settings and plugins but that didn't help since those were modal dialog.

pradeepmurugesan avatar Aug 23 '13 09:08 pradeepmurugesan

I'm starting to feel like the keycombo handler needs some re-working. I'm just running into too many issues, although I'm not sure why there would be an issue with ctrl q.

Any chance you could post a link to the code/fork so I could take a look?

ksafranski avatar Aug 23 '13 17:08 ksafranski

@Fluidbyte https://github.com/pradeepmurugesan/Nodedit/tree/quickfilefinder

ctrl q works , but ctrl s is not working when both the keys are bound.

Also please help me with the second question when you find some time.

P.S- I am sorry , closed the issue by mistake.

pradeepmurugesan avatar Aug 26 '13 05:08 pradeepmurugesan

@pradeepmurugesan I'm very sorry I haven't had a chance to respond, I'm just drowning in work right now and unfortunately I am not able to spend more time on this issue. I'm going to try to take a look at this as soon as things slow down for me.

ksafranski avatar Sep 01 '13 12:09 ksafranski