Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Moves pages into its own folder #624

Merged
merged 11 commits into from
Aug 31, 2020
222 changes: 105 additions & 117 deletions amundsen_application/static/.betterer.results

Large diffs are not rendered by default.

15 changes: 11 additions & 4 deletions amundsen_application/static/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,16 @@ module.exports = {
statements: 90,
},
'./js/components': {
branches: 60, // 75
functions: 65, // 75
lines: 65, // 75
statements: 70, // 75
branches: 67, // 75
functions: 67, // 75
lines: 75, // 75
statements: 75, // 75
},
'./js/pages': {
branches: 65, // 75
functions: 72, // 75
lines: 81, // 75
statements: 78, // 75
},
'./js/ducks': {
branches: 75,
Expand All @@ -33,6 +39,7 @@ module.exports = {
},
testRegex: '(test|spec)\\.(j|t)sx?$',
moduleDirectories: ['node_modules', 'js'],
coveragePathIgnorePatterns: ['stories/*', 'constants.ts'],
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json'],
moduleNameMapper: {
'^.+\\.(css|scss)$': '<rootDir>/node_modules/jest-css-modules',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

import * as React from 'react';

import { Button, Panel } from 'react-bootstrap';
import BugReportFeedbackForm from './FeedbackForm/BugReportFeedbackForm';
import RatingFeedbackForm from './FeedbackForm/RatingFeedbackForm';
import RequestFeedbackForm from './FeedbackForm/RequestFeedbackForm';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@

import * as React from 'react';
import { Link } from 'react-router-dom';
import { Modal } from 'react-bootstrap';

import AppConfig from 'config/config';
import AvatarLabel, { AvatarLabelProps } from 'components/common/AvatarLabel';
import LoadingSpinner from 'components/common/LoadingSpinner';
import { Modal } from 'react-bootstrap';
import { ResourceType, UpdateMethod, UpdateOwnerPayload } from 'interfaces';

// TODO: Use css-modules instead of 'import'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import * as React from 'react';
import { OverlayTrigger, Popover } from 'react-bootstrap';

import './styles.scss';

export interface SchemaInfoProps {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import * as Avatar from 'react-avatar';
import { Link } from 'react-router-dom';

import { UserResource } from 'interfaces';
import Flag from 'components/common/Flag';
import { BadgeStyle } from 'config/config-types';
import { LoggingParams } from '../types';

export interface UserListItemProps {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ $shimmer-loader-items: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14;
$shimmer-loader-tag-max-width: 130;
$shimmer-loader-tag-min-width: 50;

.shimmer-tag-list-loader {
}

.shimmer-tag-loader-item {
margin: 0 $spacer-1 $spacer-1 0;
height: $shimmer-loader-tag-height;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ export interface TabsProps {
onSelect?: (key: string) => void;
}

interface TabInfo {
export interface TabInfo {
content: JSX.Element;
key: string;
title: string;
title: string | JSX.Element;
}

const TabsComponent: React.FC<TabsProps> = ({
Expand Down
2 changes: 1 addition & 1 deletion amundsen_application/static/js/ducks/dashboard/api/v0.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import axios, { AxiosResponse } from 'axios';
import * as qs from 'simple-query-string';

import { QueryResource, ResourceType } from 'interfaces/Resources';
import { ResourceType } from 'interfaces/Resources';
import { DashboardMetadata } from 'interfaces/Dashboard';

export type GetDashboardAPI = {
Expand Down
22 changes: 11 additions & 11 deletions amundsen_application/static/js/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,26 @@ import 'core-js/stable';
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import * as ReduxPromise from 'redux-promise';

import createSagaMiddleware from 'redux-saga';

import { Provider } from 'react-redux';
import { createStore, applyMiddleware } from 'redux';
import { Router, Route, Switch } from 'react-router-dom';
import DocumentTitle from 'react-document-title';

import DashboardPage from 'components/DashboardPage';
import Preloader from 'components/common/Preloader';
import { BrowserHistory } from 'utils/navigationUtils';
import AnnouncementPage from './components/AnnouncementPage';
import BrowsePage from './components/BrowsePage';

import DashboardPage from './pages/DashboardPage';
import AnnouncementPage from './pages/AnnouncementPage';
import BrowsePage from './pages/BrowsePage';
import HomePage from './pages/HomePage';
import NotFoundPage from './pages/NotFoundPage';
import SearchPage from './pages/SearchPage';
import ProfilePage from './pages/ProfilePage';
import TableDetail from './pages/TableDetailPage';

import Preloader from './components/common/Preloader';
import Footer from './components/Footer';
import HomePage from './components/HomePage';
import NavBar from './components/NavBar';
import NotFoundPage from './components/NotFoundPage';
import ProfilePage from './components/ProfilePage';
import SearchPage from './components/SearchPage';
import TableDetail from './components/TableDetail';

import rootReducer from './ducks/rootReducer';
import rootSaga from './ducks/rootSaga';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,5 @@ export const mapStateToProps = (state: GlobalState) => {

export default connect<StateFromProps, {}, ComponentProps>(
mapStateToProps,
null
{}
)(OwnerEditor);
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,9 @@ import Breadcrumb from 'components/common/Breadcrumb';
import BookmarkIcon from 'components/common/Bookmark/BookmarkIcon';
import EditableSection from 'components/common/EditableSection';
import LoadingSpinner from 'components/common/LoadingSpinner';
import TabsComponent from 'components/common/TabsComponent';
import DashboardOwnerEditor from 'components/DashboardPage/DashboardOwnerEditor';
import QueryList from 'components/DashboardPage/QueryList';
import ChartList from 'components/DashboardPage/ChartList';
import TabsComponent, { TabInfo } from 'components/common/TabsComponent';
import ResourceStatusMarker from 'components/common/ResourceStatusMarker';
import ResourceList from 'components/common/ResourceList';
import {
ADD_DESC_TEXT,
EDIT_DESC_TEXT,
OWNER_HEADER_TEXT,
DASHBOARD_SOURCE,
TABLES_PER_PAGE,
LAST_RUN_SUCCEEDED,
STATUS_TEXT,
} from 'components/DashboardPage/constants';
import TagInput from 'components/common/Tags/TagInput';
import { NO_TIMESTAMP_TEXT } from 'components/constants';

Expand All @@ -40,6 +28,18 @@ import { getLoggingParams } from 'utils/logUtils';

import { ResourceType } from 'interfaces';
import { DashboardMetadata } from 'interfaces/Dashboard';
import {
ADD_DESC_TEXT,
EDIT_DESC_TEXT,
OWNER_HEADER_TEXT,
DASHBOARD_SOURCE,
TABLES_PER_PAGE,
LAST_RUN_SUCCEEDED,
STATUS_TEXT,
} from './constants';
import ChartList from './ChartList';
import QueryList from './QueryList';
import DashboardOwnerEditor from './DashboardOwnerEditor';

import ImagePreview from './ImagePreview';

Expand All @@ -49,12 +49,6 @@ interface DashboardPageState {
uri: string;
}

type TabInfo = {
content: JSX.Element;
key: string;
title: string;
};

export interface StateFromProps {
isLoading: boolean;
statusCode: number;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@ import * as React from 'react';
import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';

import {
DASHBOARD_RESOURCE_TITLE,
TABLE_RESOURCE_TITLE,
USER_RESOURCE_TITLE,
} from 'components/SearchPage/constants';
import { indexDashboardsEnabled, indexUsersEnabled } from 'config/config-utils';
import { GlobalState } from 'ducks/rootReducer';
import { updateSearchState } from 'ducks/search/reducer';
Expand All @@ -20,6 +15,11 @@ import {
UserSearchResults,
} from 'ducks/search/types';
import { ResourceType } from 'interfaces/Resources';
import {
DASHBOARD_RESOURCE_TITLE,
TABLE_RESOURCE_TITLE,
USER_RESOURCE_TITLE,
} from '../constants';

const RESOURCE_SELECTOR_TITLE = 'Resource';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import { shallow } from 'enzyme';

import { ResourceType } from 'interfaces';

import ResourceSelector from 'components/SearchPage/ResourceSelector';
import SearchFilter from 'components/SearchPage/SearchFilter';
import SearchPanel from 'components/SearchPage/SearchPanel';
import ResourceSelector from 'pages/SearchPage/ResourceSelector';
import SearchFilter from 'pages/SearchPage/SearchFilter';
import SearchPanel from 'pages/SearchPage/SearchPanel';
import PaginatedApiResourceList from 'components/common/ResourceList/PaginatedApiResourceList';

import globalState from 'fixtures/globalState';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import * as DocumentTitle from 'react-document-title';
import { RouteComponentProps } from 'react-router';
import { Search as UrlSearch } from 'history';

import LoadingSpinner from 'components/common/LoadingSpinner';
import PaginatedApiResourceList from 'components/common/ResourceList/PaginatedApiResourceList';
import ShimmeringResourceLoader from 'components/common/ShimmeringResourceLoader';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ $modal-dialog-width: 418px;
height: calc(#{$modal-dialog-height - $modal-header-height - $spacer-3});
font-family: $font-family-monospace-code;
font-size: $code-font-size;

/* Override react-bootstrap styles to match design */
margin: 0 $spacer-3 !important;
padding: $spacer-1 0 !important;
Expand All @@ -51,14 +52,17 @@ $modal-dialog-width: 418px;
.modal-header {
border-bottom: none;
height: $modal-header-height;

/* Override react-bootstrap styles to match design */
padding: $spacer-3 !important;

.main-title {
@extend %text-title-w1;
}

.sub-title {
@extend %text-subtitle-w3;

color: $text-secondary;
}
}
Expand All @@ -72,13 +76,15 @@ $modal-dialog-width: 418px;
text-align: center;
padding: 0 !important;
}
.modal:before {

.modal::before {
content: '';
display: inline-block;
height: 100%;
vertical-align: middle;
margin-right: -4px;
}

.modal-dialog {
display: inline-block;
vertical-align: middle;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,13 @@
import * as React from 'react';
import { shallow } from 'enzyme';

import ColumnDescEditableText from 'components/TableDetail/ColumnDescEditableText';
import {
ColumnListItem,
ColumnListItemProps,
mapDispatchToProps,
} from 'components/TableDetail/ColumnListItem';
import EditableSection from 'components/common/EditableSection';
import ColumnStats from 'components/TableDetail/ColumnStats';
import AppConfig from 'config/config';
import EditableSection from 'components/common/EditableSection';
import * as UtilMethods from 'ducks/utilMethods';
import { RequestMetadataType } from 'interfaces/Notifications';
import ColumnStats from '../ColumnStats';
import ColumnDescEditableText from '../ColumnDescEditableText';
import { ColumnListItem, ColumnListItemProps, mapDispatchToProps } from '.';

import ColumnType from './ColumnType';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import { Dropdown, MenuItem } from 'react-bootstrap';
import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';

import ColumnDescEditableText from 'components/TableDetail/ColumnDescEditableText';
import ColumnStats from 'components/TableDetail/ColumnStats';
import { notificationsEnabled, getMaxLength } from 'config/config-utils';
import { openRequestDescriptionDialog } from 'ducks/notification/reducer';
import { OpenRequestAction } from 'ducks/notification/types';
Expand All @@ -16,6 +14,8 @@ import { RequestMetadataType, TableColumn } from 'interfaces';

import './styles.scss';
import EditableSection from 'components/common/EditableSection';
import ColumnStats from '../ColumnStats';
import ColumnDescEditableText from '../ColumnDescEditableText';
import ColumnType from './ColumnType';

const MORE_BUTTON_TEXT = 'More options';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@

import * as React from 'react';
import { shallow } from 'enzyme';

import * as ConfigUtils from 'config/config-utils';
import ExploreButton from 'components/TableDetail/ExploreButton';
import { TableMetadata } from 'interfaces/TableMetadata';
import { logClick } from 'ducks/utilMethods';

import ExploreButton from '.';

let mockExploreEnabled = true;
let mockExploreUrl = 'https://test-website.com';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import { Dropdown } from 'react-bootstrap';

import { ResourceReport } from 'interfaces/index';
import { Dropdown } from 'react-bootstrap';

export interface ResourceReportProps {
resourceReports: ResourceReport[];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@
// SPDX-License-Identifier: Apache-2.0

import * as React from 'react';

import { shallow } from 'enzyme';

import AppConfig from 'config/config';
import globalState from 'fixtures/globalState';

import { NO_DATA_ISSUES_TEXT } from 'components/TableDetail/TableIssues/constants';
import { NO_DATA_ISSUES_TEXT } from './constants';
import {
TableIssues,
TableIssueProps,
Expand Down Expand Up @@ -74,7 +73,7 @@ describe('TableIssues', () => {
const { wrapper } = setup({
issues: [],
total: 0,
allIssuesUrl: null,
allIssuesUrl: undefined,
});
expect(wrapper.find('.table-issue-more-issues').length).toEqual(0);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { Issue } from 'interfaces';
import { getIssues } from 'ducks/issue/reducer';
import { logClick } from 'ducks/utilMethods';
import { GetIssuesRequest } from 'ducks/issue/types';
import ReportTableIssue from 'components/TableDetail/ReportTableIssue';
import ReportTableIssue from '../ReportTableIssue';
import { NO_DATA_ISSUES_TEXT } from './constants';
import './styles.scss';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
NO_WATERMARK_LINE_1,
NO_WATERMARK_LINE_2,
WatermarkType,
} from 'components/TableDetail/WatermarkLabel/constants';
} from './constants';
import WatermarkLabel, { WatermarkLabelProps } from '.';

describe('WatermarkLabel', () => {
Expand Down
Loading