Skip to content

Commit

Permalink
Merge pull request #17173 from jeclrsg/hpcc-28736-security-routes
Browse files Browse the repository at this point in the history
HPCC-28736 Fix ECL Watch v9 security section missing on container builds
  • Loading branch information
GordonSmith authored Apr 17, 2023
2 parents 00505ec + 448bdc0 commit 969765a
Show file tree
Hide file tree
Showing 13 changed files with 109 additions and 106 deletions.
3 changes: 2 additions & 1 deletion esp/src/src-react/components/GroupDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { SizeMe } from "react-sizeme";
import { scopedLogger } from "@hpcc-js/util";
import * as WsAccess from "src/ws_access";
import nlsHPCC from "src/nlsHPCC";
import * as Utility from "src/Utility";
import { pivotItemStyle } from "../layouts/pivot";
import { DojoAdapter } from "../layouts/DojoAdapter";
import { TableGroup } from "./forms/Groups";
Expand Down Expand Up @@ -58,7 +59,7 @@ export const GroupDetails: React.FunctionComponent<GroupDetailsProps> = ({
<Pivot
overflowBehavior="menu" style={{ height: "100%" }} selectedKey={tab}
onLinkClick={evt => {
pushUrl(`/security/groups/${groupName}/${evt.props.itemKey}`);
pushUrl(`/${Utility.opsRouteCategory}/security/groups/${groupName}/${evt.props.itemKey}`);
}}
>
<PivotItem headerText={groupName} itemKey="summary" style={pivotItemStyle(size)} >
Expand Down
7 changes: 4 additions & 3 deletions esp/src/src-react/components/GroupMembers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { CommandBar, ContextualMenuItemType, ICommandBarItemProps, Link } from "
import { scopedLogger } from "@hpcc-js/util";
import * as WsAccess from "src/ws_access";
import nlsHPCC from "src/nlsHPCC";
import * as Utility from "src/Utility";
import { GroupMemberStore, CreateGroupMemberStore } from "src/ws_access";
import { ShortVerticalDivider } from "./Common";
import { useConfirm } from "../hooks/confirm";
Expand Down Expand Up @@ -57,7 +58,7 @@ export const GroupMembers: React.FunctionComponent<GroupMembersProps> = ({
username: {
label: nlsHPCC.UserName,
formatter: React.useCallback(function (_name, idx) {
return <Link href={`#/security/users/${_name}`}>{_name}</Link>;
return <Link href={`#/${Utility.opsRouteCategory}/security/users/${_name}`}>{_name}</Link>;
}, [])
},
employeeID: { label: nlsHPCC.EmployeeID },
Expand Down Expand Up @@ -107,10 +108,10 @@ export const GroupMembers: React.FunctionComponent<GroupMembersProps> = ({
key: "open", text: nlsHPCC.Open, disabled: !uiState.hasSelection,
onClick: () => {
if (selection.length === 1) {
pushUrl(`/security/users/${selection[0].username}`);
pushUrl(`/${Utility.opsRouteCategory}/security/users/${selection[0].username}`);
} else {
selection.forEach(user => {
window.open(`#/security/users/${user?.username}`, "_blank");
window.open(`#/${Utility.opsRouteCategory}/security/users/${user?.username}`, "_blank");
});
}
}
Expand Down
7 changes: 4 additions & 3 deletions esp/src/src-react/components/Groups.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { AddGroupForm } from "./forms/AddGroup";
import { HolyGrail } from "../layouts/HolyGrail";
import { pushUrl } from "../util/history";
import { QuerySortItem } from "src/store/Store";
import * as Utility from "src/Utility";

const logger = scopedLogger("src-react/components/Groups.tsx");
const wsAccess = new AccessService({ baseUrl: "" });
Expand Down Expand Up @@ -53,7 +54,7 @@ export const Groups: React.FunctionComponent<GroupsProps> = ({
name: {
label: nlsHPCC.GroupName,
formatter: function (_name, idx) {
return <Link href={`#/security/groups/${_name}`}>{_name}</Link>;
return <Link href={`#/${Utility.opsRouteCategory}/security/groups/${_name}`}>{_name}</Link>;
}
},
groupOwner: { label: nlsHPCC.ManagedBy },
Expand Down Expand Up @@ -110,10 +111,10 @@ export const Groups: React.FunctionComponent<GroupsProps> = ({
key: "open", text: nlsHPCC.Open, disabled: !uiState.hasSelection,
onClick: () => {
if (selection.length === 1) {
pushUrl(`/security/groups/${selection[0].name}`);
pushUrl(`/${Utility.opsRouteCategory}/security/groups/${selection[0].name}`);
} else {
selection.forEach(group => {
window.open(`#/security/groups/${group.name}`, "_blank");
window.open(`#/${Utility.opsRouteCategory}/security/groups/${group.name}`, "_blank");
});
}
}
Expand Down
23 changes: 12 additions & 11 deletions esp/src/src-react/components/Menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,16 @@ function navLinkGroups(): INavLinkGroup[] {
},
{
name: nlsHPCC.Operations,
url: "#/topology-bare-metal",
url: "#/operations",
icon: "Admin",
key: "topology-bare-metal"
key: "operations"
}
];
if (!containerized) {
links = links.filter(l => l.key !== "topology");
}
if (!bare_metal) {
links = links.filter(l => l.key !== "topology-bare-metal");
links = links.filter(l => l.key !== "operations");
}
return [{ links }];
}
Expand Down Expand Up @@ -159,16 +159,17 @@ const subMenuItems: SubMenuItems = {
{ headerText: nlsHPCC.Pods, itemKey: "/topology/pods" },
{ headerText: nlsHPCC.Services, itemKey: "/topology/services" },
{ headerText: nlsHPCC.Logs, itemKey: "/topology/logs" },
{ headerText: nlsHPCC.Security + " (L)", itemKey: "/topology/security" },
{ headerText: nlsHPCC.DaliAdmin, itemKey: "/topology/daliadmin" },
],
"topology-bare-metal": [
{ headerText: nlsHPCC.Topology + " (L)", itemKey: "/topology-bare-metal" },
{ headerText: nlsHPCC.DiskUsage + " (L)", itemKey: "/diskusage" },
{ headerText: nlsHPCC.TargetClusters + " (L)", itemKey: "/clusters" },
{ headerText: nlsHPCC.ClusterProcesses + " (L)", itemKey: "/processes" },
{ headerText: nlsHPCC.SystemServers + " (L)", itemKey: "/servers" },
{ headerText: nlsHPCC.Security + " (L)", itemKey: "/security" },
{ headerText: nlsHPCC.DESDL + " (L)", itemKey: "/desdl" },
"operations": [
{ headerText: nlsHPCC.Topology + " (L)", itemKey: "/operations" },
{ headerText: nlsHPCC.DiskUsage + " (L)", itemKey: "/operations/diskusage" },
{ headerText: nlsHPCC.TargetClusters + " (L)", itemKey: "/operations/clusters" },
{ headerText: nlsHPCC.ClusterProcesses + " (L)", itemKey: "/operations/processes" },
{ headerText: nlsHPCC.SystemServers + " (L)", itemKey: "/operations/servers" },
{ headerText: nlsHPCC.Security + " (L)", itemKey: "/operations/security" },
{ headerText: nlsHPCC.DESDL + " (L)", itemKey: "/operations/desdl" },
],
};

Expand Down
11 changes: 6 additions & 5 deletions esp/src/src-react/components/Permissions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { useConst } from "@fluentui/react-hooks";
import { scopedLogger } from "@hpcc-js/util";
import * as WsAccess from "src/ws_access";
import nlsHPCC from "src/nlsHPCC";
import * as Utility from "src/Utility";
import { ShortVerticalDivider } from "./Common";
import { useConfirm } from "../hooks/confirm";
import { DojoGrid, selector, tree } from "./DojoGrid";
Expand Down Expand Up @@ -55,7 +56,7 @@ export const Permissions: React.FunctionComponent<PermissionsProps> = ({
label: nlsHPCC.Name,
formatter: function (_name, idx) {
if (idx.__hpcc_parent) {
return `<a href="#/security/permissions/${_name}/${idx.__hpcc_parent.name}">${_name}</a>`;
return `<a href="#/${Utility.opsRouteCategory}/security/permissions/${_name}/${idx.__hpcc_parent.name}">${_name}</a>`;
} else {
return _name;
}
Expand Down Expand Up @@ -197,11 +198,11 @@ export const Permissions: React.FunctionComponent<PermissionsProps> = ({
onClick: () => setShowDisableScopesConfirm(true),
disabled: !scopeScansEnabled
},
{ key: "fileScopeDefaults", text: nlsHPCC.FileScopeDefaultPermissions, onClick: (evt, item) => pushUrl("/security/permissions/_/File%20Scopes"), disabled: !uiState.fileScope },
{ key: "workunitScopeDefaults", text: nlsHPCC.WorkUnitScopeDefaultPermissions, onClick: (evt, item) => pushUrl("/security/permissions/_/Workunit%20Scopes"), disabled: !uiState.workunitScope },
{ key: "physicalFiles", text: nlsHPCC.PhysicalFiles, onClick: (evt, item) => pushUrl("/security/permissions/file/File%20Scopes"), disabled: !uiState.fileScope },
{ key: "fileScopeDefaults", text: nlsHPCC.FileScopeDefaultPermissions, onClick: (evt, item) => pushUrl(`/${Utility.opsRouteCategory}/security/permissions/_/File%20Scopes`), disabled: !uiState.fileScope },
{ key: "workunitScopeDefaults", text: nlsHPCC.WorkUnitScopeDefaultPermissions, onClick: (evt, item) => pushUrl(`/${Utility.opsRouteCategory}/security/permissions/_/Workunit%20Scopes`), disabled: !uiState.workunitScope },
{ key: "physicalFiles", text: nlsHPCC.PhysicalFiles, onClick: (evt, item) => pushUrl(`/${Utility.opsRouteCategory}/security/permissions/file/File%20Scopes`), disabled: !uiState.fileScope },
{ key: "checkFilePermissions", text: nlsHPCC.CheckFilePermissions, disabled: !uiState.fileScope },
{ key: "codeGenerator", text: nlsHPCC.CodeGenerator, onClick: (evt, item) => pushUrl(`/security/permissions/_/${modulesDn}`), disabled: !uiState.repositoryModule },
{ key: "codeGenerator", text: nlsHPCC.CodeGenerator, onClick: (evt, item) => pushUrl(`/${Utility.opsRouteCategory}/security/permissions/_/${modulesDn}`), disabled: !uiState.repositoryModule },
],
},
},
Expand Down
3 changes: 2 additions & 1 deletion esp/src/src-react/components/Security.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { Users } from "./Users";
import { pivotItemStyle } from "../layouts/pivot";
import { DojoAdapter } from "../layouts/DojoAdapter";
import nlsHPCC from "src/nlsHPCC";
import * as Utility from "src/Utility";

interface SecurityProps {
filter?: object;
Expand All @@ -29,7 +30,7 @@ export const Security: React.FunctionComponent<SecurityProps> = ({
<SizeMe monitorHeight>{({ size }) =>
<Pivot
overflowBehavior="menu" style={{ height: "100%" }} selectedKey={tab}
onLinkClick={evt => pushUrl(`/security/${evt.props.itemKey}`)}
onLinkClick={evt => pushUrl(`/${Utility.opsRouteCategory}/security/${evt.props.itemKey}`)}
>
<PivotItem headerText={nlsHPCC.Users} itemKey="users" style={pivotItemStyle(size)}>
<Users filter={filter} page={page} />
Expand Down
3 changes: 2 additions & 1 deletion esp/src/src-react/components/UserDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { SizeMe } from "react-sizeme";
import { scopedLogger } from "@hpcc-js/util";
import * as WsAccess from "src/ws_access";
import nlsHPCC from "src/nlsHPCC";
import * as Utility from "src/Utility";
import { pivotItemStyle } from "../layouts/pivot";
import { DojoAdapter } from "../layouts/DojoAdapter";
import { TableGroup } from "./forms/Groups";
Expand Down Expand Up @@ -100,7 +101,7 @@ export const UserDetails: React.FunctionComponent<UserDetailsProps> = ({
<Pivot
overflowBehavior="menu" style={{ height: "100%" }} selectedKey={tab}
onLinkClick={evt => {
pushUrl(`/security/users/${user?.username}/${evt.props.itemKey}`);
pushUrl(`/${Utility.opsRouteCategory}/security/users/${user?.username}/${evt.props.itemKey}`);
}}
>
<PivotItem headerText={user?.username} itemKey="summary" style={pivotItemStyle(size)} >
Expand Down
7 changes: 4 additions & 3 deletions esp/src/src-react/components/UserGroups.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { CommandBar, ContextualMenuItemType, ICommandBarItemProps, Link } from "
import { AccessService } from "@hpcc-js/comms";
import { scopedLogger } from "@hpcc-js/util";
import nlsHPCC from "src/nlsHPCC";
import * as Utility from "src/Utility";
import { ShortVerticalDivider } from "./Common";
import { pushUrl } from "../util/history";
import { useConfirm } from "../hooks/confirm";
Expand Down Expand Up @@ -41,7 +42,7 @@ export const UserGroups: React.FunctionComponent<UserGroupsProps> = ({
label: nlsHPCC.GroupName,
formatter: function (_name, idx) {
_name = _name.replace(/[^-_a-zA-Z0-9\s]+/g, "");
return <Link href={`#/security/groups/${_name}`}>{_name}</Link>;
return <Link href={`#/${Utility.opsRouteCategory}/security/groups/${_name}`}>{_name}</Link>;
}
}
}
Expand Down Expand Up @@ -95,10 +96,10 @@ export const UserGroups: React.FunctionComponent<UserGroupsProps> = ({
key: "open", text: nlsHPCC.Open, disabled: !uiState.hasSelection,
onClick: () => {
if (selection.length === 1) {
pushUrl(`/security/groups/${selection[0].name}`);
pushUrl(`/${Utility.opsRouteCategory}/security/groups/${selection[0].name}`);
} else {
selection.forEach(group => {
window.open(`#/security/groups/${group?.name}`, "_blank");
window.open(`#/${Utility.opsRouteCategory}/security/groups/${group?.name}`, "_blank");
});
}
}
Expand Down
7 changes: 4 additions & 3 deletions esp/src/src-react/components/Users.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { Fields } from "./forms/Fields";
import { HolyGrail } from "../layouts/HolyGrail";
import { pushParams, pushUrl } from "../util/history";
import { QuerySortItem } from "src/store/Store";
import * as Utility from "src/Utility";

const logger = scopedLogger("src-react/components/Users.tsx");
const wsAccess = new AccessService({ baseUrl: "" });
Expand Down Expand Up @@ -69,7 +70,7 @@ export const Users: React.FunctionComponent<UsersProps> = ({
width: 180,
label: nlsHPCC.Username,
formatter: React.useCallback(function (_name, idx) {
return <Link href={`#/security/users/${_name}`}>{_name}</Link>;
return <Link href={`#/${Utility.opsRouteCategory}/security/users/${_name}`}>{_name}</Link>;
}, [])
},
employeeID: { width: 180, label: nlsHPCC.EmployeeID },
Expand Down Expand Up @@ -134,10 +135,10 @@ export const Users: React.FunctionComponent<UsersProps> = ({
key: "open", text: nlsHPCC.Open, disabled: !uiState.hasSelection,
onClick: () => {
if (selection.length === 1) {
pushUrl(`/security/users/${selection[0].username}`);
pushUrl(`/${Utility.opsRouteCategory}/security/users/${selection[0].username}`);
} else {
selection.forEach(user => {
window.open(`#/security/users/${user?.username}`, "_blank");
window.open(`#/${Utility.opsRouteCategory}/security/users/${user?.username}`, "_blank");
});
}
}
Expand Down
5 changes: 3 additions & 2 deletions esp/src/src-react/components/Xrefs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { useFluentGrid } from "../hooks/grid";
import { ShortVerticalDivider } from "./Common";
import { pushUrl } from "../util/history";
import nlsHPCC from "src/nlsHPCC";
import * as Utility from "src/Utility";

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

Expand Down Expand Up @@ -125,10 +126,10 @@ export const Xrefs: React.FunctionComponent<XrefsProps> = ({
key: "open", text: nlsHPCC.Open, disabled: !uiState.hasSelection,
onClick: () => {
if (selection.length === 1) {
pushUrl(`/security/users/${selection[0].username}`);
pushUrl(`/${Utility.opsRouteCategory}/security/users/${selection[0].username}`);
} else {
selection.forEach(user => {
window.open(`#/security/users/${user.username}`, "_blank");
window.open(`#/${Utility.opsRouteCategory}/security/users/${user.username}`, "_blank");
});
}
}
Expand Down
19 changes: 10 additions & 9 deletions esp/src/src-react/components/controls/ComingSoon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import * as React from "react";
import { IStyle, Toggle } from "@fluentui/react";
import nlsHPCC from "src/nlsHPCC";
import { ModernMode } from "src/BuildInfo";
import * as Utility from "src/Utility";
import { useUserStore } from "../../hooks/store";

const legacyIndex = {};
Expand All @@ -26,15 +27,15 @@ const modernIndex = {};
["#/stub/RoxieQueries-DL/PackageMaps", "#/packagemaps"],
["#/stub/RoxieQueries", "#/queries"],

["#/stub/OPS-DL/Topology", "#/topology-bare-metal"],
["#/stub/OPS-DL/DiskUsage", "#/diskusage"],
["#/stub/OPS-DL/TargetClustersQuery", "#/clusters"],
["#/stub/OPS-DL/ClusterProcessesQuery", "#/processes"],
["#/stub/OPS-DL/SystemServersQuery", "#/servers"],
["#/stub/OPS-DL/Permissions", "#/security"],
["#/stub/OPS-DL/DESDL", "#/desdl"],
["#/stub/OPS-DL/LogVisualization", "#/topology-bare-metal"],
["#/stub/OPS", "#/topology-bare-metal"],
["#/stub/OPS-DL/Topology", "#/operations"],
["#/stub/OPS-DL/DiskUsage", "#/operations/diskusage"],
["#/stub/OPS-DL/TargetClustersQuery", "#/operations/clusters"],
["#/stub/OPS-DL/ClusterProcessesQuery", "#/operations/processes"],
["#/stub/OPS-DL/SystemServersQuery", "#/operations/servers"],
["#/stub/OPS-DL/Permissions", `#/${Utility.opsRouteCategory}/security`],
["#/stub/OPS-DL/DESDL", `#/${Utility.opsRouteCategory}/desdl`],
["#/stub/OPS-DL/LogVisualization", "#/operations"],
["#/stub/OPS", "#/operations"],
].forEach(row => {
legacyIndex[row[0]] = row[1];
modernIndex[row[1]] = row[0];
Expand Down
Loading

0 comments on commit 969765a

Please sign in to comment.