-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
336 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { parsingRoute } from "@/helpers/route"; | ||
import { Routes } from "@/routes/routes"; | ||
|
||
export const Breadcrumbs = { | ||
Dashboard: () => [{ label: "Dashboard", href: Routes.Dashboard }], | ||
VariableInput: { | ||
Index: () => [ | ||
{ label: "Variable Input", href: Routes.VariableInputIndex }, | ||
], | ||
Create: () => [ | ||
{ label: "Variable Input", href: Routes.VariableInputIndex }, | ||
{ | ||
label: "Create Variable Input", | ||
href: Routes.VariableInputCreate, | ||
}, | ||
], | ||
Edit: (id: string) => [ | ||
{ label: "Variable Input", href: Routes.VariableInputIndex }, | ||
{ | ||
label: "Edit Variable Input", | ||
href: parsingRoute(Routes.VariableInputEdit, { id }), | ||
}, | ||
], | ||
}, | ||
VariableOutput: { | ||
Index: () => [ | ||
{ label: "Variable Output", href: Routes.VariableOutputIndex }, | ||
], | ||
}, | ||
Result: { | ||
Index: () => [{ label: "Result Predict", href: Routes.ResultIndex }], | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { ButtonProps, Button as ButtonAntd } from "antd"; | ||
import React from "react"; | ||
import { Link } from "react-router-dom"; | ||
|
||
interface IProps extends ButtonProps {} | ||
|
||
const Button: React.FC<IProps> = (props) => { | ||
const btn = <ButtonAntd {...props}>{props.children}</ButtonAntd>; | ||
return props.href ? <Link to={props.href}>{btn}</Link> : btn; | ||
}; | ||
|
||
export default Button; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { Row, Spin } from "antd"; | ||
import React from "react"; | ||
|
||
const LoaderCenter: React.FC = () => { | ||
return ( | ||
<Row justify="center"> | ||
<Spin size="large"></Spin> | ||
</Row> | ||
); | ||
}; | ||
|
||
export default LoaderCenter; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import { Space } from "antd"; | ||
import React from "react"; | ||
import Button from "../Button/Button"; | ||
import { DeleteOutlined, EditOutlined, EyeOutlined } from "@ant-design/icons"; | ||
|
||
interface IButtonAction { | ||
type: "detail" | "edit" | "delete" | "custom"; | ||
href?: string; | ||
button?: React.ReactNode; | ||
onClick?: () => void; | ||
} | ||
|
||
interface IProps { | ||
actions: IButtonAction[]; | ||
} | ||
|
||
const RowActionButtons: React.FC<IProps> = ({ actions }) => { | ||
const renderButtonAction = (action: IButtonAction) => { | ||
switch (action.type) { | ||
case "detail": | ||
return ( | ||
action.button ?? ( | ||
<Button | ||
icon={<EyeOutlined />} | ||
href={action.href} | ||
></Button> | ||
) | ||
); | ||
case "edit": | ||
return ( | ||
action.button ?? ( | ||
<Button | ||
icon={<EditOutlined />} | ||
href={action.href} | ||
></Button> | ||
) | ||
); | ||
case "delete": | ||
return ( | ||
action.button ?? ( | ||
<Button | ||
icon={<DeleteOutlined />} | ||
onClick={action.onClick} | ||
></Button> | ||
) | ||
); | ||
case "custom": | ||
return action.button; | ||
default: | ||
return <React.Fragment></React.Fragment>; | ||
} | ||
}; | ||
return <Space>{actions.map((action) => renderButtonAction(action))}</Space>; | ||
}; | ||
|
||
export default RowActionButtons; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { ColumnGroupType, ColumnType } from "antd/es/table"; | ||
|
||
export const numberColumns = <T>(): ColumnGroupType<T> | ColumnType<T> => { | ||
return { | ||
title: "No", | ||
render: (_, __, index) => index + 1, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { IBaseEntity } from "../base"; | ||
|
||
export interface IVariableInput extends IBaseEntity { | ||
id: number; | ||
name: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { IVariableInput } from "@/interfaces/entities/VariableInput"; | ||
import { IBaseResponse } from "../base"; | ||
|
||
export interface IVariableInputIndexResponse | ||
extends IBaseResponse<IVariableInput[]> {} | ||
|
||
export interface IVariableInputDetailResponse | ||
extends IBaseResponse<IVariableInput> {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { Breadcrumbs } from "@/common/breadcrumb"; | ||
import MainLayout from "@/layouts/MainLayout"; | ||
import { Card } from "antd"; | ||
import React from "react"; | ||
import { useParams } from "react-router-dom"; | ||
|
||
interface IProps { | ||
editPage?: boolean; | ||
} | ||
|
||
const VariableInputForm: React.FC<IProps> = ({ editPage = false }) => { | ||
const { id } = useParams(); | ||
return ( | ||
<MainLayout | ||
title="Variable Input" | ||
breadcrumbs={ | ||
editPage | ||
? Breadcrumbs.VariableInput.Edit(id) | ||
: Breadcrumbs.VariableInput.Create() | ||
} | ||
> | ||
<Card></Card> | ||
</MainLayout> | ||
); | ||
}; | ||
|
||
export default VariableInputForm; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.