Skip to content

Commit

Permalink
HPCC-30568 ECL Watch v9 add pod name column to Logs view
Browse files Browse the repository at this point in the history
Signed-off-by: Jeremy Clements <[email protected]>
  • Loading branch information
jeclrsg committed Nov 22, 2023
1 parent 3630d8f commit 1e7ed27
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 9 deletions.
8 changes: 4 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 @@ -42,7 +42,7 @@
"@hpcc-js/chart": "2.81.7",
"@hpcc-js/codemirror": "2.60.12",
"@hpcc-js/common": "2.71.12",
"@hpcc-js/comms": "2.84.4",
"@hpcc-js/comms": "2.85.0",
"@hpcc-js/dataflow": "8.1.6",
"@hpcc-js/eclwatch": "2.73.27",
"@hpcc-js/graph": "2.85.8",
Expand Down
2 changes: 2 additions & 0 deletions esp/src/src-react/components/Logs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const defaultStartDate = new Date(new Date().getTime() - startTimeOffset);

const FilterFields: Fields = {
components: { type: "cloud-containername", label: nlsHPCC.ContainerName },
instance: { type: "cloud-podname", label: nlsHPCC.PodName },
audience: {
type: "dropdown", label: nlsHPCC.Audience, options: [
{ key: TargetAudience.Operator, text: "Operator" },
Expand Down Expand Up @@ -130,6 +131,7 @@ export const Logs: React.FunctionComponent<LogsProps> = ({
timestamp: { label: nlsHPCC.TimeStamp, width: 140, sortable: false, },
message: { label: nlsHPCC.Message, sortable: false, },
components: { label: nlsHPCC.ContainerName, width: 150, sortable: false },
instance: { label: nlsHPCC.PodName, width: 150, sortable: false },
audience: { label: nlsHPCC.Audience, width: 60, sortable: false, },
class: {
label: nlsHPCC.Class, width: 40, sortable: false,
Expand Down
49 changes: 45 additions & 4 deletions esp/src/src-react/components/forms/Fields.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { FileList, States as DFUStates } from "src/FileSpray";
import { joinPath } from "src/Utility";
import nlsHPCC from "src/nlsHPCC";
import { useBuildInfo, useLogicalClusters } from "../../hooks/platform";
import { useContainerNames } from "../../hooks/cloud";
import { useContainerNames, usePodNames } from "../../hooks/cloud";

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

Expand Down Expand Up @@ -200,7 +200,7 @@ export type FieldType = "string" | "password" | "number" | "checkbox" | "choiceg
"target-dfuqueue" | "user-groups" | "group-members" | "permission-type" |
"logicalfile-type" | "dfuworkunit-state" |
"esdl-esp-processes" | "esdl-definitions" |
"cloud-containername";
"cloud-containername" | "cloud-podname";

export type Values = { [name: string]: string | number | boolean | (string | number | boolean)[] };

Expand Down Expand Up @@ -369,6 +369,11 @@ interface CloudContainerNameField extends BaseField {
value?: string;
}

interface CloudPodNameField extends BaseField {
type: "cloud-podname";
value?: string;
}

export type Field = StringField | NumericField | CheckboxField | ChoiceGroupField | DateTimeField | DropdownField | DropdownMultiField |
LinkField | LinksField | ProgressField |
WorkunitStateField |
Expand All @@ -378,7 +383,7 @@ export type Field = StringField | NumericField | CheckboxField | ChoiceGroupFiel
TargetDfuSprayQueueField | UserGroupsField | GroupMembersField | PermissionTypeField |
LogicalFileType | DFUWorkunitStateField |
EsdlEspProcessesField | EsdlDefinitionsField |
CloudContainerNameField;
CloudContainerNameField | CloudPodNameField;

export type Fields = { [id: string]: Field };

Expand Down Expand Up @@ -766,6 +771,28 @@ export const CloudContainerNameField: React.FunctionComponent<CloudContainerName
return <ComboBox {...props} allowFreeform={true} autoComplete={"on"} options={options} />;
};

export interface CloudPodNameFieldProps extends Omit<IComboBoxProps, "options"> {
name?: string;
}

export const CloudPodNameField: React.FunctionComponent<CloudPodNameFieldProps> = (props) => {

const [cloudPodNames] = usePodNames();
const [options, setOptions] = React.useState<IComboBoxOption[]>();

React.useEffect(() => {
const options = cloudPodNames?.map(row => {
return {
key: row,
text: row
};
}) || [];
setOptions(options);
}, [cloudPodNames]);

return <ComboBox {...props} allowFreeform={true} autoComplete={"on"} options={options} />;
};

const states = Object.keys(States).map(s => States[s]);
const dfustates = Object.keys(DFUStates).map(s => DFUStates[s]);

Expand Down Expand Up @@ -1260,7 +1287,21 @@ export function createInputs(fields: Fields, onChange?: (id: string, newValue: a
/>
});
break;

case "cloud-podname":
field.value = field.value !== undefined ? field.value : "";
retVal.push({
id: fieldID,
label: field.label,
field: <CloudPodNameField
key={fieldID}
onChange={(ev, row) => {
onChange(fieldID, row.key);
setDropzone(row.key as string);
}}
placeholder={field.placeholder}
/>
});
break;
}
}
return retVal;
Expand Down
10 changes: 10 additions & 0 deletions esp/src/src-react/hooks/cloud.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,14 @@ export function useContainerNames(): [string[], () => void] {
}, [pods]);

return [containers, refreshData];
}

export function usePodNames(): [string[], () => void] {

const [pods, refreshData] = usePods();
const podNames = React.useMemo(() => {
return pods.map(pod => pod.name);
}, [pods]);

return [podNames, refreshData];
}
1 change: 1 addition & 0 deletions esp/src/src/nls/hpcc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -686,6 +686,7 @@ export = {
Plugins: "Plugins",
PleaseEnterANumber: "Please enter a number 1 - ",
PleaseLogin: "Please log in using your username and password",
PodName: "Pod Name",
Pods: "Pods",
PodsAccessError: "Cannot retrieve list of pods",
Port: "Port",
Expand Down

0 comments on commit 1e7ed27

Please sign in to comment.