-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
207 changed files
with
5,388 additions
and
5,776 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
bundles/admin/admin-announcements/publisher/AnnouncementToolComponent.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
103
bundles/admin/admin-announcements/publisher/AnnouncementsPopup.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
}; | ||
}; |
Oops, something went wrong.