From f9b2b1f141e231aa629ae8f92c822805055c2793 Mon Sep 17 00:00:00 2001 From: Olmo del Corral Cano Date: Thu, 18 Jul 2019 14:56:18 +0200 Subject: [PATCH 1/5] change HttpStatusCode.Unauthorized to Forbidden to avoid Password dialog on Mixed mode --- Signum.React/Filters/SignumExceptionFilterAttribute.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Signum.React/Filters/SignumExceptionFilterAttribute.cs b/Signum.React/Filters/SignumExceptionFilterAttribute.cs index e26d9a96cc..6e91c6751c 100644 --- a/Signum.React/Filters/SignumExceptionFilterAttribute.cs +++ b/Signum.React/Filters/SignumExceptionFilterAttribute.cs @@ -107,7 +107,7 @@ private HttpStatusCode GetStatus(Type type) return HttpStatusCode.Forbidden; if (type == typeof(AuthenticationException)) - return HttpStatusCode.Unauthorized; + return HttpStatusCode.Forbidden; // Unauthorized produces Login Password dialog in Mixed mode if (type == typeof(EntityNotFoundException)) return HttpStatusCode.NotFound; From df562d6d6b60a3137441ca46b29f85575c3b79c5 Mon Sep 17 00:00:00 2001 From: Olmo del Corral Cano Date: Thu, 18 Jul 2019 14:56:40 +0200 Subject: [PATCH 2/5] add EntitySettings modalSize --- Signum.React/Scripts/Frames/FrameModal.tsx | 4 +++- Signum.React/Scripts/Navigator.tsx | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Signum.React/Scripts/Frames/FrameModal.tsx b/Signum.React/Scripts/Frames/FrameModal.tsx index d145e08cfb..f40ba07ee2 100644 --- a/Signum.React/Scripts/Frames/FrameModal.tsx +++ b/Signum.React/Scripts/Frames/FrameModal.tsx @@ -210,8 +210,10 @@ export default class FrameModal extends React.Component + { isNavigable?: EntityWhen; isReadOnly?: boolean; avoidPopup?: boolean; + modalSize?: BsSize; autocomplete?: AutocompleteConfig; autocompleteDelay?: number; getViewPromise?: (entity: T) => ViewPromise; @@ -796,6 +797,7 @@ export class EntitySettings { typeName: string; avoidPopup!: boolean; + modalSize?: BsSize; getViewPromise?: (entity: T) => ViewPromise; From 50ae785058ebbf22a7ae12fbcba77d3b39370ea5 Mon Sep 17 00:00:00 2001 From: Olmo del Corral Cano Date: Thu, 18 Jul 2019 14:57:14 +0200 Subject: [PATCH 3/5] add styleContext to SearchControl to access frame --- Signum.React/Scripts/SearchControl/ContextualItems.tsx | 2 ++ Signum.React/Scripts/SearchControl/SearchControl.tsx | 5 ++++- Signum.React/Scripts/SearchControl/SearchControlLoaded.tsx | 4 +++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Signum.React/Scripts/SearchControl/ContextualItems.tsx b/Signum.React/Scripts/SearchControl/ContextualItems.tsx index d2837becd1..e64b1f1120 100644 --- a/Signum.React/Scripts/SearchControl/ContextualItems.tsx +++ b/Signum.React/Scripts/SearchControl/ContextualItems.tsx @@ -3,6 +3,7 @@ import { QueryDescription, } from '../FindOptions' import { Lite, Entity } from '../Signum.Entities' import SearchControlLoaded from "./SearchControlLoaded"; import { DropdownItem } from '../Components'; +import { StyleContext } from '../TypeContext'; export interface MenuItemBlock { header: string; @@ -14,6 +15,7 @@ export interface ContextualItemsContext { queryDescription: QueryDescription; markRows: (dictionary: MarkedRowsDictionary) => void; container?: SearchControlLoaded | React.Component; + styleContext?: StyleContext; } export interface MarkedRowsDictionary { diff --git a/Signum.React/Scripts/SearchControl/SearchControl.tsx b/Signum.React/Scripts/SearchControl/SearchControl.tsx index d9b270e625..230b1aea01 100644 --- a/Signum.React/Scripts/SearchControl/SearchControl.tsx +++ b/Signum.React/Scripts/SearchControl/SearchControl.tsx @@ -9,7 +9,7 @@ import SearchControlLoaded, { ShowBarExtensionOption } from './SearchControlLoad import { ErrorBoundary } from '../Components'; import { MaxHeightProperty } from 'csstype'; import "./Search.css" -import { ButtonBarElement } from '../TypeContext'; +import { ButtonBarElement, StyleContext } from '../TypeContext'; export interface SimpleFilterBuilderProps { findOptions: FindOptions; @@ -57,6 +57,7 @@ export interface SearchControlProps extends React.Props { onSearch?: (fo: FindOptionsParsed, dataChange: boolean) => void; onResult?: (table: ResultTable, dataChange: boolean) => void; onCreate?: () => void; + styleContext?: StyleContext; } export interface SearchControlState { @@ -220,6 +221,8 @@ export default class SearchControl extends React.Component ); diff --git a/Signum.React/Scripts/SearchControl/SearchControlLoaded.tsx b/Signum.React/Scripts/SearchControl/SearchControlLoaded.tsx index 4a987043ad..56c05b5fa9 100644 --- a/Signum.React/Scripts/SearchControl/SearchControlLoaded.tsx +++ b/Signum.React/Scripts/SearchControl/SearchControlLoaded.tsx @@ -31,7 +31,7 @@ import "./Search.css" import PinnedFilterBuilder from './PinnedFilterBuilder'; import { TitleManager } from '../../Scripts/Lines/EntityBase'; import { AutoFocus } from '../Components/AutoFocus'; -import { ButtonBarElement } from '../TypeContext'; +import { ButtonBarElement, StyleContext } from '../TypeContext'; export interface ShowBarExtensionOption { } @@ -82,6 +82,7 @@ export interface SearchControlLoadedProps { onHeighChanged?: () => void; onSearch?: (fo: FindOptionsParsed, dataChange: boolean) => void; onResult?: (table: ResultTable, dataChange: boolean) => void; + styleContext?: StyleContext; } export interface SearchControlLoadedState { @@ -744,6 +745,7 @@ export default class SearchControlLoaded extends React.Component this.setState({ currentMenuItems: menuItems })) .done(); From 5f33538db4ee5f78ad693a1cafebac3b4cd2ee50 Mon Sep 17 00:00:00 2001 From: Olmo del Corral Cano Date: Thu, 18 Jul 2019 14:57:32 +0200 Subject: [PATCH 4/5] fix group: null in EntityOperationSettings --- Signum.React/Scripts/Operations.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Signum.React/Scripts/Operations.tsx b/Signum.React/Scripts/Operations.tsx index 3c59e5ee81..39dc01a9af 100644 --- a/Signum.React/Scripts/Operations.tsx +++ b/Signum.React/Scripts/Operations.tsx @@ -252,10 +252,9 @@ export class EntityOperationContext { complete() { var s = this.settings; this.color = s && s.color || Defaults.getColor(this.operationInfo); - this.group = s && s.group && s.group !== undefined ? (s.group || undefined) : Defaults.getGroup(this.operationInfo); + this.group = s && s.group !== undefined ? (s.group || undefined) : Defaults.getGroup(this.operationInfo); this.keyboardShortcut = s && s.keyboardShortcut !== undefined ? (s.keyboardShortcut || undefined) : Defaults.getKeyboardShortcut(this.operationInfo); this.alternatives = s && s.alternatives != null ? s.alternatives(this) : Defaults.getAlternatives(this); - } defaultClick(...args: any[]) { From 235df9c849d897ed4aec2e061c7c88d10595e708 Mon Sep 17 00:00:00 2001 From: Olmo del Corral Cano Date: Thu, 18 Jul 2019 14:58:09 +0200 Subject: [PATCH 5/5] make createNavigateOrTab return promise --- Signum.React/Scripts/Navigator.tsx | 7 ++++--- Signum.React/Scripts/Operations/ContextualOperations.tsx | 9 ++++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/Signum.React/Scripts/Navigator.tsx b/Signum.React/Scripts/Navigator.tsx index 26c53a1b8f..7c0112cd02 100644 --- a/Signum.React/Scripts/Navigator.tsx +++ b/Signum.React/Scripts/Navigator.tsx @@ -645,16 +645,17 @@ export function createInNewTab(pack: EntityPack) { var win = window.open(url); } -export function createNavigateOrTab(pack: EntityPack, event: React.MouseEvent) { +export function createNavigateOrTab(pack: EntityPack, event: React.MouseEvent) : Promise { if (!pack || !pack.entity) - return; + return Promise.resolve(); const es = getSettings(pack.entity.Type); if (es && es.avoidPopup || event.ctrlKey || event.button == 1) { createInNewTab(pack); + return Promise.resolve(); } else { - navigate(pack); + return navigate(pack); } } diff --git a/Signum.React/Scripts/Operations/ContextualOperations.tsx b/Signum.React/Scripts/Operations/ContextualOperations.tsx index 554890e68b..7e20761877 100644 --- a/Signum.React/Scripts/Operations/ContextualOperations.tsx +++ b/Signum.React/Scripts/Operations/ContextualOperations.tsx @@ -63,7 +63,9 @@ function defaultConstructFromMany(coc: ContextualOperationContext, ...ar return; API.constructFromMany(coc.context.lites, coc.operationInfo.key, ...args).then(pack => { - Navigator.createNavigateOrTab(pack, coc.event!); + Navigator.createNavigateOrTab(pack, coc.event!) + .then(() => coc.context.markRows({})) + .done(); }).done(); }).done(); @@ -243,8 +245,9 @@ export function defaultContextualClick(coc: ContextualOperationContext, ... API.constructFromLite(coc.context.lites[0], coc.operationInfo.key, ...args) .then(coc.onConstructFromSuccess || (pack => { notifySuccess(); - coc.context.markRows({}); - Navigator.createNavigateOrTab(pack, coc.event!); + Navigator.createNavigateOrTab(pack, coc.event!) + .then(() => coc.context.markRows({})) + .done(); })) .done(); } else {