Skip to content

Commit

Permalink
merging release/2.7 to develop (#1998)
Browse files Browse the repository at this point in the history
* [SDBELGA-778] fix: Show recurring Planning update method on Ignore|Cancel|Save modal (#1930)

* [SDBELGA-778] fix: Show recurring Planning update method on Ignore|Cancel|Save modal
Also improve look and feel when rendering Event & Planning metadata in the modal

* fix(ci): Use superdesk/release/2.7 branch for test instance

* fix extension build error

* add new should_udpate func [SDCP-742] (#1963)

* add new should_udpate func [SDCP-742]

* update params

* refactore logic

* Onclusive parse new key for event status mapping [SDCP-749] (#1970)

* Onclusive parse new key for event status mapping [SDCP-749]

* address comment

* Fix content profile closing after canceling a groups' creation (#1964)

* implement onclusive reingesting (#1971)

SDCP-751

* drop angular-history (#1933)

* drop angular-history

* fix test build

* sync redux versions with client core

* update package-lock

* update events during ingest if name/subject changes

SDCP-751

* allow removing contact email/phone via update (#1979)

SDCP-762

* set expiry when parsing onclusive events (#1995)

* set expiry when parsing onclusive events

CPCN-825

* fix mypy

* bump version

* update ui framework version (#1997)

* fix ci

* Set version to 2.8.0-dev

---------

Co-authored-by: MarkLark86 <[email protected]>
Co-authored-by: Ketan <[email protected]>
Co-authored-by: Konstantin Markov <[email protected]>
  • Loading branch information
4 people authored Jun 19, 2024
1 parent 5bd2a11 commit d152883
Show file tree
Hide file tree
Showing 28 changed files with 951 additions and 623 deletions.
5 changes: 3 additions & 2 deletions client/actions/events/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -569,8 +569,9 @@ const save = (original, updates) => (
) {
delete eventUpdates.dates;
}
eventUpdates.update_method = get(eventUpdates, 'update_method.value') ||
EVENTS.UPDATE_METHODS[0].value;
eventUpdates.update_method = eventUpdates.update_method == null ?
EVENTS.UPDATE_METHODS[0].value :
eventUpdates.update_method?.value ?? eventUpdates.update_method;

return originalEvent?._id != null ?
planningApi.events.update(originalItem, eventUpdates) :
Expand Down
1 change: 1 addition & 0 deletions client/actions/events/ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -928,6 +928,7 @@ const save = (original, updates, confirmation, unlockOnClose) => (
{
actionType: 'save',
unlockOnClose: unlockOnClose,
large: true,
}
));
}
Expand Down
8 changes: 2 additions & 6 deletions client/actions/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -716,11 +716,7 @@ const openIgnoreCancelSaveModal = ({
const storedItems = itemType === ITEM_TYPE.EVENT ?
selectors.events.storedEvents(getState()) :
selectors.planning.storedPlannings(getState());

const item = {
...get(storedItems, itemId) || {},
...autosaveData,
};
const item = get(storedItems, itemId) || {};

if (!isExistingItem(item)) {
delete item._id;
Expand Down Expand Up @@ -749,7 +745,7 @@ const openIgnoreCancelSaveModal = ({
modalType: MODALS.IGNORE_CANCEL_SAVE,
modalProps: {
item: itemWithAssociatedData,
itemType: itemType,
updates: autosaveData,
onCancel: onCancel,
onIgnore: onIgnore,
onSave: onSave,
Expand Down
54 changes: 30 additions & 24 deletions client/components/ConfirmationModal.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,35 @@
import React from 'react';
import PropTypes from 'prop-types';

import {gettext} from '../utils';

import {Modal} from './index';
import {ButtonList, Icon} from './UI';
import {KEYCODES} from '../constants';

export class ConfirmationModal extends React.Component {
interface IProps {
handleHide(itemType?: string): void;
modalProps: {
onCancel?(): void;
cancelText?: string;
ignore?(): void;
showIgnore?: boolean;
ignoreText?: string;
okText?: string;
action?(): void;
title?: string;
body: React.ReactNode;
itemType?: string;
autoClose?: boolean;
large?: boolean;
bodyClassname?: string;
};
}

interface IState {
submitting: boolean;
}

export class ConfirmationModal extends React.Component<IProps, IState> {
constructor(props) {
super(props);

Expand Down Expand Up @@ -96,14 +118,18 @@ export class ConfirmationModal extends React.Component {
}

return (
<Modal show={true} onHide={this.onCancel}>
<Modal
show={true}
onHide={this.onCancel}
large={this.props.modalProps.large}
>
<Modal.Header>
<h3 className="modal__heading">{modalProps.title || gettext('Confirmation')}</h3>
<a className="icn-btn" aria-label={gettext('Close')} onClick={this.onCancel}>
<Icon icon="icon-close-small" />
</a>
</Modal.Header>
<Modal.Body>
<Modal.Body className={this.props.modalProps.bodyClassname}>
<div>
{modalProps.body || gettext('Are you sure ?')}
</div>
Expand All @@ -115,23 +141,3 @@ export class ConfirmationModal extends React.Component {
);
}
}

ConfirmationModal.propTypes = {
handleHide: PropTypes.func.isRequired,
modalProps: PropTypes.shape({
onCancel: PropTypes.func,
cancelText: PropTypes.string,
ignore: PropTypes.func,
showIgnore: PropTypes.bool,
ignoreText: PropTypes.string,
okText: PropTypes.string,
action: PropTypes.func,
title: PropTypes.string,
body: PropTypes.oneOfType([
PropTypes.string,
PropTypes.element,
]),
itemType: PropTypes.string,
autoClose: PropTypes.bool,
}),
};
43 changes: 38 additions & 5 deletions client/components/Events/EventScheduleSummary/index.tsx
Original file line number Diff line number Diff line change
@@ -1,24 +1,32 @@
import React from 'react';
import PropTypes from 'prop-types';
import {get} from 'lodash';

import {IEventItem} from 'interfaces';
import {gettext, eventUtils, timeUtils} from '../../../utils';

import {FormLabel, Text, ContentDivider} from 'superdesk-ui-framework/react';
import {RepeatEventSummary} from '../RepeatEventSummary';
import {Row} from '../../UI/Preview';
import {gettext, eventUtils, timeUtils} from '../../../utils';

import './style.scss';
import {IEventItem} from 'interfaces';


interface IProps {
event: Partial<IEventItem>,
noPadding?: boolean,
forUpdating?: boolean,
useEventTimezone?: boolean
useFormLabelAndText?: boolean
addContentDivider?: boolean
}

export const EventScheduleSummary = ({
event,
noPadding = false,
forUpdating = false,
useEventTimezone = false
useEventTimezone = false,
useFormLabelAndText = false,
addContentDivider = false,
}: IProps) => {
if (!event) {
return null;
Expand Down Expand Up @@ -74,7 +82,32 @@ export const EventScheduleSummary = ({
currentDateLabel = gettext('Current Date (Based on Event timezone)');
}

return (
return useFormLabelAndText ? (
<React.Fragment>
<div>
<FormLabel text={forUpdating ? currentDateLabel : gettext('Date:')} />
<Text size="small" weight="medium">
{currentDateText || ''}
</Text>
</div>
{addContentDivider !== true ? null : (
<ContentDivider type="dashed" margin="x-small" />
)}
{doesRepeat !== true ? null : (
<React.Fragment>
<div>
<FormLabel text={gettext('Repeat Summary')} />
<Text size="small" weight="medium">
{eventUtils.getRepeatSummaryForEvent(eventSchedule)}
</Text>
</div>
{addContentDivider !== true ? null : (
<ContentDivider type="dashed" margin="x-small" />
)}
</React.Fragment>
)}
</React.Fragment>
) : (
<React.Fragment>
<Row
label={forUpdating ? currentDateLabel : gettext('Date:')}
Expand Down
Loading

0 comments on commit d152883

Please sign in to comment.