Skip to content

Commit

Permalink
Remove workflow slide panel, use modal (#233)
Browse files Browse the repository at this point in the history
  • Loading branch information
jedirandy authored Feb 20, 2018
1 parent a161387 commit 3e8c2ba
Show file tree
Hide file tree
Showing 5 changed files with 110 additions and 175 deletions.
3 changes: 2 additions & 1 deletion core/src/main/javascript/ApplicationState.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ export type Page =
| { id: "" }
| {
id: "workflow",
jobId?: string
jobId?: string,
showDetail: boolean
}
| {
id: "executions/started",
Expand Down
7 changes: 5 additions & 2 deletions core/src/main/javascript/app/components/Link.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ type Props = {
className: string,
children: any,
open: (href: string) => void,
replace: boolean
replace: boolean,
title: string
};

const Link = ({
Expand All @@ -21,13 +22,15 @@ const Link = ({
className,
children,
open,
replace = false
replace = false,
title = ""
}: Props) => {
return (
<a
onClick={open(href, replace)}
href={href}
className={classNames(classes.link, className)}
title={title}
>
{children}
</a>
Expand Down
96 changes: 0 additions & 96 deletions core/src/main/javascript/app/components/SlidePanel.js

This file was deleted.

174 changes: 100 additions & 74 deletions core/src/main/javascript/app/pages/Workflow.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,20 @@ import reduce from "lodash/reduce";
import some from "lodash/some";

import type { Edge, Node } from "../../graph/dagger/dataAPI/genericGraph";
import type { Dependency, Job, Tag, Workflow } from "../../datamodel";
import type { Dependency, Job, Workflow } from "../../datamodel";

import Select from "react-select";
import { navigate } from "redux-url";
import { connect } from "react-redux";
import { markdown } from "markdown";

import TagIcon from "react-icons/lib/md/label";
import MdList from "react-icons/lib/md/list";
import Dagger from "../../graph/Dagger";
import SlidePanel from "../components/SlidePanel";
import Window from "../components/Window";
import FancyTable from "../components/FancyTable";
import Spinner from "../components/Spinner";
import Link from "../components/Link";

import moment from "moment";
import PopoverMenu from "../components/PopoverMenu";
Expand All @@ -39,7 +41,8 @@ type Props = {
workflow: Workflow,
selectedJobs: string[],
job: string,
navTo: () => void
navTo: () => void,
showDetail: boolean
};

type State = {
Expand Down Expand Up @@ -250,7 +253,8 @@ class WorkflowComponent extends React.Component {
workflow = {},
job,
selectedJobs = [],
navTo
navTo,
showDetail
} = this.props;

const filteredJobs = filter(workflow.jobs, j =>
Expand Down Expand Up @@ -305,7 +309,7 @@ class WorkflowComponent extends React.Component {
const charts = (data: any) => {
if (data) {
return (
<div>
<div className={classes.charts}>
<div className={classes.chartSection}>
<h3>Average run/wait times over last 30 days</h3>
<AverageRunWaitChart
Expand Down Expand Up @@ -382,66 +386,74 @@ class WorkflowComponent extends React.Component {
startNodeId={startNode.id}
onClickNode={id => navTo("/workflow/" + id)}
/>
<Select
className={classes.jobSelector}
name="jobSelector"
options={map(nodes, n => ({ value: n.id, label: n.name }))}
onChange={o => navTo("/workflow/" + o.value)}
/>
<SlidePanel open={false}>
<div className={classes.jobCard}>
<JobMenu job={startNode.id} />
<FancyTable>
<dt key="id">Id:</dt>
<dd key="id_">
{startNode.id}
</dd>
<dt key="name">Name:</dt>
<dd key="name_">
{startNode.name}
</dd>
{renderTimeSeriesSechduling()}
{startNode.tags.length > 0 && [
<dt key="tags">Tags:</dt>,
<dd key="tags_" className={classes.tags}>
{map(startNode.tags, t => [
<span
key={tagsDictionnary[t].name}
className={classes.tag}
data-for={"tag" + tagsDictionnary[t].name}
data-tip={tagsDictionnary[t].description}
>
<TagIcon className="tagIcon" />
{tagsDictionnary[t].name}
</span>,
<ReactTooltip
id={"tag" + tagsDictionnary[t].name}
effect="float"
/>
])}
</dd>
]}
{startNode.description && [
<dt key="description">Description:</dt>,
<dd
key="description_"
className={classes.description}
dangerouslySetInnerHTML={{
__html: markdown.toHTML(startNode.description)
}}
/>
]}
{this.state.jobColors &&
this.state.jobColors[startNode.id] && [
<dt key="status">Status:</dt>,
<dd key="status_">
<Status status="paused" />
</dd>
]}
</FancyTable>
</div>
{charts(this.state.data)}
</SlidePanel>
<div className={classes.controller}>
<Select
className={classes.jobSelector}
name="jobSelector"
options={map(nodes, n => ({ value: n.id, label: n.name }))}
onChange={o => navTo("/workflow/" + o.value)}
value={startNode.id}
clearable={false}
/>
<Link
className={classes.detailIcon}
title="Job details"
href={`/workflow/${startNode.id}?showDetail=true`}
>
<MdList />
</Link>
</div>
{showDetail &&
<Window closeUrl={`/workflow/${job}`} title="Job details">
<div className={classes.jobCard}>
<JobMenu job={startNode.id} />
<FancyTable>
<dt key="id">Id:</dt>
<dd key="id_">{startNode.id}</dd>
<dt key="name">Name:</dt>
<dd key="name_">{startNode.name}</dd>
{renderTimeSeriesSechduling()}
{startNode.tags.length > 0 && [
<dt key="tags">Tags:</dt>,
<dd key="tags_" className={classes.tags}>
{map(startNode.tags, t => [
<span
key={tagsDictionnary[t].name}
className={classes.tag}
data-for={"tag" + tagsDictionnary[t].name}
data-tip={tagsDictionnary[t].description}
>
<TagIcon className="tagIcon" />
{tagsDictionnary[t].name}
</span>,
<ReactTooltip
id={"tag" + tagsDictionnary[t].name}
effect="float"
/>
])}
</dd>
]}
{startNode.description && [
<dt key="description">Description:</dt>,
<dd
key="description_"
className={classes.description}
dangerouslySetInnerHTML={{
__html: markdown.toHTML(startNode.description)
}}
/>
]}
{this.state.jobColors &&
this.state.jobColors[startNode.id] && [
<dt key="status">Status:</dt>,
<dd key="status_">
<Status status="paused" />
</dd>
]}
</FancyTable>
</div>
{charts(this.state.data)}
</Window>}
</div>
);
}
Expand All @@ -455,6 +467,12 @@ const styles = {
height: "calc(100vh - 4em)",
position: "relative"
},
charts: {
overflow: "auto",
display: "flex",
flexWrap: "wrap",
justifyContent: "space-around"
},
chartSection: {
"& > .chart": {
marginLeft: "50px",
Expand Down Expand Up @@ -487,11 +505,20 @@ const styles = {
textAlign: "justify !important",
overflowY: "scroll"
},
jobSelector: {
controller: {
position: "absolute",
top: "2em",
left: "50%",
marginLeft: "-300px",
display: "flex",
justifyContent: "center",
width: "100%"
},
detailIcon: {
fontSize: "30px",
color: "#607e96",
marginLeft: ".25em",
cursor: "pointer"
},
jobSelector: {
width: "600px",
"& .Select-control": {
height: "1em",
Expand Down Expand Up @@ -527,9 +554,8 @@ const styles = {
}
};

export default connect(
() => ({}),
dispatch => ({
navTo: link => dispatch(navigate(link))
})
)(injectSheet(styles)(WorkflowComponent));
const mapStateToProps = ({ app: { page: { showDetail } } }) => ({ showDetail });

export default connect(mapStateToProps, dispatch => ({
navTo: link => dispatch(navigate(link))
}))(injectSheet(styles)(WorkflowComponent));
5 changes: 3 additions & 2 deletions core/src/main/javascript/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@ const routes = {
openPage({ id: "executions/paused", page, sort, order }),
"/executions/:id": ({ id }) =>
openPage({ id: "executions/detail", execution: id }),
"/workflow/*": ({ _ }) => openPage({ id: "workflow", jobId: _ }),
"/workflow": () => openPage({ id: "workflow" }),
"/workflow/*": ({ _ }, { showDetail }) =>
openPage({ id: "workflow", jobId: _, showDetail: Boolean(showDetail) }),
"/workflow": () => openPage({ id: "workflow", showDetail: false }),
"/timeseries/calendar": () => openPage({ id: "timeseries/calendar" }),
"/timeseries/calendar/:start_:end": ({ start, end }) =>
openPage({ id: "timeseries/calendar/focus", start, end }),
Expand Down

0 comments on commit 3e8c2ba

Please sign in to comment.