Hook up Test All Applications button in UI

This commit is contained in:
Qstick
2021-02-20 17:42:56 -05:00
parent c12052867a
commit 512216cf90
4 changed files with 69 additions and 28 deletions

View File

@@ -7,7 +7,7 @@ import HistoryConnector from 'History/HistoryConnector';
import IndexerIndexConnector from 'Indexer/Index/IndexerIndexConnector'; import IndexerIndexConnector from 'Indexer/Index/IndexerIndexConnector';
import StatsConnector from 'Indexer/Stats/StatsConnector'; import StatsConnector from 'Indexer/Stats/StatsConnector';
import SearchIndexConnector from 'Search/SearchIndexConnector'; import SearchIndexConnector from 'Search/SearchIndexConnector';
import ApplicationSettings from 'Settings/Applications/ApplicationSettings'; import ApplicationSettingsConnector from 'Settings/Applications/ApplicationSettingsConnector';
import GeneralSettingsConnector from 'Settings/General/GeneralSettingsConnector'; import GeneralSettingsConnector from 'Settings/General/GeneralSettingsConnector';
import NotificationSettings from 'Settings/Notifications/NotificationSettings'; import NotificationSettings from 'Settings/Notifications/NotificationSettings';
import Settings from 'Settings/Settings'; import Settings from 'Settings/Settings';
@@ -90,7 +90,7 @@ function AppRoutes(props) {
<Route <Route
path="/settings/applications" path="/settings/applications"
component={ApplicationSettings} component={ApplicationSettingsConnector}
/> />
<Route <Route

View File

@@ -1,4 +1,5 @@
import React, { Fragment } from 'react'; import PropTypes from 'prop-types';
import React, { Component, Fragment } from 'react';
import PageContent from 'Components/Page/PageContent'; import PageContent from 'Components/Page/PageContent';
import PageContentBody from 'Components/Page/PageContentBody'; import PageContentBody from 'Components/Page/PageContentBody';
import PageToolbarButton from 'Components/Page/Toolbar/PageToolbarButton'; import PageToolbarButton from 'Components/Page/Toolbar/PageToolbarButton';
@@ -8,7 +9,13 @@ import SettingsToolbarConnector from 'Settings/SettingsToolbarConnector';
import translate from 'Utilities/String/translate'; import translate from 'Utilities/String/translate';
import ApplicationsConnector from './Applications/ApplicationsConnector'; import ApplicationsConnector from './Applications/ApplicationsConnector';
function ApplicationSettings() { class ApplicationSettings extends Component {
render() {
const {
isTestingAll,
dispatchTestAllApplications
} = this.props;
return ( return (
<PageContent title={translate('Applications')}> <PageContent title={translate('Applications')}>
<SettingsToolbarConnector <SettingsToolbarConnector
@@ -25,6 +32,8 @@ function ApplicationSettings() {
<PageToolbarButton <PageToolbarButton
label={translate('TestAllApps')} label={translate('TestAllApps')}
iconName={icons.TEST} iconName={icons.TEST}
isSpinning={isTestingAll}
onPress={dispatchTestAllApplications}
/> />
</Fragment> </Fragment>
} }
@@ -36,5 +45,11 @@ function ApplicationSettings() {
</PageContent> </PageContent>
); );
} }
}
ApplicationSettings.propTypes = {
isTestingAll: PropTypes.bool.isRequired,
dispatchTestAllApplications: PropTypes.func.isRequired
};
export default ApplicationSettings; export default ApplicationSettings;

View File

@@ -0,0 +1,21 @@
import { connect } from 'react-redux';
import { createSelector } from 'reselect';
import { testAllApplications } from 'Store/Actions/settingsActions';
import ApplicationSettings from './ApplicationSettings';
function createMapStateToProps() {
return createSelector(
(state) => state.settings.applications.isTestingAll,
(isTestingAll) => {
return {
isTestingAll
};
}
);
}
const mapDispatchToProps = {
dispatchTestAllApplications: testAllApplications
};
export default connect(createMapStateToProps, mapDispatchToProps)(ApplicationSettings);

View File

@@ -3,6 +3,7 @@ import createFetchHandler from 'Store/Actions/Creators/createFetchHandler';
import createFetchSchemaHandler from 'Store/Actions/Creators/createFetchSchemaHandler'; import createFetchSchemaHandler from 'Store/Actions/Creators/createFetchSchemaHandler';
import createRemoveItemHandler from 'Store/Actions/Creators/createRemoveItemHandler'; import createRemoveItemHandler from 'Store/Actions/Creators/createRemoveItemHandler';
import createSaveProviderHandler, { createCancelSaveProviderHandler } from 'Store/Actions/Creators/createSaveProviderHandler'; import createSaveProviderHandler, { createCancelSaveProviderHandler } from 'Store/Actions/Creators/createSaveProviderHandler';
import createTestAllProvidersHandler from 'Store/Actions/Creators/createTestAllProvidersHandler';
import createTestProviderHandler, { createCancelTestProviderHandler } from 'Store/Actions/Creators/createTestProviderHandler'; import createTestProviderHandler, { createCancelTestProviderHandler } from 'Store/Actions/Creators/createTestProviderHandler';
import createSetProviderFieldValueReducer from 'Store/Actions/Creators/Reducers/createSetProviderFieldValueReducer'; import createSetProviderFieldValueReducer from 'Store/Actions/Creators/Reducers/createSetProviderFieldValueReducer';
import createSetSettingValueReducer from 'Store/Actions/Creators/Reducers/createSetSettingValueReducer'; import createSetSettingValueReducer from 'Store/Actions/Creators/Reducers/createSetSettingValueReducer';
@@ -27,6 +28,7 @@ export const CANCEL_SAVE_APPLICATION = 'settings/applications/cancelSaveApplicat
export const DELETE_APPLICATION = 'settings/applications/deleteApplication'; export const DELETE_APPLICATION = 'settings/applications/deleteApplication';
export const TEST_APPLICATION = 'settings/applications/testApplication'; export const TEST_APPLICATION = 'settings/applications/testApplication';
export const CANCEL_TEST_APPLICATION = 'settings/applications/cancelTestApplication'; export const CANCEL_TEST_APPLICATION = 'settings/applications/cancelTestApplication';
export const TEST_ALL_APPLICATIONS = 'indexers/testAllApplications';
// //
// Action Creators // Action Creators
@@ -40,6 +42,7 @@ export const cancelSaveApplication = createThunk(CANCEL_SAVE_APPLICATION);
export const deleteApplication = createThunk(DELETE_APPLICATION); export const deleteApplication = createThunk(DELETE_APPLICATION);
export const testApplication = createThunk(TEST_APPLICATION); export const testApplication = createThunk(TEST_APPLICATION);
export const cancelTestApplication = createThunk(CANCEL_TEST_APPLICATION); export const cancelTestApplication = createThunk(CANCEL_TEST_APPLICATION);
export const testAllApplications = createThunk(TEST_ALL_APPLICATIONS);
export const setApplicationValue = createAction(SET_APPLICATION_VALUE, (payload) => { export const setApplicationValue = createAction(SET_APPLICATION_VALUE, (payload) => {
return { return {
@@ -75,6 +78,7 @@ export default {
isSaving: false, isSaving: false,
saveError: null, saveError: null,
isTesting: false, isTesting: false,
isTestingAll: false,
items: [], items: [],
pendingChanges: {} pendingChanges: {}
}, },
@@ -90,7 +94,8 @@ export default {
[CANCEL_SAVE_APPLICATION]: createCancelSaveProviderHandler(section), [CANCEL_SAVE_APPLICATION]: createCancelSaveProviderHandler(section),
[DELETE_APPLICATION]: createRemoveItemHandler(section, '/applications'), [DELETE_APPLICATION]: createRemoveItemHandler(section, '/applications'),
[TEST_APPLICATION]: createTestProviderHandler(section, '/applications'), [TEST_APPLICATION]: createTestProviderHandler(section, '/applications'),
[CANCEL_TEST_APPLICATION]: createCancelTestProviderHandler(section) [CANCEL_TEST_APPLICATION]: createCancelTestProviderHandler(section),
[TEST_ALL_APPLICATIONS]: createTestAllProvidersHandler(section, '/applications')
}, },
// //