small changes
This commit is contained in:
@@ -7,7 +7,6 @@ import {LocaleContext} from "../locale";
|
||||
import clsx from "clsx";
|
||||
import {Box, IconButton} from "@mui/material";
|
||||
import {formatDateTime} from "../util";
|
||||
import UserLink from "security-lab/src/elements/user/userlink";
|
||||
import CachedIcon from "@material-ui/icons/Cached";
|
||||
|
||||
|
||||
@@ -137,6 +136,7 @@ export class DataColumn {
|
||||
this.field = field;
|
||||
this.sortable = !params.hasOwnProperty("sortable") || !!params.sortable;
|
||||
this.align = params.align || "left";
|
||||
this.params = params;
|
||||
}
|
||||
|
||||
renderData(L, entry, index) {
|
||||
@@ -152,6 +152,16 @@ export class StringColumn extends DataColumn {
|
||||
constructor(label, field = null, params = {}) {
|
||||
super(label, field, params);
|
||||
}
|
||||
|
||||
renderData(L, entry, index) {
|
||||
let data = super.renderData(L, entry, index);
|
||||
|
||||
if (this.params.style) {
|
||||
data = <span style={this.params.style}>{data}</span>
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
export class NumericColumn extends DataColumn {
|
||||
@@ -198,13 +208,14 @@ export class DateTimeColumn extends DataColumn {
|
||||
}
|
||||
}
|
||||
|
||||
export class UserLinkColumn extends DataColumn {
|
||||
export class BoolColumn extends DataColumn {
|
||||
constructor(label, field = null, params = {}) {
|
||||
super(label, field, params);
|
||||
}
|
||||
|
||||
renderData(L, entry, index) {
|
||||
return <UserLink user={super.renderData(L, entry)}/>
|
||||
let data = super.renderData(L, entry);
|
||||
return L(data ? "general.true" : "general.false");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import React from "react";
|
||||
import clsx from "clsx";
|
||||
import {Box, Modal} from "@mui/material";
|
||||
import {Button, Typography} from "@material-ui/core";
|
||||
import React, {useContext} from "react";
|
||||
import {Dialog as MuiDialog, DialogActions, DialogContent, DialogContentText, DialogTitle} from "@mui/material";
|
||||
import {Button} from "@material-ui/core";
|
||||
import {LocaleContext} from "../locale";
|
||||
import "./dialog.css";
|
||||
|
||||
export default function Dialog(props) {
|
||||
@@ -11,6 +11,8 @@ export default function Dialog(props) {
|
||||
const onOption = props.onOption || function() { };
|
||||
const options = props.options || ["Close"];
|
||||
const type = props.type || "default";
|
||||
const {translate: L} = useContext(LocaleContext);
|
||||
|
||||
|
||||
let buttons = [];
|
||||
for (let name of options) {
|
||||
@@ -26,20 +28,19 @@ export default function Dialog(props) {
|
||||
)
|
||||
}
|
||||
|
||||
return <Modal
|
||||
return <MuiDialog
|
||||
open={show}
|
||||
onClose={onClose}
|
||||
aria-labelledby="modal-title"
|
||||
aria-describedby="modal-description"
|
||||
>
|
||||
<Box className={clsx("modal-dialog", props.className)}>
|
||||
<Typography id="modal-title" variant="h6" component="h2">
|
||||
{props.title}
|
||||
</Typography>
|
||||
<Typography id="modal-description" sx={{ mt: 2 }}>
|
||||
{props.message}
|
||||
</Typography>
|
||||
{ buttons }
|
||||
</Box>
|
||||
</Modal>
|
||||
aria-labelledby="alert-dialog-title"
|
||||
aria-describedby="alert-dialog-description">
|
||||
<DialogTitle>{ props.title }</DialogTitle>
|
||||
<DialogContent>
|
||||
<DialogContentText>
|
||||
{ props.message }
|
||||
</DialogContentText>
|
||||
</DialogContent>
|
||||
<DialogActions>
|
||||
{buttons}
|
||||
</DialogActions>
|
||||
</MuiDialog>
|
||||
}
|
||||
Reference in New Issue
Block a user