fleet/frontend/router/index.tsx

202 lines
8.6 KiB
TypeScript
Raw Normal View History

import React from "react";
import {
browserHistory,
IndexRedirect,
IndexRoute,
Route,
RouteComponent,
Router,
} from "react-router";
import AdminAppSettingsPage from "pages/admin/AppSettingsPage";
import AdminIntegrationsPage from "pages/admin/IntegrationsPage";
import AdminUserManagementPage from "pages/admin/UserManagementPage";
2021-04-14 16:52:15 +00:00
import AdminTeamManagementPage from "pages/admin/TeamManagementPage";
import TeamDetailsWrapper from "pages/admin/TeamManagementPage/TeamDetailsWrapper";
import App from "components/App";
import ConfirmInvitePage from "pages/ConfirmInvitePage";
import ConfirmSSOInvitePage from "pages/ConfirmSSOInvitePage";
import CoreLayout from "layouts/CoreLayout";
2022-06-23 17:32:20 +00:00
import GatedLayout from "layouts/GatedLayout";
import DeviceUserPage from "pages/hosts/details/DeviceUserPage";
import EditPackPage from "pages/packs/EditPackPage";
import EmailTokenRedirect from "components/EmailTokenRedirect";
import ForgotPasswordPage from "pages/ForgotPasswordPage";
import HostDetailsPage from "pages/hosts/details/HostDetailsPage";
import Homepage from "pages/Homepage";
import LabelPage from "pages/LabelPage";
import LoginPage, { LoginPreviewPage } from "pages/LoginPage";
import LogoutPage from "pages/LogoutPage";
import ManageHostsPage from "pages/hosts/ManageHostsPage";
import ManageSoftwarePage from "pages/software/ManageSoftwarePage";
import ManageQueriesPage from "pages/queries/ManageQueriesPage";
import ManagePacksPage from "pages/packs/ManagePacksPage";
2021-08-30 23:02:53 +00:00
import ManagePoliciesPage from "pages/policies/ManagePoliciesPage";
import ManageSchedulePage from "pages/schedule/ManageSchedulePage";
import PackComposerPage from "pages/packs/PackComposerPage";
import PolicyPage from "pages/policies/PolicyPage";
import QueryPage from "pages/queries/QueryPage";
import RegistrationPage from "pages/RegistrationPage";
import ResetPasswordPage from "pages/ResetPasswordPage";
2022-06-08 19:01:38 +00:00
import SoftwareDetailsPage from "pages/software/SoftwareDetailsPage";
import ApiOnlyUser from "pages/ApiOnlyUser";
import Fleet403 from "pages/errors/Fleet403";
import Fleet404 from "pages/errors/Fleet404";
import UserSettingsPage from "pages/UserSettingsPage";
import SettingsWrapper from "pages/admin/SettingsWrapper/SettingsWrapper";
import MembersPage from "pages/admin/TeamManagementPage/TeamDetailsWrapper/MembersPage";
import AgentOptionsPage from "pages/admin/TeamManagementPage/TeamDetailsWrapper/AgentOptionsPage";
import PATHS from "router/paths";
1497 improved query experience (#1998) * Step 1 for improving query experience (#1591) * fake change to create draft PR * temp routes to work and not modify old query page * created new API abstraction for query * refactored App.jsx to prepare react-query * fixed flow of redirects after page refresh; functional component added * setup for getting data on edit * implementing functions for query page * Old form showing on new setup * improving and breaking up query form * no need for the helpers anymore; clean up * added type for button component variant * step toward new save modal; have to switch gears to #1619 * creating new query works * clean up * linting cleanup * added default value for new query * will address dynamic save disabled in edit step * Step 2 for improving query experience (select targets) (#1732) * fake change to create draft PR * temp routes to work and not modify old query page * created new API abstraction for query * refactored App.jsx to prepare react-query * fixed flow of redirects after page refresh; functional component added * setup for getting data on edit * implementing functions for query page * Old form showing on new setup * improving and breaking up query form * no need for the helpers anymore; clean up * added type for button component variant * step toward new save modal; have to switch gears to #1619 * creating new query works * clean up * linting cleanup * added default value for new query * split steps into separate files for readability * components laid out * new targets picker * function clean up * styling tables * fixing logic * fixed logic to keep getting related hosts * formatting targets for API * fixed default query * clean up * styled target selectors; fixed target input styles * began total count * forgot to remove debugging code * lint fixes * added target count from API * clean up * able to remove selected host targets from table * lint fixes * Improving query experience - Step 3 (query results) (#1766) * fake change to create draft PR * temp routes to work and not modify old query page * created new API abstraction for query * refactored App.jsx to prepare react-query * fixed flow of redirects after page refresh; functional component added * setup for getting data on edit * implementing functions for query page * Old form showing on new setup * improving and breaking up query form * no need for the helpers anymore; clean up * added type for button component variant * step toward new save modal; have to switch gears to #1619 * creating new query works * clean up * linting cleanup * added default value for new query * split steps into separate files for readability * components laid out * new targets picker * function clean up * styling tables * fixing logic * fixed logic to keep getting related hosts * formatting targets for API * fixed default query * clean up * styled target selectors; fixed target input styles * began total count * forgot to remove debugging code * lint fixes * added target count from API * clean up * able to remove selected host targets from table * lint fixes * connected run query with modern React/JS; clean up * linting fixes * fixed logic to retrieve results from live query * linting fixes * created new, simpler query progress * populating results and errors tables as expected * syntax fixes * fixing styles for query results * more styling for query results * manual merge from main * Rename core->free and basic->premium * Fix lint js * Comment out portion of test that seems to timeout * Rename tier to premium if basic is still loaded * go sum * Query Experience Cleanup Tasks (#1807) * fixes to get merged main branch to build and work * moved screens for query pages; clean up * updated and typed react ace for query form; clean up * using console error instead * added real types instead of `any` except for errors * query side panel ts and functional. prep for close task. * ability to hide, show query table sidebar * improved live query status warning * added loading and error state for targets search * error screen for targets; improved loading display * now using API-created label for all linux * missed some files on previous commit * able to edit query * clean up * lint fixes * query results showing as they come * remove unused code * removed old query page. major file cleanup. * removed selectedTargets redux implementation * removed unused redux actions and reducers * removed unused keys in initial state * selectedOsqueryTable is now using context API * removed all querypages redux code * set up context for app and user * fixed auth with temp fix for wrapper * completed redux removal from query page * fixed var names coming from main branch * fixed var name changes coming from issue 1501 * fixed save popup bug; clean up * added permissions * fixed login redirect * removed unused props * linting fix * clean up * removed unused component, refactor, and clean up * fixed styles for step 1 as admin * fixed styles for step 1 as observer * fixed percentage of online hosts * added loading progress to query stop button * reset query status on run again * added download icon to export button text * fixed error reset on name input; fixed styles * fixed bug where query value wasn't saving * fixed query value when blank * fixed bug - default query was running every time * auto adding host from url to targets * fixed flows for repeating run and save steps * fleet ace is now TS and functional * fixed a couple of tests * fixed issues with query value text inconsistencies * fixed query side panel not showing * hiding error count if not > 0 * fixed showing editor for different roles * using integer for targets * go sum * fixed targets param * catching all errors while running query * fixed hover state for title and description * ignore unit test for now; lint fixes * locking react-ace version * ignoring tests breaking in github actions * brought tests back * fixing file name * fixing file name again * fixed e2e test * have to ignore tests for now * ignore certain premium tests for now * one last test to revamp * another test * fixed teamflow test * fixed observer query 403 * lint fixes * fixed maintainer test * added changes file Co-authored-by: Tomas Touceda <chiiph@gmail.com>
2021-09-10 19:06:37 +00:00
import AppProvider from "context/app";
import RoutingProvider from "context/routing";
1497 improved query experience (#1998) * Step 1 for improving query experience (#1591) * fake change to create draft PR * temp routes to work and not modify old query page * created new API abstraction for query * refactored App.jsx to prepare react-query * fixed flow of redirects after page refresh; functional component added * setup for getting data on edit * implementing functions for query page * Old form showing on new setup * improving and breaking up query form * no need for the helpers anymore; clean up * added type for button component variant * step toward new save modal; have to switch gears to #1619 * creating new query works * clean up * linting cleanup * added default value for new query * will address dynamic save disabled in edit step * Step 2 for improving query experience (select targets) (#1732) * fake change to create draft PR * temp routes to work and not modify old query page * created new API abstraction for query * refactored App.jsx to prepare react-query * fixed flow of redirects after page refresh; functional component added * setup for getting data on edit * implementing functions for query page * Old form showing on new setup * improving and breaking up query form * no need for the helpers anymore; clean up * added type for button component variant * step toward new save modal; have to switch gears to #1619 * creating new query works * clean up * linting cleanup * added default value for new query * split steps into separate files for readability * components laid out * new targets picker * function clean up * styling tables * fixing logic * fixed logic to keep getting related hosts * formatting targets for API * fixed default query * clean up * styled target selectors; fixed target input styles * began total count * forgot to remove debugging code * lint fixes * added target count from API * clean up * able to remove selected host targets from table * lint fixes * Improving query experience - Step 3 (query results) (#1766) * fake change to create draft PR * temp routes to work and not modify old query page * created new API abstraction for query * refactored App.jsx to prepare react-query * fixed flow of redirects after page refresh; functional component added * setup for getting data on edit * implementing functions for query page * Old form showing on new setup * improving and breaking up query form * no need for the helpers anymore; clean up * added type for button component variant * step toward new save modal; have to switch gears to #1619 * creating new query works * clean up * linting cleanup * added default value for new query * split steps into separate files for readability * components laid out * new targets picker * function clean up * styling tables * fixing logic * fixed logic to keep getting related hosts * formatting targets for API * fixed default query * clean up * styled target selectors; fixed target input styles * began total count * forgot to remove debugging code * lint fixes * added target count from API * clean up * able to remove selected host targets from table * lint fixes * connected run query with modern React/JS; clean up * linting fixes * fixed logic to retrieve results from live query * linting fixes * created new, simpler query progress * populating results and errors tables as expected * syntax fixes * fixing styles for query results * more styling for query results * manual merge from main * Rename core->free and basic->premium * Fix lint js * Comment out portion of test that seems to timeout * Rename tier to premium if basic is still loaded * go sum * Query Experience Cleanup Tasks (#1807) * fixes to get merged main branch to build and work * moved screens for query pages; clean up * updated and typed react ace for query form; clean up * using console error instead * added real types instead of `any` except for errors * query side panel ts and functional. prep for close task. * ability to hide, show query table sidebar * improved live query status warning * added loading and error state for targets search * error screen for targets; improved loading display * now using API-created label for all linux * missed some files on previous commit * able to edit query * clean up * lint fixes * query results showing as they come * remove unused code * removed old query page. major file cleanup. * removed selectedTargets redux implementation * removed unused redux actions and reducers * removed unused keys in initial state * selectedOsqueryTable is now using context API * removed all querypages redux code * set up context for app and user * fixed auth with temp fix for wrapper * completed redux removal from query page * fixed var names coming from main branch * fixed var name changes coming from issue 1501 * fixed save popup bug; clean up * added permissions * fixed login redirect * removed unused props * linting fix * clean up * removed unused component, refactor, and clean up * fixed styles for step 1 as admin * fixed styles for step 1 as observer * fixed percentage of online hosts * added loading progress to query stop button * reset query status on run again * added download icon to export button text * fixed error reset on name input; fixed styles * fixed bug where query value wasn't saving * fixed query value when blank * fixed bug - default query was running every time * auto adding host from url to targets * fixed flows for repeating run and save steps * fleet ace is now TS and functional * fixed a couple of tests * fixed issues with query value text inconsistencies * fixed query side panel not showing * hiding error count if not > 0 * fixed showing editor for different roles * using integer for targets * go sum * fixed targets param * catching all errors while running query * fixed hover state for title and description * ignore unit test for now; lint fixes * locking react-ace version * ignoring tests breaking in github actions * brought tests back * fixing file name * fixing file name again * fixed e2e test * have to ignore tests for now * ignore certain premium tests for now * one last test to revamp * another test * fixed teamflow test * fixed observer query 403 * lint fixes * fixed maintainer test * added changes file Co-authored-by: Tomas Touceda <chiiph@gmail.com>
2021-09-10 19:06:37 +00:00
import AuthGlobalAdminRoutes from "./components/AuthGlobalAdminRoutes";
import AuthAnyAdminRoutes from "./components/AuthAnyAdminRoutes";
import AuthenticatedRoutes from "./components/AuthenticatedRoutes";
import UnauthenticatedRoutes from "./components/UnauthenticatedRoutes";
import AuthGlobalAdminMaintainerRoutes from "./components/AuthGlobalAdminMaintainerRoutes";
import AuthAnyMaintainerAnyAdminRoutes from "./components/AuthAnyMaintainerAnyAdminRoutes";
import PremiumRoutes from "./components/PremiumRoutes";
1497 improved query experience (#1998) * Step 1 for improving query experience (#1591) * fake change to create draft PR * temp routes to work and not modify old query page * created new API abstraction for query * refactored App.jsx to prepare react-query * fixed flow of redirects after page refresh; functional component added * setup for getting data on edit * implementing functions for query page * Old form showing on new setup * improving and breaking up query form * no need for the helpers anymore; clean up * added type for button component variant * step toward new save modal; have to switch gears to #1619 * creating new query works * clean up * linting cleanup * added default value for new query * will address dynamic save disabled in edit step * Step 2 for improving query experience (select targets) (#1732) * fake change to create draft PR * temp routes to work and not modify old query page * created new API abstraction for query * refactored App.jsx to prepare react-query * fixed flow of redirects after page refresh; functional component added * setup for getting data on edit * implementing functions for query page * Old form showing on new setup * improving and breaking up query form * no need for the helpers anymore; clean up * added type for button component variant * step toward new save modal; have to switch gears to #1619 * creating new query works * clean up * linting cleanup * added default value for new query * split steps into separate files for readability * components laid out * new targets picker * function clean up * styling tables * fixing logic * fixed logic to keep getting related hosts * formatting targets for API * fixed default query * clean up * styled target selectors; fixed target input styles * began total count * forgot to remove debugging code * lint fixes * added target count from API * clean up * able to remove selected host targets from table * lint fixes * Improving query experience - Step 3 (query results) (#1766) * fake change to create draft PR * temp routes to work and not modify old query page * created new API abstraction for query * refactored App.jsx to prepare react-query * fixed flow of redirects after page refresh; functional component added * setup for getting data on edit * implementing functions for query page * Old form showing on new setup * improving and breaking up query form * no need for the helpers anymore; clean up * added type for button component variant * step toward new save modal; have to switch gears to #1619 * creating new query works * clean up * linting cleanup * added default value for new query * split steps into separate files for readability * components laid out * new targets picker * function clean up * styling tables * fixing logic * fixed logic to keep getting related hosts * formatting targets for API * fixed default query * clean up * styled target selectors; fixed target input styles * began total count * forgot to remove debugging code * lint fixes * added target count from API * clean up * able to remove selected host targets from table * lint fixes * connected run query with modern React/JS; clean up * linting fixes * fixed logic to retrieve results from live query * linting fixes * created new, simpler query progress * populating results and errors tables as expected * syntax fixes * fixing styles for query results * more styling for query results * manual merge from main * Rename core->free and basic->premium * Fix lint js * Comment out portion of test that seems to timeout * Rename tier to premium if basic is still loaded * go sum * Query Experience Cleanup Tasks (#1807) * fixes to get merged main branch to build and work * moved screens for query pages; clean up * updated and typed react ace for query form; clean up * using console error instead * added real types instead of `any` except for errors * query side panel ts and functional. prep for close task. * ability to hide, show query table sidebar * improved live query status warning * added loading and error state for targets search * error screen for targets; improved loading display * now using API-created label for all linux * missed some files on previous commit * able to edit query * clean up * lint fixes * query results showing as they come * remove unused code * removed old query page. major file cleanup. * removed selectedTargets redux implementation * removed unused redux actions and reducers * removed unused keys in initial state * selectedOsqueryTable is now using context API * removed all querypages redux code * set up context for app and user * fixed auth with temp fix for wrapper * completed redux removal from query page * fixed var names coming from main branch * fixed var name changes coming from issue 1501 * fixed save popup bug; clean up * added permissions * fixed login redirect * removed unused props * linting fix * clean up * removed unused component, refactor, and clean up * fixed styles for step 1 as admin * fixed styles for step 1 as observer * fixed percentage of online hosts * added loading progress to query stop button * reset query status on run again * added download icon to export button text * fixed error reset on name input; fixed styles * fixed bug where query value wasn't saving * fixed query value when blank * fixed bug - default query was running every time * auto adding host from url to targets * fixed flows for repeating run and save steps * fleet ace is now TS and functional * fixed a couple of tests * fixed issues with query value text inconsistencies * fixed query side panel not showing * hiding error count if not > 0 * fixed showing editor for different roles * using integer for targets * go sum * fixed targets param * catching all errors while running query * fixed hover state for title and description * ignore unit test for now; lint fixes * locking react-ace version * ignoring tests breaking in github actions * brought tests back * fixing file name * fixing file name again * fixed e2e test * have to ignore tests for now * ignore certain premium tests for now * one last test to revamp * another test * fixed teamflow test * fixed observer query 403 * lint fixes * fixed maintainer test * added changes file Co-authored-by: Tomas Touceda <chiiph@gmail.com>
2021-09-10 19:06:37 +00:00
interface IAppWrapperProps {
children: JSX.Element;
location?: {
pathname: string;
};
1497 improved query experience (#1998) * Step 1 for improving query experience (#1591) * fake change to create draft PR * temp routes to work and not modify old query page * created new API abstraction for query * refactored App.jsx to prepare react-query * fixed flow of redirects after page refresh; functional component added * setup for getting data on edit * implementing functions for query page * Old form showing on new setup * improving and breaking up query form * no need for the helpers anymore; clean up * added type for button component variant * step toward new save modal; have to switch gears to #1619 * creating new query works * clean up * linting cleanup * added default value for new query * will address dynamic save disabled in edit step * Step 2 for improving query experience (select targets) (#1732) * fake change to create draft PR * temp routes to work and not modify old query page * created new API abstraction for query * refactored App.jsx to prepare react-query * fixed flow of redirects after page refresh; functional component added * setup for getting data on edit * implementing functions for query page * Old form showing on new setup * improving and breaking up query form * no need for the helpers anymore; clean up * added type for button component variant * step toward new save modal; have to switch gears to #1619 * creating new query works * clean up * linting cleanup * added default value for new query * split steps into separate files for readability * components laid out * new targets picker * function clean up * styling tables * fixing logic * fixed logic to keep getting related hosts * formatting targets for API * fixed default query * clean up * styled target selectors; fixed target input styles * began total count * forgot to remove debugging code * lint fixes * added target count from API * clean up * able to remove selected host targets from table * lint fixes * Improving query experience - Step 3 (query results) (#1766) * fake change to create draft PR * temp routes to work and not modify old query page * created new API abstraction for query * refactored App.jsx to prepare react-query * fixed flow of redirects after page refresh; functional component added * setup for getting data on edit * implementing functions for query page * Old form showing on new setup * improving and breaking up query form * no need for the helpers anymore; clean up * added type for button component variant * step toward new save modal; have to switch gears to #1619 * creating new query works * clean up * linting cleanup * added default value for new query * split steps into separate files for readability * components laid out * new targets picker * function clean up * styling tables * fixing logic * fixed logic to keep getting related hosts * formatting targets for API * fixed default query * clean up * styled target selectors; fixed target input styles * began total count * forgot to remove debugging code * lint fixes * added target count from API * clean up * able to remove selected host targets from table * lint fixes * connected run query with modern React/JS; clean up * linting fixes * fixed logic to retrieve results from live query * linting fixes * created new, simpler query progress * populating results and errors tables as expected * syntax fixes * fixing styles for query results * more styling for query results * manual merge from main * Rename core->free and basic->premium * Fix lint js * Comment out portion of test that seems to timeout * Rename tier to premium if basic is still loaded * go sum * Query Experience Cleanup Tasks (#1807) * fixes to get merged main branch to build and work * moved screens for query pages; clean up * updated and typed react ace for query form; clean up * using console error instead * added real types instead of `any` except for errors * query side panel ts and functional. prep for close task. * ability to hide, show query table sidebar * improved live query status warning * added loading and error state for targets search * error screen for targets; improved loading display * now using API-created label for all linux * missed some files on previous commit * able to edit query * clean up * lint fixes * query results showing as they come * remove unused code * removed old query page. major file cleanup. * removed selectedTargets redux implementation * removed unused redux actions and reducers * removed unused keys in initial state * selectedOsqueryTable is now using context API * removed all querypages redux code * set up context for app and user * fixed auth with temp fix for wrapper * completed redux removal from query page * fixed var names coming from main branch * fixed var name changes coming from issue 1501 * fixed save popup bug; clean up * added permissions * fixed login redirect * removed unused props * linting fix * clean up * removed unused component, refactor, and clean up * fixed styles for step 1 as admin * fixed styles for step 1 as observer * fixed percentage of online hosts * added loading progress to query stop button * reset query status on run again * added download icon to export button text * fixed error reset on name input; fixed styles * fixed bug where query value wasn't saving * fixed query value when blank * fixed bug - default query was running every time * auto adding host from url to targets * fixed flows for repeating run and save steps * fleet ace is now TS and functional * fixed a couple of tests * fixed issues with query value text inconsistencies * fixed query side panel not showing * hiding error count if not > 0 * fixed showing editor for different roles * using integer for targets * go sum * fixed targets param * catching all errors while running query * fixed hover state for title and description * ignore unit test for now; lint fixes * locking react-ace version * ignoring tests breaking in github actions * brought tests back * fixing file name * fixing file name again * fixed e2e test * have to ignore tests for now * ignore certain premium tests for now * one last test to revamp * another test * fixed teamflow test * fixed observer query 403 * lint fixes * fixed maintainer test * added changes file Co-authored-by: Tomas Touceda <chiiph@gmail.com>
2021-09-10 19:06:37 +00:00
}
2016-09-06 18:41:16 +00:00
1497 improved query experience (#1998) * Step 1 for improving query experience (#1591) * fake change to create draft PR * temp routes to work and not modify old query page * created new API abstraction for query * refactored App.jsx to prepare react-query * fixed flow of redirects after page refresh; functional component added * setup for getting data on edit * implementing functions for query page * Old form showing on new setup * improving and breaking up query form * no need for the helpers anymore; clean up * added type for button component variant * step toward new save modal; have to switch gears to #1619 * creating new query works * clean up * linting cleanup * added default value for new query * will address dynamic save disabled in edit step * Step 2 for improving query experience (select targets) (#1732) * fake change to create draft PR * temp routes to work and not modify old query page * created new API abstraction for query * refactored App.jsx to prepare react-query * fixed flow of redirects after page refresh; functional component added * setup for getting data on edit * implementing functions for query page * Old form showing on new setup * improving and breaking up query form * no need for the helpers anymore; clean up * added type for button component variant * step toward new save modal; have to switch gears to #1619 * creating new query works * clean up * linting cleanup * added default value for new query * split steps into separate files for readability * components laid out * new targets picker * function clean up * styling tables * fixing logic * fixed logic to keep getting related hosts * formatting targets for API * fixed default query * clean up * styled target selectors; fixed target input styles * began total count * forgot to remove debugging code * lint fixes * added target count from API * clean up * able to remove selected host targets from table * lint fixes * Improving query experience - Step 3 (query results) (#1766) * fake change to create draft PR * temp routes to work and not modify old query page * created new API abstraction for query * refactored App.jsx to prepare react-query * fixed flow of redirects after page refresh; functional component added * setup for getting data on edit * implementing functions for query page * Old form showing on new setup * improving and breaking up query form * no need for the helpers anymore; clean up * added type for button component variant * step toward new save modal; have to switch gears to #1619 * creating new query works * clean up * linting cleanup * added default value for new query * split steps into separate files for readability * components laid out * new targets picker * function clean up * styling tables * fixing logic * fixed logic to keep getting related hosts * formatting targets for API * fixed default query * clean up * styled target selectors; fixed target input styles * began total count * forgot to remove debugging code * lint fixes * added target count from API * clean up * able to remove selected host targets from table * lint fixes * connected run query with modern React/JS; clean up * linting fixes * fixed logic to retrieve results from live query * linting fixes * created new, simpler query progress * populating results and errors tables as expected * syntax fixes * fixing styles for query results * more styling for query results * manual merge from main * Rename core->free and basic->premium * Fix lint js * Comment out portion of test that seems to timeout * Rename tier to premium if basic is still loaded * go sum * Query Experience Cleanup Tasks (#1807) * fixes to get merged main branch to build and work * moved screens for query pages; clean up * updated and typed react ace for query form; clean up * using console error instead * added real types instead of `any` except for errors * query side panel ts and functional. prep for close task. * ability to hide, show query table sidebar * improved live query status warning * added loading and error state for targets search * error screen for targets; improved loading display * now using API-created label for all linux * missed some files on previous commit * able to edit query * clean up * lint fixes * query results showing as they come * remove unused code * removed old query page. major file cleanup. * removed selectedTargets redux implementation * removed unused redux actions and reducers * removed unused keys in initial state * selectedOsqueryTable is now using context API * removed all querypages redux code * set up context for app and user * fixed auth with temp fix for wrapper * completed redux removal from query page * fixed var names coming from main branch * fixed var name changes coming from issue 1501 * fixed save popup bug; clean up * added permissions * fixed login redirect * removed unused props * linting fix * clean up * removed unused component, refactor, and clean up * fixed styles for step 1 as admin * fixed styles for step 1 as observer * fixed percentage of online hosts * added loading progress to query stop button * reset query status on run again * added download icon to export button text * fixed error reset on name input; fixed styles * fixed bug where query value wasn't saving * fixed query value when blank * fixed bug - default query was running every time * auto adding host from url to targets * fixed flows for repeating run and save steps * fleet ace is now TS and functional * fixed a couple of tests * fixed issues with query value text inconsistencies * fixed query side panel not showing * hiding error count if not > 0 * fixed showing editor for different roles * using integer for targets * go sum * fixed targets param * catching all errors while running query * fixed hover state for title and description * ignore unit test for now; lint fixes * locking react-ace version * ignoring tests breaking in github actions * brought tests back * fixing file name * fixing file name again * fixed e2e test * have to ignore tests for now * ignore certain premium tests for now * one last test to revamp * another test * fixed teamflow test * fixed observer query 403 * lint fixes * fixed maintainer test * added changes file Co-authored-by: Tomas Touceda <chiiph@gmail.com>
2021-09-10 19:06:37 +00:00
// App.tsx needs the context for user and config
const AppWrapper = ({ children, location }: IAppWrapperProps) => (
1497 improved query experience (#1998) * Step 1 for improving query experience (#1591) * fake change to create draft PR * temp routes to work and not modify old query page * created new API abstraction for query * refactored App.jsx to prepare react-query * fixed flow of redirects after page refresh; functional component added * setup for getting data on edit * implementing functions for query page * Old form showing on new setup * improving and breaking up query form * no need for the helpers anymore; clean up * added type for button component variant * step toward new save modal; have to switch gears to #1619 * creating new query works * clean up * linting cleanup * added default value for new query * will address dynamic save disabled in edit step * Step 2 for improving query experience (select targets) (#1732) * fake change to create draft PR * temp routes to work and not modify old query page * created new API abstraction for query * refactored App.jsx to prepare react-query * fixed flow of redirects after page refresh; functional component added * setup for getting data on edit * implementing functions for query page * Old form showing on new setup * improving and breaking up query form * no need for the helpers anymore; clean up * added type for button component variant * step toward new save modal; have to switch gears to #1619 * creating new query works * clean up * linting cleanup * added default value for new query * split steps into separate files for readability * components laid out * new targets picker * function clean up * styling tables * fixing logic * fixed logic to keep getting related hosts * formatting targets for API * fixed default query * clean up * styled target selectors; fixed target input styles * began total count * forgot to remove debugging code * lint fixes * added target count from API * clean up * able to remove selected host targets from table * lint fixes * Improving query experience - Step 3 (query results) (#1766) * fake change to create draft PR * temp routes to work and not modify old query page * created new API abstraction for query * refactored App.jsx to prepare react-query * fixed flow of redirects after page refresh; functional component added * setup for getting data on edit * implementing functions for query page * Old form showing on new setup * improving and breaking up query form * no need for the helpers anymore; clean up * added type for button component variant * step toward new save modal; have to switch gears to #1619 * creating new query works * clean up * linting cleanup * added default value for new query * split steps into separate files for readability * components laid out * new targets picker * function clean up * styling tables * fixing logic * fixed logic to keep getting related hosts * formatting targets for API * fixed default query * clean up * styled target selectors; fixed target input styles * began total count * forgot to remove debugging code * lint fixes * added target count from API * clean up * able to remove selected host targets from table * lint fixes * connected run query with modern React/JS; clean up * linting fixes * fixed logic to retrieve results from live query * linting fixes * created new, simpler query progress * populating results and errors tables as expected * syntax fixes * fixing styles for query results * more styling for query results * manual merge from main * Rename core->free and basic->premium * Fix lint js * Comment out portion of test that seems to timeout * Rename tier to premium if basic is still loaded * go sum * Query Experience Cleanup Tasks (#1807) * fixes to get merged main branch to build and work * moved screens for query pages; clean up * updated and typed react ace for query form; clean up * using console error instead * added real types instead of `any` except for errors * query side panel ts and functional. prep for close task. * ability to hide, show query table sidebar * improved live query status warning * added loading and error state for targets search * error screen for targets; improved loading display * now using API-created label for all linux * missed some files on previous commit * able to edit query * clean up * lint fixes * query results showing as they come * remove unused code * removed old query page. major file cleanup. * removed selectedTargets redux implementation * removed unused redux actions and reducers * removed unused keys in initial state * selectedOsqueryTable is now using context API * removed all querypages redux code * set up context for app and user * fixed auth with temp fix for wrapper * completed redux removal from query page * fixed var names coming from main branch * fixed var name changes coming from issue 1501 * fixed save popup bug; clean up * added permissions * fixed login redirect * removed unused props * linting fix * clean up * removed unused component, refactor, and clean up * fixed styles for step 1 as admin * fixed styles for step 1 as observer * fixed percentage of online hosts * added loading progress to query stop button * reset query status on run again * added download icon to export button text * fixed error reset on name input; fixed styles * fixed bug where query value wasn't saving * fixed query value when blank * fixed bug - default query was running every time * auto adding host from url to targets * fixed flows for repeating run and save steps * fleet ace is now TS and functional * fixed a couple of tests * fixed issues with query value text inconsistencies * fixed query side panel not showing * hiding error count if not > 0 * fixed showing editor for different roles * using integer for targets * go sum * fixed targets param * catching all errors while running query * fixed hover state for title and description * ignore unit test for now; lint fixes * locking react-ace version * ignoring tests breaking in github actions * brought tests back * fixing file name * fixing file name again * fixed e2e test * have to ignore tests for now * ignore certain premium tests for now * one last test to revamp * another test * fixed teamflow test * fixed observer query 403 * lint fixes * fixed maintainer test * added changes file Co-authored-by: Tomas Touceda <chiiph@gmail.com>
2021-09-10 19:06:37 +00:00
<AppProvider>
<RoutingProvider>
<App location={location}>{children}</App>
</RoutingProvider>
1497 improved query experience (#1998) * Step 1 for improving query experience (#1591) * fake change to create draft PR * temp routes to work and not modify old query page * created new API abstraction for query * refactored App.jsx to prepare react-query * fixed flow of redirects after page refresh; functional component added * setup for getting data on edit * implementing functions for query page * Old form showing on new setup * improving and breaking up query form * no need for the helpers anymore; clean up * added type for button component variant * step toward new save modal; have to switch gears to #1619 * creating new query works * clean up * linting cleanup * added default value for new query * will address dynamic save disabled in edit step * Step 2 for improving query experience (select targets) (#1732) * fake change to create draft PR * temp routes to work and not modify old query page * created new API abstraction for query * refactored App.jsx to prepare react-query * fixed flow of redirects after page refresh; functional component added * setup for getting data on edit * implementing functions for query page * Old form showing on new setup * improving and breaking up query form * no need for the helpers anymore; clean up * added type for button component variant * step toward new save modal; have to switch gears to #1619 * creating new query works * clean up * linting cleanup * added default value for new query * split steps into separate files for readability * components laid out * new targets picker * function clean up * styling tables * fixing logic * fixed logic to keep getting related hosts * formatting targets for API * fixed default query * clean up * styled target selectors; fixed target input styles * began total count * forgot to remove debugging code * lint fixes * added target count from API * clean up * able to remove selected host targets from table * lint fixes * Improving query experience - Step 3 (query results) (#1766) * fake change to create draft PR * temp routes to work and not modify old query page * created new API abstraction for query * refactored App.jsx to prepare react-query * fixed flow of redirects after page refresh; functional component added * setup for getting data on edit * implementing functions for query page * Old form showing on new setup * improving and breaking up query form * no need for the helpers anymore; clean up * added type for button component variant * step toward new save modal; have to switch gears to #1619 * creating new query works * clean up * linting cleanup * added default value for new query * split steps into separate files for readability * components laid out * new targets picker * function clean up * styling tables * fixing logic * fixed logic to keep getting related hosts * formatting targets for API * fixed default query * clean up * styled target selectors; fixed target input styles * began total count * forgot to remove debugging code * lint fixes * added target count from API * clean up * able to remove selected host targets from table * lint fixes * connected run query with modern React/JS; clean up * linting fixes * fixed logic to retrieve results from live query * linting fixes * created new, simpler query progress * populating results and errors tables as expected * syntax fixes * fixing styles for query results * more styling for query results * manual merge from main * Rename core->free and basic->premium * Fix lint js * Comment out portion of test that seems to timeout * Rename tier to premium if basic is still loaded * go sum * Query Experience Cleanup Tasks (#1807) * fixes to get merged main branch to build and work * moved screens for query pages; clean up * updated and typed react ace for query form; clean up * using console error instead * added real types instead of `any` except for errors * query side panel ts and functional. prep for close task. * ability to hide, show query table sidebar * improved live query status warning * added loading and error state for targets search * error screen for targets; improved loading display * now using API-created label for all linux * missed some files on previous commit * able to edit query * clean up * lint fixes * query results showing as they come * remove unused code * removed old query page. major file cleanup. * removed selectedTargets redux implementation * removed unused redux actions and reducers * removed unused keys in initial state * selectedOsqueryTable is now using context API * removed all querypages redux code * set up context for app and user * fixed auth with temp fix for wrapper * completed redux removal from query page * fixed var names coming from main branch * fixed var name changes coming from issue 1501 * fixed save popup bug; clean up * added permissions * fixed login redirect * removed unused props * linting fix * clean up * removed unused component, refactor, and clean up * fixed styles for step 1 as admin * fixed styles for step 1 as observer * fixed percentage of online hosts * added loading progress to query stop button * reset query status on run again * added download icon to export button text * fixed error reset on name input; fixed styles * fixed bug where query value wasn't saving * fixed query value when blank * fixed bug - default query was running every time * auto adding host from url to targets * fixed flows for repeating run and save steps * fleet ace is now TS and functional * fixed a couple of tests * fixed issues with query value text inconsistencies * fixed query side panel not showing * hiding error count if not > 0 * fixed showing editor for different roles * using integer for targets * go sum * fixed targets param * catching all errors while running query * fixed hover state for title and description * ignore unit test for now; lint fixes * locking react-ace version * ignoring tests breaking in github actions * brought tests back * fixing file name * fixing file name again * fixed e2e test * have to ignore tests for now * ignore certain premium tests for now * one last test to revamp * another test * fixed teamflow test * fixed observer query 403 * lint fixes * fixed maintainer test * added changes file Co-authored-by: Tomas Touceda <chiiph@gmail.com>
2021-09-10 19:06:37 +00:00
</AppProvider>
);
2016-09-07 00:04:02 +00:00
const routes = (
<Router history={browserHistory}>
<Route path={PATHS.ROOT} component={AppWrapper}>
2022-06-23 17:32:20 +00:00
<Route component={UnauthenticatedRoutes as RouteComponent}>
<Route component={GatedLayout}>
<Route path="setup" component={RegistrationPage} />
<Route path="previewlogin" component={LoginPreviewPage} />
<Route path="login" component={LoginPage} />
<Route
path="login/invites/:invite_token"
component={ConfirmInvitePage}
/>
<Route
path="login/ssoinvites/:invite_token"
component={ConfirmSSOInvitePage}
/>
<Route path="login/forgot" component={ForgotPasswordPage} />
<Route path="login/reset" component={ResetPasswordPage} />
</Route>
</Route>
<Route component={AuthenticatedRoutes as RouteComponent}>
<Route path="email/change/:token" component={EmailTokenRedirect} />
<Route path="logout" component={LogoutPage} />
<Route component={CoreLayout}>
<IndexRedirect to={"dashboard"} />
<Route path="dashboard" component={Homepage} />
<Route path="settings" component={AuthAnyAdminRoutes}>
<IndexRedirect to={"/dashboard"} />
<Route component={SettingsWrapper}>
<Route component={AuthGlobalAdminRoutes}>
<Route path="organization" component={AdminAppSettingsPage} />
<Route
path="organization/:section"
component={AdminAppSettingsPage}
/>
<Route path="integrations" component={AdminIntegrationsPage} />
<Route path="users" component={AdminUserManagementPage} />
<Route component={PremiumRoutes}>
<Route path="teams" component={AdminTeamManagementPage} />
</Route>
</Route>
</Route>
<Route path="teams/:team_id" component={TeamDetailsWrapper}>
<Route path="members" component={MembersPage} />
<Route path="options" component={AgentOptionsPage} />
</Route>
</Route>
<Route path="labels">
<IndexRedirect to={"new"} />
<Route path=":label_id" component={LabelPage} />
<Route path="new" component={LabelPage} />
</Route>
<Route path="hosts">
<IndexRedirect to={"manage"} />
<Route path="manage" component={ManageHostsPage} />
<Route path="manage/labels/:label_id" component={ManageHostsPage} />
<Route path="manage/:active_label" component={ManageHostsPage} />
<Route
path="manage/labels/:label_id/:active_label"
component={ManageHostsPage}
/>
<Route
path="manage/:active_label/labels/:label_id"
component={ManageHostsPage}
/>
<Route path=":host_id" component={HostDetailsPage} />
</Route>
<Route path="software">
<IndexRedirect to={"manage"} />
<Route path="manage" component={ManageSoftwarePage} />
2022-06-08 19:01:38 +00:00
<Route path=":software_id" component={SoftwareDetailsPage} />
</Route>
<Route component={AuthGlobalAdminMaintainerRoutes}>
<Route path="packs">
<IndexRedirect to={"manage"} />
<Route path="manage" component={ManagePacksPage} />
<Route path="new" component={PackComposerPage} />
<Route path=":id">
<IndexRoute component={EditPackPage} />
<Route path="edit" component={EditPackPage} />
</Route>
</Route>
</Route>
<Route component={AuthAnyMaintainerAnyAdminRoutes}>
<Route path="schedule">
<IndexRedirect to={"manage"} />
<Route path="manage" component={ManageSchedulePage} />
<Route
path="manage/teams/:team_id"
component={ManageSchedulePage}
/>
</Route>
</Route>
<Route path="queries">
<IndexRedirect to={"manage"} />
<Route path="manage" component={ManageQueriesPage} />
<Route component={AuthAnyMaintainerAnyAdminRoutes}>
<Route path="new" component={QueryPage} />
</Route>
<Route path=":id" component={QueryPage} />
</Route>
<Route path="policies">
<IndexRedirect to={"manage"} />
<Route path="manage" component={ManagePoliciesPage} />
<Route component={AuthAnyMaintainerAnyAdminRoutes}>
<Route path="new" component={PolicyPage} />
</Route>
<Route path=":id" component={PolicyPage} />
</Route>
<Route
path="profile"
component={UserSettingsPage as RouteComponent}
/>
</Route>
</Route>
<Route path="/device/:device_auth_token" component={DeviceUserPage} />
</Route>
<Route path="/apionlyuser" component={ApiOnlyUser} />
<Route path="/404" component={Fleet404} />
<Route path="/403" component={Fleet403} />
<Route path="*" component={Fleet404} />
</Router>
2016-09-07 00:04:02 +00:00
);
2016-09-07 00:04:02 +00:00
export default routes;