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

Adding new pages titles #181, preview for candidate ERC #151 and disable synchronized scrolling #183 #191

Merged
merged 10 commits into from
Mar 11, 2021
21 changes: 10 additions & 11 deletions ui/src/components/app/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import Discovery from '../discovery/Discovery';
import ERC from '../erc/ERC';

const Header = ( props ) => {
return (
return (
<AppBar id="header">
<Toolbar>
<a href="/"><img src={logo} alt="o2r" id="headerLogo"/></a>
Expand All @@ -35,22 +35,22 @@ const Header = ( props ) => {
</Button>
</NavLink>*/}
<NavLink id="link" to={"/author/" + props.userOrcid}>
{props.loggedIn ?
{props.loggedIn ?
<Button color="inherit">
{props.userName} |
{props.userName} |
<img src={orcidLogo} className="orcidImage" alt="orcid"></img>
{props.userOrcid}
</Button> : ''}
</NavLink>
</HashRouter>
<Button color="inherit"
href={props.loggedIn ? "api/v1/auth/logout" : "api/v1/auth/login"}
href={props.loggedIn ? "api/v1/auth/logout" : "api/v1/auth/login"}
onClick={() => props.login()}>{props.loggedIn ? 'Logout' : 'Login'}
</Button>
{/*<Button color="inherit">
Help
</Button>*/}
</Toolbar>
</Toolbar>
</AppBar>
);
};
Expand Down Expand Up @@ -96,20 +96,20 @@ class App extends Component {
)
.catch(response => {
console.log(response);
});
});
}

render() {
return (
<ThemeProvider theme={theme}>
<div id="pageContainer">
<Header
loggedIn={this.state.loggedIn}
<Header
loggedIn={this.state.loggedIn}
login={() => this.user()}
userName={this.state.userName}
userOrcid={this.state.userOrcid}>
userOrcid={this.state.userOrcid}>
</Header>

<HashRouter>
<div>
<div className="content" id="mainView">
Expand All @@ -131,4 +131,3 @@ class App extends Component {
}

export default App

13 changes: 10 additions & 3 deletions ui/src/components/app/footerLinks/Impressum.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
import React, { Component } from "react";
import config from '../../../helpers/config';

class Impressum extends Component {

componentDidMount(){
nuest marked this conversation as resolved.
Show resolved Hide resolved
document.title = "Impressum" + config.title;

}

render() {
return (
<div>
<h1>Impressum</h1>
<h2>Contact</h2>
<div>
Westfälische Wilhelms-Universität Münster<br/>
Westfälische Wilhelms-Universität Münster<br/>
Institut für Geoinformatik - o2r Project Team<br/>
Heisenbergstraße 2<br/>
D-48149 Münster<br/><br/>
Expand All @@ -16,12 +23,12 @@ class Impressum extends Component {
</div>
<h2>Notice of Liability</h2>
<div flex="50">
Although we check the content carefully, we cannot accept responsibility for the content of external links.
Although we check the content carefully, we cannot accept responsibility for the content of external links.
The linked sites’ carriers are responsible for their sites’ content.
</div>
</div>
);
}
}

export default Impressum;
export default Impressum;
11 changes: 9 additions & 2 deletions ui/src/components/app/footerLinks/Privacy.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
import React, { Component } from "react";
import config from '../../../helpers/config';

class Privacy extends Component {

componentDidMount(){
document.title = "Privacy" + config.title;

}

render() {
return (
return (
<div>
<h3>Privacy Policy</h3>
<h4 id="userdata">User Data</h4>
Expand Down Expand Up @@ -40,4 +47,4 @@ class Privacy extends Component {
}
}

export default Privacy;
export default Privacy;
4 changes: 3 additions & 1 deletion ui/src/components/authorView/Author.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import React, { Component } from "react";
import httpRequests from '../../helpers/httpRequests';
import ResultList from './resultList'
import { Grid, Paper } from "@material-ui/core";
import config from '../../helpers/config';

class Author extends Component {

Expand All @@ -16,6 +17,7 @@ class Author extends Component {
}
componentDidMount() {
this.getCompendia();
document.title = "Author View" + config.title;
}

goToErc = (erc) => {
Expand Down Expand Up @@ -88,4 +90,4 @@ class Author extends Component {
}
}

export default Author;
export default Author;
24 changes: 18 additions & 6 deletions ui/src/components/createERC/CreateERC.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import RequiredMetadata from './requiredMetadata/RequiredMetadata';
import SpatioTemporalMetadata from './spatioTemporalMetadata/SpatioTemporalMetadata';
import Bindings from './bindings/Bindings';
import httpRequests from '../../helpers/httpRequests';

import config from '../../helpers/config';


function TabContainer(props) {
Expand Down Expand Up @@ -35,7 +35,7 @@ class CreateERC extends Component {
spatioTemporalChanged: false,
authorsValid: false,
candidate: true,
showProgress: false,
showProgress: false
}
}

Expand Down Expand Up @@ -106,6 +106,11 @@ class CreateERC extends Component {
});
}

goToPreview = () => {
Fmazin marked this conversation as resolved.
Show resolved Hide resolved
let win = window.open('/#/erc/' + this.state.compendium_id);
win.focus();
}

updateAuthors = async (value) => {

var changed = true;
Expand Down Expand Up @@ -146,17 +151,21 @@ class CreateERC extends Component {
this.setState({ authorsValid: valid });
};


componentDidMount = () => this.getMetadata();
componentDidMount = () => {
this.getMetadata();
document.title = "Create ERC" + config.title;
}

handleClose = () => {
this.setState({ open: false })


}

render() {
const { value } = this.state;
return (
<div>
<div>
<AppBar position="fixed" color="default" id="appBar">
<Tabs scrollButtons="on" variant="standard" indicatorColor="primary" centered textColor="primary"
value={value}
Expand All @@ -177,6 +186,7 @@ class CreateERC extends Component {
metadata={this.state.metadata}
setMetadata={this.setMetadata}
goToErc={this.goToErc}
goToPreview={this.goToPreview}
originalMetadata={this.state.originalMetadata}
authors={this.state.authors}
authorsChanged={this.state.authorsChanged}
Expand All @@ -196,6 +206,7 @@ class CreateERC extends Component {
<TabContainer>
{ <SpatioTemporalMetadata
goToErc={this.goToErc}
goToPreview={this.goToPreview}
metadata={this.state.metadata}
setMetadata={this.setMetadata}
originalMetadata={JSON.parse(JSON.stringify(this.state.originalMetadata))}
Expand All @@ -217,6 +228,7 @@ class CreateERC extends Component {
setChangedFalse={this.setChangedFalse}
originalMetadata={this.state.originalMetadata}
goToErc={this.goToErc}
goToPreview={this.goToPreview}
candidate={this.state.candidate}
/>
</TabContainer>
Expand All @@ -243,4 +255,4 @@ class CreateERC extends Component {
}
}

export default CreateERC;
export default CreateERC;
32 changes: 22 additions & 10 deletions ui/src/components/createERC/bindings/Bindings.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,8 @@ function VerticalLinearStepper(props) {

const goToErc = () => props.goToErc();

const goToPreview = () => props.goToPreview();

return (
<div className={classes.root}>
<Stepper activeStep={activeStep} orientation="vertical">
Expand Down Expand Up @@ -281,9 +283,14 @@ function VerticalLinearStepper(props) {
<Button onClick={saveErc} disabled = {!valid2} className={classes.button} variant="contained" color="primary">
Publish
</Button>
<Button onClick={goToErc} disabled = {props.candidate} className={classes.button} variant="contained" color="primary">
Go to ERC
</Button>
{props.candidate
? <Button onClick={goToPreview} className={classes.button} variant="contained">
Preview
</Button>
: <Button onClick={goToErc} disabled = {props.candidate} className={classes.button} variant="contained" color="primary">
Go to ERC
</Button>
}
</Paper>
)}
</div>
Expand Down Expand Up @@ -473,7 +480,7 @@ class Bindings extends Component {
}

analyzeIfConditions = (analyzedCode, codelines) => {

for (var codeItem of analyzedCode) {
if (codeItem.type === "if" || codeItem.type === "while" ) {
if(codeItem.code[0].func && codeItem.code[0].func.id ==="install.packages"){
Expand Down Expand Up @@ -531,8 +538,8 @@ class Bindings extends Component {
/*handleMouseUp ( e ) {
if (this.state.creationStep === 1) {
try {
this.setCode(window.getSelection().getRangeAt(0).toString());
} catch (error) {
this.setCode(window.getSelection().getRangeAt(0).toString());
} catch (error) {
}
} else if (this.state.creationStep === 2) {
this.setState({
Expand Down Expand Up @@ -628,13 +635,17 @@ class Bindings extends Component {
saveErc = () => {
this.props.setChangedFalse("all")
this.props.updateMetadata(this.props.metadata, true)

}

goToErc= () => {
this.props.goToErc();
}


goToPreview= () => {
this.props.goToPreview();
}

clearBinding() {
let state = this.state;
//state.codeview=true;
Expand Down Expand Up @@ -681,6 +692,7 @@ class Bindings extends Component {
saveBinding={this.saveBinding.bind(this)}
saveErc={this.saveErc.bind(this)}
goToErc={this.goToErc.bind(this)}
goToPreview={this.goToPreview.bind(this)}
candidate={this.props.candidate}
clearBinding={this.clearBinding.bind(this)}
figures={this.state.figures}
Expand Down Expand Up @@ -729,7 +741,7 @@ class Bindings extends Component {
<Button onClick={this.handleClose} color="primary">
Go Back
</Button>
<Button onClick={window.location.href="mailto:[email protected]?subject=CreateBinding"} color="primary" autoFocus>
<Button onClick={() => window.location.href="mailto:[email protected]?subject=CreateBinding"} color="primary" autoFocus>
Contact
</Button>
</DialogActions>
Expand Down Expand Up @@ -809,4 +821,4 @@ export default Bindings;
}
}
}
*/
*/
21 changes: 15 additions & 6 deletions ui/src/components/createERC/requiredMetadata/Form.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ export const Form = props => {


const goToErc = () => props.goToERC();
const goToPreview = () => props.goToPreview();


const setMostRestrictive = () => {
Expand Down Expand Up @@ -334,12 +335,20 @@ export const Form = props => {
>
Publish
</Button>
<Button
type="button"
onClick={goToErc}
disabled={props.candidate}>
Go To ERC
{props.candidate
? <Button
type="button"
onClick={goToPreview}>
Preview
</Button>
: <Button
type="button"
color="primary"
onClick={goToErc}
disabled={props.candidate}>
Go To ERC
</Button>
}
</Paper>
<div id={"errorMessage"}>
{errors.title ? errors.title : ""}
Expand Down Expand Up @@ -367,4 +376,4 @@ export const Form = props => {

</form>
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ class RequiredMetadata extends Component {
codeLicense: this.props.originalMetadata.license.code,

}

componentDidMount() {
prepareLicense();
refs2 = refs.splice(refs.length - this.props.authors.length, refs.length)
Expand Down Expand Up @@ -179,6 +179,7 @@ class RequiredMetadata extends Component {
setFormValues={this.setFormValues}
resetAuthors={refs2}
goToERC={this.props.goToErc}
goToPreview={this.props.goToPreview}
spatioTemporalChanged={this.props.spatioTemporalChanged}
authorsChanged={this.props.authorsChanged}
changed={this.props.changed}
Expand All @@ -190,7 +191,7 @@ class RequiredMetadata extends Component {
dataLicenses={dataLicenses}
mostRestrictiveData={mostRestrictiveData}
leastRestrictiveData={leastRestrictiveData}
candidate={this.props.candidate}
candidate={this.props.candidate}
showProgress={this.props.showProgress} />}
initialValues={this.formValues}
validationSchema={validationSchema}
Expand Down
Loading