Skip to content

Commit 2bf7aab

Browse files
authored
Merge pull request #1984 from Heigvd/dev
Dev to master
2 parents c45a52a + 86038fc commit 2bf7aab

File tree

12 files changed

+97
-8
lines changed

12 files changed

+97
-8
lines changed

wegas-app/src/main/node/wegas-react/src/Components/Outputs/Inbox.tsx

+49-5
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,17 @@ import { css, cx } from '@emotion/css';
22
import { faArrowLeft } from '@fortawesome/free-solid-svg-icons';
33
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
44
import * as React from 'react';
5-
import { IInboxDescriptor, IMessage } from 'wegas-ts-api';
5+
import { IAttachment, IInboxDescriptor, IMessage } from 'wegas-ts-api';
66
import {
7-
bolder, defaultMarginBottom,
7+
bolder,
8+
defaultMarginBottom,
89
defaultMarginTop,
910
expandWidth,
1011
flex,
1112
flexBetween,
1213
flexColumn,
1314
flexRow,
15+
flexWrap,
1416
itemCenter,
1517
toolboxHeaderStyle,
1618
} from '../../css/classes';
@@ -24,13 +26,17 @@ import { wwarn } from '../../Helper/wegaslog';
2426
import { componentsTranslations } from '../../i18n/components/components';
2527
import { useInternalTranslate } from '../../i18n/internalTranslator';
2628
import {
27-
DefaultEntityChooserLabel, defaultEntityDisplay,
29+
DefaultEntityChooserLabel,
30+
defaultEntityDisplay,
2831
EntityChooser,
2932
EntityChooserLabelProps,
3033
} from '../EntityChooser';
3134
import { useTranslate } from '../Hooks/useTranslate';
3235
import { themeVar } from '../Theme/ThemeVars';
3336
import { TranslatableText } from './HTMLText';
37+
import { fileURL } from '../../API/files.api';
38+
import {languagesCTX} from "../Contexts/LanguagesProvider";
39+
import {translate} from "../../data/i18n";
3440

3541
interface MessageLabelProps {
3642
message: IMessage;
@@ -62,6 +68,13 @@ const labelTitleStyle = css({
6268
whiteSpace: 'nowrap',
6369
});
6470

71+
const attachmentDisplay = cx(
72+
flex,
73+
flexRow,
74+
flexWrap,
75+
css({ flexShrink: 0, marginLeft: '5px', width: '100%' }),
76+
);
77+
6578
function MessageLabel({ message }: MessageLabelProps) {
6679
const translatedLabel = useTranslate(message.subject);
6780
const translatedFrom = useTranslate(message.from);
@@ -116,6 +129,28 @@ function MessageChooser(props: EntityChooserLabelProps<IMessage>) {
116129
);
117130
}
118131

132+
interface AttachmentsDisplayProps {
133+
attachments: IAttachment[];
134+
}
135+
136+
function AttachmentsDisplay({ attachments }: AttachmentsDisplayProps) {
137+
const { lang, availableLang } = React.useContext(languagesCTX);
138+
const files = attachments.map(attachment => translate(attachment.file, lang, availableLang));
139+
140+
return (
141+
<div className={attachmentDisplay}>
142+
{files.map((file, index) => (
143+
<span className={css({ marginLeft: '5px' })} key={index}>
144+
<a href={fileURL(file)} target="_blank" rel="noreferrer">
145+
{file.slice(1)}
146+
</a>
147+
{index < files.length - 1 && ','}
148+
</span>
149+
))}
150+
</div>
151+
);
152+
}
153+
119154
interface MessageDisplayProps {
120155
entity: IMessage;
121156
}
@@ -126,11 +161,14 @@ function MessageDisplay({ entity }: MessageDisplayProps) {
126161
const subject = useTranslate(entity.subject);
127162
const date = useTranslate(entity.date);
128163
const from = useTranslate(entity.from);
164+
const attachments = entity.attachments;
129165

130166
return (
131167
<div className={defaultEntityDisplay}>
132168
<div className={cx(toolboxHeaderStyle)}>
133-
{subject && <div className={cx(bolder, defaultMarginBottom)}>{subject}</div>}
169+
{subject && (
170+
<div className={cx(bolder, defaultMarginBottom)}>{subject}</div>
171+
)}
134172
{date && (
135173
<div>
136174
{i18nComponentValues.inbox.date}: {date}
@@ -141,8 +179,14 @@ function MessageDisplay({ entity }: MessageDisplayProps) {
141179
{i18nComponentValues.inbox.sender}: {from}
142180
</div>
143181
)}
182+
{attachments.length > 0 && (
183+
<div className={cx(flex, flexRow, css({whiteSpace: 'nowrap'}))}>
184+
{i18nComponentValues.inbox.attachments}:
185+
<AttachmentsDisplay attachments={attachments}/>
186+
</div>
187+
)}
144188
</div>
145-
<TranslatableText content={entity.body}/>
189+
<TranslatableText content={entity.body} />
146190
</div>
147191
);
148192
}

wegas-app/src/main/node/wegas-react/src/Editor/Components/ScriptEditors/TempScriptEditor.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ export function TempScriptEditor(props: TempScriptEditorProps) {
399399
{error && <MessageString value={error} type="error" />}
400400
{resizable ? (
401401
<ResizeHandle
402-
minSize={100}
402+
minSize={125}
403403
textContent={value + '\n\n' || '\n\n\n\n\n'}
404404
>
405405
<SrcEditor

wegas-app/src/main/node/wegas-react/src/i18n/components/de.ts

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ export const DE: ComponentsTranslations = {
55
subject: 'Betreff',
66
sender: 'Von',
77
date: 'Datum',
8+
attachments: 'Anhäge',
89
noSelectionMessage: 'Wählen Sie eine anzuzeigende Nachricht aus',
910
},
1011
question: {

wegas-app/src/main/node/wegas-react/src/i18n/components/definitions.ts

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ export interface ComponentsTranslations {
33
subject: string;
44
sender: string;
55
date: string;
6+
attachments: string;
67
noSelectionMessage: string;
78
};
89
question: {

wegas-app/src/main/node/wegas-react/src/i18n/components/en.ts

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ export const EN: ComponentsTranslations = {
55
subject: 'Subject',
66
sender: 'From',
77
date: 'Date',
8+
attachments: 'Attachment(s)',
89
noSelectionMessage: 'Choose a message to display',
910
},
1011
question: {

wegas-app/src/main/node/wegas-react/src/i18n/components/fr.ts

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ export const FR: ComponentsTranslations = {
55
subject: 'Objet',
66
sender: 'De',
77
date: 'Date',
8+
attachments: 'Pièce(s) jointe(s)',
89
noSelectionMessage: 'Choisissez un message à afficher',
910
},
1011
question: {

wegas-app/src/main/node/wegas-react/src/i18n/components/it.ts

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ export const IT: ComponentsTranslations = {
55
subject: 'Oggetto',
66
sender: 'Da',
77
date: 'Data',
8+
attachments: 'Alegato/i',
89
noSelectionMessage: 'Scegli un messaggio da vasualizzare',
910
},
1011
question: {

wegas-app/src/main/webapp/wegas-app/jsf/app-default.xhtml

+3
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@
4444
</ui:fragment>
4545

4646

47+
<!-- Self hosted mutation events polyfill -->
48+
<script type="text/javascript" src="#{request.contextPath}/lib/mutation-events-polyfill/mutation_events.min.js"></script>
49+
4750
<!-- Self hosted YUI 3 -->
4851
<script type="text/javascript" src="#{request.contextPath}/lib/yui3/build/yui/yui-min.js"></script>
4952

wegas-core/src/main/java/com/wegas/resourceManagement/ejb/ResourceFacade.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@
2727
import com.wegas.resourceManagement.persistence.TaskDescriptor;
2828
import com.wegas.resourceManagement.persistence.TaskInstance;
2929
import com.wegas.resourceManagement.persistence.WRequirement;
30-
import java.util.Collection;
31-
import java.util.Set;
3230
import jakarta.ejb.LocalBean;
3331
import jakarta.ejb.Stateless;
3432
import jakarta.inject.Inject;
@@ -37,6 +35,9 @@
3735
import org.slf4j.Logger;
3836
import org.slf4j.LoggerFactory;
3937

38+
import java.util.Collection;
39+
import java.util.Set;
40+
4041
/**
4142
*
4243
* @author Francois-Xavier Aeberhard (fx at red-agent.com)
@@ -398,6 +399,7 @@ public void reviveTaskDescriptor(TaskDescriptor task) {
398399
* New predecessor's names : be sure they're registered
399400
*/
400401
task.getPredecessors().clear();
402+
this.getEntityManager().flush();
401403

402404
for (String predecessorName : predecessorNames) {
403405
try {

wegas-resources/pom.xml

+1
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
<exclude>lib/jsPlumb/**</exclude>
6464
<exclude>lib/tiny_mce/**</exclude>
6565
<exclude>lib/yui3/**</exclude>
66+
<exclude>lib/mutation-events-polyfill/**</exclude>
6667
</excludes>
6768
<statistics>false</statistics>
6869
<jswarn>false</jswarn>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
BSD 3-Clause License
2+
3+
Copyright (c) 2023, Mason Freed
4+
5+
Redistribution and use in source and binary forms, with or without
6+
modification, are permitted provided that the following conditions are met:
7+
8+
1. Redistributions of source code must retain the above copyright notice, this
9+
list of conditions and the following disclaimer.
10+
11+
2. Redistributions in binary form must reproduce the above copyright notice,
12+
this list of conditions and the following disclaimer in the documentation
13+
and/or other materials provided with the distribution.
14+
15+
3. Neither the name of the copyright holder nor the names of its
16+
contributors may be used to endorse or promote products derived from
17+
this software without specific prior written permission.
18+
19+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

wegas-resources/src/main/webapp/lib/mutation-events-polyfill/mutation_events.min.js

+6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)