Skip to content

Commit

Permalink
Merge pull request #19327 from GordonSmith/HPCC-33060-BACKPORT_ECLWAT…
Browse files Browse the repository at this point in the history
…CH_MASTER

HPCC-33060 Backport master prior to refactor

Reviewed-By: Jeremy Clements <[email protected]>
Merged-by: Gavin Halliday <[email protected]>
  • Loading branch information
ghalliday authored Dec 4, 2024
2 parents 30cfe70 + 97b6026 commit 2bca5ba
Show file tree
Hide file tree
Showing 29 changed files with 1,063 additions and 34 deletions.
1 change: 1 addition & 0 deletions esp/src/eclwatch/TimingTreeMapWidget.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ define([
}
return (timer.Name !== "Process" &&
timer.Name !== "compile" &&
timer.Name !== ">compile" &&
timer.Name !== "Total thor time" &&
timer.Name !== "Total cluster time" &&
timer.Name.indexOf(":TimeElapsed") < 0);
Expand Down
1 change: 1 addition & 0 deletions esp/src/eclwatch/img/opentelemetry-icon-color.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 5 additions & 4 deletions esp/src/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion esp/src/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"@hpcc-js/chart": "2.84.1",
"@hpcc-js/codemirror": "2.63.0",
"@hpcc-js/common": "2.72.0",
"@hpcc-js/comms": "2.96.1",
"@hpcc-js/comms": "2.97.0",
"@hpcc-js/dataflow": "8.1.7",
"@hpcc-js/eclwatch": "2.75.3",
"@hpcc-js/graph": "2.86.0",
Expand Down
4 changes: 4 additions & 0 deletions esp/src/src-react/components/DaliAdmin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { GetLogicalFilePart } from "./GetLogicalFilePart";
import { GetProtectedList } from "./GetProtectedList";
import { GetValue } from "./GetValue";
import { SetLogicalFilePartAttr } from "./SetLogicalFilePartAttr";
import { DaliSDSUnlock } from "./DaliSDSUnlock";
import { SetProtected } from "./SetProtected";
import { SetUnprotected } from "./SetUnprotected";
import { SetValue } from "./SetValue";
Expand Down Expand Up @@ -67,6 +68,9 @@ export const DaliAdmin: React.FunctionComponent<DaliAdminProps> = ({
<PivotItem headerText={nlsHPCC.SetLogicalFileAttribute} itemKey="setlogicalfilepartattr" style={pivotItemStyle(size)} >
<SetLogicalFilePartAttr />
</PivotItem>
<PivotItem headerText={nlsHPCC.UnlockSDSLock} itemKey="unlockSdsLock" style={pivotItemStyle(size)} >
<DaliSDSUnlock />
</PivotItem>
<PivotItem headerText={nlsHPCC.SetProtected} itemKey="setprotected" style={pivotItemStyle(size)} >
<SetProtected />
</PivotItem>
Expand Down
84 changes: 84 additions & 0 deletions esp/src/src-react/components/DaliSDSUnlock.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
import * as React from "react";
import { DefaultButton, DetailsList, DetailsListLayoutMode, IColumn } from "@fluentui/react";
import { SizeMe } from "react-sizeme";
import { csvParse } from "d3-dsv";
import { DaliService } from "@hpcc-js/comms";
import { scopedLogger } from "@hpcc-js/util";
import { TableGroup } from "./forms/Groups";
import { useConfirm } from "../hooks/confirm";
import nlsHPCC from "src/nlsHPCC";
import { HolyGrail } from "../layouts/HolyGrail";

const logger = scopedLogger("src-react/components/DaliSDSUnlock.tsx");

const myDaliService = new DaliService({ baseUrl: "" });

interface DaliSDSUnlockProps {
}

export const DaliSDSUnlock: React.FunctionComponent<DaliSDSUnlockProps> = ({

}) => {

const [columns, setColumns] = React.useState<IColumn[]>([]);
const [items, setItems] = React.useState<any[]>([]);
const [connectionId, setConnectionId] = React.useState<string>("");
const [close, setClose] = React.useState(false);

const [DaliPromptConfirm, setDaliPromptConfirm] = useConfirm({
title: nlsHPCC.DaliAdmin,
message: nlsHPCC.DaliPromptConfirm,
onSubmit: React.useCallback(() => {
myDaliService.UnlockSDSLock({ ConnectionID: connectionId, Close: close }).then(response => {
const data = csvParse(response.Result);
setColumns(data.columns.map((col, idx) => {
return {
key: col,
name: col,
fieldName: col,
minWidth: 100
};
}));
setItems(data);
}).catch(err => logger.error(err));
}, [connectionId, close])
});

const onSubmit = React.useCallback(() => {
setDaliPromptConfirm(true);
}, [setDaliPromptConfirm]);

return <HolyGrail
header={<span><TableGroup fields={{
"ConnectionID": {label: nlsHPCC.ConnectionID, type: "string", value: connectionId},
"Close": { label: nlsHPCC.Close, type: "checkbox", value: close },
}} onChange={(id, value) => {
switch (id) {
case "ConnectionID":
setConnectionId(value);
break;
case "Close":
setClose(value);
break;
default:
logger.debug(`${id}: ${value}`);
}
}} /><DefaultButton onClick={onSubmit} text={nlsHPCC.Submit} /></span>}
main={<SizeMe monitorHeight>{({ size }) => {
const height = `${size.height}px`;
return <div style={{ position: "relative", width: "100%", height: "100%" }}>
<div style={{ position: "absolute", width: "100%", height: `${size.height}px` }}>
<DetailsList compact={true}
items={items}
columns={columns}
setKey="key"
layoutMode={DetailsListLayoutMode.justified}
selectionPreservedOnEmptyClick={true}
styles={{ root: { height, minHeight: height, maxHeight: height } }}
/>
<DaliPromptConfirm />
</div>
</div>;
}}</SizeMe>}
/>;
};
2 changes: 1 addition & 1 deletion esp/src/src-react/components/InfoGrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export const InfoGrid: React.FunctionComponent<InfoGridProps> = ({
return Priority;
}
},
Code: { label: nlsHPCC.Code, width: 45, sortable: false },
Code: { label: nlsHPCC.Code, width: 45 },
Message: {
label: nlsHPCC.Message,
sortable: true,
Expand Down
1 change: 1 addition & 0 deletions esp/src/src-react/components/Menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ const subMenuItems: SubMenuItems = {
{ headerText: nlsHPCC.Security + " (L)", itemKey: "/topology/security" },
{ headerText: nlsHPCC.DESDL + " (L)", itemKey: "/topology/desdl" },
{ headerText: nlsHPCC.DaliAdmin, itemKey: "/topology/daliadmin" },
{ headerText: nlsHPCC.Sasha, itemKey: "/topology/sasha" },
],
"operations": [
{ headerText: nlsHPCC.Topology + " (L)", itemKey: "/operations" },
Expand Down
5 changes: 4 additions & 1 deletion esp/src/src-react/components/Permissions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { useConfirm } from "../hooks/confirm";
import { useBuildInfo } from "../hooks/platform";
import { DojoGrid, selector, tree } from "./DojoGrid";
import { AddPermissionForm } from "./forms/AddPermission";
import { CheckPermissionsForm } from "./forms/CheckPermissions";
import { HolyGrail } from "../layouts/HolyGrail";
import { pushUrl } from "../util/history";

Expand All @@ -35,6 +36,7 @@ export const Permissions: React.FunctionComponent<PermissionsProps> = ({
const [selection, setSelection] = React.useState([]);

const [showAddPermission, setShowAddPermission] = React.useState(false);
const [showCheckFilePermissions, setShowCheckFilePermissions] = React.useState(false);
const [scopeScansEnabled, setScopeScansEnabled] = React.useState(false);
const [modulesDn, setModulesDn] = React.useState("");
const [uiState, setUIState] = React.useState({ ...defaultUIState });
Expand Down Expand Up @@ -203,7 +205,7 @@ export const Permissions: React.FunctionComponent<PermissionsProps> = ({
{ key: "fileScopeDefaults", text: nlsHPCC.FileScopeDefaultPermissions, onClick: (evt, item) => pushUrl(`/${opsCategory}/security/permissions/_/File%20Scopes`), disabled: !uiState.fileScope },
{ key: "workunitScopeDefaults", text: nlsHPCC.WorkUnitScopeDefaultPermissions, onClick: (evt, item) => pushUrl(`/${opsCategory}/security/permissions/_/Workunit%20Scopes`), disabled: !uiState.workunitScope },
{ key: "physicalFiles", text: nlsHPCC.PhysicalFiles, onClick: (evt, item) => pushUrl(`/${opsCategory}/security/permissions/file/File%20Scopes`), disabled: !uiState.fileScope },
{ key: "checkFilePermissions", text: nlsHPCC.CheckFilePermissions, disabled: !uiState.fileScope },
{ key: "checkFilePermissions", text: nlsHPCC.CheckFilePermissions, onClick: () => setShowCheckFilePermissions(true), disabled: !uiState.fileScope },
{ key: "codeGenerator", text: nlsHPCC.CodeGenerator, onClick: (evt, item) => pushUrl(`/${opsCategory}/security/permissions/_/${modulesDn}`), disabled: !uiState.repositoryModule },
],
},
Expand All @@ -223,6 +225,7 @@ export const Permissions: React.FunctionComponent<PermissionsProps> = ({
<ClearPermissionsConfirm />
<EnableScopesConfirm />
<DisableScopesConfirm />
<CheckPermissionsForm showForm={showCheckFilePermissions} setShowForm={setShowCheckFilePermissions} refreshGrid={() => refreshTable()} />
<AddPermissionForm showForm={showAddPermission} setShowForm={setShowAddPermission} refreshGrid={refreshTable} />
</>;

Expand Down
96 changes: 96 additions & 0 deletions esp/src/src-react/components/Sasha.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
import * as React from "react";
import { Dropdown, TextField, PrimaryButton } from "@fluentui/react";
import nlsHPCC from "src/nlsHPCC";

interface SashaProps {}

export const Sasha: React.FunctionComponent<SashaProps> = ({ }) => {
const [selectedOption, setSelectedOption] = React.useState("");
const [wuid, setWuid] = React.useState("");
const [result, setResult] = React.useState("");

const handleOptionChange = (event: React.FormEvent<HTMLDivElement>, option: any) => {
setSelectedOption(option.key);
};

const handleSubmit = (event: React.FormEvent<HTMLFormElement>) => {
event.preventDefault();
// Perform action based on selected option
switch (selectedOption) {
case "getVersion":
// Implement getVersion function call
break;
case "getLastServerMessage":
// Implement getLastServerMessage function call
break;
case "restoreECLWorkUnit":
// Implement restoreECLWorkUnit function call
break;
case "restoreDFUWorkUnit":
// Implement restoreDFUWorkUnit function call
break;
case "archiveECLWorkUnit":
// Implement archiveECLWorkUnit function call
break;
case "archiveDFUWorkUnit":
// Implement archiveDFUWorkUnit function call
break;
case "backupECLWorkUnit":
// Implement backupECLWorkUnit function call
break;
case "backupDFUWorkUnit":
// Implement backupDFUWorkUnit function call
break;
default:
console.log("Invalid option selected");
}
// Reset form
setSelectedOption("");
setWuid("");
setResult("");
};

// Conditional rendering for default value
const defaultValue = result ? null : <div>{nlsHPCC.noDataMessage}</div>;

return (
<div>
<form onSubmit={handleSubmit}>
<Dropdown
placeholder={nlsHPCC.SelectAnOption}
selectedKey={selectedOption}
onChange={handleOptionChange}
options={[
{ key: "", text: nlsHPCC.SelectAnOption },
{ key: "getVersion", text: nlsHPCC.GetVersion },
{ key: "getLastServerMessage", text: nlsHPCC.GetLastServerMessage },
{ key: "restoreECLWorkUnit", text: nlsHPCC.RestoreECLWorkunit },
{ key: "restoreDFUWorkUnit", text: nlsHPCC.RestoreDFUWorkunit },
{ key: "archiveECLWorkUnit", text: nlsHPCC.ArchiveECLWorkunit },
{ key: "archiveDFUWorkUnit", text: nlsHPCC.ArchiveDFUWorkunit },
{ key: "backupECLWorkUnit", text: nlsHPCC.BackupECLWorkunit },
{ key: "backupDFUWorkUnit", text: nlsHPCC.BackupDFUWorkunit }
]}
styles={{ dropdown: { width: 400 } }}
/>
{["restoreECLWorkUnit", "restoreDFUWorkUnit", "archiveECLWorkUnit", "archiveDFUWorkUnit", "backupECLWorkUnit", "backupDFUWorkUnit"].includes(selectedOption) && (
<div>
<TextField
label= {nlsHPCC.WUID}
value={wuid}
onChange={(event: React.FormEvent<HTMLInputElement>, newValue?: string) => setWuid(newValue || "")}
styles={{ fieldGroup: { width: 400 } }}
/>
</div>
)}
<PrimaryButton type="submit" >{nlsHPCC.Submit}</PrimaryButton>
{/* Render defaultValue when result is empty */}
{defaultValue}
{/* Render result when available */}
{result && <div>{nlsHPCC.Results}: {result}</div>}
</form>
</div>
);
};

export default Sasha;
9 changes: 5 additions & 4 deletions esp/src/src-react/components/Variables.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,25 @@ import * as React from "react";
import { CommandBar, ContextualMenuItemType, ICommandBarItemProps } from "@fluentui/react";
import nlsHPCC from "src/nlsHPCC";
import { QuerySortItem } from "src/store/Store";
import { useWorkunitVariables } from "../hooks/workunit";
import { Variable } from "../hooks/workunit";
import { HolyGrail } from "../layouts/HolyGrail";
import { FluentGrid, useCopyButtons, useFluentStoreState, FluentColumns } from "./controls/Grid";
import { ShortVerticalDivider } from "./Common";

interface VariablesProps {
wuid: string;
variables: Variable[];
refreshData: () => void;
sort?: QuerySortItem;
}

const defaultSort = { attribute: "Wuid", descending: true };

export const Variables: React.FunctionComponent<VariablesProps> = ({
wuid,
variables,
refreshData,
sort = defaultSort
}) => {

const [variables, , , refreshData] = useWorkunitVariables(wuid);
const [data, setData] = React.useState<any[]>([]);
const {
selection, setSelection,
Expand Down
13 changes: 10 additions & 3 deletions esp/src/src-react/components/WorkunitDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import nlsHPCC from "src/nlsHPCC";
import { hasLogAccess } from "src/ESPLog";
import { wuidToDate, wuidToTime } from "src/Utility";
import { emptyFilter, formatQuery } from "src/ESPWorkunit";
import { useWorkunit } from "../hooks/workunit";
import { Variable, useWorkunit, useWorkunitVariables } from "../hooks/workunit";
import { useDeepEffect } from "../hooks/deepHooks";
import { DojoAdapter } from "../layouts/DojoAdapter";
import { FullscreenFrame, FullscreenStack } from "../layouts/Fullscreen";
Expand Down Expand Up @@ -55,6 +55,8 @@ export const WorkunitDetails: React.FunctionComponent<WorkunitDetailsProps> = ({
}) => {

const [workunit] = useWorkunit(wuid, true);
const [variables, , , refreshVariables] = useWorkunitVariables(wuid);
const [otTraceParent, setOtTraceParent] = React.useState("");
const [logCount, setLogCount] = React.useState<number | string>("*");
const [logsDisabled, setLogsDisabled] = React.useState(true);
const [_nextPrev, setNextPrev] = useNextPrev();
Expand All @@ -67,6 +69,11 @@ export const WorkunitDetails: React.FunctionComponent<WorkunitDetailsProps> = ({
return parseQuery("?" + parentUrlParts[1]);
}, [parentUrl]);

React.useEffect(() => {
const traceInfo: Variable = variables.filter(v => v.Name === "ottraceparent")[0];
setOtTraceParent(traceInfo?.Value ?? "");
}, [variables]);

const nextWuid = React.useCallback((wuids: WsWorkunits.ECLWorkunit[]) => {
let found = false;
for (const wu of wuids) {
Expand Down Expand Up @@ -184,10 +191,10 @@ export const WorkunitDetails: React.FunctionComponent<WorkunitDetailsProps> = ({
<OverflowTabList tabs={tabs} selected={tab} onTabSelect={onTabSelect} size="medium" />
</FullscreenStack>
<DelayLoadedPanel visible={tab === "summary"} size={size}>
<WorkunitSummary wuid={wuid} />
<WorkunitSummary wuid={wuid} otTraceParent={otTraceParent} />
</DelayLoadedPanel>
<DelayLoadedPanel visible={tab === "variables"} size={size}>
<Variables wuid={wuid} />
<Variables variables={variables} refreshData={refreshVariables} />
</DelayLoadedPanel>
<DelayLoadedPanel visible={tab === "outputs"} size={size}>
{state?.outputs ?
Expand Down
Loading

0 comments on commit 2bca5ba

Please sign in to comment.