Skip to content

Commit 77e602a

Browse files
committed
added redirects to old routes
1 parent 8e18e2a commit 77e602a

File tree

3 files changed

+26
-72
lines changed

3 files changed

+26
-72
lines changed

frontend/javascripts/admin/auth/account_settings_view.tsx

Lines changed: 21 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -47,29 +47,27 @@ function AccountSettingsView() {
4747

4848
return (
4949
<Layout style={{ minHeight: "calc(100vh - 64px)" }} className="container">
50-
<Layout>
51-
<Sider width={200}>
52-
<Menu
53-
mode="inline"
54-
selectedKeys={[selectedKey]}
55-
style={{ height: "100%" }}
56-
items={menuItems}
57-
onClick={({ key }) => history.push(`/account/${key}`)}
58-
/>
59-
</Sider>
60-
<Content style={{ padding: "24px", paddingTop: 0, minHeight: 280, maxWidth: 1000 }}>
61-
<Breadcrumb style={{ marginBottom: "16px", padding: "8px 0" }}>
62-
<Breadcrumb.Item>Account Settings</Breadcrumb.Item>
63-
<Breadcrumb.Item>{subPageBreadcrumb}</Breadcrumb.Item>
64-
</Breadcrumb>
65-
<Switch>
66-
<Route path="/account/profile" component={ProfileView} />
67-
<Route path="/account/password" component={ChangePasswordView} />
68-
<Route path="/account/token" component={AuthTokenView} />
69-
<Route path="/account" component={ProfileView} />
70-
</Switch>
71-
</Content>
72-
</Layout>
50+
<Sider width={200}>
51+
<Menu
52+
mode="inline"
53+
selectedKeys={[selectedKey]}
54+
style={{ height: "100%" }}
55+
items={menuItems}
56+
onClick={({ key }) => history.push(`/account/${key}`)}
57+
/>
58+
</Sider>
59+
<Content style={{ padding: "24px", paddingTop: 0, minHeight: 280, maxWidth: 1000 }}>
60+
<Breadcrumb style={{ marginBottom: "16px", padding: "8px 0" }}>
61+
<Breadcrumb.Item>Account Settings</Breadcrumb.Item>
62+
<Breadcrumb.Item>{subPageBreadcrumb}</Breadcrumb.Item>
63+
</Breadcrumb>
64+
<Switch>
65+
<Route path="/account/profile" component={ProfileView} />
66+
<Route path="/account/password" component={ChangePasswordView} />
67+
<Route path="/account/token" component={AuthTokenView} />
68+
<Route path="/account" component={ProfileView} />
69+
</Switch>
70+
</Content>
7371
</Layout>
7472
);
7573
}

frontend/javascripts/navbar.tsx

Lines changed: 3 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import {
22
BarChartOutlined,
33
BellOutlined,
4-
CheckOutlined,
54
HomeOutlined,
65
QuestionCircleOutlined,
76
SwapOutlined,
@@ -36,7 +35,6 @@ import {
3635
sendAnalyticsEvent,
3736
switchToOrganization,
3837
updateNovelUserExperienceInfos,
39-
updateSelectedThemeOfUser,
4038
} from "admin/rest_api";
4139
import type { ItemType, MenuItemType, SubMenuType } from "antd/es/menu/interface";
4240
import { MaintenanceBanner, UpgradeVersionBanner } from "banners";
@@ -50,20 +48,14 @@ import * as Utils from "libs/utils";
5048
import window, { location } from "libs/window";
5149
import messages from "messages";
5250
import type { MenuClickEventHandler } from "rc-menu/lib/interface";
53-
import { getAntdTheme, getSystemColorTheme } from "theme";
54-
import type {
55-
APIOrganizationCompact,
56-
APIUser,
57-
APIUserCompact,
58-
APIUserTheme,
59-
} from "types/api_types";
51+
import { getAntdTheme } from "theme";
52+
import type { APIOrganizationCompact, APIUser, APIUserCompact } from "types/api_types";
6053
import constants from "viewer/constants";
6154
import {
6255
isAnnotationFromDifferentOrganization,
6356
isAnnotationOwner as isAnnotationOwnerAccessor,
6457
} from "viewer/model/accessors/annotation_accessor";
6558
import { formatUserName } from "viewer/model/accessors/user_accessor";
66-
import { setThemeAction } from "viewer/model/actions/ui_actions";
6759
import { logoutUserAction, setActiveUserAction } from "viewer/model/actions/user_actions";
6860
import type { WebknossosState } from "viewer/store";
6961
import Store from "viewer/store";
@@ -573,7 +565,7 @@ function LoggedInAvatar({
573565
handleLogout: (event: React.SyntheticEvent) => void;
574566
navbarHeight: number;
575567
} & SubMenuProps) {
576-
const { firstName, lastName, organization: organizationId, selectedTheme } = activeUser;
568+
const { firstName, lastName, organization: organizationId } = activeUser;
577569
const usersOrganizations = useFetch(getUsersOrganizations, [], []);
578570
const activeOrganization = usersOrganizations.find((org) => org.id === organizationId);
579571
const switchableOrganizations = usersOrganizations.filter((org) => org.id !== organizationId);
@@ -593,16 +585,6 @@ function LoggedInAvatar({
593585
}
594586
};
595587

596-
const setSelectedTheme = async (newTheme: APIUserTheme) => {
597-
if (newTheme === "auto") newTheme = getSystemColorTheme();
598-
599-
if (selectedTheme !== newTheme) {
600-
const newUser = await updateSelectedThemeOfUser(activeUser.id, newTheme);
601-
Store.dispatch(setThemeAction(newTheme));
602-
Store.dispatch(setActiveUserAction(newUser));
603-
}
604-
};
605-
606588
const maybeOrganizationFilterInput =
607589
switchableOrganizations.length > ORGANIZATION_COUNT_THRESHOLD_FOR_SEARCH_INPUT
608590
? [
@@ -673,34 +655,10 @@ function LoggedInAvatar({
673655
],
674656
}
675657
: null,
676-
{
677-
key: "resetpassword",
678-
label: <Link to="/account/password">Change Password</Link>,
679-
},
680-
{ key: "token", label: <Link to="/account/token">Auth Token</Link> },
681658
{
682659
key: "account",
683660
label: <Link to="/account">Account Settings</Link>,
684661
},
685-
{
686-
key: "theme",
687-
label: "Theme",
688-
children: [
689-
["auto", "System-default"],
690-
["light", "Light"],
691-
["dark", "Dark"],
692-
].map(([key, label]) => {
693-
return {
694-
key,
695-
label: label,
696-
icon: selectedTheme === key ? <CheckOutlined /> : null,
697-
onClick: () => {
698-
// @ts-expect-error ts-migrate(2345) FIXME: Argument of type 'string' is not assignable to par... Remove this comment to see the full error message
699-
setSelectedTheme(key);
700-
},
701-
};
702-
}),
703-
},
704662
{
705663
key: "logout",
706664
label: (

frontend/javascripts/router.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
import AcceptInviteView from "admin/auth/accept_invite_view";
2-
import AuthTokenView from "admin/auth/auth_token_view";
3-
import ChangePasswordView from "admin/auth/change_password_view";
42
import FinishResetPasswordView from "admin/auth/finish_reset_password_view";
53
import LoginView from "admin/auth/login_view";
64
import RegistrationView from "admin/auth/registration_view";
@@ -643,12 +641,12 @@ class ReactRouter extends React.Component<Props> {
643641
<SecuredRouteWithErrorBoundary
644642
isAuthenticated={isAuthenticated}
645643
path="/auth/token"
646-
component={AuthTokenView}
644+
render={() => <Redirect to="/account/login" />}
647645
/>
648646
<SecuredRouteWithErrorBoundary
649647
isAuthenticated={isAuthenticated}
650648
path="/auth/changePassword"
651-
component={ChangePasswordView}
649+
render={() => <Redirect to="/account/password" />}
652650
/>
653651
<RouteWithErrorBoundary path="/login" render={() => <Redirect to="/auth/login" />} />
654652

0 commit comments

Comments
 (0)