diff --git a/frontend/src/metabase/Routes.jsx b/frontend/src/metabase/Routes.jsx index ba33abf1cbf07b0168ff961752e8c606370426da..d28083906424df9c5c94543458f1df2d89bcdfc2 100644 --- a/frontend/src/metabase/Routes.jsx +++ b/frontend/src/metabase/Routes.jsx @@ -3,8 +3,6 @@ import React, { Component, PropTypes } from "react"; import { Route, Redirect } from 'react-router'; import { ReduxRouter } from 'redux-router'; -import Sidebar from "metabase/components/Sidebar.jsx"; - // auth containers import ForgotPasswordApp from "metabase/auth/containers/ForgotPasswordApp.jsx"; import LoginApp from "metabase/auth/containers/LoginApp.jsx"; diff --git a/frontend/src/metabase/components/Item.jsx b/frontend/src/metabase/components/Item.jsx index cb91aec8d217cc034cc1c3d67a26e352198eb972..47a6d10f3a2bdb5055a83ef4c143b6bfeb0b59ab 100644 --- a/frontend/src/metabase/components/Item.jsx +++ b/frontend/src/metabase/components/Item.jsx @@ -3,7 +3,6 @@ import React, { Component, PropTypes } from "react"; import { Link } from "react-router"; import S from "./List.css"; -import Urls from "metabase/lib/urls"; import Icon from "./Icon.jsx"; import cx from "classnames"; diff --git a/frontend/src/metabase/components/List.jsx b/frontend/src/metabase/components/List.jsx index 05a1b11c402343af5d0109c8ebf2936410f04046..b0d13c49159674592e062fb0d2db1774fdd7c88e 100644 --- a/frontend/src/metabase/components/List.jsx +++ b/frontend/src/metabase/components/List.jsx @@ -9,4 +9,8 @@ const List = ({ children }) => { children } </ul> +List.propTypes = { + children: PropTypes.any.isRequired +}; + export default pure(List); diff --git a/frontend/src/metabase/components/Sidebar.jsx b/frontend/src/metabase/components/Sidebar.jsx index 7242a55a4a8c564ec074b2ebaf5791c9672dcaa7..0a7a3747c0a0424839faa6f004c44bbac64d3ed3 100644 --- a/frontend/src/metabase/components/Sidebar.jsx +++ b/frontend/src/metabase/components/Sidebar.jsx @@ -3,9 +3,6 @@ import React, { PropTypes } from "react"; import { Link } from "react-router"; import S from "./Sidebar.css"; -import Icon from "./Icon.jsx"; -import LoadingAndErrorWrapper from "./LoadingAndErrorWrapper.jsx"; - import Breadcrumbs from "./Breadcrumbs.jsx"; import LabelIcon from "./LabelIcon.jsx"; @@ -38,35 +35,10 @@ const Sidebar = ({ </ul> </div> - // { () => labels ? - // // TODO: factor this out properly for reuse in questions - // <QuestionSidebarSectionTitle name="Labels" href="/questions/edit/labels" /> - // <LoadingAndErrorWrapper loading={labelsLoading} error={labelsError} noBackground noWrapper> - // { () => labels.length > 0 ? // eslint-disable-line - // <ul> - // { labels.map(label => - // <QuestionSidebarItem key={label.id} href={"/questions/label/"+label.slug} {...label} /> - // )} - // </ul> - // : - // <div className={S.noLabelsMessage}> - // <div> - // <Icon name="label" /> - // </div> - // Create labels to group and manage questions. - // </div> - // } - // </LoadingAndErrorWrapper> - // <ul> - // <li className={S.divider} /> - // <QuestionSidebarItem name="Archive" href="/questions/archived" icon="archive" /> - // </ul> - // : null - // } - Sidebar.propTypes = { className: PropTypes.string, style: PropTypes.object, + breadcrumbs: PropTypes.array, sections: PropTypes.object.isRequired, labels: PropTypes.array, labelsLoading: PropTypes.bool, diff --git a/frontend/src/metabase/redux/metadata.js b/frontend/src/metabase/redux/metadata.js index 07a21bbc9238bed8257d814dbbf5f3337464f3fc..7b8bb9bb53124dc71a8e8deaab47a79f84ddd2ba 100644 --- a/frontend/src/metabase/redux/metadata.js +++ b/frontend/src/metabase/redux/metadata.js @@ -1,4 +1,4 @@ -import { handleActions, combineReducers, AngularResourceProxy, createAction, createThunkAction } from "metabase/lib/redux"; +import { handleActions, combineReducers, AngularResourceProxy, createThunkAction } from "metabase/lib/redux"; import { normalize, Schema, arrayOf } from 'normalizr'; import i from "icepick"; import _ from "underscore"; @@ -59,8 +59,6 @@ export const updateData = async ({dispatch, getState, requestStatePath, existing const existingData = i.getIn(getState(), existingStatePath); const statePath = requestStatePath.concat(['update']); try { - const requestState = i.getIn(getState(), ["requests", ...statePath]); - dispatch(setRequestState({ statePath, state: "LOADING" })); const data = await putData(); dispatch(setRequestState({ statePath, state: "LOADED" })); diff --git a/frontend/src/metabase/reference/components/Field.jsx b/frontend/src/metabase/reference/components/Field.jsx index 11d28c8b0368af4909363401f68bb55294bd0afc..144e72f4e97c5a464ad7819200da7e75e1b0af27 100644 --- a/frontend/src/metabase/reference/components/Field.jsx +++ b/frontend/src/metabase/reference/components/Field.jsx @@ -10,7 +10,6 @@ import i from 'icepick'; import S from "metabase/components/List.css"; import F from "./Field.css"; -import Icon from "metabase/components/Icon.jsx"; import Select from "metabase/components/Select.jsx"; import cx from "classnames"; @@ -104,6 +103,7 @@ const Field = ({ } Field.propTypes = { field: PropTypes.object.isRequired, + foreignKeys: PropTypes.object.isRequired, url: PropTypes.string.isRequired, placeholder: PropTypes.string, icon: PropTypes.string, diff --git a/frontend/src/metabase/reference/containers/ReferenceApp.jsx b/frontend/src/metabase/reference/containers/ReferenceApp.jsx index 8afc906c289b8ce00f1a761e9bb732200a34cd24..e3db1138b1f78d7a6bb932987b716238bd86599f 100644 --- a/frontend/src/metabase/reference/containers/ReferenceApp.jsx +++ b/frontend/src/metabase/reference/containers/ReferenceApp.jsx @@ -63,10 +63,12 @@ export const tryFetchData = async (props) => { @connect(mapStateToProps, mapDispatchToProps) export default class ReferenceApp extends Component { static propTypes = { - params: PropTypes.object.isRequired, - children: PropTypes.any.isRequired, - sections: PropTypes.object.isRequired, - section: PropTypes.object.isRequired, + params: PropTypes.object.isRequired, + breadcrumbs: PropTypes.array, + location: PropTypes.object.isRequired, + children: PropTypes.any.isRequired, + sections: PropTypes.object.isRequired, + section: PropTypes.object.isRequired, isEditing: PropTypes.bool }; diff --git a/frontend/src/metabase/reference/containers/ReferenceEntity.jsx b/frontend/src/metabase/reference/containers/ReferenceEntity.jsx index 8e425a1327b53ade59e9d3ad5439c74c528fdf99..db02e43404b0bbdbc71f593bdad47b636f444491 100644 --- a/frontend/src/metabase/reference/containers/ReferenceEntity.jsx +++ b/frontend/src/metabase/reference/containers/ReferenceEntity.jsx @@ -66,9 +66,25 @@ const validate = (values, props) => props.hasRevisionHistory ? }) export default class EntityItem extends Component { static propTypes = { - entity: PropTypes.object, + style: PropTypes.object.isRequired, + entity: PropTypes.object.isRequired, + user: PropTypes.object.isRequired, + foreignKeys: PropTypes.object, isEditing: PropTypes.bool, - user: PropTypes.object, + startEditing: PropTypes.func.isRequired, + endEditing: PropTypes.func.isRequired, + startLoading: PropTypes.func.isRequired, + endLoading: PropTypes.func.isRequired, + setError: PropTypes.func.isRequired, + updateField: PropTypes.func.isRequired, + handleSubmit: PropTypes.func.isRequired, + fields: PropTypes.object.isRequired, + section: PropTypes.object.isRequired, + hasDisplayName: PropTypes.bool, + hasRevisionHistory: PropTypes.bool, + loading: PropTypes.bool, + loadingError: PropTypes.object, + submitting: PropTypes.bool }; render() { diff --git a/frontend/src/metabase/reference/containers/ReferenceEntityList.jsx b/frontend/src/metabase/reference/containers/ReferenceEntityList.jsx index a17093b490ae2877cfbbad1ea1f53828cac47131..5d4872055173f7377ff93e28f66520126eea0513 100644 --- a/frontend/src/metabase/reference/containers/ReferenceEntityList.jsx +++ b/frontend/src/metabase/reference/containers/ReferenceEntityList.jsx @@ -57,10 +57,6 @@ export default class ReferenceEntityList extends Component { loading } = this.props; - const empty = { - icon: 'mine', - message: 'You haven\'t added any databases yet.' - }; return ( <div style={style} className="full"> <div className="wrapper wrapper--trim"> diff --git a/frontend/src/metabase/reference/containers/ReferenceFieldsList.jsx b/frontend/src/metabase/reference/containers/ReferenceFieldsList.jsx index 8cf17640158945b796a5970381055df5ccad5343..129edf0f789b8bd2122cb745f5970e178129cfb7 100644 --- a/frontend/src/metabase/reference/containers/ReferenceFieldsList.jsx +++ b/frontend/src/metabase/reference/containers/ReferenceFieldsList.jsx @@ -30,7 +30,13 @@ import { import * as metadataActions from "metabase/redux/metadata"; import * as actions from 'metabase/reference/reference'; -const fieldsToFormFields = (fields) => Object.keys(fields); +const fieldsToFormFields = (fields) => Object.keys(fields) + .map(key => [ + `${key}.display_name`, + `${key}.special_type`, + `${key}.fk_target_field_id` + ]) + .reduce((array, keys) => array.concat(keys), []); const mapStateToProps = (state, props) => { const data = getData(state); @@ -42,13 +48,7 @@ const mapStateToProps = (state, props) => { loadingError: getError(state), user: getUser(state), isEditing: getIsEditing(state), - fields: Object.keys(data) - .map(key => [ - `${key}.display_name`, - `${key}.special_type`, - `${key}.fk_target_field_id` - ]) - .reduce((array, keys) => array.concat(keys), []) + fields: fieldsToFormFields(data) }; } @@ -70,10 +70,21 @@ export default class ReferenceEntityList extends Component { static propTypes = { style: PropTypes.object.isRequired, entities: PropTypes.object.isRequired, + foreignKeys: PropTypes.object.isRequired, + isEditing: PropTypes.bool, + startEditing: PropTypes.func.isRequired, + endEditing: PropTypes.func.isRequired, + startLoading: PropTypes.func.isRequired, + endLoading: PropTypes.func.isRequired, + setError: PropTypes.func.isRequired, + updateField: PropTypes.func.isRequired, + handleSubmit: PropTypes.func.isRequired, + user: PropTypes.object.isRequired, fields: PropTypes.object.isRequired, section: PropTypes.object.isRequired, loading: PropTypes.bool, - loadingError: PropTypes.object + loadingError: PropTypes.object, + submitting: PropTypes.bool }; render() { diff --git a/frontend/src/metabase/reference/reference.js b/frontend/src/metabase/reference/reference.js index f5c35ecd87b6ecc43dd6d18e0f6eefeba47de690..d5dfa74dfd07f73cf7200c0c968d943614d07dd8 100644 --- a/frontend/src/metabase/reference/reference.js +++ b/frontend/src/metabase/reference/reference.js @@ -1,4 +1,4 @@ -import { handleActions, createAction, createThunkAction } from 'metabase/lib/redux'; +import { handleActions, createAction } from 'metabase/lib/redux'; import i from 'icepick';