Skip to content

Commit 002bcc9

Browse files
committed
Merge remote-tracking branch 'AlejandroCano/O365' into bootstrap5
# Conflicts: # Signum.React.Extensions/Mailing/MailingClient.tsx # Signum.React.Extensions/Workflow/WorkflowClient.tsx
2 parents 53c1189 + 27cc951 commit 002bcc9

19 files changed

Lines changed: 283 additions & 206 deletions

Signum.React.Extensions/Alerts/AlertsClient.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,10 @@ export function start(options: { routes: JSX.Element[], showAlerts?: (typeName:
5252
}));
5353

5454
Operations.addSettings(new EntityOperationSettings(AlertOperation.Delay, {
55-
onClick: (eoc) => chooseDate().then(d => d && eoc.defaultClick(d.toISO())).done(),
55+
onClick: (eoc) => chooseDate().then(d => d && eoc.defaultClick(d.toISO())),
5656
hideOnCanExecute: true,
57-
contextual: { onClick: (coc) => chooseDate().then(d => d && coc.defaultContextualClick(d.toISO())).done() },
58-
contextualFromMany: { onClick: (coc) => chooseDate().then(d => d && coc.defaultContextualClick(d.toISO())).done() },
57+
contextual: { onClick: (coc) => chooseDate().then(d => d && coc.defaultContextualClick(d.toISO())) },
58+
contextualFromMany: { onClick: (coc) => chooseDate().then(d => d && coc.defaultContextualClick(d.toISO())) },
5959
}));
6060

6161
var cellFormatter = new Finder.CellFormatter((cell, ctx) => {

Signum.React.Extensions/Dynamic/DynamicTypeClient.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,24 +32,24 @@ export function start(options: { routes: JSX.Element[] }) {
3232
onClick: eoc => {
3333
(eoc.frame.entityComponent as DynamicTypeComponent).beforeSave();
3434

35-
Operations.API.executeEntity(eoc.entity, eoc.operationInfo.key)
35+
return Operations.API.executeEntity(eoc.entity, eoc.operationInfo.key)
3636
.then(pack => { eoc.frame.onReload(pack); Operations.notifySuccess(); })
3737
.then(() => {
3838
if (AuthClient.isPermissionAuthorized(DynamicPanelPermission.ViewDynamicPanel)) {
39-
MessageModal.show({
39+
return MessageModal.show({
4040
title: DynamicTypeMessage.TypeSaved.niceToString(),
4141
message: DynamicTypeMessage.DynamicType0SucessfullySavedGoToDynamicPanelNow.niceToString(eoc.entity.typeName),
4242
buttons: "yes_no",
4343
style: "success",
4444
icon: "success"
4545
}).then(result => {
46-
if (result == "yes")
46+
if (result == "yes")
4747
window.open(AppContext.toAbsoluteUrl("~/dynamic/panel"));
48-
}).done();
48+
return;
49+
});
4950
}
5051
})
51-
.catch(ifError(ValidationError, e => eoc.frame.setError(e.modelState, "entity")))
52-
.done();
52+
.catch(ifError(ValidationError, e => eoc.frame.setError(e.modelState, "entity")));
5353
},
5454
alternatives: eoc => [],
5555
}));

Signum.React.Extensions/Dynamic/DynamicViewClient.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,33 +64,33 @@ export function start(options: { routes: JSX.Element[] }) {
6464
onClick: ctx => {
6565
(ctx.frame.entityComponent as DynamicViewEntityComponent).beforeSave();
6666
cleanCaches();
67-
ctx.defaultClick();
67+
return ctx.defaultClick();
6868
}
6969
}));
7070

7171
Operations.addSettings(new EntityOperationSettings(DynamicViewOperation.Delete, {
7272
onClick: ctx => {
7373
cleanCaches();
74-
ctx.defaultClick();
74+
return ctx.defaultClick();
7575
},
76-
contextual: { onClick: ctx => { cleanCaches(); ctx.defaultContextualClick(); } },
77-
contextualFromMany: { onClick: ctx => { cleanCaches(); ctx.defaultContextualClick(); } },
76+
contextual: { onClick: ctx => { cleanCaches(); return ctx.defaultContextualClick(); } },
77+
contextualFromMany: { onClick: ctx => { cleanCaches(); return ctx.defaultContextualClick(); } },
7878
}));
7979

8080
Operations.addSettings(new EntityOperationSettings(DynamicViewSelectorOperation.Save, {
8181
onClick: ctx => {
8282
cleanCaches();
83-
ctx.defaultClick();
83+
return ctx.defaultClick();
8484
}
8585
}));
8686

8787
Operations.addSettings(new EntityOperationSettings(DynamicViewSelectorOperation.Delete, {
8888
onClick: ctx => {
8989
cleanCaches();
90-
ctx.defaultClick();
90+
return ctx.defaultClick();
9191
},
92-
contextual: { onClick: ctx => { cleanCaches(); ctx.defaultContextualClick(); } },
93-
contextualFromMany: { onClick: ctx => { cleanCaches(); ctx.defaultContextualClick(); } },
92+
contextual: { onClick: ctx => { cleanCaches(); return ctx.defaultContextualClick(); } },
93+
contextualFromMany: { onClick: ctx => { cleanCaches(); return ctx.defaultContextualClick(); } },
9494
}));
9595

9696
Navigator.setViewDispatcher(new DynamicViewViewDispatcher());

Signum.React.Extensions/MachineLearning/PredictorClient.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,20 +68,18 @@ export function start(options: { routes: JSX.Element[] }) {
6868

6969
Operations.addSettings(new EntityOperationSettings(PredictorOperation.Publish, {
7070
hideOnCanExecute: true,
71-
onClick: eoc => {
71+
onClick: eoc =>
7272
API.publications(eoc.entity.mainQuery.query!.key)
7373
.then(pubs => SelectorModal.chooseElement(pubs, { buttonDisplay: a => symbolNiceName(a), buttonName: a => a.key }))
7474
.then(pps => pps && eoc.defaultClick(pps))
75-
.done();
76-
},
75+
,
7776
contextual: {
78-
onClick: coc => {
77+
onClick: coc =>
7978
Navigator.API.fetch(coc.context.lites[0])
8079
.then(p => API.publications(p.mainQuery.query!.key))
8180
.then(pubs => SelectorModal.chooseElement(pubs, { buttonDisplay: a => symbolNiceName(a), buttonName: a => a.key }))
8281
.then(pps => pps && coc.defaultContextualClick(pps))
83-
.done();
84-
}
82+
8583
}
8684
}));
8785

Signum.React.Extensions/Mailing/MailingClient.tsx

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
33
import { ajaxPost, ajaxGet } from '@framework/Services';
44
import { EntitySettings } from '@framework/Navigator'
55
import * as Navigator from '@framework/Navigator'
6+
import * as Constructor from '@framework/Constructor'
67
import * as Finder from '@framework/Finder'
78
import { Lite, Entity, registerToString, JavascriptMessage } from '@framework/Signum.Entities'
89
import { EntityOperationSettings } from '@framework/Operations'
9-
import { PseudoType, Type, getTypeName } from '@framework/Reflection'
10+
import { PseudoType, Type, getTypeName, isTypeEntity } from '@framework/Reflection'
1011
import * as Operations from '@framework/Operations'
1112
import { EmailMessageEntity, EmailTemplateMessageEmbedded, EmailMasterTemplateEntity, EmailMasterTemplateMessageEmbedded, EmailMessageOperation, EmailPackageEntity, EmailRecipientEmbedded, EmailConfigurationEmbedded, EmailTemplateEntity, AsyncEmailSenderPermission, EmailModelEntity, IEmailOwnerEntity, EmailFromEmbedded, MicrosoftGraphEmbedded } from './Signum.Entities.Mailing'
1213
import { EmailSenderConfigurationEntity, Pop3ConfigurationEntity, Pop3ReceptionEntity, EmailAddressEmbedded } from './Signum.Entities.Mailing'
@@ -61,17 +62,20 @@ export function start(options: {
6162

6263
Operations.addSettings(new EntityOperationSettings(EmailMessageOperation.CreateEmailFromTemplate, {
6364
onClick: (ctx) => {
64-
6565
var promise: Promise<string | undefined> = ctx.entity.model ? API.getConstructorType(ctx.entity.model) : Promise.resolve(undefined);
66-
promise
67-
68-
Finder.find({ queryName: ctx.entity.query!.key }).then(lite => {
69-
if (!lite)
70-
return;
71-
Navigator.API.fetch(lite).then(entity =>
72-
ctx.defaultClick(entity))
73-
.done();
74-
}).done();
66+
return promise.then(ct => {
67+
if (!ct || isTypeEntity(ct))
68+
return Finder.find({ queryName: ctx.entity.query!.key }).then(lite => {
69+
if (!lite)
70+
return;
71+
return Navigator.API.fetch(lite).then(entity => ctx.defaultClick(entity));
72+
});
73+
else {
74+
var s = settings[ct];
75+
var promise = (s?.createFromTemplate ? s.createFromTemplate(ctx.entity) : Constructor.constructPack(ct).then(a => a && Navigator.view(a)));
76+
return promise.then(model => model && ctx.defaultClick(model));
77+
}
78+
});
7579
}
7680
}));
7781

Signum.React.Extensions/Tree/TreeClient.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export function start(options: { routes: JSX.Element[] }) {
3636
new EntityOperationSettings(TreeOperation.Copy, {
3737
onClick: ctx => copyModal(toLite(ctx.entity)).then(m => {
3838
if (m) {
39-
ctx.onConstructFromSuccess = pack => Operations.notifySuccess();
39+
ctx.onConstructFromSuccess = pack => { Operations.notifySuccess(); return Promise.resolve(); };
4040
ctx.defaultClick(m);
4141
}
4242
}),

Signum.React.Extensions/Word/WordClient.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ export function start(options: { routes: JSX.Element[], contextual: boolean, que
6060
onClick: ctx => {
6161

6262
var promise: Promise<string | undefined> = ctx.entity.model ? API.getConstructorType(ctx.entity.model) : Promise.resolve(undefined);
63-
promise
63+
return promise
6464
.then<Response | undefined>(ct => {
6565
var template = toLite(ctx.entity);
6666

@@ -77,8 +77,8 @@ export function start(options: { routes: JSX.Element[], contextual: boolean, que
7777
if (!response)
7878
return;
7979

80-
saveFile(response);
81-
}).done();
80+
return saveFile(response);
81+
});
8282
}
8383
}));
8484

Signum.React.Extensions/Workflow/Case/CaseFrameModal.tsx

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ interface CaseFrameModalState {
3838
show: boolean;
3939
prefix?: string;
4040
refreshCount: number;
41+
executing?: boolean;
4142
}
4243

4344
var modalCount = 0;
@@ -65,7 +66,7 @@ export default class CaseFrameModal extends React.Component<CaseFrameModalProps,
6566
.done();
6667
}
6768

68-
handleKeyDown(e: KeyboardEvent) {
69+
handleKeyDown(e: KeyboardEvent) {
6970
this.buttonBar && this.buttonBar.handleKeyDown(e);
7071
}
7172

@@ -176,7 +177,18 @@ export default class CaseFrameModal extends React.Component<CaseFrameModalProps,
176177
},
177178
refreshCount: this.state.refreshCount,
178179
allowExchangeEntity: false,
179-
prefix: this.prefix
180+
prefix: this.prefix,
181+
isExecuting: () => this.state.executing == true,
182+
execute: action => {
183+
if (this.state.executing)
184+
return;
185+
186+
this.setState({ executing: true });
187+
action()
188+
.finally(() => this.setState({ executing: undefined }))
189+
.done();
190+
}
191+
180192
};
181193

182194
var activityPack = { entity: pack.activity, canExecute: pack.canExecuteActivity };
@@ -229,7 +241,18 @@ export default class CaseFrameModal extends React.Component<CaseFrameModalProps,
229241
},
230242
refreshCount: this.state.refreshCount,
231243
allowExchangeEntity: false,
232-
prefix: this.prefix
244+
prefix: this.prefix,
245+
isExecuting: () => this.state.executing == true,
246+
execute: action => {
247+
if (this.state.executing)
248+
return;
249+
250+
this.setState({ executing: true });
251+
252+
action()
253+
.finally(() => this.setState({ executing: undefined }))
254+
.done();
255+
}
233256
};
234257

235258
var ti = this.getMainTypeInfo();
@@ -247,7 +270,7 @@ export default class CaseFrameModal extends React.Component<CaseFrameModalProps,
247270
};
248271

249272
return (
250-
<div className="sf-main-entity case-main-entity" data-main-entity={entityInfo(mainEntity)}>
273+
<div className="sf-main-entity case-main-entity" style={this.state.executing == true ? { opacity: ".7" } : undefined} data-main-entity={entityInfo(mainEntity)}>
251274
<div className="sf-button-widget-container">
252275
{renderWidgets(wc)}
253276
{this.entityComponent && !mainEntity.isNew && !pack.activity.doneBy ? <ButtonBar ref={bb => this.buttonBar = bb} frame={mainFrame} pack={mainFrame.pack} /> : <br />}

Signum.React.Extensions/Workflow/Case/CaseFramePage.tsx

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ interface CaseFramePageState {
2929
pack?: WorkflowClient.CaseEntityPack;
3030
getComponent?: (ctx: TypeContext<Entity>) => React.ReactElement<any>;
3131
refreshCount: number;
32+
executing?: boolean;
3233
}
3334

3435
export default class CaseFramePage extends React.Component<CaseFramePageProps, CaseFramePageState> implements IHasCaseActivity {
@@ -161,7 +162,17 @@ export default class CaseFramePage extends React.Component<CaseFramePageProps, C
161162
},
162163
refreshCount: this.state.refreshCount,
163164
allowExchangeEntity: false,
164-
prefix: "caseFrame"
165+
prefix: "caseFrame",
166+
isExecuting: () => this.state.executing == true,
167+
execute: action => {
168+
if (this.state.executing)
169+
return;
170+
171+
this.setState({ executing: true });
172+
action()
173+
.finally(() => { this.setState({ executing: undefined }) })
174+
.done();
175+
}
165176
};
166177

167178

@@ -232,7 +243,17 @@ export default class CaseFramePage extends React.Component<CaseFramePageProps, C
232243
},
233244
refreshCount: this.state.refreshCount,
234245
allowExchangeEntity: false,
235-
prefix: "caseFrame"
246+
prefix: "caseFrame",
247+
isExecuting: () => this.state.executing == true,
248+
execute: action => {
249+
if (this.state.executing)
250+
return;
251+
252+
this.setState({ executing: true });
253+
action()
254+
.finally(() => this.setState({ executing: undefined }))
255+
.done();
256+
}
236257
};
237258

238259
var ti = this.getMainTypeInfo();
@@ -252,7 +273,7 @@ export default class CaseFramePage extends React.Component<CaseFramePageProps, C
252273
};
253274

254275
return (
255-
<div className="sf-main-entity case-main-entity" data-main-entity={entityInfo(mainEntity)}>
276+
<div className="sf-main-entity case-main-entity" style={this.state.executing == true ? { opacity: ".7" } : undefined} data-main-entity={entityInfo(mainEntity)}>
256277
<div className="sf-button-widget-container">
257278
{renderWidgets(wc)}
258279
{this.entityComponent && !mainEntity.isNew && !pack.activity.doneBy ? <ButtonBar ref={a => this.buttonBar = a} frame={mainFrame} pack={mainFrame.pack} /> : <br />}

0 commit comments

Comments
 (0)