Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@ export class TOCEntry extends Component<Props, State> {
openLayerSettings={this._openLayerPanelWithCheck}
isEditButtonDisabled={this.props.isEditButtonDisabled}
supportsFitToBounds={this.state.supportsFitToBounds}
editModeActiveForLayer={this.props.editModeActiveForLayer}
/>

{this._renderQuickActions()}
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ const defaultProps = {
enableShapeEditing: () => {},
enablePointEditing: () => {},
openLayerSettings: () => {},
editModeActiveForLayer: false,
};

describe('TOCEntryActionsPopover', () => {
Expand Down Expand Up @@ -100,4 +101,17 @@ describe('TOCEntryActionsPopover', () => {

expect(component).toMatchSnapshot();
});

test('should disable Edit features when edit mode active for layer', async () => {
const component = shallow(
<TOCEntryActionsPopover {...defaultProps} editModeActiveForLayer={true} />
);

// Ensure all promises resolve
await new Promise((resolve) => process.nextTick(resolve));
// Ensure the state changes are reflected
component.update();

expect(component).toMatchSnapshot();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export interface Props {
removeLayer: (layerId: string) => void;
supportsFitToBounds: boolean;
toggleVisible: (layerId: string) => void;
editModeActiveForLayer: boolean;
}

interface State {
Expand Down Expand Up @@ -170,7 +171,7 @@ export class TOCEntryActionsPopover extends Component<Props, State> {
defaultMessage:
'Edit features only supported for document layers without clustering, joins, or time filtering',
}),
disabled: !this.state.isFeatureEditingEnabled,
disabled: !this.state.isFeatureEditingEnabled || this.props.editModeActiveForLayer,
onClick: async () => {
this._closePopover();
const supportedShapeTypes = await (this.props.layer.getSource() as ESSearchSource).getSupportedShapeTypes();
Expand Down