-
Notifications
You must be signed in to change notification settings - Fork 351
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #772 from oskarhane/grass-regressions
Fix :style / GraSS regressions
- Loading branch information
Showing
15 changed files
with
522 additions
and
109 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,57 @@ | ||
/* | ||
* Copyright (c) 2002-2018 "Neo4j, Inc" | ||
* Network Engine for Objects in Lund AB [http://neotechnology.com] | ||
* | ||
* This file is part of Neo4j. | ||
* | ||
* Neo4j is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
/* global Cypress, cy, test, expect */ | ||
|
||
describe(':style', () => { | ||
it('can connect', () => { | ||
const password = Cypress.env('BROWSER_NEW_PASSWORD') || 'newpassword' | ||
cy.connect('neo4j', password) | ||
}) | ||
it('print the current style', () => { | ||
cy.executeCommand(':clear') | ||
cy.executeCommand('CREATE (n:Style) RETURN n') // To generate any style | ||
const query = ':style' | ||
cy.executeCommand(query) | ||
cy | ||
.get('[data-test-id="frameCommand"]', { timeout: 10000 }) | ||
.first() | ||
.should('contain', query) | ||
cy | ||
.get('[data-test-id="frameContents"]', { timeout: 10000 }) | ||
.first() | ||
.should('contain', 'node {') | ||
.should('contain', 'relationship {') | ||
.should('contain', '"<type>"') | ||
}) | ||
it('can reset style with button', () => { | ||
cy.executeCommand(':clear') | ||
cy.executeCommand(':style') | ||
cy.get('[data-test-id="exportGrassButton"]', { timeout: 10000 }) | ||
cy | ||
.get('[data-test-id="styleResetButton"]', { timeout: 10000 }) | ||
.first() | ||
.click() | ||
cy | ||
.get('[data-test-id="frameContents"]', { timeout: 10000 }) | ||
.first() | ||
.should('contain', 'No style generated or set yet') | ||
}) | ||
}) |
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
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
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
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,50 @@ | ||
/* | ||
* Copyright (c) 2002-2018 "Neo4j, Inc" | ||
* Network Engine for Objects in Lund AB [http://neotechnology.com] | ||
* | ||
* This file is part of Neo4j. | ||
* | ||
* Neo4j is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
import { Component } from 'preact' | ||
import { | ||
StyledInfoMessage, | ||
StyledHelpContent, | ||
StyledH4, | ||
StyledHelpDescription, | ||
StyledDiv, | ||
StyledHelpFrame | ||
} from './styled' | ||
|
||
export class InfoView extends Component { | ||
shouldComponentUpdate (props, state) { | ||
return false | ||
} | ||
render () { | ||
const { title, description } = this.props | ||
return ( | ||
<StyledHelpFrame> | ||
<StyledHelpContent> | ||
<StyledHelpDescription> | ||
<StyledInfoMessage>INFO</StyledInfoMessage> | ||
<StyledH4>{title}</StyledH4> | ||
</StyledHelpDescription> | ||
<StyledDiv> | ||
<StyledHelpDescription>{description}</StyledHelpDescription> | ||
</StyledDiv> | ||
</StyledHelpContent> | ||
</StyledHelpFrame> | ||
) | ||
} | ||
} |
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
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,101 @@ | ||
/* | ||
* Copyright (c) 2002-2018 "Neo4j, Inc" | ||
* Network Engine for Objects in Lund AB [http://neotechnology.com] | ||
* | ||
* This file is part of Neo4j. | ||
* | ||
* Neo4j is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
import { connect } from 'preact-redux' | ||
import FrameTemplate from './FrameTemplate' | ||
import { | ||
PaddedDiv, | ||
StyledOneRowStatsBar, | ||
StyledRightPartial, | ||
FrameTitlebarButtonSection | ||
} from './styled' | ||
import { FrameButton } from 'browser-components/buttons' | ||
import { objToCss } from 'services/grassUtils' | ||
import { | ||
executeSystemCommand, | ||
executeCommand | ||
} from 'shared/modules/commands/commandsDuck' | ||
import { getCmdChar } from 'shared/modules/settings/settingsDuck' | ||
import { FireExtinguisherIcon } from 'browser-components/icons/Icons' | ||
import { InfoView } from './InfoView' | ||
|
||
const StyleFrame = ({ frame }) => { | ||
let grass = '' | ||
let contents = ( | ||
<InfoView | ||
title='No styles yet' | ||
description='No style generated or set yet. Run a query and return a few nodes and | ||
relationships to generate some styling.' | ||
/> | ||
) | ||
if (frame.result) { | ||
grass = objToCss(frame.result) | ||
contents = ( | ||
<PaddedDiv> | ||
<pre> | ||
{grass || | ||
'Something went wrong when parsing the GraSS. Please reset and try again.'} | ||
</pre> | ||
</PaddedDiv> | ||
) | ||
} | ||
return ( | ||
<FrameTemplate | ||
header={frame} | ||
numRecords={1} | ||
getRecords={() => grass} | ||
contents={contents} | ||
statusbar={<Statusbar frame={frame} />} | ||
/> | ||
) | ||
} | ||
|
||
const StyleStatusbar = ({ resetStyleAction, rerunAction, onResetClick }) => { | ||
return ( | ||
<StyledOneRowStatsBar> | ||
<StyledRightPartial> | ||
<FrameTitlebarButtonSection> | ||
<FrameButton | ||
data-test-id='styleResetButton' | ||
onClick={() => onResetClick(resetStyleAction, rerunAction)} | ||
> | ||
<FireExtinguisherIcon title='Reset style' /> | ||
</FrameButton> | ||
</FrameTitlebarButtonSection> | ||
</StyledRightPartial> | ||
</StyledOneRowStatsBar> | ||
) | ||
} | ||
|
||
const mapStateToProps = (state, ownProps) => { | ||
return { | ||
resetStyleAction: executeSystemCommand(`${getCmdChar(state)}style reset`), | ||
rerunAction: executeCommand(ownProps.frame.cmd, ownProps.frame.id) | ||
} | ||
} | ||
const mapDispatchToProps = dispatch => ({ | ||
onResetClick: (resetStyleAction, rerunAction) => { | ||
dispatch(resetStyleAction) | ||
dispatch(rerunAction) | ||
} | ||
}) | ||
|
||
const Statusbar = connect(mapStateToProps, mapDispatchToProps)(StyleStatusbar) | ||
|
||
export default StyleFrame |
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
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
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
Oops, something went wrong.