UI Formatting Cleanup

This commit is contained in:
Qstick 2017-10-07 02:21:06 -04:00
parent b963f2aa82
commit 52e3d96f4a
110 changed files with 901 additions and 701 deletions

View file

@ -12,8 +12,8 @@ function createSetServerSideCollectionSortHandler(section, getFromState, fetchHa
if (!sortDirection) {
if (payload.sortKey === sectionState.sortKey) {
sortDirection = sectionState.sortDirection === sortDirections.ASCENDING ?
sortDirections.DESCENDING :
sortDirections.ASCENDING;
sortDirections.DESCENDING :
sortDirections.ASCENDING;
} else {
sortDirection = sectionState.sortDirection;
}

View file

@ -12,13 +12,15 @@ const section = 'series';
const artistActionHandlers = {
[types.FETCH_ARTIST]: createFetchHandler(section, '/artist'),
[types.SAVE_ARTIST]: createSaveProviderHandler(section,
'/artist',
(state) => state.series),
[types.SAVE_ARTIST]: createSaveProviderHandler(
section,
'/artist',
(state) => state.series),
[types.DELETE_ARTIST]: createRemoveItemHandler(section,
'/artist',
(state) => state.series),
[types.DELETE_ARTIST]: createRemoveItemHandler(
section,
'/artist',
(state) => state.series),
[types.TOGGLE_ARTIST_MONITORED]: function(payload) {
return function(dispatch, getState) {

View file

@ -130,12 +130,12 @@ const calendarActionHandlers = {
};
const attrs = isPrePopulated ?
{
view,
...basesAttrs,
...dates
} :
basesAttrs;
{
view,
...basesAttrs,
...dates
} :
basesAttrs;
dispatch(set(attrs));

View file

@ -1,3 +1,4 @@
/* eslint callback-return: 0 */
import _ from 'lodash';
import $ from 'jquery';
import requestAction from 'Utilities/requestAction';

View file

@ -10,9 +10,10 @@ const section = 'rootFolders';
const rootFolderActionHandlers = {
[types.FETCH_ROOT_FOLDERS]: createFetchHandler('rootFolders', '/rootFolder'),
[types.DELETE_ROOT_FOLDER]: createRemoveItemHandler('rootFolders',
'/rootFolder',
(state) => state.rootFolders),
[types.DELETE_ROOT_FOLDER]: createRemoveItemHandler(
'rootFolders',
'/rootFolder',
(state) => state.rootFolders),
[types.ADD_ROOT_FOLDER]: function(payload) {
return function(dispatch, getState) {

View file

@ -88,34 +88,40 @@ const settingsActionHandlers = {
[types.FETCH_QUALITY_PROFILES]: createFetchHandler('qualityProfiles', '/qualityprofile'),
[types.FETCH_QUALITY_PROFILE_SCHEMA]: createFetchSchemaHandler('qualityProfiles', '/qualityprofile/schema'),
[types.SAVE_QUALITY_PROFILE]: createSaveProviderHandler('qualityProfiles',
'/qualityprofile',
(state) => state.settings.qualityProfiles),
[types.SAVE_QUALITY_PROFILE]: createSaveProviderHandler(
'qualityProfiles',
'/qualityprofile',
(state) => state.settings.qualityProfiles),
[types.DELETE_QUALITY_PROFILE]: createRemoveItemHandler('qualityProfiles',
'/qualityprofile',
(state) => state.settings.qualityProfiles),
[types.DELETE_QUALITY_PROFILE]: createRemoveItemHandler(
'qualityProfiles',
'/qualityprofile',
(state) => state.settings.qualityProfiles),
[types.FETCH_LANGUAGE_PROFILES]: createFetchHandler('languageProfiles', '/languageprofile'),
[types.FETCH_LANGUAGE_PROFILE_SCHEMA]: createFetchSchemaHandler('languageProfiles', '/languageprofile/schema'),
[types.SAVE_LANGUAGE_PROFILE]: createSaveProviderHandler('languageProfiles',
'/languageprofile',
(state) => state.settings.languageProfiles),
[types.SAVE_LANGUAGE_PROFILE]: createSaveProviderHandler(
'languageProfiles',
'/languageprofile',
(state) => state.settings.languageProfiles),
[types.DELETE_LANGUAGE_PROFILE]: createRemoveItemHandler('languageProfiles',
'/languageprofile',
(state) => state.settings.languageProfiles),
[types.DELETE_LANGUAGE_PROFILE]: createRemoveItemHandler(
'languageProfiles',
'/languageprofile',
(state) => state.settings.languageProfiles),
[types.FETCH_DELAY_PROFILES]: createFetchHandler('delayProfiles', '/delayprofile'),
[types.SAVE_DELAY_PROFILE]: createSaveProviderHandler('delayProfiles',
'/delayprofile',
(state) => state.settings.delayProfiles),
[types.SAVE_DELAY_PROFILE]: createSaveProviderHandler(
'delayProfiles',
'/delayprofile',
(state) => state.settings.delayProfiles),
[types.DELETE_DELAY_PROFILE]: createRemoveItemHandler('delayProfiles',
'/delayprofile',
(state) => state.settings.delayProfiles),
[types.DELETE_DELAY_PROFILE]: createRemoveItemHandler(
'delayProfiles',
'/delayprofile',
(state) => state.settings.delayProfiles),
[types.FETCH_QUALITY_DEFINITIONS]: createFetchHandler('qualityDefinitions', '/qualitydefinition'),
[types.SAVE_QUALITY_DEFINITIONS]: createSaveHandler('qualityDefinitions', '/qualitydefinition', (state) => state.settings.qualitydefinitions),
@ -157,19 +163,22 @@ const settingsActionHandlers = {
[types.FETCH_INDEXERS]: createFetchHandler('indexers', '/indexer'),
[types.FETCH_INDEXER_SCHEMA]: createFetchSchemaHandler('indexers', '/indexer/schema'),
[types.SAVE_INDEXER]: createSaveProviderHandler('indexers',
'/indexer',
(state) => state.settings.indexers),
[types.SAVE_INDEXER]: createSaveProviderHandler(
'indexers',
'/indexer',
(state) => state.settings.indexers),
[types.CANCEL_SAVE_INDEXER]: createCancelSaveProviderHandler('indexers'),
[types.DELETE_INDEXER]: createRemoveItemHandler('indexers',
'/indexer',
(state) => state.settings.indexers),
[types.DELETE_INDEXER]: createRemoveItemHandler(
'indexers',
'/indexer',
(state) => state.settings.indexers),
[types.TEST_INDEXER]: createTestProviderHandler('indexers',
'/indexer',
(state) => state.settings.indexers),
[types.TEST_INDEXER]: createTestProviderHandler(
'indexers',
'/indexer',
(state) => state.settings.indexers),
[types.CANCEL_TEST_INDEXER]: createCancelTestProviderHandler('indexers'),
@ -178,30 +187,35 @@ const settingsActionHandlers = {
[types.FETCH_RESTRICTIONS]: createFetchHandler('restrictions', '/restriction'),
[types.SAVE_RESTRICTION]: createSaveProviderHandler('restrictions',
'/restriction',
(state) => state.settings.restrictions),
[types.SAVE_RESTRICTION]: createSaveProviderHandler(
'restrictions',
'/restriction',
(state) => state.settings.restrictions),
[types.DELETE_RESTRICTION]: createRemoveItemHandler('restrictions',
'/restriction',
(state) => state.settings.restrictions),
[types.DELETE_RESTRICTION]: createRemoveItemHandler(
'restrictions',
'/restriction',
(state) => state.settings.restrictions),
[types.FETCH_DOWNLOAD_CLIENTS]: createFetchHandler('downloadClients', '/downloadclient'),
[types.FETCH_DOWNLOAD_CLIENT_SCHEMA]: createFetchSchemaHandler('downloadClients', '/downloadclient/schema'),
[types.SAVE_DOWNLOAD_CLIENT]: createSaveProviderHandler('downloadClients',
'/downloadclient',
(state) => state.settings.downloadClients),
[types.SAVE_DOWNLOAD_CLIENT]: createSaveProviderHandler(
'downloadClients',
'/downloadclient',
(state) => state.settings.downloadClients),
[types.CANCEL_SAVE_DOWNLOAD_CLIENT]: createCancelSaveProviderHandler('downloadClients'),
[types.DELETE_DOWNLOAD_CLIENT]: createRemoveItemHandler('downloadClients',
'/downloadclient',
(state) => state.settings.downloadClients),
[types.DELETE_DOWNLOAD_CLIENT]: createRemoveItemHandler(
'downloadClients',
'/downloadclient',
(state) => state.settings.downloadClients),
[types.TEST_DOWNLOAD_CLIENT]: createTestProviderHandler('downloadClients',
'/downloadclient',
(state) => state.settings.downloadClients),
[types.TEST_DOWNLOAD_CLIENT]: createTestProviderHandler(
'downloadClients',
'/downloadclient',
(state) => state.settings.downloadClients),
[types.CANCEL_TEST_DOWNLOAD_CLIENT]: createCancelTestProviderHandler('downloadClients'),
@ -210,38 +224,44 @@ const settingsActionHandlers = {
[types.FETCH_REMOTE_PATH_MAPPINGS]: createFetchHandler('remotePathMappings', '/remotepathmapping'),
[types.SAVE_REMOTE_PATH_MAPPING]: createSaveProviderHandler('remotePathMappings',
'/remotepathmapping',
(state) => state.settings.remotePathMappings),
[types.SAVE_REMOTE_PATH_MAPPING]: createSaveProviderHandler(
'remotePathMappings',
'/remotepathmapping',
(state) => state.settings.remotePathMappings),
[types.DELETE_REMOTE_PATH_MAPPING]: createRemoveItemHandler('remotePathMappings',
'/remotepathmapping',
(state) => state.settings.remotePathMappings),
[types.DELETE_REMOTE_PATH_MAPPING]: createRemoveItemHandler(
'remotePathMappings',
'/remotepathmapping',
(state) => state.settings.remotePathMappings),
[types.FETCH_NOTIFICATIONS]: createFetchHandler('notifications', '/notification'),
[types.FETCH_NOTIFICATION_SCHEMA]: createFetchSchemaHandler('notifications', '/notification/schema'),
[types.SAVE_NOTIFICATION]: createSaveProviderHandler('notifications',
'/notification',
(state) => state.settings.notifications),
[types.SAVE_NOTIFICATION]: createSaveProviderHandler(
'notifications',
'/notification',
(state) => state.settings.notifications),
[types.CANCEL_SAVE_NOTIFICATION]: createCancelSaveProviderHandler('notifications'),
[types.DELETE_NOTIFICATION]: createRemoveItemHandler('notifications',
'/notification',
(state) => state.settings.notifications),
[types.DELETE_NOTIFICATION]: createRemoveItemHandler(
'notifications',
'/notification',
(state) => state.settings.notifications),
[types.TEST_NOTIFICATION]: createTestProviderHandler('notifications',
'/notification',
(state) => state.settings.notifications),
[types.TEST_NOTIFICATION]: createTestProviderHandler(
'notifications',
'/notification',
(state) => state.settings.notifications),
[types.CANCEL_TEST_NOTIFICATION]: createCancelTestProviderHandler('notifications'),
[types.FETCH_METADATA]: createFetchHandler('metadata', '/metadata'),
[types.SAVE_METADATA]: createSaveProviderHandler('metadata',
'/metadata',
(state) => state.settings.metadata),
[types.SAVE_METADATA]: createSaveProviderHandler(
'metadata',
'/metadata',
(state) => state.settings.metadata),
[types.FETCH_METADATA_PROVIDER]: createFetchHandler('metadataProvider', '/config/metadataProvider'),
[types.SAVE_METADATA_PROVIDER]: createSaveHandler('metadataProvider', '/config/metadataProvider', (state) => state.settings.metadataProvider),

View file

@ -1,35 +1,15 @@
import { applyMiddleware, compose } from 'redux';
import Raven from 'raven-js';
import createRavenMiddleware from 'raven-for-redux';
import thunk from 'redux-thunk';
import { routerMiddleware } from 'react-router-redux';
import sentryMiddleware from './sentryMiddleware';
import persistState from './persistState';
export default function(history) {
const {
analytics,
branch,
version,
release,
isProduction
} = window.Sonarr;
const dsn = isProduction ? 'https://c3a5b33e08de4e18b7d0505e942dbc95@sentry.io/216290' :
'https://c3a5b33e08de4e18b7d0505e942dbc95@sentry.io/216290';
Raven.config(dsn).install();
const middlewares = [];
const ravenMiddleware = sentryMiddleware();
if (analytics) {
middlewares.push(createRavenMiddleware(Raven, {
environment: isProduction ? 'production' : 'development',
release,
tags: {
branch,
version
}
}));
if (ravenMiddleware) {
middlewares.push(ravenMiddleware);
}
middlewares.push(routerMiddleware(history));

View file

@ -0,0 +1,48 @@
import _ from 'lodash';
import Raven from 'raven-js';
import createRavenMiddleware from 'raven-for-redux';
import parseUrl from 'Utilities/String/parseUrl';
function cleanseUrl(url) {
const properties = parseUrl(url);
return `${properties.pathname}${properties.search}`;
}
function cleanseData(data) {
const result = _.cloneDeep(data);
result.culprit = cleanseUrl(result.culprit);
result.request.url = cleanseUrl(result.request.url);
return result;
}
export default function sentryMiddleware() {
const {
analytics,
branch,
version,
release,
isProduction
} = window.Sonarr;
if (!analytics) {
return;
}
const dsn = isProduction ? 'https://c3a5b33e08de4e18b7d0505e942dbc95@sentry.io/216290' :
'https://c3a5b33e08de4e18b7d0505e942dbc95@sentry.io/216290';
Raven.config(dsn).install();
return createRavenMiddleware(Raven, {
environment: isProduction ? 'production' : 'development',
release,
tags: {
branch,
version
},
dataCallback: cleanseData
});
}

View file

@ -12,8 +12,8 @@ function createSetClientSideCollectionSortReducer(section) {
if (!sortDirection) {
if (payload.sortKey === newState.sortKey) {
sortDirection = newState.sortDirection === sortDirections.ASCENDING ?
sortDirections.DESCENDING :
sortDirections.ASCENDING;
sortDirections.DESCENDING :
sortDirections.ASCENDING;
} else {
sortDirection = newState.sortDirection;
}

View file

@ -2,28 +2,6 @@ import _ from 'lodash';
import getSectionState from 'Utilities/State/getSectionState';
import updateSectionState from 'Utilities/State/updateSectionState';
const whitelistedProperties = [
'isFetching',
'isPopulated',
'error',
'isFetchingSchema',
'schemaPopulated',
'schemaError',
'schema',
'selectedSchema',
'isSaving',
'saveError',
'isTesting',
'isDeleting',
'deleteError',
'pendingChanges',
'filterKey',
'filterValue',
'page',
'sortKey',
'sortDirection'
];
const blacklistedProperties = [
'section',
'id'
@ -33,7 +11,7 @@ function createSetReducer(section) {
return (state, { payload }) => {
if (section === payload.section) {
const newState = Object.assign(getSectionState(state, section),
_.omit(payload, blacklistedProperties));
_.omit(payload, blacklistedProperties));
return updateSectionState(state, section, newState);
}

View file

@ -9,8 +9,9 @@ const whitelistedProperties = [
function createSetTableOptionReducer(section) {
return (state, { payload }) => {
const newState = Object.assign(getSectionState(state, section),
_.pick(payload, whitelistedProperties));
const newState = Object.assign(
getSectionState(state, section),
_.pick(payload, whitelistedProperties));
return updateSectionState(state, section, newState);
};

View file

@ -1,5 +1,4 @@
import { handleActions } from 'redux-actions';
import updateSectionState from 'Utilities/State/updateSectionState';
import { sortDirections } from 'Helpers/Props';
import * as types from 'Store/Actions/actionTypes';
import createClearReducer from './Creators/createClearReducer';