Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #10631 New MapStore Home Page #10731

Merged
merged 16 commits into from
Jan 31, 2025
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions web/client/components/I18N/LangBar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ class LangBar extends React.Component {
className={this.props.className}>
<DropdownButton
pullRight
noCaret
id={this.props.id}
className="square-button-md _border-transparent"
title={
<FlagButton
componentAsButton={false}
Expand Down
4 changes: 2 additions & 2 deletions web/client/components/contextcreator/ContextCreator.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ export default class ContextCreator extends React.Component {
allAvailablePlugins: [],
isCfgValidated: false,
curStepId: 'general-settings',
saveDestLocation: '/context-manager',
saveDestLocation: '/',
onInit: () => { },
onSetStep: () => { },
onShowTutorial: () => { },
Expand All @@ -267,7 +267,7 @@ export default class ContextCreator extends React.Component {
pluginsToUpload: [],
onShowBackToPageConfirmation: () => { },
showBackToPageConfirmation: false,
backToPageDestRoute: '/context-manager',
backToPageDestRoute: '/',
backToPageConfirmationMessage: 'contextCreator.undo',
tutorials: CONTEXT_TUTORIALS,
tutorialsList: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ describe('ContextCreator component', () => {
expect(saveBtn.childNodes[0].innerHTML).toBe('save');
ReactTestUtils.Simulate.click(saveBtn); // <-- trigger event callback
// check destination path
expect(spyonSave).toHaveBeenCalledWith("/context-manager");
expect(spyonSave).toHaveBeenCalledWith("/");
});
it('custom destination', () => {
const eng = {
Expand Down
55 changes: 11 additions & 44 deletions web/client/components/home/Home.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,13 @@ import PropTypes from 'prop-types';
import { Glyphicon, Tooltip } from 'react-bootstrap';
import OverlayTrigger from '../misc/OverlayTrigger';
import Message from '../../components/I18N/Message';
import ConfirmModal from '../../components/misc/ResizableModal';
import { pick } from "lodash";
import { goToHomePage } from '../../actions/router';

class Home extends React.Component {
static propTypes = {
icon: PropTypes.string,
onCheckMapChanges: PropTypes.func,
onCloseUnsavedDialog: PropTypes.func,
displayUnsavedDialog: PropTypes.bool,
renderUnsavedMapChangesDialog: PropTypes.bool,
tooltipPosition: PropTypes.string,
bsStyle: PropTypes.string,
hidden: PropTypes.bool
Expand All @@ -36,9 +32,6 @@ class Home extends React.Component {

static defaultProps = {
icon: "home",
onCheckMapChanges: () => {},
onCloseUnsavedDialog: () => {},
renderUnsavedMapChangesDialog: true,
tooltipPosition: 'left',
bsStyle: 'primary',
hidden: false
Expand All @@ -48,47 +41,21 @@ class Home extends React.Component {
const { tooltipPosition, hidden, ...restProps} = this.props;
let tooltip = <Tooltip id="toolbar-home-button">{<Message msgId="gohome"/>}</Tooltip>;
return hidden ? false : (
<React.Fragment>
<OverlayTrigger overlay={tooltip} placement={tooltipPosition}>
<Button
id="home-button"
className="square-button"
bsStyle={this.props.bsStyle}
onClick={this.checkUnsavedChanges}
tooltip={tooltip}
{...pick(restProps, ['disabled', 'active', 'block', 'componentClass', 'href', 'children', 'icon', 'bsStyle', 'className'])}
><Glyphicon glyph={this.props.icon}/></Button>
</OverlayTrigger>
<ConfirmModal
ref="unsavedMapModal"
show={this.props.displayUnsavedDialog || false}
onClose={this.props.onCloseUnsavedDialog}
title={<Message msgId="resources.maps.unsavedMapConfirmTitle" />}
buttons={[{
bsStyle: "primary",
text: <Message msgId="resources.maps.unsavedMapConfirmButtonText" />,
onClick: this.goHome
}, {
text: <Message msgId="resources.maps.unsavedMapCancelButtonText" />,
onClick: this.props.onCloseUnsavedDialog
}]}
fitContent
>
<div className="ms-detail-body">
<Message msgId="resources.maps.unsavedMapConfirmMessage" />
</div>
</ConfirmModal>
</React.Fragment>
<OverlayTrigger overlay={tooltip} placement={tooltipPosition}>
<Button
id="home-button"
className="square-button"
bsStyle={this.props.bsStyle}
onClick={this.checkUnsavedChanges}
tooltip={tooltip}
{...pick(restProps, ['disabled', 'active', 'block', 'componentClass', 'href', 'children', 'icon', 'bsStyle', 'className'])}
><Glyphicon glyph={this.props.icon}/></Button>
</OverlayTrigger>
);
}

checkUnsavedChanges = () => {
if (this.props.renderUnsavedMapChangesDialog) {
this.props.onCheckMapChanges(this.goHome);
} else {
this.props.onCloseUnsavedDialog();
this.goHome();
}
this.goHome();
}

goHome = () => {
Expand Down
4 changes: 2 additions & 2 deletions web/client/components/layout/BorderLayout.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ export default ({id, children, header, footer, columns, height, style = {}, clas
flex: 1,
overflowY: "auto"
}}>
<main className="ms2-border-layout-content" style={{flex: 1, overflowX: 'hidden'}}>
<div className="ms2-border-layout-content" style={{flex: 1, overflowX: 'hidden'}}>
{height ? <div style={{height}}>{children}</div> : children}
</main>
</div>
{height ? <div style={{height}}>{columns}</div> : columns}
</div>
{footer}
Expand Down
9 changes: 7 additions & 2 deletions web/client/components/share/SharePanel.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ class SharePanel extends React.Component {
addMarker: PropTypes.func,
viewerOptions: PropTypes.object,
mapType: PropTypes.string,
updateMapView: PropTypes.func
updateMapView: PropTypes.func,
onClearShareResource: PropTypes.func
};

static defaultProps = {
Expand All @@ -118,7 +119,8 @@ class SharePanel extends React.Component {
isScrollPosition: false,
hideMarker: () => {},
addMarker: () => {},
updateMapView: () => {}
updateMapView: () => {},
onClearShareResource: () => {}
};

static contextTypes = {
Expand Down Expand Up @@ -182,6 +184,9 @@ class SharePanel extends React.Component {
});
}
}
componentWillUnmount() {
this.props.onClearShareResource();
}

initializeDefaults = (props) => {
const coordinate = this.getCoordinates(props);
Expand Down
Loading
Loading