Skip to content

Commit

Permalink
fix: dashboard margins
Browse files Browse the repository at this point in the history
  • Loading branch information
lideming committed Nov 27, 2023
1 parent 12bba64 commit 742f6bc
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 10 deletions.
1 change: 0 additions & 1 deletion neetbox/frontend/.gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
Expand Down
6 changes: 4 additions & 2 deletions neetbox/frontend/src/components/dashboard/project/actions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export function Actions({ actions }: Props) {
const [blocking, setBlocking] = useState(false);
const actionList = Object.entries(actions?.value ?? {});
return (
<Space>
<Space style={{ marginBottom: "20px" }}>
{actionList.length ? (
actionList.map(([actionName, actionOptions]) => (
<ActionItem
Expand Down Expand Up @@ -68,7 +68,7 @@ export function ActionItem({
};
const renderContent = () => (
<div style={{ padding: "10px", maxWidth: "400px" }}>
<Space vertical spacing={"tight"}>
<Space vertical spacing={"medium"}>
<Typography.Title heading={5}>{name}</Typography.Title>
{options.description && (
<div style={{ margin: 0, whiteSpace: "pre-wrap" }}>
Expand Down Expand Up @@ -101,6 +101,8 @@ export function ActionItem({
<Button
style={{ width: "100px" }}
onClick={handleRun}
type="warning"
theme="solid"
disabled={blocking}
>
Run
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ export const Logs = React.memo(({ projectName }: Props) => {
});

const LogItems = ({ logs }: { logs: LogData[] }) => {
console.info("logitems render logs count", logs.length);
return logs.map((x) => <LogItem key={x._id} data={x} />);
};

Expand Down
15 changes: 15 additions & 0 deletions neetbox/frontend/src/components/sectionTitle.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { Typography } from "@douyinfe/semi-ui";

interface Props {
title: string;
}

export function SectionTitle(props: Props) {
return (
<div>
<Typography.Title heading={3} style={{ margin: "20px 0" }}>
{props.title}
</Typography.Title>
</div>
);
}
16 changes: 10 additions & 6 deletions neetbox/frontend/src/pages/console/proejctDashboard.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { useParams } from "react-router-dom";
import { createContext, useMemo } from "react";
import { Typography } from "@douyinfe/semi-ui";
import { Divider, Typography } from "@douyinfe/semi-ui";
import PlatformProps from "../../components/dashboard/project/platformProps";
import { useProjectStatus } from "../../services/projects";
import { Logs } from "../../components/dashboard/project/logs/logs";
import { Actions } from "../../components/dashboard/project/actions";
import Loading from "../../components/loading";
import { Hardware } from "../../components/dashboard/project/hardware";
import { SectionTitle } from "../../components/sectionTitle";

export const ProjectContext = createContext<{ projectName: string } | null>(
null,
Expand All @@ -33,19 +34,22 @@ function ProjectDashboard() {

return (
<ProjectContext.Provider value={projectContextData}>
<div style={{ padding: "10px" }}>
<div style={{ padding: "20px" }}>
<Typography.Title heading={2} style={{ textAlign: "center" }}>
Project "{projectName}"
</Typography.Title>
<Typography.Title heading={3}>Logs</Typography.Title>
<SectionTitle title="Logs" />
<Logs projectName={projectName} />
<Divider />
{data.current ? (
<>
<Typography.Title heading={3}>Actions</Typography.Title>
<SectionTitle title="Actions" />
<Actions actions={data.current.__action} />
<Typography.Title heading={3}>Hardware</Typography.Title>
<Divider />
<SectionTitle title="Hardware" />
<Hardware hardwareData={data.history.map((x) => x.hardware)} />
<Typography.Title heading={3}>Platform</Typography.Title>
<Divider />
<SectionTitle title="Platform" />
<PlatformProps data={data.current.platform} />
</>
) : (
Expand Down

0 comments on commit 742f6bc

Please sign in to comment.