Skip to content

Commit

Permalink
[refactoring] #30
Browse files Browse the repository at this point in the history
  • Loading branch information
yoneyan committed Jul 9, 2021
1 parent d4f8e81 commit 27d17dd
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 53 deletions.
3 changes: 2 additions & 1 deletion src/components/Dashboard/Group/Memo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -195,12 +195,13 @@ export function StatusTable(props: {
{
(
rowsPerPage > 0 ? group.slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage) : group
).map((row,index) => (
).map((row, index) => (
<TableRow key={"group_memo_detail_" + index}>
<TableCell style={{width: 700}} component="th" scope="row">
{
row.memos?.filter(memo => memo.type === 1).map(memo => (
<Chip
key={"memo_" + memo.ID}
label={memo.title}
className={classes.right}
clickable
Expand Down
8 changes: 4 additions & 4 deletions src/components/Dashboard/Service/Service.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -194,28 +194,28 @@ export function StatusTable(props: {
{
!row.pass &&
<ExaminationDialog
key={"service_examination_dialog_" + row.ID}
key={"service_examination_dialog_" + index}
id={row.ID}
service={row}
reload={setReload}
/>
}
&nbsp;
<ServiceGetDialogs
key={row.ID + "_service_get_dialog"}
key={"service_get_dialog_"+index}
service={row}
reload={setReload}
template={template}
/>
&nbsp;
<DeleteDialog
key={"service_delete_alert_dialog_" + row.ID}
key={"service_delete_dialog_" + index}
id={row.ID}
reload={setReload}
/>
&nbsp;
<EnableDialog
key={"service_enable_alert_dialog_" + row.ID}
key={"service_enable_dialog_" + row.ID}
service={row}
reload={setReload}
/>
Expand Down
16 changes: 12 additions & 4 deletions src/pages/Connection/ConnectionDetail/ConnectionDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,20 @@ export default function ConnectionGetDialogs(props: {
<ConnectionEtc key={"connectionETC"} connection={connection}/>
</Grid>
<Grid item xs={6}>
<ConnectionOpen key={"connection_open"} connection={connection} service={service}
template={template} setReload={reload}/>
<ConnectionOpen
key={"connection_open"}
connection={connection}
service={service}
template={template}
setReload={reload}
/>
</Grid>
<Grid item xs={6}>
<ConnectionUserDisplay key={"connection_user_display"} service={service}
connection={connection}/>
<ConnectionUserDisplay
key={"connection_user_display"}
service={service}
connection={connection}
/>
</Grid>
</Grid>
</DialogContent>
Expand Down
20 changes: 8 additions & 12 deletions src/pages/Group/GroupDetail/Connection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -228,32 +228,28 @@ export function EnableDialog(props: {
<div>
<Button size="small" variant="outlined" onClick={handleClickOpen}>
{
connection.enable &&
<div>Disable</div>
connection.enable && "Disable"
}
{
!connection.enable &&
<div>Enable</div>
!connection.enable && "Enable"
}
</Button>
<Dialog
open={open}
TransitionComponent={Transition}
keepMounted
onClose={handleClose}
aria-labelledby="alert-dialog-slide-title"
aria-describedby="alert-dialog-slide-description"
aria-labelledby="connection-enable-dialog-title"
aria-describedby="connection-enable-dialog-description"
>
<DialogTitle id="alert-dialog-slide-title">Enable</DialogTitle>
<DialogTitle id="connection-enable-dialog-title">Enable</DialogTitle>
<DialogContent>
<DialogContentText id="alert-dialog-slide-description">
<DialogContentText id="connection-enable-dialog-description">
{
connection.enable &&
<div>有効から無効に変更します。</div>
connection.enable && "有効から無効に変更します。"
}
{
!connection.enable &&
<div>無効から有効に変更します。</div>
!connection.enable && "無効から有効に変更します。"
}
</DialogContentText>
</DialogContent>
Expand Down
78 changes: 46 additions & 32 deletions src/pages/Group/GroupDetail/Service.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,7 @@ function RowService(props: {
<TableCell align="left">
{service.ID}
</TableCell>
<TableCell
align="left">{serviceCode}</TableCell>
<TableCell align="left">{serviceCode}</TableCell>
<TableCell align="left">{service.service_template.name}</TableCell>
<TableCell align="left">
<ChipGet open={service.pass} pass={service.pass} enable={service.enable}/>
Expand All @@ -117,27 +116,46 @@ function RowService(props: {
<Box display="flex" justifyContent="flex-end">
{
!service.pass &&
<ExaminationDialog key={"service_examination_dialog_" + service.ID} id={service.ID}
service={service} reload={reload}/>
<ExaminationDialog
key={"service_examination_dialog_" + service.ID}
id={service.ID}
service={service}
reload={reload}
/>
}
&nbsp;
<ServiceGetDialogs key={"service_get_dialog_" + service.ID} service={service} reload={reload}
template={template}/>
<ServiceGetDialogs
key={"service_get_dialog_" + service.ID}
service={service}
reload={reload}
template={template}
/>
&nbsp;
<DeleteDialog key={"service_delete_alert_dialog_" + service.ID} id={service.ID}
reload={reload}/>
<DeleteDialog
key={"service_delete_alert_dialog_" + service.ID}
id={service.ID}
reload={reload}
/>
&nbsp;
<EnableDialog key={"service_enable_alert_dialog_" + service.ID} service={service}
reload={reload}/>
<EnableDialog
key={"service_enable_alert_dialog_" + service.ID}
service={service}
reload={reload}
/>
</Box>
</TableCell>
</TableRow>
<TableRow>
<TableCell style={{paddingBottom: 0, paddingTop: 0}} colSpan={7}>
<Collapse in={open} timeout="auto" unmountOnExit>
<Box margin={1}>
<RowConnectionCheck key={service.ID + "Connection"} template={template} service={service}
groupID={groupID} reload={reload}/>
<RowConnectionCheck
key={service.ID + "Connection"}
template={template}
service={service}
groupID={groupID}
reload={reload}
/>
</Box>
</Collapse>
</TableCell>
Expand Down Expand Up @@ -186,12 +204,12 @@ export function ExaminationDialog(props: {
TransitionComponent={Transition}
keepMounted
onClose={handleClose}
aria-labelledby="alert-dialog-slide-title"
aria-describedby="alert-dialog-slide-description"
aria-labelledby="alert-dialog-examination-title"
aria-describedby="alert-dialog-examination-description"
>
<DialogTitle id="alert-dialog-slide-title">審査通過</DialogTitle>
<DialogTitle id="alert-dialog-examination-title">審査通過</DialogTitle>
<DialogContent>
<DialogContentText id="alert-dialog-slide-description">
<DialogContentText id="alert-dialog-examination-description">
審査を通過させますか?
</DialogContentText>
</DialogContent>
Expand Down Expand Up @@ -246,12 +264,12 @@ export function DeleteDialog(props: {
TransitionComponent={Transition}
keepMounted
onClose={handleClose}
aria-labelledby="alert-dialog-slide-title"
aria-describedby="alert-dialog-slide-description"
aria-labelledby="alert-delete-dialog-title"
aria-describedby="alert-delete-dialog-description"
>
<DialogTitle id="alert-dialog-slide-title">削除</DialogTitle>
<DialogTitle id="alert-delete-dialog-title">削除</DialogTitle>
<DialogContent>
<DialogContentText id="alert-dialog-slide-description">
<DialogContentText id="alert-delete-dialog">
本当に削除しますか?
</DialogContentText>
</DialogContent>
Expand Down Expand Up @@ -304,32 +322,28 @@ export function EnableDialog(props: {
<div>
<Button size="small" variant="outlined" onClick={handleClickOpen}>
{
service.enable &&
<div>Disable</div>
service.enable && "Disable"
}
{
!service.enable &&
<div>Enable</div>
!service.enable && "Enable"
}
</Button>
<Dialog
open={open}
TransitionComponent={Transition}
keepMounted
onClose={handleClose}
aria-labelledby="alert-dialog-slide-title"
aria-describedby="alert-dialog-slide-description"
aria-labelledby="enable dialog"
aria-describedby="enable dialog"
>
<DialogTitle id="alert-dialog-slide-title">Enable</DialogTitle>
<DialogTitle id="alert-dialog-enable-title">Enable</DialogTitle>
<DialogContent>
<DialogContentText id="alert-dialog-slide-description">
<DialogContentText id="alert-dialog-enable-text">
{
service.enable &&
<div>有効から無効に変更します。</div>
service.enable && "有効から無効に変更します。"
}
{
!service.enable &&
<div>無効から有効に変更します。</div>
!service.enable && "無効から有効に変更します。"
}
</DialogContentText>
</DialogContent>
Expand Down

0 comments on commit 27d17dd

Please sign in to comment.