Skip to content

Commit

Permalink
Merge pull request #363 from fahad-aot/bugfix/fwf-4023-undefined-in-u…
Browse files Browse the repository at this point in the history
…rl-on-manage-tab

Bugfix/fwf 4023 undefined in url on manage tab
  • Loading branch information
arun-s-aot authored Dec 9, 2024
2 parents 7180b14 + 5cf8aa7 commit b5e0923
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
5 changes: 2 additions & 3 deletions forms-flow-nav/src/sidenav/MenuComponent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,13 @@ const MenuComponent = ({
subMenu,
optionsCount,
subscribe,
baseUrl
}) => {
const [tenant, setTenant] = React.useState({});
const location = useLocation();
const history = useHistory();
const tenantKey = tenant?.tenantId;
const baseUrl = MULTITENANCY_ENABLED ? `/tenant/${tenantKey}/` : "/";
const { t } = useTranslation();
const noOptionsMenu = optionsCount === "0";

React.useEffect(() => {
subscribe("ES_TENANT", (msg, data) => {
if (data) {
Expand Down Expand Up @@ -108,6 +106,7 @@ MenuComponent.propTypes = {
).isRequired,
optionsCount: PropTypes.string.isRequired,
subscribe: PropTypes.func.isRequired,
baseUrl: PropTypes.string.isRequired,
};

export default MenuComponent;
11 changes: 11 additions & 0 deletions forms-flow-nav/src/sidenav/Sidebar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,12 @@ const Sidebar = React.memo(({ props, sidenavHeight }) => {
JSON.parse(StorageService.get(StorageService.User.USER_DETAILS)) || {}
);
}, [instance]);

React.useEffect(() => {
if (MULTITENANCY_ENABLED && !tenant.tenantId && instance?.isAuthenticated) {
fetchTenantDetails(setTenant);
}
}, [instance]);

React.useEffect(() => {
props.subscribe("FF_AUTH", (msg, data) => {
Expand Down Expand Up @@ -229,6 +235,7 @@ const Sidebar = React.memo(({ props, sidenavHeight }) => {
{ENABLE_FORMS_MODULE &&
(isCreateDesigns || isViewDesigns) && (
<MenuComponent
baseUrl={baseUrl}
eventKey={SectionKeys.DESIGN}
optionsCount="5"
mainMenu="Design"
Expand Down Expand Up @@ -287,6 +294,7 @@ const Sidebar = React.memo(({ props, sidenavHeight }) => {
isViewSubmissions &&
ENABLE_APPLICATIONS_MODULE && (
<MenuComponent
baseUrl={baseUrl}
eventKey={SectionKeys.SUBMIT}
optionsCount="1"
mainMenu="Submit"
Expand All @@ -306,6 +314,7 @@ const Sidebar = React.memo(({ props, sidenavHeight }) => {
)}
{(isViewTask || isManageTask) && ENABLE_TASKS_MODULE && (
<MenuComponent
baseUrl={baseUrl}
eventKey={SectionKeys.REVIEW}
optionsCount="1"
mainMenu="Review"
Expand All @@ -321,6 +330,7 @@ const Sidebar = React.memo(({ props, sidenavHeight }) => {
)}
{isViewDashboard && ENABLE_DASHBOARDS_MODULE && (
<MenuComponent
baseUrl={baseUrl}
eventKey={SectionKeys.ANALYZE}
optionsCount="2"
mainMenu="Analyze"
Expand All @@ -345,6 +355,7 @@ const Sidebar = React.memo(({ props, sidenavHeight }) => {
)}
{isAdmin && (
<MenuComponent
baseUrl={baseUrl}
eventKey={SectionKeys.MANAGE}
optionsCount="3"
mainMenu="Manage"
Expand Down

0 comments on commit b5e0923

Please sign in to comment.