Skip to content

Commit

Permalink
src: introducing func comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Sinclert committed Jul 31, 2018
1 parent 649f036 commit 7ae33ef
Show file tree
Hide file tree
Showing 10 changed files with 152 additions and 182 deletions.
2 changes: 1 addition & 1 deletion reana-ui/public/index.html
Expand Up @@ -19,7 +19,7 @@
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>React App</title>
<title>REANA</title>
</head>
<body>
<noscript>
Expand Down
4 changes: 2 additions & 2 deletions reana-ui/public/manifest.json
@@ -1,6 +1,6 @@
{
"short_name": "Reana-UI",
"name": "Reana-UI",
"short_name": "REANA",
"name": "REANA",
"icons": [
{
"src": "favicon.ico",
Expand Down
21 changes: 9 additions & 12 deletions reana-ui/src/App.js
Expand Up @@ -21,18 +21,15 @@
submit itself to any jurisdiction.
*/


import React, { Component } from 'react';
import WorkflowsPage from './pages/Workflows'

import React, { Component } from "react";
import WorkflowsPage from "./pages/Workflows";

export default class App extends Component {

render() {
return (
<div className="App" style={{height: '100%'}}>
<WorkflowsPage />
</div>
);
}
render() {
return (
<div className="App" style={{ height: "100%" }}>
<WorkflowsPage />
</div>
);
}
}
57 changes: 24 additions & 33 deletions reana-ui/src/components/Header.js
Expand Up @@ -21,39 +21,30 @@
submit itself to any jurisdiction.
*/


import React, { Component } from 'react';
import { Segment, Image, Button, Menu, Icon } from 'semantic-ui-react'
import LogoImg from '../images/logo.svg';

import React, { Component } from "react";
import { Segment, Image, Button, Menu, Icon } from "semantic-ui-react";
import LogoImg from "../images/logo.svg";

export default class Header extends Component {

render() {
return (
<Segment
secondary
clearing
attached='top'
padded='big'
>
<Image
src={LogoImg}
size='medium'
floated='left'
/>
<Button size='huge' icon primary floated='right'>
<Icon name='user'/>
</Button>
<Menu size='huge' floated='right'>
<Menu.Item href='http://www.reana.io' target='_blank'>
About
</Menu.Item>
<Menu.Item href='https://reana.readthedocs.io/en/latest/' target='_blank'>
Documentation
</Menu.Item>
</Menu>
</Segment>
)
}
render() {
return (
<Segment secondary clearing attached="top" padded="big">
<Image src={LogoImg} size="medium" floated="left" />
<Button size="huge" icon primary floated="right">
<Icon name="user" />
</Button>
<Menu size="huge" floated="right">
<Menu.Item href="http://www.reana.io" target="_blank">
About
</Menu.Item>
<Menu.Item
href="https://reana.readthedocs.io/en/latest/"
target="_blank"
>
Documentation
</Menu.Item>
</Menu>
</Segment>
);
}
}
1 change: 0 additions & 1 deletion reana-ui/src/components/Table.js
Expand Up @@ -31,7 +31,6 @@ const URL = "http://reana-dev.cern.ch/api/workflows?";
const TOKEN = "<ACCESS_TOKEN>";
const POOLING_PERIOD = 5;


export default class SortTable extends Component {

/**
Expand Down
99 changes: 47 additions & 52 deletions reana-ui/src/components/TableActions.js
Expand Up @@ -21,57 +21,52 @@
submit itself to any jurisdiction.
*/


import React, { Component } from 'react';
import { Button } from 'semantic-ui-react'

import React, { Component } from "react";
import { Button } from "semantic-ui-react";

export default class TableActions extends Component {

static disableView() {
return false;
}

static disablePause() {
return true;
}

static disableResume(status) {
return status !== 'created';
}

static disableRunnable(status) {
return status === 'created' || status === 'running';
}


render() {

return(
<Button.Group basic icon size='tiny' color='blue' widths='4'>
<Button
disabled={TableActions.disableView()}
icon='eye'
content=' View'
compact
/>
<Button
disabled={TableActions.disablePause()}
icon='pause'
content=' Pause'
compact
/>
<Button
disabled={TableActions.disableResume(this.props.status)}
icon='play'
content=' Resume'
/>
<Button
disabled={TableActions.disableRunnable(this.props.status)}
icon='refresh'
content=' Rerun'
/>
</Button.Group>
)
}
}
static disableView() {
return false;
}

static disablePause() {
return true;
}

static disableResume(status) {
return status !== "created";
}

static disableRunnable(status) {
return status === "created" || status === "running";
}

render() {
return (
<Button.Group basic icon size="tiny" color="blue" widths="4">
<Button
disabled={TableActions.disableView()}
icon="eye"
content=" View"
compact
/>
<Button
disabled={TableActions.disablePause()}
icon="pause"
content=" Pause"
compact
/>
<Button
disabled={TableActions.disableResume(this.props.status)}
icon="play"
content=" Resume"
/>
<Button
disabled={TableActions.disableRunnable(this.props.status)}
icon="refresh"
content=" Rerun"
/>
</Button.Group>
);
}
}
85 changes: 39 additions & 46 deletions reana-ui/src/components/TableProgress.js
Expand Up @@ -21,51 +21,44 @@
submit itself to any jurisdiction.
*/


import React, { Component } from 'react';
import { Progress } from 'semantic-ui-react'

import React, { Component } from "react";
import { Progress } from "semantic-ui-react";

export default class TableProgress extends Component {


static handleActive(status) {
return status === 'running';
}


static handleColor(status) {
if (status === 'created') {
return 'grey';
}
if (status === 'running') {
return 'blue';
}
else if (status === 'finished') {
return 'green';
}
else if (status === 'failed') {
return 'red';
}
}


static handlePercentage(completedSteps, totalSteps) {
return Math.floor(completedSteps * 100 / totalSteps);
}


render() {

return(
<Progress
size = 'small'
percent = {TableProgress.handlePercentage(this.props.completed, this.props.total)}
color = {TableProgress.handleColor(this.props.status)}
active = {TableProgress.handleActive(this.props.status)}
>
{this.props.completed} / {this.props.total}
</Progress>
)
}
}
static handleActive(status) {
return status === "running";
}

static handleColor(status) {
if (status === "created") {
return "grey";
}
if (status === "running") {
return "blue";
} else if (status === "finished") {
return "green";
} else if (status === "failed") {
return "red";
}
}

static handlePercentage(completedSteps, totalSteps) {
return Math.floor((completedSteps * 100) / totalSteps);
}

render() {
return (
<Progress
size="small"
percent={TableProgress.handlePercentage(
this.props.completed,
this.props.total
)}
color={TableProgress.handleColor(this.props.status)}
active={TableProgress.handleActive(this.props.status)}
>
{this.props.completed} / {this.props.total}
</Progress>
);
}
}
14 changes: 6 additions & 8 deletions reana-ui/src/index.js
Expand Up @@ -21,13 +21,11 @@
submit itself to any jurisdiction.
*/

import React from "react";
import ReactDOM from "react-dom";
import App from "./App";
import registerServiceWorker from "./registerServiceWorker";
import "semantic-ui-css/semantic.min.css";

import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';
import registerServiceWorker from './registerServiceWorker';
import 'semantic-ui-css/semantic.min.css';


ReactDOM.render(<App />, document.getElementById('root'));
ReactDOM.render(<App />, document.getElementById("root"));
registerServiceWorker();
25 changes: 11 additions & 14 deletions reana-ui/src/pages/Workflows.js
Expand Up @@ -21,20 +21,17 @@
submit itself to any jurisdiction.
*/


import React, { Component } from 'react';
import Header from '../components/Header'
import Table from '../components/Table'

import React, { Component } from "react";
import Header from "../components/Header";
import Table from "../components/Table";

export default class WorkflowsPage extends Component {

render() {
return (
<div>
<Header/>
<Table/>
</div>
);
}
render() {
return (
<div>
<Header />
<Table />
</div>
);
}
}

0 comments on commit 7ae33ef

Please sign in to comment.