Renaming Server Action Structure


#1

Hi.
Building on the feature request here.

  1. There is no option to rename server action files, but pressing F2 does make the name editable. Although, after refresh name returns to original.
  2. Folder rename similarly, doesn’t work.
  3. Moving files and folders around work in the UI, but after refresh everything just restores to original.

Off Topic: Renaming in code view should have a refactor rename option. This would be really helpful as changing ID in Properties panel does not update various events and attributes where that ID is in use.


#2

Indeed as you discovered a refactoring process can became quickly very complicated.

For example if one server action is used in multiple files, when you rename it, you have to go through all the files and rename it in the code there as well.

That is why we haven’t implemented rename on purpose yet.

We do plan in future versions to have a meta index per project containing all the links, images, include files and server connect actions usage, so that we know where what is used and when you rename it, we can auto rename it in all other files.

But this have quite a large impact in Wappler so it will take some time to implement.


#3

I understood this complexity. So, on the contrary, what I am suggesting is to implement refactoring just in the code view, limited to single file.
How it could be helpful is for eg:

  1. If name/ID of a variable or a component is changed, it will get updated everywhere used in the dynamic events, attributes etc. on THAT page.
  2. If a file is renamed or moved in server action, having the option to quickly change its name/path on every page it has been implemented in, would be better than nothing.

I don’t know if this makes sense to implement for short term, but project level refactor is something definitely worth waiting for.


#4

Yes refactoring of the components id’s on a single page is a whole different thing indeed.

However there it has its own challenges as the id’s can be used in all kind of dynamic expressions that we need to parse all and change.


#5

True. For a single page, using find & replace would be a better option. Replace All in code view would serve the similar purpose as refactoring.

Thanks for your input. Please do add refactoring in Wappler to-do.


#6

I also wanted to ask that, but I guess if you plan your project well, then its not so needed.


#7

I’m sure quite a few people would find it useful now. Also, it would be very useful to have ‘save as’ or ‘duplicate’ options. In fact, all the options which are in File Manager (Open in Explorer, Upload). I can see why you haven’t added these features, but couldn’t you make it an Options setting? I probably duplicate server connect files as much as app connect files; it seems odd that on one side you have the expected options, and on the other, they’re missing.


#8

How often does that happen? :sweat_smile:


#9

I haven’t yet had a situation where I have to duplicate app connect files, except when I made files in incorrect folder, due to poor planning. But in that case, I just opened the file and copied the text to the new action file.
Its not as convenient as duplicate, but it works.

Create a new action file & just save. Then open the new & old files using “open in editor”. Select all, copy, paste, save - and its duplicated.
image


#10

I usually use the OS file manager to make a duplicate but you can certainly use the method you suggest. It’s surprising there is an option to open an action file in Wappler, given that most other file options are missing (but I’m glad the feature is there).

I duplicate files for various reasons - eg if I want to try something in a different way or make changes to an action file, I usually like to have a copy of the original to revert to if necessary. Also, in many cases, a very similar action file will be needed in a different context; I find it’s often easier to duplicate a file and make the necessary changes rather than starting from scratch.


#11

@George One more request, just had the need for this: Found items count.


#12

interested by having some option to renaming some server action too…
:hugs: