Skip to content

Commit

Permalink
resolve merge conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
okauppinen committed Nov 27, 2024
2 parents b5413d5 + 6ff8b36 commit 278d5a2
Show file tree
Hide file tree
Showing 207 changed files with 5,388 additions and 5,776 deletions.
29 changes: 29 additions & 0 deletions UpdatingDependencies.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Updating dependencies

List of some recognized fragile points on the code that could break when updating dependencies.

## OpenLayers

See notes: https://github.com/openlayers/openlayers/releases

Timeseries implementation tries to preload the "next" image to be shown (the next "time" on the timeseries) for showing WMS-T layers and tinkers with some internals of OpenLayers: https://github.com/oskariorg/oskari-frontend/pull/2732

## Cesium

See notes:
- https://github.com/CesiumGS/cesium/releases
- https://github.com/CesiumGS/cesium/blob/main/CHANGES.md

On Oskari 2.14 cesium was switched to @cesium/engine as we aren't using the widgets part. However it seems it's more difficult to track the changes on the engine as changelog describes the "full release" of everything cesium (or more difficult to track which version of engine is used on which Cesium release).

The engine version can be found here: https://github.com/CesiumGS/cesium/blob/1.123.1/packages/engine/package.json#L3 (when cesium version is 1.123.1).

## ol-cesium

Maintained under openlayers and acts as glue between cesium and OpenLayers. We can use most of OpenLayers API while showing data on Cesium.

Currently, doesn't have support for OpenLayers 10.x/prevents from updating to most recent version of OpenLayers.

## AntD

Usually styles tend to break when updating AntD. However in the 5.x version AntD introduced theming using props on components. This might make it easier to update.
3 changes: 2 additions & 1 deletion api/ui/toolbar/bundle.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,12 @@ A toolbar can also contain color configs:
"background": "#00ff00"
}
}
```

Hover color is used when hovering icon and Toolbar.ToolbarRequest add operation data not contains color configuration.

Background color is now only used to calculate light/dark icon classes.
Configuration is used when Toolbar.ToolbarREquest add operation data not contains color configuration.
Configuration is used when Toolbar.ToolbarREquest add operation data not contains color configuration.

## Bundle state

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import React from 'react';
import { PropTypes } from 'prop-types';
import { Message, Checkbox, Button } from 'oskari-ui';
import styled from 'styled-components';

const Col = styled('div')`
display: flex;
flex-direction: column;
`;

const SelectedAnnouncements = styled('div')`
display: flex;
flex-direction: column;
margin-top: 1em;
`;

const SelectedAnnouncementsTitle = styled('div')`
font-weight: bold;
`;

const SelectedAnnouncementsText = styled('div')`
font-style: italic;
`;

const SelectedAnnouncement = ({ announcement, lang }) => {
return <SelectedAnnouncementsText>{ Oskari.getLocalized(announcement.locale, lang)?.title }</SelectedAnnouncementsText>;
};

const SelectButton = styled(Button)`
margin-top: 0.5em;
width: 50%;
`;

SelectedAnnouncement.propTypes = {
announcement: PropTypes.object,
lang: PropTypes.string
};

export const AnnouncementToolComponent = ({ state, controller }) => {
const { noUI, announcements, selectedAnnouncements } = state;

return (
<Col>
<Checkbox checked={noUI} onChange={ evt => controller.setNoUI(evt.target.checked) }>
<Message bundleKey={'admin-announcements'} messageKey={'publisher.noUI'}/>
</Checkbox>

<SelectedAnnouncements>
<Message LabelComponent={SelectedAnnouncementsTitle} bundleKey={'admin-announcements'} messageKey={'publisher.selectedAnnouncementsTitle'} />
{ announcements
.filter((ann) => selectedAnnouncements?.includes(ann.id))
.map((announcement) => {
return <SelectedAnnouncement key={ announcement.id } announcement={announcement} lang={state?.lang}/>;
})
}
</SelectedAnnouncements>
<SelectButton onClick={() => controller.showPopup()}>
<Message bundleKey={'admin-announcements'} messageKey={'tool.buttonLabel'}/>
</SelectButton>

</Col>);
};

AnnouncementToolComponent.propTypes = {
state: PropTypes.object,
controller: PropTypes.object
};
103 changes: 103 additions & 0 deletions bundles/admin/admin-announcements/publisher/AnnouncementsPopup.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
import { showPopup } from 'oskari-ui/components/window';
import React from 'react';
import { Checkbox, Message, WarningIcon } from 'oskari-ui';
import styled from 'styled-components';
import { getDateRange, isOutdated } from '../../../framework/announcements/service/util';
import { PrimaryButton } from 'oskari-ui/components/buttons';

const PopupContentContainer = styled('div')`
margin: 1em;
width: 25vw;
display: flex;
flex-direction: column;
`;

const Disclaimer = styled('div')`
margin-bottom: 1em;
flex-grow: 0;
`;

const PopupContent = styled('div')`
flex-grow: 1;
max-height: 50vh;
overflow-y: auto;
`;

const Footer = styled('div')`
flex-grow: 0;
margin: 0 auto;
`;

const Row = styled('div')`
display: flex;
flex-direction: row;
justify-content: space-between;
`;

const ColHeading = styled('div')`
font-weight: bold;
`;

const Col = styled('div')`
`;

const getContent = (state, controller, onClose) => {
const { announcements, selectedAnnouncements, lang } = state;
/*
let { announcements } = state;
announcements = announcements.concat(announcements).concat(announcements).concat(announcements);
*/
const title = <Message bundleKey='admin-announcements' messageKey='tool.popup.title'/>;

const content = <PopupContentContainer>
<Disclaimer>
<Message bundleKey='admin-announcements' messageKey='tool.popup.disclaimer'/>
</Disclaimer>
<PopupContent>
<Row>
<ColHeading>
<Message bundleKey='admin-announcements' messageKey='tool.announcementsName'></Message>
</ColHeading>
<ColHeading>
<Message bundleKey='admin-announcements' messageKey='tool.announcementsTime'></Message>
</ColHeading>
</Row>
{announcements.map((announcement) => {
const dateRange = getDateRange(announcement);
const daterangeOutdated = isOutdated(announcement);

return <Row key={announcement.id}>
<Col>
<Checkbox
onChange={(e) => controller.updateSelectedAnnouncements(e.target.checked, announcement.id)}
checked = { !daterangeOutdated && !!selectedAnnouncements?.includes(announcement.id)}
disabled={daterangeOutdated}>
{Oskari.getLocalized(announcement.locale, lang)?.title} {daterangeOutdated && <WarningIcon/>}
</Checkbox>
</Col>
<Col>{dateRange}</Col>
</Row>;
})}
</PopupContent>
<Footer>
<PrimaryButton type={'close'} onClick={onClose}/>
</Footer>
</PopupContentContainer>;

return {
title,
content
};
};

export const showAnnouncementsPopup = (state, controller, onClose) => {
const { title, content } = getContent(state, controller, onClose);
const controls = showPopup(title, content, onClose, {});
return {
...controls,
update: (state) => {
const { title, content } = getContent(state, controller, onClose);
controls.update(title, content);
}
};
};
Loading

0 comments on commit 278d5a2

Please sign in to comment.