Skip to content

Commit

Permalink
[dashboard] Small visual improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
spirali committed Aug 28, 2018
1 parent fbbc9f6 commit 48fb84a
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 11 deletions.
4 changes: 2 additions & 2 deletions dashboard/src/components/Session.tsx
Expand Up @@ -4,7 +4,7 @@ import { parseDate } from "../utils/date";
import { fetchEvents } from "../utils/fetch";
import Error from "./Error";
import { SessionBar } from "./SessionBar";
import { niceTime, StatusBadge } from "./utils";
import { niceTime, SessionStatusBadge } from "./utils";

interface Props {
id: string;
Expand Down Expand Up @@ -118,7 +118,7 @@ class Session extends Component<Props, State> {
<tr>
<td>Status</td>
<td>
<StatusBadge status={session.status} />
<SessionStatusBadge status={session.status} />
<p className="text-left text-monospace">
{session.message}
</p>
Expand Down
4 changes: 2 additions & 2 deletions dashboard/src/components/Sessions.tsx
Expand Up @@ -5,7 +5,7 @@ import { EventWrapper, SessionSpec } from "../lib/event";
import { parseDate } from "../utils/date";
import { fetchEvents } from "../utils/fetch";
import Error from "./Error";
import { niceTime, StatusBadge } from "./utils";
import { niceTime, SessionStatusBadge } from "./utils";

interface Session {
id: string;
Expand Down Expand Up @@ -118,7 +118,7 @@ class Sessions extends Component<{}, State> {
<Link to={"session/" + s.id}>{s.spec.name}</Link>
</td>
<td>
<StatusBadge status={s.status} />
<SessionStatusBadge status={s.status} />
</td>
<td>{s.client}</td>
<td>{s.created}</td>
Expand Down
8 changes: 5 additions & 3 deletions dashboard/src/components/TaskList.tsx
Expand Up @@ -6,7 +6,7 @@ import Error from "./Error";
import { FaCaretDown, FaCaretRight } from "react-icons/fa";
import { parseDate } from "../utils/date";
import { SessionBar } from "./SessionBar";
import { niceTime } from "./utils";
import { niceTime, TaskStatusBadge } from "./utils";

const bgColors = ["white", "#EEE", "#D2D2D2"];

Expand Down Expand Up @@ -117,10 +117,12 @@ const TaskRow = (props: {
onClick={toggle}
>
{node.open ? <FaCaretDown /> : <FaCaretRight />}
Task {node.name} {node.spec && node.spec.id[1]}
Task {node.spec && node.spec.id[1]} {node.name}
</span>
</td>
<td>{node.status}</td>
<td>
<TaskStatusBadge status={node.status} />
</td>
<td>{duration && niceTime(duration)}</td>
{duration ? (
<td
Expand Down
13 changes: 12 additions & 1 deletion dashboard/src/components/utils.tsx
Expand Up @@ -4,7 +4,7 @@ interface Props {
status: string;
}

export const StatusBadge = (props: Props) => {
export const SessionStatusBadge = (props: Props) => {
const style: { color?: string } = {};
if (props.status === "Open") {
style.color = "green";
Expand All @@ -18,6 +18,17 @@ export const StatusBadge = (props: Props) => {
return <span style={style}>{props.status}</span>;
};

export const TaskStatusBadge = (props: Props) => {
const style: { color?: string } = {};
if (props.status === "running") {
style.color = "green";
}
if (props.status === "error") {
style.color = "red";
}
return <span style={style}>{props.status}</span>;
};

export function niceTime(s: number) {
if (s < 0.5) {
return (s * 1000).toFixed(0) + "ms";
Expand Down
4 changes: 2 additions & 2 deletions dashboard/src/utils/fetch.ts
Expand Up @@ -3,8 +3,8 @@ import { EventWrapper } from "../lib/event";
let SERVER_URL = "/";

if (window.location.href.startsWith("http://localhost:3000")) {
console.log("DEV mode detected, connecting to http://localhost:8080/");
SERVER_URL = "http://localhost:8080/";
console.log("DEV mode detected, connecting to http://localhost:7222/");
SERVER_URL = "http://localhost:7222/";
}

export function fetchFromServer(
Expand Down
2 changes: 1 addition & 1 deletion docs/guide/install.rst
Expand Up @@ -209,7 +209,7 @@ ready and terminates.
Set listening address of server. Default is 0.0.0.0:7210.

**--http-listen=(PORT|ADDRESS|ADDRESS:PORT)**
Set listening address of server for HTTP (dashboard). Default is 0.0.0.0:8080.
Set listening address of server for HTTP (dashboard). Default is 0.0.0.0:7222.

**--runprefix**
Set a command before rain programs. It is designed to used to run
Expand Down

0 comments on commit 48fb84a

Please sign in to comment.