2020-09-24 04:47:37 +00:00
|
|
|
import React from "react";
|
2020-09-24 16:05:18 +00:00
|
|
|
import { Route, RouteComponentProps } from "react-router-dom";
|
2020-08-28 17:23:07 +00:00
|
|
|
import * as Sentry from "@sentry/react";
|
2020-09-24 04:47:37 +00:00
|
|
|
import { connect } from "react-redux";
|
2021-02-11 12:54:00 +00:00
|
|
|
import { getCurrentThemeDetails, ThemeMode } from "selectors/themeSelectors";
|
2020-09-21 13:08:57 +00:00
|
|
|
import { AppState } from "reducers";
|
|
|
|
|
import { setThemeMode } from "actions/themeActions";
|
2020-09-24 16:05:18 +00:00
|
|
|
import equal from "fast-deep-equal/es6";
|
2020-08-28 17:23:07 +00:00
|
|
|
const SentryRoute = Sentry.withSentryRouting(Route);
|
2019-12-23 12:16:33 +00:00
|
|
|
|
2020-09-24 16:05:18 +00:00
|
|
|
interface AppRouteProps {
|
2020-09-21 13:08:57 +00:00
|
|
|
currentTheme: any;
|
2020-03-11 13:59:46 +00:00
|
|
|
path?: string;
|
2020-09-24 16:05:18 +00:00
|
|
|
component:
|
|
|
|
|
| React.ComponentType<RouteComponentProps<any>>
|
|
|
|
|
| React.ComponentType<any>;
|
2019-11-22 14:02:55 +00:00
|
|
|
exact?: boolean;
|
2020-03-11 13:59:46 +00:00
|
|
|
logDisable?: boolean;
|
|
|
|
|
name: string;
|
|
|
|
|
location?: any;
|
2020-11-03 13:05:40 +00:00
|
|
|
setTheme: (themeMode: ThemeMode) => void;
|
2020-09-24 16:05:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class AppRouteWithoutProps extends React.Component<AppRouteProps> {
|
|
|
|
|
shouldComponentUpdate(prevProps: AppRouteProps, nextProps: AppRouteProps) {
|
|
|
|
|
return !equal(prevProps?.location, nextProps?.location);
|
2020-09-21 13:08:57 +00:00
|
|
|
}
|
2020-09-24 16:05:18 +00:00
|
|
|
|
2020-09-21 13:08:57 +00:00
|
|
|
render() {
|
2021-01-12 01:22:31 +00:00
|
|
|
const { currentTheme, ...rest } = this.props;
|
2020-09-21 13:08:57 +00:00
|
|
|
if (
|
|
|
|
|
window.location.pathname === "/applications" ||
|
|
|
|
|
window.location.pathname.indexOf("/settings/") !== -1
|
|
|
|
|
) {
|
|
|
|
|
document.body.style.backgroundColor =
|
|
|
|
|
currentTheme.colors.homepageBackground;
|
|
|
|
|
} else {
|
2020-09-21 13:25:58 +00:00
|
|
|
document.body.style.backgroundColor = currentTheme.colors.appBackground;
|
2020-09-21 13:08:57 +00:00
|
|
|
}
|
2021-01-12 01:22:31 +00:00
|
|
|
return <SentryRoute {...rest} />;
|
2020-09-21 12:17:08 +00:00
|
|
|
}
|
2020-09-21 13:08:57 +00:00
|
|
|
}
|
|
|
|
|
const mapStateToProps = (state: AppState) => ({
|
2021-02-11 12:54:00 +00:00
|
|
|
currentTheme: getCurrentThemeDetails(state),
|
2020-09-21 13:08:57 +00:00
|
|
|
});
|
|
|
|
|
const mapDispatchToProps = (dispatch: any) => ({
|
|
|
|
|
setTheme: (mode: ThemeMode) => {
|
|
|
|
|
dispatch(setThemeMode(mode));
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const AppRoute = connect(
|
|
|
|
|
mapStateToProps,
|
|
|
|
|
mapDispatchToProps,
|
|
|
|
|
)(AppRouteWithoutProps);
|
2019-09-02 14:50:01 +00:00
|
|
|
|
2020-09-21 13:08:57 +00:00
|
|
|
(AppRoute as any).whyDidYouRender = {
|
Feature/entity browse (#220)
# New Feature: Entity Explorer
- Entities are actions (apis and queries), datasources, pages, and widgets
- With this new feature, all entities in the application will be available
to view in the new entity explorer sidebar
- All existing application features from the api sidebar, query sidebar, datasource sidebar and pages sidebar
now are avialable on the entity explorer sidebar
- Users are now able to quickly switch to any entity in the application from the entity explorer sidebar.
- Users can also search all entities in the application from the new sidebar. Use cmd + f or ctrl + f to focus on the search input
- Users can rename entities from the new sidebar
- Users can also perform contextual actions on these entities like set a page as home page, copy/move actions, delete entity, etc from the context menu available alongside the entities in the sidebar
- Users can view the properties of the entities in the sidebar, as well as copy bindings to use in the application.
2020-08-10 08:52:45 +00:00
|
|
|
logOnDifferentValues: false,
|
|
|
|
|
};
|
|
|
|
|
|
2020-03-11 13:59:46 +00:00
|
|
|
export default AppRoute;
|