mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-09-17 17:14:18 +02:00
Hook up Test All Applications button in UI
This commit is contained in:
@@ -7,7 +7,7 @@ import HistoryConnector from 'History/HistoryConnector';
|
||||
import IndexerIndexConnector from 'Indexer/Index/IndexerIndexConnector';
|
||||
import StatsConnector from 'Indexer/Stats/StatsConnector';
|
||||
import SearchIndexConnector from 'Search/SearchIndexConnector';
|
||||
import ApplicationSettings from 'Settings/Applications/ApplicationSettings';
|
||||
import ApplicationSettingsConnector from 'Settings/Applications/ApplicationSettingsConnector';
|
||||
import GeneralSettingsConnector from 'Settings/General/GeneralSettingsConnector';
|
||||
import NotificationSettings from 'Settings/Notifications/NotificationSettings';
|
||||
import Settings from 'Settings/Settings';
|
||||
@@ -90,7 +90,7 @@ function AppRoutes(props) {
|
||||
|
||||
<Route
|
||||
path="/settings/applications"
|
||||
component={ApplicationSettings}
|
||||
component={ApplicationSettingsConnector}
|
||||
/>
|
||||
|
||||
<Route
|
||||
|
@@ -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 PageContentBody from 'Components/Page/PageContentBody';
|
||||
import PageToolbarButton from 'Components/Page/Toolbar/PageToolbarButton';
|
||||
@@ -8,33 +9,47 @@ import SettingsToolbarConnector from 'Settings/SettingsToolbarConnector';
|
||||
import translate from 'Utilities/String/translate';
|
||||
import ApplicationsConnector from './Applications/ApplicationsConnector';
|
||||
|
||||
function ApplicationSettings() {
|
||||
return (
|
||||
<PageContent title={translate('Applications')}>
|
||||
<SettingsToolbarConnector
|
||||
showSave={false}
|
||||
additionalButtons={
|
||||
<Fragment>
|
||||
<PageToolbarSeparator />
|
||||
class ApplicationSettings extends Component {
|
||||
render() {
|
||||
const {
|
||||
isTestingAll,
|
||||
dispatchTestAllApplications
|
||||
} = this.props;
|
||||
|
||||
<PageToolbarButton
|
||||
label={translate('SyncAppIndexers')}
|
||||
iconName={icons.REFRESH}
|
||||
/>
|
||||
return (
|
||||
<PageContent title={translate('Applications')}>
|
||||
<SettingsToolbarConnector
|
||||
showSave={false}
|
||||
additionalButtons={
|
||||
<Fragment>
|
||||
<PageToolbarSeparator />
|
||||
|
||||
<PageToolbarButton
|
||||
label={translate('TestAllApps')}
|
||||
iconName={icons.TEST}
|
||||
/>
|
||||
</Fragment>
|
||||
}
|
||||
/>
|
||||
<PageToolbarButton
|
||||
label={translate('SyncAppIndexers')}
|
||||
iconName={icons.REFRESH}
|
||||
/>
|
||||
|
||||
<PageContentBody>
|
||||
<ApplicationsConnector />
|
||||
</PageContentBody>
|
||||
</PageContent>
|
||||
);
|
||||
<PageToolbarButton
|
||||
label={translate('TestAllApps')}
|
||||
iconName={icons.TEST}
|
||||
isSpinning={isTestingAll}
|
||||
onPress={dispatchTestAllApplications}
|
||||
/>
|
||||
</Fragment>
|
||||
}
|
||||
/>
|
||||
|
||||
<PageContentBody>
|
||||
<ApplicationsConnector />
|
||||
</PageContentBody>
|
||||
</PageContent>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
ApplicationSettings.propTypes = {
|
||||
isTestingAll: PropTypes.bool.isRequired,
|
||||
dispatchTestAllApplications: PropTypes.func.isRequired
|
||||
};
|
||||
|
||||
export default ApplicationSettings;
|
||||
|
@@ -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);
|
@@ -3,6 +3,7 @@ import createFetchHandler from 'Store/Actions/Creators/createFetchHandler';
|
||||
import createFetchSchemaHandler from 'Store/Actions/Creators/createFetchSchemaHandler';
|
||||
import createRemoveItemHandler from 'Store/Actions/Creators/createRemoveItemHandler';
|
||||
import createSaveProviderHandler, { createCancelSaveProviderHandler } from 'Store/Actions/Creators/createSaveProviderHandler';
|
||||
import createTestAllProvidersHandler from 'Store/Actions/Creators/createTestAllProvidersHandler';
|
||||
import createTestProviderHandler, { createCancelTestProviderHandler } from 'Store/Actions/Creators/createTestProviderHandler';
|
||||
import createSetProviderFieldValueReducer from 'Store/Actions/Creators/Reducers/createSetProviderFieldValueReducer';
|
||||
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 TEST_APPLICATION = 'settings/applications/testApplication';
|
||||
export const CANCEL_TEST_APPLICATION = 'settings/applications/cancelTestApplication';
|
||||
export const TEST_ALL_APPLICATIONS = 'indexers/testAllApplications';
|
||||
|
||||
//
|
||||
// Action Creators
|
||||
@@ -40,6 +42,7 @@ export const cancelSaveApplication = createThunk(CANCEL_SAVE_APPLICATION);
|
||||
export const deleteApplication = createThunk(DELETE_APPLICATION);
|
||||
export const testApplication = createThunk(TEST_APPLICATION);
|
||||
export const cancelTestApplication = createThunk(CANCEL_TEST_APPLICATION);
|
||||
export const testAllApplications = createThunk(TEST_ALL_APPLICATIONS);
|
||||
|
||||
export const setApplicationValue = createAction(SET_APPLICATION_VALUE, (payload) => {
|
||||
return {
|
||||
@@ -75,6 +78,7 @@ export default {
|
||||
isSaving: false,
|
||||
saveError: null,
|
||||
isTesting: false,
|
||||
isTestingAll: false,
|
||||
items: [],
|
||||
pendingChanges: {}
|
||||
},
|
||||
@@ -90,7 +94,8 @@ export default {
|
||||
[CANCEL_SAVE_APPLICATION]: createCancelSaveProviderHandler(section),
|
||||
[DELETE_APPLICATION]: createRemoveItemHandler(section, '/applications'),
|
||||
[TEST_APPLICATION]: createTestProviderHandler(section, '/applications'),
|
||||
[CANCEL_TEST_APPLICATION]: createCancelTestProviderHandler(section)
|
||||
[CANCEL_TEST_APPLICATION]: createCancelTestProviderHandler(section),
|
||||
[TEST_ALL_APPLICATIONS]: createTestAllProvidersHandler(section, '/applications')
|
||||
},
|
||||
|
||||
//
|
||||
|
Reference in New Issue
Block a user