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

[WIP] Migrate AngularJS to Angular #5039

Draft
wants to merge 57 commits into
base: master
Choose a base branch
from

Conversation

Jojo-1000
Copy link
Contributor

@Jojo-1000 Jojo-1000 commented Oct 4, 2023

The web UI currently uses AngularJS which is out of support since 2022. This means it gets no security fixes anymore. The version we are using is even older (from 2015).

There were a few attempts to rewrite the UI (question about updating, redesign in Vue) but they did not seem to go anywhere, be it due to lack of initiative or lack of encouragement.

I chose to use the successor Angular over Vue, because I did not want to change anything about the site structure or design (this can be tackled at a later stage, if resources permit). Everything is as close to a 1:1 copy as possible, while using more modern code patterns where it is feasible.

I know this is not high on the priority list, but I created this draft to keep track of progress, for others to contribute, and to prevent anyone from doing duplicated work if they also want to update the UI.

Progress

  • convert html pages to the new template format
  • convert old directives and controllers to components
  • add, edit and restore wizards (including file pickers)
  • dialogs, status bar and notifications
  • editor components for all backend types in original UI
  • UI themes can be changed
  • translation support (different locales with single app build)
  • update translations to new format (WIP, majority of translations can be automatically converted via a python script)
  • verification and testing
  • documentation
  • check whether we need third party libraries for date formatting and cryptography
  • verify that changes in XSRF handling can't be exploited
  • incorporate UI changes made since

Nice to have

  • improve form validation (show obvious errors before running Test Connection, for example)
  • keep state during some navigation transitions (e.g. when going back from restore to restoredirect)
  • split less used parts into lazy-loaded modules to improve load times

Usage

The new UI is running in parallel to the existing UI for now.

The process to set up the webserver pages is more complicated, because it is required to build the app into a precompiled form. The process is described in webroot/angular/README.md. It is also possible to serve via the angular CLI (for development) and use a proxy to forward to the Duplicati REST API.

Once built, the UI can be reached on the address http://HOSTNAME/ng/ instead of http://HOSTNAME/ngax/. A browser cookie can be set on http://HOSTNAME/theme.html to automatically redirect to the new version.

The previous JS code incorrectly converted glob expressions to regexp which prevented them from showing the correct file states in the list.
This was only a UI bug and has no effect on the backend.
No longer adds invisible dir separators to filter list.
Only the last exclude or include option was sent to the backend.
Now all include and exclude options are used.
Instead of selecting the first matching in list, which does not recognize regexp without ? or *, choose the type with longest prefix and suffix.
Inputs were interpreted as regexp in the UI instead of globbing expressions which are used in the backend.
Closes duplicati#2682.
Add more metadata to the file list returned by server, so that the source file picker can display filters based on file attributes.
Correctly display 'X' in file list if a file is excluded by attributes and not included as a source (duplicati#4751).
Fix directory separator issue when loading the page and prevent opening folders in source file list.
Add filters to the beginning instead of the end of the list, so they are not overridden by more general ones.
If a file is excluded, add an include filter to include the file.
This can happen if a source is added to force including a system folder.
Add REST handler /systeminfo/filtergroups that returns the filter strings for all filter groups on the system.
Use these filter strings to apply filter groups to the source file picker.
The built-in angular XSRF handler only sends the token for modifying methods.
The live log could probably still be improved.
Implement destination folder picker and start of file destination editor.
TypeError: Cannot read Property 'Path' of undefined.
Add a break to for loop, thanks @tx0h (duplicati#4997).
The paths are split by dirsep, but directories end with it, which results in an empty part at the end.
@AlexFRAN
Copy link
Contributor

If anyone merges this request, i'll do a graphical redesign of the UI, since my old one is really really dated, but i agree with Jojo, that it makes no sense keeping AngularJS and his codebase seems good.

@gpatel-fr
Copy link
Contributor

@AlexFRAN

If anyone merges this request

it will not be for next Canary for sure, but the PR is very interesting nonetheless.

i'll do a graphical redesign of the UI

Thanks for the proposal !

since my old one is really really dated

wow, 8 years ago.
Once this is into Duplicati, enhancements could be discussed on the forum, but there are more important things to fix first.

@kenkendk
Copy link
Member

Amazing progress @Jojo-1000 !
I think the size of this PR explains why it has just been left as AngularJS for so long :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants