|
@@ -95,7 +95,7 @@ import { useUniqueId } from "./utils/hooks";
|
|
|
import DataNodeChart from "./DataNodeChart";
|
|
|
import DataNodeTable from "./DataNodeTable";
|
|
|
|
|
|
-const editTimestampFormat = "YYY/MM/dd HH:mm";
|
|
|
+const editTimestampFormat = "yyyy/MM/dd HH:mm";
|
|
|
|
|
|
const tabBoxSx = { borderBottom: 1, borderColor: "divider" };
|
|
|
const noDisplay = { display: "none" };
|
|
@@ -158,7 +158,7 @@ enum DatanodeDataProps {
|
|
|
error,
|
|
|
}
|
|
|
|
|
|
-interface DataNodeViewerProps extends CoreProps {
|
|
|
+interface DataNodeViewerProps extends CoreProps {
|
|
|
expandable?: boolean;
|
|
|
expanded?: boolean;
|
|
|
defaultDataNode?: string;
|
|
@@ -168,6 +168,7 @@ interface DataNodeViewerProps extends CoreProps {
|
|
|
showOwner?: boolean;
|
|
|
showEditDate?: boolean;
|
|
|
showExpirationDate?: boolean;
|
|
|
+ showCustomProperties?: boolean;
|
|
|
showProperties?: boolean;
|
|
|
showHistory?: boolean;
|
|
|
showData?: boolean;
|
|
@@ -237,6 +238,7 @@ const DataNodeViewer = (props: DataNodeViewerProps) => {
|
|
|
showOwner = true,
|
|
|
showEditDate = false,
|
|
|
showExpirationDate = false,
|
|
|
+ showCustomProperties = true,
|
|
|
showProperties = true,
|
|
|
showHistory = true,
|
|
|
showData = true,
|
|
@@ -281,7 +283,9 @@ const DataNodeViewer = (props: DataNodeViewerProps) => {
|
|
|
const dtError = dnData[DatanodeDataProps.error];
|
|
|
|
|
|
// Tabs
|
|
|
- const [tabValue, setTabValue] = useState<TabValues>(TabValues.Data);
|
|
|
+ const [tabValue, setTabValue] = useState<TabValues | undefined>(
|
|
|
+ showData ? TabValues.Data : showProperties ? TabValues.Properties : showHistory ? TabValues.History : undefined
|
|
|
+ );
|
|
|
const handleTabChange = useCallback(
|
|
|
(_: SyntheticEvent, newValue: number) => {
|
|
|
if (valid) {
|
|
@@ -378,14 +382,14 @@ const DataNodeViewer = (props: DataNodeViewerProps) => {
|
|
|
);
|
|
|
}
|
|
|
if (!dn || isNewDn) {
|
|
|
- setTabValue(showData ? TabValues.Data : TabValues.Properties);
|
|
|
+ (showData || showProperties || showHistory) && setTabValue(showData ? TabValues.Data : showProperties ? TabValues.Properties: showHistory ? TabValues.History: undefined);
|
|
|
}
|
|
|
if (!dn) {
|
|
|
return invalidDatanode;
|
|
|
}
|
|
|
editLock.current = dn[DataNodeFullProps.editInProgress];
|
|
|
setHistoryRequested((req) => {
|
|
|
- if (req && !isNewDn && tabValue == TabValues.History) {
|
|
|
+ if (req && showHistory && !isNewDn && tabValue == TabValues.History) {
|
|
|
const idVar = getUpdateVar(updateDnVars, "history_id");
|
|
|
const vars = getUpdateVarNames(updateVars, "history");
|
|
|
Promise.resolve().then(() =>
|
|
@@ -411,7 +415,7 @@ const DataNodeViewer = (props: DataNodeViewerProps) => {
|
|
|
return false;
|
|
|
});
|
|
|
setPropertiesRequested((req) => {
|
|
|
- if ((req || !showData) && tabValue == TabValues.Properties) {
|
|
|
+ if ((req || !showData) && showProperties && tabValue == TabValues.Properties) {
|
|
|
const idVar = getUpdateVar(updateDnVars, "properties_id");
|
|
|
const vars = getUpdateVarNames(updateVars, "dnProperties");
|
|
|
Promise.resolve().then(() =>
|
|
@@ -429,7 +433,7 @@ const DataNodeViewer = (props: DataNodeViewerProps) => {
|
|
|
return dn;
|
|
|
});
|
|
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
|
- }, [props.dataNode, props.defaultDataNode, showData, id, dispatch, module, props.onLock]);
|
|
|
+ }, [props.dataNode, props.defaultDataNode, showData, showProperties, showHistory, id, dispatch, module, props.onLock]);
|
|
|
|
|
|
// clean lock on unmount
|
|
|
useEffect(
|
|
@@ -665,14 +669,18 @@ const DataNodeViewer = (props: DataNodeViewerProps) => {
|
|
|
useEffect(() => {
|
|
|
const ids = coreChanged?.datanode;
|
|
|
if ((typeof ids === "string" && ids === dnId) || (Array.isArray(ids) && ids.includes(dnId))) {
|
|
|
- props.updateVarName &&
|
|
|
- dispatch(createRequestUpdateAction(id, module, [props.updateVarName], true));
|
|
|
+ props.updateVarName && dispatch(createRequestUpdateAction(id, module, [props.updateVarName], true));
|
|
|
}
|
|
|
}, [coreChanged, props.updateVarName, id, module, dispatch, dnId]);
|
|
|
|
|
|
return (
|
|
|
<>
|
|
|
- <Box sx={dnMainBoxSx} id={id} onClick={onFocus} className={`${className} ${getComponentClassName(props.children)}`}>
|
|
|
+ <Box
|
|
|
+ sx={dnMainBoxSx}
|
|
|
+ id={id}
|
|
|
+ onClick={onFocus}
|
|
|
+ className={`${className} ${getComponentClassName(props.children)}`}
|
|
|
+ >
|
|
|
<Accordion defaultExpanded={expanded} expanded={userExpanded} onChange={onExpand} disabled={!valid}>
|
|
|
<AccordionSummary
|
|
|
expandIcon={expandable ? <ArrowForwardIosSharp sx={AccordionIconSx} /> : null}
|
|
@@ -716,6 +724,7 @@ const DataNodeViewer = (props: DataNodeViewerProps) => {
|
|
|
label="Properties"
|
|
|
id={`${uniqId}-properties`}
|
|
|
aria-controls={`${uniqId}-dn-tabpanel-properties`}
|
|
|
+ style={showProperties ? undefined : noDisplay}
|
|
|
/>
|
|
|
<Tab
|
|
|
label="History"
|
|
@@ -913,7 +922,7 @@ const DataNodeViewer = (props: DataNodeViewerProps) => {
|
|
|
? props.dnProperties
|
|
|
: []
|
|
|
}
|
|
|
- show={showProperties}
|
|
|
+ show={showCustomProperties}
|
|
|
focusName={focusName}
|
|
|
setFocusName={setFocusName}
|
|
|
onFocus={onFocus}
|