diff --git a/frontend/src/setup/actions.js b/frontend/src/setup/actions.js index 8d961e969cd2d44ef473c5ad320ce0191cb12caf..8fbb15dd3a2be6dc616e7225e62a984e53780d1d 100644 --- a/frontend/src/setup/actions.js +++ b/frontend/src/setup/actions.js @@ -36,7 +36,6 @@ function createThunkAction(actionType, actionThunkCreator) { // // resource wrappers const SetupApi = new AngularResourceProxy("Setup", ["create", "validate_db"]); const UtilApi = new AngularResourceProxy("Util", ["password_check"]); -const MetabaseApi = new AngularResourceProxy("Metabase", ["db_form_input"]); // action constants @@ -48,7 +47,6 @@ export const VALIDATE_DATABASE = 'VALIDATE_DATABASE'; export const VALIDATE_PASSWORD = 'VALIDATE_PASSWORD'; export const SUBMIT_SETUP = 'SUBMIT_SETUP'; export const COMPLETE_SETUP = 'COMPLETE_SETUP'; -export const FETCH_ENGINES = 'FETCH_ENGINES'; // action creators @@ -111,10 +109,3 @@ export const completeSetup = createAction(COMPLETE_SETUP, function(apiResponse) return true; }); - -export const fetchEngines = createThunkAction(FETCH_ENGINES, function() { - return async function(dispatch, getState) { - let formInput = await MetabaseApi.db_form_input(); - return formInput.engines; - }; -}); diff --git a/frontend/src/setup/components/DatabaseStep.jsx b/frontend/src/setup/components/DatabaseStep.jsx index 4d5dabed644cbbdee0479b9ea5c8bba9fcb98ce7..e50236d04392c510a267c28b1bbc4841fea5eab0 100644 --- a/frontend/src/setup/components/DatabaseStep.jsx +++ b/frontend/src/setup/components/DatabaseStep.jsx @@ -4,6 +4,7 @@ import _ from "underscore"; import DatabaseDetailsForm from "metabase/components/database/DatabaseDetailsForm.jsx"; import FormField from "metabase/components/form/FormField.jsx"; import MetabaseAnalytics from "metabase/lib/analytics"; +import MetabaseSettings from "metabase/lib/settings"; import StepTitle from './StepTitle.jsx' import CollapsedStep from "./CollapsedStep.jsx"; @@ -18,7 +19,6 @@ export default class DatabaseStep extends Component { static propTypes = { dispatch: PropTypes.func.isRequired, - engines: PropTypes.object.isRequired, stepNumber: PropTypes.number.isRequired } @@ -92,7 +92,7 @@ export default class DatabaseStep extends Component { } renderEngineSelect() { - let { engines } = this.props; + let engines = MetabaseSettings.get('engines'); let { engine } = this.state, engineNames = _.keys(engines).sort(); @@ -107,8 +107,9 @@ export default class DatabaseStep extends Component { } render() { - let { activeStep, databaseDetails, dispatch, engines, stepNumber } = this.props; + let { activeStep, databaseDetails, dispatch, stepNumber } = this.props; let { engine, formError } = this.state; + let engines = MetabaseSettings.get('engines'); let stepText = 'Add your data'; if (activeStep > stepNumber) { diff --git a/frontend/src/setup/components/Setup.jsx b/frontend/src/setup/components/Setup.jsx index 74d68061b834f90c6f854e178a14ce32d557eb78..09f8609f166e7138c2fcf1bb464339cbe6eed7a7 100644 --- a/frontend/src/setup/components/Setup.jsx +++ b/frontend/src/setup/components/Setup.jsx @@ -8,7 +8,7 @@ import UserStep from './UserStep.jsx'; import DatabaseStep from './DatabaseStep.jsx'; import PreferencesStep from './PreferencesStep.jsx'; -import { setActiveStep, fetchEngines } from '../actions'; +import { setActiveStep } from '../actions'; const WELCOME_STEP_NUMBER = 0; const USER_STEP_NUMBER = 1; @@ -21,10 +21,6 @@ export default class Setup extends Component { dispatch: PropTypes.func.isRequired } - componentDidMount() { - this.props.dispatch(fetchEngines()); - } - completeWelcome() { this.props.dispatch(setActiveStep(USER_STEP_NUMBER)); MetabaseAnalytics.trackEvent('Setup', 'Welcome'); diff --git a/frontend/src/setup/reducers.js b/frontend/src/setup/reducers.js index 721a018cf2853d646f3140dd79b577075fe5e240..7ce670c4587bef5d4137eee55975e01455b34e45 100644 --- a/frontend/src/setup/reducers.js +++ b/frontend/src/setup/reducers.js @@ -6,8 +6,7 @@ import { SET_DATABASE_DETAILS, SET_ALLOW_TRACKING, SUBMIT_SETUP, - COMPLETE_SETUP, - FETCH_ENGINES + COMPLETE_SETUP } from './actions'; @@ -36,7 +35,3 @@ export const setupError = handleActions({ export const setupComplete = handleActions({ [COMPLETE_SETUP]: { next: (state, { payload }) => true } }, false); - -export const engines = handleActions({ - [FETCH_ENGINES]: { next: (state, { payload }) => payload } -}, {}); diff --git a/frontend/src/setup/selectors.js b/frontend/src/setup/selectors.js index 3b4cd4576c1428700bc29e120f3820641f59da42..fbb38251379e3729ea695aca7fa946712105d791 100644 --- a/frontend/src/setup/selectors.js +++ b/frontend/src/setup/selectors.js @@ -7,11 +7,10 @@ const databaseDetailsSelector = state => state.databaseDetails; const allowTrackingSelector = state => state.allowTracking; const setupErrorSelector = state => state.setupError; const setupCompleteSelector = state => state.setupComplete; -const enginesSelector = state => state.engines; // our master selector which combines all of our partial selectors above export const setupSelectors = createSelector( - [activeStepSelector, userDetailsSelector, databaseDetailsSelector, allowTrackingSelector, setupErrorSelector, setupCompleteSelector, enginesSelector], - (activeStep, userDetails, databaseDetails, allowTracking, setupError, setupComplete, engines) => ({activeStep, userDetails, databaseDetails, allowTracking, setupError, setupComplete, engines}) + [activeStepSelector, userDetailsSelector, databaseDetailsSelector, allowTrackingSelector, setupErrorSelector, setupCompleteSelector], + (activeStep, userDetails, databaseDetails, allowTracking, setupError, setupComplete) => ({activeStep, userDetails, databaseDetails, allowTracking, setupError, setupComplete}) ); diff --git a/src/metabase/api/database.clj b/src/metabase/api/database.clj index 4a4fd6e1e16b1436e4455d96946df1be1eb3d389..1eaf29f7457694fb3c0a61aa0f409a2b27dc11c4 100644 --- a/src/metabase/api/database.clj +++ b/src/metabase/api/database.clj @@ -42,17 +42,6 @@ (sample-data/add-sample-dataset!) (sel :one Database :is_sample true)) -(defn form-input - "`GET /api/database/form_input` - Values of options for the create/edit `Database` UI. - - This is defined *without* using `defendpoint` because we don't want it to be included in `routes`, which would make - it subject to the `+auth` requirements we use for those endpoints." - [_] - {:status 200 - :body {:timezones metabase.models.common/timezones - :engines @driver/available-drivers}}) - ;; Stub function that will eventually validate a connection string (defendpoint POST "/validate" "Validate that we can connect to a `Database`." diff --git a/src/metabase/api/routes.clj b/src/metabase/api/routes.clj index 36d01b97529c7b06e26e75bd00671b2c75162b9a..1006dfb5316fe189ac2846b5b706e1f8138990f5 100644 --- a/src/metabase/api/routes.clj +++ b/src/metabase/api/routes.clj @@ -28,26 +28,25 @@ middleware/enforce-authentication) (defroutes routes - (context "/activity" [] (+auth activity/routes)) - (context "/card" [] (+auth card/routes)) - (context "/dashboard" [] (+auth dashboard/routes)) - (GET "/database/form_input" [] database/form-input) ; this endpoint included separately so it's not subject to +auth - (context "/database" [] (+auth database/routes)) - (context "/dataset" [] (+auth dataset/routes)) - (context "/field" [] (+auth field/routes)) - (context "/foreignkey" [] (+auth fk/routes)) - (GET "/health" [] (if ((resolve 'metabase.core/initialized?)) + (context "/activity" [] (+auth activity/routes)) + (context "/card" [] (+auth card/routes)) + (context "/dashboard" [] (+auth dashboard/routes)) + (context "/database" [] (+auth database/routes)) + (context "/dataset" [] (+auth dataset/routes)) + (context "/field" [] (+auth field/routes)) + (context "/foreignkey" [] (+auth fk/routes)) + (GET "/health" [] (if ((resolve 'metabase.core/initialized?)) {:status 200 :body {:status "ok"}} {:status 503 :body {:status "initializing" :progress ((resolve 'metabase.core/initialization-progress))}})) - (context "/notify" [] (+apikey notify/routes)) - (context "/revision" [] (+auth revision/routes)) - (context "/session" [] session/routes) - (context "/setting" [] (+auth setting/routes)) - (context "/setup" [] setup/routes) - (context "/table" [] (+auth table/routes)) - (context "/tiles" [] (+auth tiles/routes)) - (context "/user" [] (+auth user/routes)) - (context "/util" [] util/routes) + (context "/notify" [] (+apikey notify/routes)) + (context "/revision" [] (+auth revision/routes)) + (context "/session" [] session/routes) + (context "/setting" [] (+auth setting/routes)) + (context "/setup" [] setup/routes) + (context "/table" [] (+auth table/routes)) + (context "/tiles" [] (+auth tiles/routes)) + (context "/user" [] (+auth user/routes)) + (context "/util" [] util/routes) (route/not-found (fn [{:keys [request-method uri]}] {:status 404 :body (str (.toUpperCase (name request-method)) " " uri " is not yet implemented.")}))) diff --git a/src/metabase/models/setting.clj b/src/metabase/models/setting.clj index bf2b26943524ab1587015ea755ce92964e7622a1..a8a404c686bc3c14353484ee03bdee88db97b409 100644 --- a/src/metabase/models/setting.clj +++ b/src/metabase/models/setting.clj @@ -155,7 +155,8 @@ (defn public-settings "Return a simple map of key/value pairs which represent the public settings for the front-end application." [] - {:ga_code "UA-60817802-1" + {:engines (deref @(ns-resolve 'metabase.driver 'available-drivers)) + :ga_code "UA-60817802-1" :password_complexity (password/active-password-complexity) :setup_token (setup/token-value) :timezones common/timezones