Skip to content

Commit

Permalink
fix Navigator.view upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
olmobrutall committed Dec 10, 2020
1 parent 0a245a4 commit b08684d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Signum.Upgrade/Upgrades/Upgrade_20201210_NavigatorView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ public override void Execute(UpgradeContext uctx)
{
uctx.ForeachCodeFile("*.ts, *.tsx", file =>
{
file.Replace("Navigator.navigate", "Navigator.view");
file.Replace("Navigator.isNavigable", "Navigator.isViewable");
file.Replace("Navigator.navigate(", "Navigator.view(");
file.Replace("Navigator.isNavigable(", "Navigator.isViewable(");
});
}
}
Expand Down

3 comments on commit b08684d

@olmobrutall
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

UI Improvements in FrameModal and FramePage

This commits ends a series of small-medium changes to improve the UX in the main containers of our entities: FrameModal and FramePage.

Don't get too exited, nothing fancy here, just removing some confusions in some gray areas:

1. Navigator.view and Navigator.navigate are merged.

A long time ago...
The distinction between Navigator.view and Navigator.navigate made sense in Signum.Windows:

  • View was opening a modal window (ShowDialog) with Ok/Cancel buttons and returning the new version of the entity.
  • Navigate was opening a non-modal window (Show) with Ok button and returning void because was fire-and-forget.

The concepts where carried as-is to Signum.Web and Signum.React but never made too much sense:

  • Since view was used un the entity controls (EntityLine, EntityStrip, etc..), when navigating to a real entity (i.e. Customer) you had [Ok]/[Cancel] buttons but you have to save your changes first (kind or redundant), and you could save and then press [Cancel] (kind of absurd).
  • Navigator.navigate was returning Promise<void> instead of Promise<Entity> just to keep the legacy semantics, but the Entity was just there.
  • The only way to open non-modal is by pressing Ctrl+Click or Middle-Click and open a new Tab in your browser (navigateRoute).

The solution is to merge Navigator.navigate and Navigator.view in one method (Navigator.view) that contains a new parameter viewButtons.

  • ok_cancel: Automatically selected for EmbeddedEntity, ModalEntity or Entities of EntityKind.Part or EntityKind.SharedPart. This entities typically never have a Save operation so it makes sense to have a [Ok]/[Cancel] buttons to control whether we send the changes back to the parent entity or not.
  • close: Automatically selected for Entities of the other EntityKind. This entities typically have their own save buttons (Main, Shared, String,...) or are readonly (System, SystemString). Removing the [Save] and [Cancel] problem.

Maybe there are cases where this default behavior doesn't make sense, like an InvoiceLineEntity that behaves like a Part when creating the Invoice but then becomes a self-sufficient entity, but I think the default ruele covers 99% of the cases.

Similarly, Navigator.isNavigable has been merged into Navigator.isViewable.

2. New 'Lose changes' dialog.

No the dialog detects the operations that can be executed to save the entity and are visible (typically [Save]), and suggest to either use it or [Lose changes], very much like Microsoft Word does.

image

3. New default icons for [Save] and [Delete]

image

Note: You can the default icons, colors, etc... or add your own custom rules by overriding the methods in the Defaults namespace in Operations.tsx.

4. 'Save & New' only when creating from SearchControl ValueSearchControl

When creating a new entity, it could be useful to use the 'Save & New' functionality ([+] button or Ctrl+Alt+S), but when you are just navigating to one it was cluttering the interface and making the Save & Close ([x] button or Ctrl + Shift + S) even harder to understand for new people.

image

For now creating from an EntityLine / EntityStrip / etc.. also does not enable this functionality.

5. Prevent Lose changes in FramePage

When making modifications in an entity in full-screen (FramePage) previously there was no prompt if you tried to navigate somewhere else without saving first.

image

Also if you try to close the browser tab:

image

Conclusion

As I say, nothing fancy but some simplifications for the developers and users.

To upgrade just run Upgrade_20201210_NavigatorView

@MehdyKarimpour
Copy link
Contributor

@MehdyKarimpour MehdyKarimpour commented on b08684d Dec 11, 2020 via email

Choose a reason for hiding this comment

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

@doganc
Copy link

@doganc doganc commented on b08684d Dec 11, 2020

Choose a reason for hiding this comment

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

Perfect

Please sign in to comment.