mirror of
https://github.com/Radarr/Radarr.git
synced 2026-04-18 21:35:51 -04:00
Compare commits
70 Commits
v4.5.2.738
...
v4.6.3.751
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8fd267580a | ||
|
|
8974aa823b | ||
|
|
41492efd2e | ||
|
|
d008768fff | ||
|
|
cb21fe535d | ||
|
|
4cce2727e2 | ||
|
|
b1ff82da37 | ||
|
|
c5266152c5 | ||
|
|
783878be1e | ||
|
|
0cbfb4ca65 | ||
|
|
c22c9400c2 | ||
|
|
0288c4b704 | ||
|
|
e4429d2919 | ||
|
|
7052a7a5ec | ||
|
|
b38912851b | ||
|
|
1354c2c337 | ||
|
|
e259235df6 | ||
|
|
0cc1fe8308 | ||
|
|
f4fe18a440 | ||
|
|
eeed935e3a | ||
|
|
1b3701371a | ||
|
|
d56f3ec2e7 | ||
|
|
e7e3aac971 | ||
|
|
d2cb36c88a | ||
|
|
2fe28cb1dc | ||
|
|
5d65b4cae4 | ||
|
|
b0f56e2840 | ||
|
|
5593837482 | ||
|
|
8231290c7b | ||
|
|
0c1b88c60a | ||
|
|
0b8478e4a1 | ||
|
|
69e09c8687 | ||
|
|
3f2ea49023 | ||
|
|
32f09633e9 | ||
|
|
3542b263c7 | ||
|
|
d5cc84d8c8 | ||
|
|
c0790060fb | ||
|
|
5ec7e86488 | ||
|
|
b8abafd72f | ||
|
|
a471f1b44f | ||
|
|
7fe34be789 | ||
|
|
471a34eabf | ||
|
|
4fe5e5974e | ||
|
|
1ca66d0b29 | ||
|
|
4ab1cb393a | ||
|
|
fa1f07987c | ||
|
|
b5a5530cb1 | ||
|
|
e0448f7213 | ||
|
|
8eee5a3b1d | ||
|
|
830f1aa10f | ||
|
|
7666c7b1eb | ||
|
|
0b4c12dd7b | ||
|
|
53857083f2 | ||
|
|
ea9c77cf49 | ||
|
|
43ed8d0c2b | ||
|
|
9df06b80bf | ||
|
|
713f984b26 | ||
|
|
683d261a91 | ||
|
|
b33d9a9641 | ||
|
|
c69cc20266 | ||
|
|
4fc1ee0aff | ||
|
|
1d4b6d4cad | ||
|
|
5baeba18cb | ||
|
|
854b3045fe | ||
|
|
6b80c244bf | ||
|
|
044de922fa | ||
|
|
c987824174 | ||
|
|
8762588ef0 | ||
|
|
ed68a944ea | ||
|
|
52c64080f2 |
@@ -40,12 +40,18 @@ dotnet_naming_style.instance_field_style.capitalization = camel_case
|
|||||||
dotnet_naming_style.instance_field_style.required_prefix = _
|
dotnet_naming_style.instance_field_style.required_prefix = _
|
||||||
|
|
||||||
# Prefer "var" everywhere
|
# Prefer "var" everywhere
|
||||||
csharp_style_var_for_built_in_types = true:suggestion
|
csharp_style_var_for_built_in_types = true
|
||||||
csharp_style_var_when_type_is_apparent = true:suggestion
|
csharp_style_var_when_type_is_apparent = true
|
||||||
csharp_style_var_elsewhere = true:suggestion
|
csharp_style_var_elsewhere = true
|
||||||
|
# Prefer "out" variables to be declared inline
|
||||||
|
csharp_style_inlined_variable_declaration = true
|
||||||
|
|
||||||
# Using directive is unnecessary.
|
# Using directive is unnecessary.
|
||||||
dotnet_diagnostic.IDE0005.severity = error
|
dotnet_diagnostic.IDE0005.severity = error
|
||||||
|
# Use var instead of explicit type
|
||||||
|
dotnet_diagnostic.IDE0007.severity = error
|
||||||
|
# Inline variable declaration
|
||||||
|
dotnet_diagnostic.IDE0018.severity = error
|
||||||
|
|
||||||
# Stylecop Rules
|
# Stylecop Rules
|
||||||
dotnet_diagnostic.SA0001.severity = none
|
dotnet_diagnostic.SA0001.severity = none
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ variables:
|
|||||||
testsFolder: './_tests'
|
testsFolder: './_tests'
|
||||||
yarnCacheFolder: $(Pipeline.Workspace)/.yarn
|
yarnCacheFolder: $(Pipeline.Workspace)/.yarn
|
||||||
nugetCacheFolder: $(Pipeline.Workspace)/.nuget/packages
|
nugetCacheFolder: $(Pipeline.Workspace)/.nuget/packages
|
||||||
majorVersion: '4.5.2'
|
majorVersion: '4.6.3'
|
||||||
minorVersion: $[counter('minorVersion', 2000)]
|
minorVersion: $[counter('minorVersion', 2000)]
|
||||||
radarrVersion: '$(majorVersion).$(minorVersion)'
|
radarrVersion: '$(majorVersion).$(minorVersion)'
|
||||||
buildName: '$(Build.SourceBranchName).$(radarrVersion)'
|
buildName: '$(Build.SourceBranchName).$(radarrVersion)'
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import React, { Component } from 'react';
|
import React, { Component } from 'react';
|
||||||
|
import Alert from 'Components/Alert';
|
||||||
import LoadingIndicator from 'Components/Loading/LoadingIndicator';
|
import LoadingIndicator from 'Components/Loading/LoadingIndicator';
|
||||||
import ConfirmModal from 'Components/Modal/ConfirmModal';
|
import ConfirmModal from 'Components/Modal/ConfirmModal';
|
||||||
import PageContent from 'Components/Page/PageContent';
|
import PageContent from 'Components/Page/PageContent';
|
||||||
@@ -156,16 +157,16 @@ class Blocklist extends Component {
|
|||||||
|
|
||||||
{
|
{
|
||||||
!isFetching && !!error &&
|
!isFetching && !!error &&
|
||||||
<div>
|
<Alert kind={kinds.DANGER}>
|
||||||
{translate('UnableToLoadBlocklist')}
|
{translate('UnableToLoadBlocklist')}
|
||||||
</div>
|
</Alert>
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
isPopulated && !error && !items.length &&
|
isPopulated && !error && !items.length &&
|
||||||
<div>
|
<Alert kind={kinds.INFO}>
|
||||||
{translate('NoHistory')}
|
{translate('NoHistoryBlocklist')}
|
||||||
</div>
|
</Alert>
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
@@ -209,7 +210,7 @@ class Blocklist extends Component {
|
|||||||
isOpen={isConfirmRemoveModalOpen}
|
isOpen={isConfirmRemoveModalOpen}
|
||||||
kind={kinds.DANGER}
|
kind={kinds.DANGER}
|
||||||
title={translate('RemoveSelected')}
|
title={translate('RemoveSelected')}
|
||||||
message={translate('AreYouSureYouWantToRemoveTheSelectedItemsFromBlocklist')}
|
message={translate('RemoveSelectedItemBlocklistMessageText')}
|
||||||
confirmLabel={translate('RemoveSelected')}
|
confirmLabel={translate('RemoveSelected')}
|
||||||
onConfirm={this.onRemoveSelectedConfirmed}
|
onConfirm={this.onRemoveSelectedConfirmed}
|
||||||
onCancel={this.onConfirmRemoveModalClose}
|
onCancel={this.onConfirmRemoveModalClose}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import React, { Component } from 'react';
|
import React, { Component } from 'react';
|
||||||
|
import Alert from 'Components/Alert';
|
||||||
import LoadingIndicator from 'Components/Loading/LoadingIndicator';
|
import LoadingIndicator from 'Components/Loading/LoadingIndicator';
|
||||||
import FilterMenu from 'Components/Menu/FilterMenu';
|
import FilterMenu from 'Components/Menu/FilterMenu';
|
||||||
import PageContent from 'Components/Page/PageContent';
|
import PageContent from 'Components/Page/PageContent';
|
||||||
@@ -11,7 +12,7 @@ import Table from 'Components/Table/Table';
|
|||||||
import TableBody from 'Components/Table/TableBody';
|
import TableBody from 'Components/Table/TableBody';
|
||||||
import TableOptionsModalWrapper from 'Components/Table/TableOptions/TableOptionsModalWrapper';
|
import TableOptionsModalWrapper from 'Components/Table/TableOptions/TableOptionsModalWrapper';
|
||||||
import TablePager from 'Components/Table/TablePager';
|
import TablePager from 'Components/Table/TablePager';
|
||||||
import { align, icons } from 'Helpers/Props';
|
import { align, icons, kinds } from 'Helpers/Props';
|
||||||
import translate from 'Utilities/String/translate';
|
import translate from 'Utilities/String/translate';
|
||||||
import HistoryRowConnector from './HistoryRowConnector';
|
import HistoryRowConnector from './HistoryRowConnector';
|
||||||
|
|
||||||
@@ -83,9 +84,9 @@ class History extends Component {
|
|||||||
|
|
||||||
{
|
{
|
||||||
!isFetchingAny && hasError &&
|
!isFetchingAny && hasError &&
|
||||||
<div>
|
<Alert kind={kinds.DANGER}>
|
||||||
{translate('UnableToLoadHistory')}
|
{translate('UnableToLoadHistory')}
|
||||||
</div>
|
</Alert>
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
@@ -93,9 +94,9 @@ class History extends Component {
|
|||||||
// wait for the episodes to populate because they are never coming.
|
// wait for the episodes to populate because they are never coming.
|
||||||
|
|
||||||
isPopulated && !hasError && !items.length &&
|
isPopulated && !hasError && !items.length &&
|
||||||
<div>
|
<Alert kind={kinds.INFO}>
|
||||||
{translate('NoHistory')}
|
{translate('NoHistory')}
|
||||||
</div>
|
</Alert>
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import React, { Component } from 'react';
|
import React, { Component } from 'react';
|
||||||
|
import Alert from 'Components/Alert';
|
||||||
import LoadingIndicator from 'Components/Loading/LoadingIndicator';
|
import LoadingIndicator from 'Components/Loading/LoadingIndicator';
|
||||||
import PageContent from 'Components/Page/PageContent';
|
import PageContent from 'Components/Page/PageContent';
|
||||||
import PageContentBody from 'Components/Page/PageContentBody';
|
import PageContentBody from 'Components/Page/PageContentBody';
|
||||||
@@ -12,7 +13,7 @@ import Table from 'Components/Table/Table';
|
|||||||
import TableBody from 'Components/Table/TableBody';
|
import TableBody from 'Components/Table/TableBody';
|
||||||
import TableOptionsModalWrapper from 'Components/Table/TableOptions/TableOptionsModalWrapper';
|
import TableOptionsModalWrapper from 'Components/Table/TableOptions/TableOptionsModalWrapper';
|
||||||
import TablePager from 'Components/Table/TablePager';
|
import TablePager from 'Components/Table/TablePager';
|
||||||
import { align, icons } from 'Helpers/Props';
|
import { align, icons, kinds } from 'Helpers/Props';
|
||||||
import getRemovedItems from 'Utilities/Object/getRemovedItems';
|
import getRemovedItems from 'Utilities/Object/getRemovedItems';
|
||||||
import hasDifferentItems from 'Utilities/Object/hasDifferentItems';
|
import hasDifferentItems from 'Utilities/Object/hasDifferentItems';
|
||||||
import translate from 'Utilities/String/translate';
|
import translate from 'Utilities/String/translate';
|
||||||
@@ -231,17 +232,17 @@ class Queue extends Component {
|
|||||||
|
|
||||||
{
|
{
|
||||||
!isRefreshing && hasError ?
|
!isRefreshing && hasError ?
|
||||||
<div>
|
<Alert kind={kinds.DANGER}>
|
||||||
{translate('FailedToLoadQueue')}
|
{translate('FailedToLoadQueue')}
|
||||||
</div> :
|
</Alert> :
|
||||||
null
|
null
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
isAllPopulated && !hasError && !items.length ?
|
isAllPopulated && !hasError && !items.length ?
|
||||||
<div>
|
<Alert kind={kinds.INFO}>
|
||||||
{translate('QueueIsEmpty')}
|
{translate('QueueIsEmpty')}
|
||||||
</div> :
|
</Alert> :
|
||||||
null
|
null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ class RemoveQueueItemsModal extends Component {
|
|||||||
|
|
||||||
<ModalBody>
|
<ModalBody>
|
||||||
<div className={styles.message}>
|
<div className={styles.message}>
|
||||||
{selectedCount > 1 ? translate('AreYouSureYouWantToRemoveSelectedItemsFromQueue', selectedCount) : translate('AreYouSureYouWantToRemoveSelectedItemFromQueue')}
|
{selectedCount > 1 ? translate('RemoveSelectedItemsQueueMessageText', selectedCount) : translate('RemoveSelectedItemQueueMessageText')}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{
|
{
|
||||||
@@ -133,7 +133,7 @@ class RemoveQueueItemsModal extends Component {
|
|||||||
kind={kinds.DANGER}
|
kind={kinds.DANGER}
|
||||||
onPress={this.onRemoveConfirmed}
|
onPress={this.onRemoveConfirmed}
|
||||||
>
|
>
|
||||||
Remove
|
{translate('Remove')}
|
||||||
</Button>
|
</Button>
|
||||||
</ModalFooter>
|
</ModalFooter>
|
||||||
</ModalContent>
|
</ModalContent>
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
import { reduce } from 'lodash';
|
import { reduce } from 'lodash';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import React, { Component } from 'react';
|
import React, { Component } from 'react';
|
||||||
|
import Alert from 'Components/Alert';
|
||||||
import LoadingIndicator from 'Components/Loading/LoadingIndicator';
|
import LoadingIndicator from 'Components/Loading/LoadingIndicator';
|
||||||
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 { kinds } from 'Helpers/Props';
|
||||||
import translate from 'Utilities/String/translate';
|
import translate from 'Utilities/String/translate';
|
||||||
import selectAll from 'Utilities/Table/selectAll';
|
import selectAll from 'Utilities/Table/selectAll';
|
||||||
import toggleSelected from 'Utilities/Table/toggleSelected';
|
import toggleSelected from 'Utilities/Table/toggleSelected';
|
||||||
@@ -105,9 +107,9 @@ class ImportMovie extends Component {
|
|||||||
|
|
||||||
{
|
{
|
||||||
!rootFoldersFetching && !!rootFoldersError ?
|
!rootFoldersFetching && !!rootFoldersError ?
|
||||||
<div>
|
<Alert kind={kinds.DANGER}>
|
||||||
{translate('UnableToLoadRootFolders')}
|
{translate('UnableToLoadRootFolders')}
|
||||||
</div> :
|
</Alert> :
|
||||||
null
|
null
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -116,9 +118,9 @@ class ImportMovie extends Component {
|
|||||||
!rootFoldersFetching &&
|
!rootFoldersFetching &&
|
||||||
rootFoldersPopulated &&
|
rootFoldersPopulated &&
|
||||||
!unmappedFolders.length ?
|
!unmappedFolders.length ?
|
||||||
<div>
|
<Alert kind={kinds.INFO}>
|
||||||
{translate('AllMoviesInPathHaveBeenImported', [path])}
|
{translate('AllMoviesInPathHaveBeenImported', [path])}
|
||||||
</div> :
|
</Alert> :
|
||||||
null
|
null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -92,9 +92,9 @@ class ImportMovieSelectFolder extends Component {
|
|||||||
|
|
||||||
{
|
{
|
||||||
!isFetching && error ?
|
!isFetching && error ?
|
||||||
<div>
|
<Alert kind={kinds.DANGER}>
|
||||||
{translate('UnableToLoadRootFolders')}
|
{translate('UnableToLoadRootFolders')}
|
||||||
</div> :
|
</Alert> :
|
||||||
null
|
null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,14 +1,33 @@
|
|||||||
import AppSectionState, {
|
import AppSectionState, {
|
||||||
AppSectionDeleteState,
|
AppSectionDeleteState,
|
||||||
|
AppSectionSaveState,
|
||||||
AppSectionSchemaState,
|
AppSectionSchemaState,
|
||||||
} from 'App/State/AppSectionState';
|
} from 'App/State/AppSectionState';
|
||||||
import Language from 'Language/Language';
|
import Language from 'Language/Language';
|
||||||
import DownloadClient from 'typings/DownloadClient';
|
import DownloadClient from 'typings/DownloadClient';
|
||||||
|
import ImportList from 'typings/ImportList';
|
||||||
|
import Indexer from 'typings/Indexer';
|
||||||
|
import Notification from 'typings/Notification';
|
||||||
import QualityProfile from 'typings/QualityProfile';
|
import QualityProfile from 'typings/QualityProfile';
|
||||||
import { UiSettings } from 'typings/UiSettings';
|
import { UiSettings } from 'typings/UiSettings';
|
||||||
|
|
||||||
export interface DownloadClientAppState
|
export interface DownloadClientAppState
|
||||||
extends AppSectionState<DownloadClient>,
|
extends AppSectionState<DownloadClient>,
|
||||||
|
AppSectionDeleteState,
|
||||||
|
AppSectionSaveState {}
|
||||||
|
|
||||||
|
export interface ImportListAppState
|
||||||
|
extends AppSectionState<ImportList>,
|
||||||
|
AppSectionDeleteState,
|
||||||
|
AppSectionSaveState {}
|
||||||
|
|
||||||
|
export interface IndexerAppState
|
||||||
|
extends AppSectionState<Indexer>,
|
||||||
|
AppSectionDeleteState,
|
||||||
|
AppSectionSaveState {}
|
||||||
|
|
||||||
|
export interface NotificationAppState
|
||||||
|
extends AppSectionState<Notification>,
|
||||||
AppSectionDeleteState {}
|
AppSectionDeleteState {}
|
||||||
|
|
||||||
export interface QualityProfilesAppState
|
export interface QualityProfilesAppState
|
||||||
@@ -20,6 +39,9 @@ export type UiSettingsAppState = AppSectionState<UiSettings>;
|
|||||||
|
|
||||||
interface SettingsAppState {
|
interface SettingsAppState {
|
||||||
downloadClients: DownloadClientAppState;
|
downloadClients: DownloadClientAppState;
|
||||||
|
importLists: ImportListAppState;
|
||||||
|
indexers: IndexerAppState;
|
||||||
|
notifications: NotificationAppState;
|
||||||
language: LanguageSettingsAppState;
|
language: LanguageSettingsAppState;
|
||||||
uiSettings: UiSettingsAppState;
|
uiSettings: UiSettingsAppState;
|
||||||
qualityProfiles: QualityProfilesAppState;
|
qualityProfiles: QualityProfilesAppState;
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import React, { Component } from 'react';
|
import React, { Component } from 'react';
|
||||||
|
import Alert from 'Components/Alert';
|
||||||
import LoadingIndicator from 'Components/Loading/LoadingIndicator';
|
import LoadingIndicator from 'Components/Loading/LoadingIndicator';
|
||||||
|
import { kinds } from 'Helpers/Props';
|
||||||
import translate from 'Utilities/String/translate';
|
import translate from 'Utilities/String/translate';
|
||||||
import AgendaConnector from './Agenda/AgendaConnector';
|
import AgendaConnector from './Agenda/AgendaConnector';
|
||||||
import * as calendarViews from './calendarViews';
|
import * as calendarViews from './calendarViews';
|
||||||
@@ -31,9 +33,9 @@ class Calendar extends Component {
|
|||||||
|
|
||||||
{
|
{
|
||||||
!isFetching && !!error &&
|
!isFetching && !!error &&
|
||||||
<div>
|
<Alert kind={kinds.DANGER}>
|
||||||
{translate('UnableToLoadTheCalendar')}
|
{translate('UnableToLoadTheCalendar')}
|
||||||
</div>
|
</Alert>
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import React, { Component } from 'react';
|
import React, { Component } from 'react';
|
||||||
|
import Alert from 'Components/Alert';
|
||||||
import LoadingIndicator from 'Components/Loading/LoadingIndicator';
|
import LoadingIndicator from 'Components/Loading/LoadingIndicator';
|
||||||
import PageContent from 'Components/Page/PageContent';
|
import PageContent from 'Components/Page/PageContent';
|
||||||
import PageContentBody from 'Components/Page/PageContentBody';
|
import PageContentBody from 'Components/Page/PageContentBody';
|
||||||
@@ -9,7 +10,7 @@ import PageToolbar from 'Components/Page/Toolbar/PageToolbar';
|
|||||||
import PageToolbarButton from 'Components/Page/Toolbar/PageToolbarButton';
|
import PageToolbarButton from 'Components/Page/Toolbar/PageToolbarButton';
|
||||||
import PageToolbarSection from 'Components/Page/Toolbar/PageToolbarSection';
|
import PageToolbarSection from 'Components/Page/Toolbar/PageToolbarSection';
|
||||||
import PageToolbarSeparator from 'Components/Page/Toolbar/PageToolbarSeparator';
|
import PageToolbarSeparator from 'Components/Page/Toolbar/PageToolbarSeparator';
|
||||||
import { align, icons, sortDirections } from 'Helpers/Props';
|
import { align, icons, kinds, sortDirections } from 'Helpers/Props';
|
||||||
import styles from 'Movie/Index/MovieIndex.css';
|
import styles from 'Movie/Index/MovieIndex.css';
|
||||||
import hasDifferentItemsOrOrder from 'Utilities/Object/hasDifferentItemsOrOrder';
|
import hasDifferentItemsOrOrder from 'Utilities/Object/hasDifferentItemsOrOrder';
|
||||||
import translate from 'Utilities/String/translate';
|
import translate from 'Utilities/String/translate';
|
||||||
@@ -313,9 +314,9 @@ class Collection extends Component {
|
|||||||
|
|
||||||
{
|
{
|
||||||
!isFetching && !!error &&
|
!isFetching && !!error &&
|
||||||
<div>
|
<Alert kind={kinds.DANGER}>
|
||||||
{translate('UnableToLoadCollections')}
|
{translate('UnableToLoadCollections')}
|
||||||
</div>
|
</Alert>
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -265,6 +265,8 @@ FormInputGroup.propTypes = {
|
|||||||
values: PropTypes.arrayOf(PropTypes.any),
|
values: PropTypes.arrayOf(PropTypes.any),
|
||||||
type: PropTypes.string.isRequired,
|
type: PropTypes.string.isRequired,
|
||||||
kind: PropTypes.oneOf(kinds.all),
|
kind: PropTypes.oneOf(kinds.all),
|
||||||
|
min: PropTypes.number,
|
||||||
|
max: PropTypes.number,
|
||||||
unit: PropTypes.string,
|
unit: PropTypes.string,
|
||||||
buttons: PropTypes.oneOfType([PropTypes.node, PropTypes.arrayOf(PropTypes.node)]),
|
buttons: PropTypes.oneOfType([PropTypes.node, PropTypes.arrayOf(PropTypes.node)]),
|
||||||
helpText: PropTypes.string,
|
helpText: PropTypes.string,
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ function parseValue(props, value) {
|
|||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
if (value == null || value === '') {
|
if (value == null || value === '') {
|
||||||
return min;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
let newValue = isFloat ? parseFloat(value) : parseInt(value);
|
let newValue = isFloat ? parseFloat(value) : parseInt(value);
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ function ProviderFieldFormGroup(props) {
|
|||||||
name,
|
name,
|
||||||
label,
|
label,
|
||||||
helpText,
|
helpText,
|
||||||
|
helpTextWarning,
|
||||||
helpLink,
|
helpLink,
|
||||||
placeholder,
|
placeholder,
|
||||||
value,
|
value,
|
||||||
@@ -96,6 +97,7 @@ function ProviderFieldFormGroup(props) {
|
|||||||
name={name}
|
name={name}
|
||||||
label={label}
|
label={label}
|
||||||
helpText={helpText}
|
helpText={helpText}
|
||||||
|
helpTextWarning={helpTextWarning}
|
||||||
helpLink={helpLink}
|
helpLink={helpLink}
|
||||||
placeholder={placeholder}
|
placeholder={placeholder}
|
||||||
value={value}
|
value={value}
|
||||||
@@ -122,6 +124,7 @@ ProviderFieldFormGroup.propTypes = {
|
|||||||
name: PropTypes.string.isRequired,
|
name: PropTypes.string.isRequired,
|
||||||
label: PropTypes.string.isRequired,
|
label: PropTypes.string.isRequired,
|
||||||
helpText: PropTypes.string,
|
helpText: PropTypes.string,
|
||||||
|
helpTextWarning: PropTypes.string,
|
||||||
helpLink: PropTypes.string,
|
helpLink: PropTypes.string,
|
||||||
placeholder: PropTypes.string,
|
placeholder: PropTypes.string,
|
||||||
value: PropTypes.any,
|
value: PropTypes.any,
|
||||||
|
|||||||
@@ -19,6 +19,8 @@ function createCleanMovieSelector() {
|
|||||||
year,
|
year,
|
||||||
images,
|
images,
|
||||||
alternateTitles = [],
|
alternateTitles = [],
|
||||||
|
tmdbId,
|
||||||
|
imdbId,
|
||||||
tags = []
|
tags = []
|
||||||
} = movie;
|
} = movie;
|
||||||
|
|
||||||
@@ -29,6 +31,8 @@ function createCleanMovieSelector() {
|
|||||||
year,
|
year,
|
||||||
images,
|
images,
|
||||||
alternateTitles,
|
alternateTitles,
|
||||||
|
tmdbId,
|
||||||
|
imdbId,
|
||||||
firstCharacter: title.charAt(0).toLowerCase(),
|
firstCharacter: title.charAt(0).toLowerCase(),
|
||||||
tags: tags.reduce((acc, id) => {
|
tags: tags.reduce((acc, id) => {
|
||||||
const matchingTag = allTags.find((tag) => tag.id === id);
|
const matchingTag = allTags.find((tag) => tag.id === id);
|
||||||
|
|||||||
@@ -12,6 +12,8 @@ function MovieSearchResult(props) {
|
|||||||
year,
|
year,
|
||||||
images,
|
images,
|
||||||
alternateTitles,
|
alternateTitles,
|
||||||
|
tmdbId,
|
||||||
|
imdbId,
|
||||||
tags
|
tags
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
@@ -47,6 +49,22 @@ function MovieSearchResult(props) {
|
|||||||
null
|
null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
match.key === 'tmdbId' && tmdbId ?
|
||||||
|
<div className={styles.alternateTitle}>
|
||||||
|
TmdbId: {tmdbId}
|
||||||
|
</div> :
|
||||||
|
null
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
match.key === 'imdbId' && imdbId ?
|
||||||
|
<div className={styles.alternateTitle}>
|
||||||
|
ImdbId: {imdbId}
|
||||||
|
</div> :
|
||||||
|
null
|
||||||
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
tag ?
|
tag ?
|
||||||
<div className={styles.tagContainer}>
|
<div className={styles.tagContainer}>
|
||||||
@@ -69,6 +87,8 @@ MovieSearchResult.propTypes = {
|
|||||||
year: PropTypes.number.isRequired,
|
year: PropTypes.number.isRequired,
|
||||||
images: PropTypes.arrayOf(PropTypes.object).isRequired,
|
images: PropTypes.arrayOf(PropTypes.object).isRequired,
|
||||||
alternateTitles: PropTypes.arrayOf(PropTypes.object).isRequired,
|
alternateTitles: PropTypes.arrayOf(PropTypes.object).isRequired,
|
||||||
|
tmdbId: PropTypes.number,
|
||||||
|
imdbId: PropTypes.string,
|
||||||
tags: PropTypes.arrayOf(PropTypes.object).isRequired,
|
tags: PropTypes.arrayOf(PropTypes.object).isRequired,
|
||||||
match: PropTypes.object.isRequired
|
match: PropTypes.object.isRequired
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ const fuseOptions = {
|
|||||||
keys: [
|
keys: [
|
||||||
'title',
|
'title',
|
||||||
'alternateTitles.title',
|
'alternateTitles.title',
|
||||||
|
'tmdbId',
|
||||||
|
'imdbId',
|
||||||
'tags.label'
|
'tags.label'
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import Alert from 'Components/Alert';
|
||||||
import LoadingIndicator from 'Components/Loading/LoadingIndicator';
|
import LoadingIndicator from 'Components/Loading/LoadingIndicator';
|
||||||
|
import { kinds } from 'Helpers/Props';
|
||||||
|
|
||||||
function PageSectionContent(props) {
|
function PageSectionContent(props) {
|
||||||
const {
|
const {
|
||||||
@@ -17,7 +19,7 @@ function PageSectionContent(props) {
|
|||||||
);
|
);
|
||||||
} else if (!isFetching && !!error) {
|
} else if (!isFetching && !!error) {
|
||||||
return (
|
return (
|
||||||
<div>{errorMessage}</div>
|
<Alert kind={kinds.DANGER}>{errorMessage}</Alert>
|
||||||
);
|
);
|
||||||
} else if (isPopulated && !error) {
|
} else if (isPopulated && !error) {
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -16,6 +16,46 @@
|
|||||||
box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.15);
|
box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.15);
|
||||||
color: var(--white);
|
color: var(--white);
|
||||||
transition: width 0.6s ease;
|
transition: width 0.6s ease;
|
||||||
|
|
||||||
|
&.default {
|
||||||
|
background-color: var(--darkGray);
|
||||||
|
}
|
||||||
|
|
||||||
|
&.primary {
|
||||||
|
background-color: var(--primaryColor);
|
||||||
|
}
|
||||||
|
|
||||||
|
&.danger {
|
||||||
|
background-color: var(--dangerColor);
|
||||||
|
|
||||||
|
&:global(.colorImpaired) {
|
||||||
|
background: repeating-linear-gradient(90deg, color(#f05050 shade(5%)), color(#f05050 shade(5%)) 5px, color(#f05050 shade(15%)) 5px, color(#f05050 shade(15%)) 10px);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&.success {
|
||||||
|
background-color: var(--successColor);
|
||||||
|
}
|
||||||
|
|
||||||
|
&.purple {
|
||||||
|
background-color: var(--purple);
|
||||||
|
}
|
||||||
|
|
||||||
|
&.warning {
|
||||||
|
background-color: var(--warningColor);
|
||||||
|
|
||||||
|
&:global(.colorImpaired) {
|
||||||
|
background: repeating-linear-gradient(45deg, #ffa500, #ffa500 5px, color(#ffa500 tint(15%)) 5px, color(#ffa500 tint(15%)) 10px);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&.info {
|
||||||
|
background-color: var(--infoColor);
|
||||||
|
}
|
||||||
|
|
||||||
|
&.queue {
|
||||||
|
background-color: var(--queueColor);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.frontTextContainer {
|
.frontTextContainer {
|
||||||
@@ -45,42 +85,6 @@
|
|||||||
cursor: default;
|
cursor: default;
|
||||||
}
|
}
|
||||||
|
|
||||||
.primary {
|
|
||||||
background-color: var(--primaryColor);
|
|
||||||
}
|
|
||||||
|
|
||||||
.danger {
|
|
||||||
background-color: var(--dangerColor);
|
|
||||||
|
|
||||||
&:global(.colorImpaired) {
|
|
||||||
background: repeating-linear-gradient(90deg, color(#f05050 shade(5%)), color(#f05050 shade(5%)) 5px, color(#f05050 shade(15%)) 5px, color(#f05050 shade(15%)) 10px);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.success {
|
|
||||||
background-color: var(--successColor);
|
|
||||||
}
|
|
||||||
|
|
||||||
.purple {
|
|
||||||
background-color: var(--purple);
|
|
||||||
}
|
|
||||||
|
|
||||||
.warning {
|
|
||||||
background-color: var(--warningColor);
|
|
||||||
|
|
||||||
&:global(.colorImpaired) {
|
|
||||||
background: repeating-linear-gradient(45deg, #ffa500, #ffa500 5px, color(#ffa500 tint(15%)) 5px, color(#ffa500 tint(15%)) 10px);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.info {
|
|
||||||
background-color: var(--infoColor);
|
|
||||||
}
|
|
||||||
|
|
||||||
.queue {
|
|
||||||
background-color: var(--queueColor);
|
|
||||||
}
|
|
||||||
|
|
||||||
.small {
|
.small {
|
||||||
height: $progressBarSmallHeight;
|
height: $progressBarSmallHeight;
|
||||||
|
|
||||||
|
|||||||
1
frontend/src/Components/ProgressBar.css.d.ts
vendored
1
frontend/src/Components/ProgressBar.css.d.ts
vendored
@@ -5,6 +5,7 @@ interface CssExports {
|
|||||||
'backTextContainer': string;
|
'backTextContainer': string;
|
||||||
'container': string;
|
'container': string;
|
||||||
'danger': string;
|
'danger': string;
|
||||||
|
'default': string;
|
||||||
'frontText': string;
|
'frontText': string;
|
||||||
'frontTextContainer': string;
|
'frontTextContainer': string;
|
||||||
'info': string;
|
'info': string;
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ function ProgressBar(props) {
|
|||||||
{
|
{
|
||||||
showText && width ?
|
showText && width ?
|
||||||
<div
|
<div
|
||||||
className={styles.backTextContainer}
|
className={classNames(styles.backTextContainer, styles[kind])}
|
||||||
style={{ width: actualWidth }}
|
style={{ width: actualWidth }}
|
||||||
>
|
>
|
||||||
<div className={styles.backText}>
|
<div className={styles.backText}>
|
||||||
@@ -67,7 +67,7 @@ function ProgressBar(props) {
|
|||||||
{
|
{
|
||||||
showText ?
|
showText ?
|
||||||
<div
|
<div
|
||||||
className={styles.frontTextContainer}
|
className={classNames(styles.frontTextContainer, styles[kind])}
|
||||||
style={{ width: progressPercent }}
|
style={{ width: progressPercent }}
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
|
|||||||
@@ -2,16 +2,17 @@
|
|||||||
"name": "Radarr",
|
"name": "Radarr",
|
||||||
"icons": [
|
"icons": [
|
||||||
{
|
{
|
||||||
"src": "/Content/Images/Icons/android-chrome-192x192.png",
|
"src": "android-chrome-192x192.png",
|
||||||
"sizes": "192x192",
|
"sizes": "192x192",
|
||||||
"type": "image/png"
|
"type": "image/png"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"src": "/Content/Images/Icons/android-chrome-512x512.png",
|
"src": "android-chrome-512x512.png",
|
||||||
"sizes": "512x512",
|
"sizes": "512x512",
|
||||||
"type": "image/png"
|
"type": "image/png"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
"start_url": "../../../../",
|
||||||
"theme_color": "#3a3f51",
|
"theme_color": "#3a3f51",
|
||||||
"background_color": "#3a3f51",
|
"background_color": "#3a3f51",
|
||||||
"display": "standalone"
|
"display": "standalone"
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import React, { Component } from 'react';
|
import React, { Component } from 'react';
|
||||||
|
import Alert from 'Components/Alert';
|
||||||
import LoadingIndicator from 'Components/Loading/LoadingIndicator';
|
import LoadingIndicator from 'Components/Loading/LoadingIndicator';
|
||||||
import PageContent from 'Components/Page/PageContent';
|
import PageContent from 'Components/Page/PageContent';
|
||||||
import PageContentBody from 'Components/Page/PageContentBody';
|
import PageContentBody from 'Components/Page/PageContentBody';
|
||||||
@@ -10,7 +11,7 @@ import PageToolbarButton from 'Components/Page/Toolbar/PageToolbarButton';
|
|||||||
import PageToolbarSection from 'Components/Page/Toolbar/PageToolbarSection';
|
import PageToolbarSection from 'Components/Page/Toolbar/PageToolbarSection';
|
||||||
import PageToolbarSeparator from 'Components/Page/Toolbar/PageToolbarSeparator';
|
import PageToolbarSeparator from 'Components/Page/Toolbar/PageToolbarSeparator';
|
||||||
import TableOptionsModalWrapper from 'Components/Table/TableOptions/TableOptionsModalWrapper';
|
import TableOptionsModalWrapper from 'Components/Table/TableOptions/TableOptionsModalWrapper';
|
||||||
import { align, icons, sortDirections } from 'Helpers/Props';
|
import { align, icons, kinds, sortDirections } from 'Helpers/Props';
|
||||||
import styles from 'Movie/Index/MovieIndex.css';
|
import styles from 'Movie/Index/MovieIndex.css';
|
||||||
import hasDifferentItemsOrOrder from 'Utilities/Object/hasDifferentItemsOrOrder';
|
import hasDifferentItemsOrOrder from 'Utilities/Object/hasDifferentItemsOrOrder';
|
||||||
import translate from 'Utilities/String/translate';
|
import translate from 'Utilities/String/translate';
|
||||||
@@ -369,9 +370,9 @@ class DiscoverMovie extends Component {
|
|||||||
|
|
||||||
{
|
{
|
||||||
!isFetching && !!error &&
|
!isFetching && !!error &&
|
||||||
<div>
|
<Alert kind={kinds.DANGER}>
|
||||||
{translate('UnableToLoadMovies')}
|
{translate('UnableToLoadMovies')}
|
||||||
</div>
|
</Alert>
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -71,6 +71,7 @@ import {
|
|||||||
faLanguage as fasLanguage,
|
faLanguage as fasLanguage,
|
||||||
faLaptop as fasLaptop,
|
faLaptop as fasLaptop,
|
||||||
faLevelUpAlt as fasLevelUpAlt,
|
faLevelUpAlt as fasLevelUpAlt,
|
||||||
|
faListCheck as fasListCheck,
|
||||||
faMedkit as fasMedkit,
|
faMedkit as fasMedkit,
|
||||||
faMinus as fasMinus,
|
faMinus as fasMinus,
|
||||||
faPause as fasPause,
|
faPause as fasPause,
|
||||||
@@ -172,6 +173,7 @@ export const INFO = fasInfoCircle;
|
|||||||
export const INTERACTIVE = fasUser;
|
export const INTERACTIVE = fasUser;
|
||||||
export const KEYBOARD = farKeyboard;
|
export const KEYBOARD = farKeyboard;
|
||||||
export const LOGOUT = fasSignOutAlt;
|
export const LOGOUT = fasSignOutAlt;
|
||||||
|
export const MANAGE = fasListCheck;
|
||||||
export const MEDIA_INFO = farFileInvoice;
|
export const MEDIA_INFO = farFileInvoice;
|
||||||
export const MISSING = fasExclamationTriangle;
|
export const MISSING = fasExclamationTriangle;
|
||||||
export const MONITORED = fasBookmark;
|
export const MONITORED = fasBookmark;
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import React, { useCallback, useState } from 'react';
|
|||||||
import { useSelector } from 'react-redux';
|
import { useSelector } from 'react-redux';
|
||||||
import { createSelector } from 'reselect';
|
import { createSelector } from 'reselect';
|
||||||
import { LanguageSettingsAppState } from 'App/State/SettingsAppState';
|
import { LanguageSettingsAppState } from 'App/State/SettingsAppState';
|
||||||
|
import Alert from 'Components/Alert';
|
||||||
import Form from 'Components/Form/Form';
|
import Form from 'Components/Form/Form';
|
||||||
import FormGroup from 'Components/Form/FormGroup';
|
import FormGroup from 'Components/Form/FormGroup';
|
||||||
import FormInputGroup from 'Components/Form/FormInputGroup';
|
import FormInputGroup from 'Components/Form/FormInputGroup';
|
||||||
@@ -86,7 +87,9 @@ function SelectLanguageModalContent(props: SelectLanguageModalContentProps) {
|
|||||||
{isFetching ? <LoadingIndicator /> : null}
|
{isFetching ? <LoadingIndicator /> : null}
|
||||||
|
|
||||||
{!isFetching && error ? (
|
{!isFetching && error ? (
|
||||||
<div>{translate('UnableToLoadLanguages')}</div>
|
<Alert kind={kinds.DANGER}>
|
||||||
|
{translate('UnableToLoadLanguages')}
|
||||||
|
</Alert>
|
||||||
) : null}
|
) : null}
|
||||||
|
|
||||||
{isPopulated && !error ? (
|
{isPopulated && !error ? (
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import { useDispatch, useSelector } from 'react-redux';
|
|||||||
import { createSelector } from 'reselect';
|
import { createSelector } from 'reselect';
|
||||||
import { Error } from 'App/State/AppSectionState';
|
import { Error } from 'App/State/AppSectionState';
|
||||||
import AppState from 'App/State/AppState';
|
import AppState from 'App/State/AppState';
|
||||||
|
import Alert from 'Components/Alert';
|
||||||
import Form from 'Components/Form/Form';
|
import Form from 'Components/Form/Form';
|
||||||
import FormGroup from 'Components/Form/FormGroup';
|
import FormGroup from 'Components/Form/FormGroup';
|
||||||
import FormInputGroup from 'Components/Form/FormInputGroup';
|
import FormInputGroup from 'Components/Form/FormInputGroup';
|
||||||
@@ -130,7 +131,9 @@ function SelectQualityModalContent(props: SelectQualityModalContentProps) {
|
|||||||
{isFetching && <LoadingIndicator />}
|
{isFetching && <LoadingIndicator />}
|
||||||
|
|
||||||
{!isFetching && error ? (
|
{!isFetching && error ? (
|
||||||
<div>{translate('UnableToLoadQualities')}</div>
|
<Alert kind={kinds.DANGER}>
|
||||||
|
{translate('UnableToLoadQualities')}
|
||||||
|
</Alert>
|
||||||
) : null}
|
) : null}
|
||||||
|
|
||||||
{isPopulated && !error ? (
|
{isPopulated && !error ? (
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import { SelectProvider } from 'App/SelectContext';
|
|||||||
import ClientSideCollectionAppState from 'App/State/ClientSideCollectionAppState';
|
import ClientSideCollectionAppState from 'App/State/ClientSideCollectionAppState';
|
||||||
import MoviesAppState, { MovieIndexAppState } from 'App/State/MoviesAppState';
|
import MoviesAppState, { MovieIndexAppState } from 'App/State/MoviesAppState';
|
||||||
import { RSS_SYNC } from 'Commands/commandNames';
|
import { RSS_SYNC } from 'Commands/commandNames';
|
||||||
|
import Alert from 'Components/Alert';
|
||||||
import LoadingIndicator from 'Components/Loading/LoadingIndicator';
|
import LoadingIndicator from 'Components/Loading/LoadingIndicator';
|
||||||
import PageContent from 'Components/Page/PageContent';
|
import PageContent from 'Components/Page/PageContent';
|
||||||
import PageContentBody from 'Components/Page/PageContentBody';
|
import PageContentBody from 'Components/Page/PageContentBody';
|
||||||
@@ -20,7 +21,7 @@ import PageToolbarSection from 'Components/Page/Toolbar/PageToolbarSection';
|
|||||||
import PageToolbarSeparator from 'Components/Page/Toolbar/PageToolbarSeparator';
|
import PageToolbarSeparator from 'Components/Page/Toolbar/PageToolbarSeparator';
|
||||||
import TableOptionsModalWrapper from 'Components/Table/TableOptions/TableOptionsModalWrapper';
|
import TableOptionsModalWrapper from 'Components/Table/TableOptions/TableOptionsModalWrapper';
|
||||||
import withScrollPosition from 'Components/withScrollPosition';
|
import withScrollPosition from 'Components/withScrollPosition';
|
||||||
import { align, icons } from 'Helpers/Props';
|
import { align, icons, kinds } from 'Helpers/Props';
|
||||||
import SortDirection from 'Helpers/Props/SortDirection';
|
import SortDirection from 'Helpers/Props/SortDirection';
|
||||||
import InteractiveImportModal from 'InteractiveImport/InteractiveImportModal';
|
import InteractiveImportModal from 'InteractiveImport/InteractiveImportModal';
|
||||||
import NoMovie from 'Movie/NoMovie';
|
import NoMovie from 'Movie/NoMovie';
|
||||||
@@ -337,7 +338,9 @@ const MovieIndex = withScrollPosition((props: MovieIndexProps) => {
|
|||||||
{isFetching && !isPopulated ? <LoadingIndicator /> : null}
|
{isFetching && !isPopulated ? <LoadingIndicator /> : null}
|
||||||
|
|
||||||
{!isFetching && !!error ? (
|
{!isFetching && !!error ? (
|
||||||
<div>{translate('UnableToLoadMovies')}</div>
|
<Alert kind={kinds.DANGER}>
|
||||||
|
{translate('UnableToLoadMovies')}
|
||||||
|
</Alert>
|
||||||
) : null}
|
) : null}
|
||||||
|
|
||||||
{isLoaded ? (
|
{isLoaded ? (
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import MovieIndexPosterSelect from 'Movie/Index/Select/MovieIndexPosterSelect';
|
|||||||
import MoviePoster from 'Movie/MoviePoster';
|
import MoviePoster from 'Movie/MoviePoster';
|
||||||
import { executeCommand } from 'Store/Actions/commandActions';
|
import { executeCommand } from 'Store/Actions/commandActions';
|
||||||
import createUISettingsSelector from 'Store/Selectors/createUISettingsSelector';
|
import createUISettingsSelector from 'Store/Selectors/createUISettingsSelector';
|
||||||
|
import getRelativeDate from 'Utilities/Date/getRelativeDate';
|
||||||
import translate from 'Utilities/String/translate';
|
import translate from 'Utilities/String/translate';
|
||||||
import createMovieIndexItemSelector from '../createMovieIndexItemSelector';
|
import createMovieIndexItemSelector from '../createMovieIndexItemSelector';
|
||||||
import MovieIndexPosterInfo from './MovieIndexPosterInfo';
|
import MovieIndexPosterInfo from './MovieIndexPosterInfo';
|
||||||
@@ -46,9 +47,8 @@ function MovieIndexPoster(props: MovieIndexPosterProps) {
|
|||||||
showSearchAction,
|
showSearchAction,
|
||||||
} = useSelector(selectPosterOptions);
|
} = useSelector(selectPosterOptions);
|
||||||
|
|
||||||
const { showRelativeDates, shortDateFormat, timeFormat } = useSelector(
|
const { showRelativeDates, shortDateFormat, longDateFormat, timeFormat } =
|
||||||
createUISettingsSelector()
|
useSelector(createUISettingsSelector());
|
||||||
);
|
|
||||||
|
|
||||||
const {
|
const {
|
||||||
title,
|
title,
|
||||||
@@ -62,12 +62,17 @@ function MovieIndexPoster(props: MovieIndexPosterProps) {
|
|||||||
isAvailable,
|
isAvailable,
|
||||||
studio,
|
studio,
|
||||||
added,
|
added,
|
||||||
|
year,
|
||||||
inCinemas,
|
inCinemas,
|
||||||
physicalRelease,
|
physicalRelease,
|
||||||
digitalRelease,
|
digitalRelease,
|
||||||
path,
|
path,
|
||||||
movieFile,
|
movieFile,
|
||||||
|
ratings,
|
||||||
|
sizeOnDisk,
|
||||||
certification,
|
certification,
|
||||||
|
originalTitle,
|
||||||
|
originalLanguage,
|
||||||
} = movie;
|
} = movie;
|
||||||
|
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
@@ -125,6 +130,20 @@ function MovieIndexPoster(props: MovieIndexPosterProps) {
|
|||||||
height: `${posterHeight}px`,
|
height: `${posterHeight}px`,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let releaseDate = '';
|
||||||
|
let releaseDateType = '';
|
||||||
|
if (physicalRelease && digitalRelease) {
|
||||||
|
releaseDate =
|
||||||
|
physicalRelease < digitalRelease ? physicalRelease : digitalRelease;
|
||||||
|
releaseDateType = physicalRelease < digitalRelease ? 'Released' : 'Digital';
|
||||||
|
} else if (physicalRelease && !digitalRelease) {
|
||||||
|
releaseDate = physicalRelease;
|
||||||
|
releaseDateType = 'Released';
|
||||||
|
} else if (digitalRelease && !physicalRelease) {
|
||||||
|
releaseDate = digitalRelease;
|
||||||
|
releaseDateType = 'Digital';
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={styles.content}>
|
<div className={styles.content}>
|
||||||
<div className={styles.posterContainer} title={title}>
|
<div className={styles.posterContainer} title={title}>
|
||||||
@@ -211,25 +230,55 @@ function MovieIndexPoster(props: MovieIndexPosterProps) {
|
|||||||
) : null}
|
) : null}
|
||||||
|
|
||||||
{showQualityProfile ? (
|
{showQualityProfile ? (
|
||||||
<div className={styles.title}>{qualityProfile.name}</div>
|
<div className={styles.title} title={translate('QualityProfile')}>
|
||||||
|
{qualityProfile.name}
|
||||||
|
</div>
|
||||||
|
) : null}
|
||||||
|
|
||||||
|
{showCinemaRelease && inCinemas ? (
|
||||||
|
<div className={styles.title} title={translate('InCinemas')}>
|
||||||
|
<Icon name={icons.IN_CINEMAS} />{' '}
|
||||||
|
{getRelativeDate(inCinemas, shortDateFormat, showRelativeDates, {
|
||||||
|
timeFormat,
|
||||||
|
timeForToday: false,
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
) : null}
|
||||||
|
|
||||||
|
{showReleaseDate && releaseDate ? (
|
||||||
|
<div className={styles.title}>
|
||||||
|
<Icon
|
||||||
|
name={releaseDateType === 'Digital' ? icons.MOVIE_FILE : icons.DISC}
|
||||||
|
/>{' '}
|
||||||
|
{getRelativeDate(releaseDate, shortDateFormat, showRelativeDates, {
|
||||||
|
timeFormat,
|
||||||
|
timeForToday: false,
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
) : null}
|
) : null}
|
||||||
|
|
||||||
<MovieIndexPosterInfo
|
<MovieIndexPosterInfo
|
||||||
studio={studio}
|
studio={studio}
|
||||||
qualityProfile={qualityProfile}
|
qualityProfile={qualityProfile}
|
||||||
added={added}
|
added={added}
|
||||||
|
year={year}
|
||||||
showQualityProfile={showQualityProfile}
|
showQualityProfile={showQualityProfile}
|
||||||
showCinemaRelease={showCinemaRelease}
|
showCinemaRelease={showCinemaRelease}
|
||||||
showReleaseDate={showReleaseDate}
|
showReleaseDate={showReleaseDate}
|
||||||
showRelativeDates={showRelativeDates}
|
showRelativeDates={showRelativeDates}
|
||||||
shortDateFormat={shortDateFormat}
|
shortDateFormat={shortDateFormat}
|
||||||
|
longDateFormat={longDateFormat}
|
||||||
timeFormat={timeFormat}
|
timeFormat={timeFormat}
|
||||||
inCinemas={inCinemas}
|
inCinemas={inCinemas}
|
||||||
physicalRelease={physicalRelease}
|
physicalRelease={physicalRelease}
|
||||||
digitalRelease={digitalRelease}
|
digitalRelease={digitalRelease}
|
||||||
|
ratings={ratings}
|
||||||
|
sizeOnDisk={sizeOnDisk}
|
||||||
sortKey={sortKey}
|
sortKey={sortKey}
|
||||||
path={path}
|
path={path}
|
||||||
certification={certification}
|
certification={certification}
|
||||||
|
originalTitle={originalTitle}
|
||||||
|
originalLanguage={originalLanguage}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<EditMovieModalConnector
|
<EditMovieModalConnector
|
||||||
|
|||||||
@@ -3,3 +3,9 @@
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
font-size: $smallFontSize;
|
font-size: $smallFontSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.title {
|
||||||
|
@add-mixin truncate;
|
||||||
|
|
||||||
|
composes: info;
|
||||||
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
// Please do not change this file!
|
// Please do not change this file!
|
||||||
interface CssExports {
|
interface CssExports {
|
||||||
'info': string;
|
'info': string;
|
||||||
|
'title': string;
|
||||||
}
|
}
|
||||||
export const cssExports: CssExports;
|
export const cssExports: CssExports;
|
||||||
export default cssExports;
|
export default cssExports;
|
||||||
|
|||||||
@@ -1,7 +1,11 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import Icon from 'Components/Icon';
|
import Icon from 'Components/Icon';
|
||||||
|
import ImdbRating from 'Components/ImdbRating';
|
||||||
|
import TmdbRating from 'Components/TmdbRating';
|
||||||
import { icons } from 'Helpers/Props';
|
import { icons } from 'Helpers/Props';
|
||||||
|
import { Language, Ratings } from 'Movie/Movie';
|
||||||
import QualityProfile from 'typings/QualityProfile';
|
import QualityProfile from 'typings/QualityProfile';
|
||||||
|
import formatDateTime from 'Utilities/Date/formatDateTime';
|
||||||
import getRelativeDate from 'Utilities/Date/getRelativeDate';
|
import getRelativeDate from 'Utilities/Date/getRelativeDate';
|
||||||
import formatBytes from 'Utilities/Number/formatBytes';
|
import formatBytes from 'Utilities/Number/formatBytes';
|
||||||
import translate from 'Utilities/String/translate';
|
import translate from 'Utilities/String/translate';
|
||||||
@@ -12,17 +16,22 @@ interface MovieIndexPosterInfoProps {
|
|||||||
showQualityProfile: boolean;
|
showQualityProfile: boolean;
|
||||||
qualityProfile: QualityProfile;
|
qualityProfile: QualityProfile;
|
||||||
added?: string;
|
added?: string;
|
||||||
|
year: number;
|
||||||
inCinemas?: string;
|
inCinemas?: string;
|
||||||
digitalRelease?: string;
|
digitalRelease?: string;
|
||||||
physicalRelease?: string;
|
physicalRelease?: string;
|
||||||
path: string;
|
path: string;
|
||||||
|
ratings: Ratings;
|
||||||
certification: string;
|
certification: string;
|
||||||
|
originalTitle: string;
|
||||||
|
originalLanguage: Language;
|
||||||
sizeOnDisk?: number;
|
sizeOnDisk?: number;
|
||||||
sortKey: string;
|
sortKey: string;
|
||||||
showRelativeDates: boolean;
|
showRelativeDates: boolean;
|
||||||
showCinemaRelease: boolean;
|
showCinemaRelease: boolean;
|
||||||
showReleaseDate: boolean;
|
showReleaseDate: boolean;
|
||||||
shortDateFormat: string;
|
shortDateFormat: string;
|
||||||
|
longDateFormat: string;
|
||||||
timeFormat: string;
|
timeFormat: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -32,26 +41,39 @@ function MovieIndexPosterInfo(props: MovieIndexPosterInfoProps) {
|
|||||||
showQualityProfile,
|
showQualityProfile,
|
||||||
qualityProfile,
|
qualityProfile,
|
||||||
added,
|
added,
|
||||||
|
year,
|
||||||
inCinemas,
|
inCinemas,
|
||||||
digitalRelease,
|
digitalRelease,
|
||||||
physicalRelease,
|
physicalRelease,
|
||||||
path,
|
path,
|
||||||
|
ratings,
|
||||||
certification,
|
certification,
|
||||||
|
originalTitle,
|
||||||
|
originalLanguage,
|
||||||
sizeOnDisk,
|
sizeOnDisk,
|
||||||
sortKey,
|
sortKey,
|
||||||
showRelativeDates,
|
showRelativeDates,
|
||||||
showCinemaRelease,
|
showCinemaRelease,
|
||||||
showReleaseDate,
|
showReleaseDate,
|
||||||
shortDateFormat,
|
shortDateFormat,
|
||||||
|
longDateFormat,
|
||||||
timeFormat,
|
timeFormat,
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
if (sortKey === 'studio' && studio) {
|
if (sortKey === 'studio' && studio) {
|
||||||
return <div className={styles.info}>{studio}</div>;
|
return (
|
||||||
|
<div className={styles.info} title={translate('Studio')}>
|
||||||
|
{studio}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sortKey === 'qualityProfileId' && !showQualityProfile) {
|
if (sortKey === 'qualityProfileId' && !showQualityProfile) {
|
||||||
return <div className={styles.info}>{qualityProfile.name}</div>;
|
return (
|
||||||
|
<div className={styles.info} title={translate('QualityProfile')}>
|
||||||
|
{qualityProfile.name}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sortKey === 'added' && added) {
|
if (sortKey === 'added' && added) {
|
||||||
@@ -66,13 +88,24 @@ function MovieIndexPosterInfo(props: MovieIndexPosterInfoProps) {
|
|||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={styles.info}>
|
<div
|
||||||
|
className={styles.info}
|
||||||
|
title={formatDateTime(added, longDateFormat, timeFormat)}
|
||||||
|
>
|
||||||
{translate('Added')}: {addedDate}
|
{translate('Added')}: {addedDate}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sortKey === 'inCinemas' && inCinemas && showCinemaRelease) {
|
if (sortKey === 'year' && year) {
|
||||||
|
return (
|
||||||
|
<div className={styles.info} title={translate('Year')}>
|
||||||
|
{year}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sortKey === 'inCinemas' && inCinemas && !showCinemaRelease) {
|
||||||
const inCinemasDate = getRelativeDate(
|
const inCinemasDate = getRelativeDate(
|
||||||
inCinemas,
|
inCinemas,
|
||||||
shortDateFormat,
|
shortDateFormat,
|
||||||
@@ -84,13 +117,13 @@ function MovieIndexPosterInfo(props: MovieIndexPosterInfoProps) {
|
|||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={styles.info}>
|
<div className={styles.info} title={translate('InCinemas')}>
|
||||||
<Icon name={icons.IN_CINEMAS} /> {inCinemasDate}
|
<Icon name={icons.IN_CINEMAS} /> {inCinemasDate}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sortKey === 'digitalRelease' && digitalRelease && showReleaseDate) {
|
if (sortKey === 'digitalRelease' && digitalRelease && !showReleaseDate) {
|
||||||
const digitalReleaseDate = getRelativeDate(
|
const digitalReleaseDate = getRelativeDate(
|
||||||
digitalRelease,
|
digitalRelease,
|
||||||
shortDateFormat,
|
shortDateFormat,
|
||||||
@@ -108,7 +141,7 @@ function MovieIndexPosterInfo(props: MovieIndexPosterInfoProps) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sortKey === 'physicalRelease' && physicalRelease && showReleaseDate) {
|
if (sortKey === 'physicalRelease' && physicalRelease && !showReleaseDate) {
|
||||||
const physicalReleaseDate = getRelativeDate(
|
const physicalReleaseDate = getRelativeDate(
|
||||||
physicalRelease,
|
physicalRelease,
|
||||||
shortDateFormat,
|
shortDateFormat,
|
||||||
@@ -126,18 +159,58 @@ function MovieIndexPosterInfo(props: MovieIndexPosterInfoProps) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (sortKey === 'imdbRating' && !!ratings.imdb) {
|
||||||
|
return (
|
||||||
|
<div className={styles.info}>
|
||||||
|
<ImdbRating ratings={ratings} iconSize={12} />
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sortKey === 'tmdbRating' && !!ratings.tmdb) {
|
||||||
|
return (
|
||||||
|
<div className={styles.info}>
|
||||||
|
<TmdbRating ratings={ratings} iconSize={12} />
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if (sortKey === 'path') {
|
if (sortKey === 'path') {
|
||||||
return <div className={styles.info}>{path}</div>;
|
return (
|
||||||
|
<div className={styles.info} title={translate('Path')}>
|
||||||
|
{path}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sortKey === 'sizeOnDisk') {
|
if (sortKey === 'sizeOnDisk') {
|
||||||
return <div className={styles.info}>{formatBytes(sizeOnDisk)}</div>;
|
return (
|
||||||
|
<div className={styles.info} title={translate('SizeOnDisk')}>
|
||||||
|
{formatBytes(sizeOnDisk)}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sortKey === 'certification') {
|
if (sortKey === 'certification') {
|
||||||
return <div className={styles.info}>{certification}</div>;
|
return <div className={styles.info}>{certification}</div>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (sortKey === 'originalTitle' && originalTitle) {
|
||||||
|
return (
|
||||||
|
<div className={styles.title} title={originalTitle}>
|
||||||
|
{originalTitle}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sortKey === 'originalLanguage' && originalLanguage) {
|
||||||
|
return (
|
||||||
|
<div className={styles.info} title={translate('OriginalLanguage')}>
|
||||||
|
{originalLanguage.name}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -143,6 +143,7 @@ export default function MovieIndexPosters(props: MovieIndexPostersProps) {
|
|||||||
showTitle,
|
showTitle,
|
||||||
showMonitored,
|
showMonitored,
|
||||||
showQualityProfile,
|
showQualityProfile,
|
||||||
|
showCinemaRelease,
|
||||||
showReleaseDate,
|
showReleaseDate,
|
||||||
} = posterOptions;
|
} = posterOptions;
|
||||||
|
|
||||||
@@ -167,6 +168,10 @@ export default function MovieIndexPosters(props: MovieIndexPostersProps) {
|
|||||||
heights.push(19);
|
heights.push(19);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (showCinemaRelease) {
|
||||||
|
heights.push(19);
|
||||||
|
}
|
||||||
|
|
||||||
if (showReleaseDate) {
|
if (showReleaseDate) {
|
||||||
heights.push(19);
|
heights.push(19);
|
||||||
}
|
}
|
||||||
@@ -174,8 +179,13 @@ export default function MovieIndexPosters(props: MovieIndexPostersProps) {
|
|||||||
switch (sortKey) {
|
switch (sortKey) {
|
||||||
case 'studio':
|
case 'studio':
|
||||||
case 'added':
|
case 'added':
|
||||||
|
case 'year':
|
||||||
|
case 'imdbRating':
|
||||||
|
case 'tmdbRating':
|
||||||
case 'path':
|
case 'path':
|
||||||
case 'sizeOnDisk':
|
case 'sizeOnDisk':
|
||||||
|
case 'originalTitle':
|
||||||
|
case 'originalLanguage':
|
||||||
heights.push(19);
|
heights.push(19);
|
||||||
break;
|
break;
|
||||||
case 'qualityProfileId':
|
case 'qualityProfileId':
|
||||||
@@ -183,6 +193,17 @@ export default function MovieIndexPosters(props: MovieIndexPostersProps) {
|
|||||||
heights.push(19);
|
heights.push(19);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case 'inCinemas':
|
||||||
|
if (!showCinemaRelease) {
|
||||||
|
heights.push(19);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'digitalRelease':
|
||||||
|
case 'physicalRelease':
|
||||||
|
if (!showReleaseDate) {
|
||||||
|
heights.push(19);
|
||||||
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
// No need to add a height of 0
|
// No need to add a height of 0
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,13 @@ export interface Collection {
|
|||||||
title: string;
|
title: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface Ratings {
|
||||||
|
imdb: object;
|
||||||
|
tmdb: object;
|
||||||
|
metacritic: object;
|
||||||
|
rottenTomatoes: object;
|
||||||
|
}
|
||||||
|
|
||||||
interface Movie extends ModelBase {
|
interface Movie extends ModelBase {
|
||||||
tmdbId: number;
|
tmdbId: number;
|
||||||
imdbId: string;
|
imdbId: string;
|
||||||
@@ -41,7 +48,7 @@ interface Movie extends ModelBase {
|
|||||||
path: string;
|
path: string;
|
||||||
sizeOnDisk: number;
|
sizeOnDisk: number;
|
||||||
genres: string[];
|
genres: string[];
|
||||||
ratings: object;
|
ratings: Ratings;
|
||||||
certification: string;
|
certification: string;
|
||||||
tags: number[];
|
tags: number[];
|
||||||
images: Image[];
|
images: Image[];
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import React, { Component } from 'react';
|
import React, { Component } from 'react';
|
||||||
|
import Alert from 'Components/Alert';
|
||||||
import Form from 'Components/Form/Form';
|
import Form from 'Components/Form/Form';
|
||||||
import FormGroup from 'Components/Form/FormGroup';
|
import FormGroup from 'Components/Form/FormGroup';
|
||||||
import FormInputGroup from 'Components/Form/FormInputGroup';
|
import FormInputGroup from 'Components/Form/FormInputGroup';
|
||||||
@@ -109,9 +110,9 @@ class FileEditModalContent extends Component {
|
|||||||
|
|
||||||
{
|
{
|
||||||
!isFetching && !!error &&
|
!isFetching && !!error &&
|
||||||
<div>
|
<Alert kind={kinds.DANGER}>
|
||||||
{translate('UnableToLoadQualities')}
|
{translate('UnableToLoadQualities')}
|
||||||
</div>
|
</Alert>
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import React, { Component } from 'react';
|
import React, { Component } from 'react';
|
||||||
|
import Alert from 'Components/Alert';
|
||||||
import Form from 'Components/Form/Form';
|
import Form from 'Components/Form/Form';
|
||||||
import FormGroup from 'Components/Form/FormGroup';
|
import FormGroup from 'Components/Form/FormGroup';
|
||||||
import FormInputGroup from 'Components/Form/FormInputGroup';
|
import FormInputGroup from 'Components/Form/FormInputGroup';
|
||||||
@@ -92,9 +93,9 @@ class SelectQualityModalContent extends Component {
|
|||||||
|
|
||||||
{
|
{
|
||||||
!isFetching && !!error &&
|
!isFetching && !!error &&
|
||||||
<div>
|
<Alert kind={kinds.DANGER}>
|
||||||
{translate('UnableToLoadQualities')}
|
{translate('UnableToLoadQualities')}
|
||||||
</div>
|
</Alert>
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import Alert from 'Components/Alert';
|
||||||
import LoadingIndicator from 'Components/Loading/LoadingIndicator';
|
import LoadingIndicator from 'Components/Loading/LoadingIndicator';
|
||||||
import Table from 'Components/Table/Table';
|
import Table from 'Components/Table/Table';
|
||||||
import TableBody from 'Components/Table/TableBody';
|
import TableBody from 'Components/Table/TableBody';
|
||||||
|
import { kinds } from 'Helpers/Props';
|
||||||
import translate from 'Utilities/String/translate';
|
import translate from 'Utilities/String/translate';
|
||||||
import RootFolderRowConnector from './RootFolderRowConnector';
|
import RootFolderRowConnector from './RootFolderRowConnector';
|
||||||
|
|
||||||
@@ -44,9 +46,9 @@ function RootFolders(props) {
|
|||||||
|
|
||||||
if (!isFetching && !!error) {
|
if (!isFetching && !!error) {
|
||||||
return (
|
return (
|
||||||
<div>
|
<Alert kind={kinds.DANGER}>
|
||||||
{translate('UnableToLoadRootFolders')}
|
{translate('UnableToLoadRootFolders')}
|
||||||
</div>
|
</Alert>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -152,13 +152,7 @@ class CustomFormat extends Component {
|
|||||||
isOpen={this.state.isDeleteCustomFormatModalOpen}
|
isOpen={this.state.isDeleteCustomFormatModalOpen}
|
||||||
kind={kinds.DANGER}
|
kind={kinds.DANGER}
|
||||||
title={translate('DeleteCustomFormat')}
|
title={translate('DeleteCustomFormat')}
|
||||||
message={
|
message={translate('DeleteCustomFormatMessageText', [name])}
|
||||||
<div>
|
|
||||||
<div>
|
|
||||||
{translate('AreYouSureYouWantToDeleteFormat', [name])}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
confirmLabel={translate('Delete')}
|
confirmLabel={translate('Delete')}
|
||||||
isSpinning={isDeleting}
|
isSpinning={isDeleting}
|
||||||
onConfirm={this.onConfirmDeleteCustomFormat}
|
onConfirm={this.onConfirmDeleteCustomFormat}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import React, { Component } from 'react';
|
import React, { Component } from 'react';
|
||||||
|
import Alert from 'Components/Alert';
|
||||||
import Button from 'Components/Link/Button';
|
import Button from 'Components/Link/Button';
|
||||||
import ClipboardButton from 'Components/Link/ClipboardButton';
|
import ClipboardButton from 'Components/Link/ClipboardButton';
|
||||||
import LoadingIndicator from 'Components/Loading/LoadingIndicator';
|
import LoadingIndicator from 'Components/Loading/LoadingIndicator';
|
||||||
@@ -41,9 +42,9 @@ class ExportCustomFormatModalContent extends Component {
|
|||||||
|
|
||||||
{
|
{
|
||||||
!isFetching && !!error &&
|
!isFetching && !!error &&
|
||||||
<div>
|
<Alert kind={kinds.DANGER}>
|
||||||
{translate('UnableToLoadCustomFormats')}
|
{translate('UnableToLoadCustomFormats')}
|
||||||
</div>
|
</Alert>
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import React, { Component } from 'react';
|
import React, { Component } from 'react';
|
||||||
|
import Alert from 'Components/Alert';
|
||||||
import Form from 'Components/Form/Form';
|
import Form from 'Components/Form/Form';
|
||||||
import FormGroup from 'Components/Form/FormGroup';
|
import FormGroup from 'Components/Form/FormGroup';
|
||||||
import FormInputGroup from 'Components/Form/FormInputGroup';
|
import FormInputGroup from 'Components/Form/FormInputGroup';
|
||||||
@@ -11,7 +12,7 @@ import ModalBody from 'Components/Modal/ModalBody';
|
|||||||
import ModalContent from 'Components/Modal/ModalContent';
|
import ModalContent from 'Components/Modal/ModalContent';
|
||||||
import ModalFooter from 'Components/Modal/ModalFooter';
|
import ModalFooter from 'Components/Modal/ModalFooter';
|
||||||
import ModalHeader from 'Components/Modal/ModalHeader';
|
import ModalHeader from 'Components/Modal/ModalHeader';
|
||||||
import { inputTypes, sizes } from 'Helpers/Props';
|
import { inputTypes, kinds, sizes } from 'Helpers/Props';
|
||||||
import translate from 'Utilities/String/translate';
|
import translate from 'Utilities/String/translate';
|
||||||
import styles from './ImportCustomFormatModalContent.css';
|
import styles from './ImportCustomFormatModalContent.css';
|
||||||
|
|
||||||
@@ -95,9 +96,9 @@ class ImportCustomFormatModalContent extends Component {
|
|||||||
|
|
||||||
{
|
{
|
||||||
!isFetching && !!error &&
|
!isFetching && !!error &&
|
||||||
<div>
|
<Alert kind={kinds.DANGER}>
|
||||||
{translate('UnableToLoadCustomFormats')}
|
{translate('UnableToLoadCustomFormats')}
|
||||||
</div>
|
</Alert>
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ class Specification extends Component {
|
|||||||
|
|
||||||
<IconButton
|
<IconButton
|
||||||
className={styles.cloneButton}
|
className={styles.cloneButton}
|
||||||
title={translate('CloneFormatTag')}
|
title={translate('CloneCondition')}
|
||||||
name={icons.CLONE}
|
name={icons.CLONE}
|
||||||
onPress={this.onCloneSpecificationPress}
|
onPress={this.onCloneSpecificationPress}
|
||||||
/>
|
/>
|
||||||
@@ -114,14 +114,8 @@ class Specification extends Component {
|
|||||||
<ConfirmModal
|
<ConfirmModal
|
||||||
isOpen={this.state.isDeleteSpecificationModalOpen}
|
isOpen={this.state.isDeleteSpecificationModalOpen}
|
||||||
kind={kinds.DANGER}
|
kind={kinds.DANGER}
|
||||||
title={translate('DeleteCustomFormat')}
|
title={translate('DeleteCondition')}
|
||||||
message={
|
message={translate('DeleteConditionMessageText', [name])}
|
||||||
<div>
|
|
||||||
<div>
|
|
||||||
{translate('AreYouSureYouWantToDeleteFormat', [name])}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
confirmLabel={translate('Delete')}
|
confirmLabel={translate('Delete')}
|
||||||
onConfirm={this.onConfirmDeleteSpecification}
|
onConfirm={this.onConfirmDeleteSpecification}
|
||||||
onCancel={this.onDeleteSpecificationModalClose}
|
onCancel={this.onDeleteSpecificationModalClose}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import { icons } from 'Helpers/Props';
|
|||||||
import SettingsToolbarConnector from 'Settings/SettingsToolbarConnector';
|
import SettingsToolbarConnector from 'Settings/SettingsToolbarConnector';
|
||||||
import translate from 'Utilities/String/translate';
|
import translate from 'Utilities/String/translate';
|
||||||
import DownloadClientsConnector from './DownloadClients/DownloadClientsConnector';
|
import DownloadClientsConnector from './DownloadClients/DownloadClientsConnector';
|
||||||
|
import ManageDownloadClientsModal from './DownloadClients/Manage/ManageDownloadClientsModal';
|
||||||
import DownloadClientOptionsConnector from './Options/DownloadClientOptionsConnector';
|
import DownloadClientOptionsConnector from './Options/DownloadClientOptionsConnector';
|
||||||
import RemotePathMappingsConnector from './RemotePathMappings/RemotePathMappingsConnector';
|
import RemotePathMappingsConnector from './RemotePathMappings/RemotePathMappingsConnector';
|
||||||
|
|
||||||
@@ -23,7 +24,8 @@ class DownloadClientSettings extends Component {
|
|||||||
|
|
||||||
this.state = {
|
this.state = {
|
||||||
isSaving: false,
|
isSaving: false,
|
||||||
hasPendingChanges: false
|
hasPendingChanges: false,
|
||||||
|
isManageDownloadClientsOpen: false
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -38,6 +40,14 @@ class DownloadClientSettings extends Component {
|
|||||||
this.setState(payload);
|
this.setState(payload);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
onManageDownloadClientsPress = () => {
|
||||||
|
this.setState({ isManageDownloadClientsOpen: true });
|
||||||
|
};
|
||||||
|
|
||||||
|
onManageDownloadClientsModalClose = () => {
|
||||||
|
this.setState({ isManageDownloadClientsOpen: false });
|
||||||
|
};
|
||||||
|
|
||||||
onSavePress = () => {
|
onSavePress = () => {
|
||||||
if (this._saveCallback) {
|
if (this._saveCallback) {
|
||||||
this._saveCallback();
|
this._saveCallback();
|
||||||
@@ -55,7 +65,8 @@ class DownloadClientSettings extends Component {
|
|||||||
|
|
||||||
const {
|
const {
|
||||||
isSaving,
|
isSaving,
|
||||||
hasPendingChanges
|
hasPendingChanges,
|
||||||
|
isManageDownloadClientsOpen
|
||||||
} = this.state;
|
} = this.state;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -73,6 +84,12 @@ class DownloadClientSettings extends Component {
|
|||||||
isSpinning={isTestingAll}
|
isSpinning={isTestingAll}
|
||||||
onPress={dispatchTestAllDownloadClients}
|
onPress={dispatchTestAllDownloadClients}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<PageToolbarButton
|
||||||
|
label="Manage Clients"
|
||||||
|
iconName={icons.MANAGE}
|
||||||
|
onPress={this.onManageDownloadClientsPress}
|
||||||
|
/>
|
||||||
</Fragment>
|
</Fragment>
|
||||||
}
|
}
|
||||||
onSavePress={this.onSavePress}
|
onSavePress={this.onSavePress}
|
||||||
@@ -87,6 +104,11 @@ class DownloadClientSettings extends Component {
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
<RemotePathMappingsConnector />
|
<RemotePathMappingsConnector />
|
||||||
|
|
||||||
|
<ManageDownloadClientsModal
|
||||||
|
isOpen={isManageDownloadClientsOpen}
|
||||||
|
onModalClose={this.onManageDownloadClientsModalClose}
|
||||||
|
/>
|
||||||
</PageContentBody>
|
</PageContentBody>
|
||||||
</PageContent>
|
</PageContent>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import Modal from 'Components/Modal/Modal';
|
||||||
|
import ManageDownloadClientsEditModalContent from './ManageDownloadClientsEditModalContent';
|
||||||
|
|
||||||
|
interface ManageDownloadClientsEditModalProps {
|
||||||
|
isOpen: boolean;
|
||||||
|
downloadClientIds: number[];
|
||||||
|
onSavePress(payload: object): void;
|
||||||
|
onModalClose(): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
function ManageDownloadClientsEditModal(
|
||||||
|
props: ManageDownloadClientsEditModalProps
|
||||||
|
) {
|
||||||
|
const { isOpen, downloadClientIds, onSavePress, onModalClose } = props;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Modal isOpen={isOpen} onModalClose={onModalClose}>
|
||||||
|
<ManageDownloadClientsEditModalContent
|
||||||
|
downloadClientIds={downloadClientIds}
|
||||||
|
onSavePress={onSavePress}
|
||||||
|
onModalClose={onModalClose}
|
||||||
|
/>
|
||||||
|
</Modal>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default ManageDownloadClientsEditModal;
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
.modalFooter {
|
||||||
|
composes: modalFooter from '~Components/Modal/ModalFooter.css';
|
||||||
|
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
|
||||||
|
.selected {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media only screen and (max-width: $breakpointExtraSmall) {
|
||||||
|
.modalFooter {
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 10px;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
// This file is automatically generated.
|
||||||
|
// Please do not change this file!
|
||||||
|
interface CssExports {
|
||||||
|
'modalFooter': string;
|
||||||
|
'selected': string;
|
||||||
|
}
|
||||||
|
export const cssExports: CssExports;
|
||||||
|
export default cssExports;
|
||||||
@@ -0,0 +1,180 @@
|
|||||||
|
import React, { useCallback, useState } from 'react';
|
||||||
|
import FormGroup from 'Components/Form/FormGroup';
|
||||||
|
import FormInputGroup from 'Components/Form/FormInputGroup';
|
||||||
|
import FormLabel from 'Components/Form/FormLabel';
|
||||||
|
import Button from 'Components/Link/Button';
|
||||||
|
import ModalBody from 'Components/Modal/ModalBody';
|
||||||
|
import ModalContent from 'Components/Modal/ModalContent';
|
||||||
|
import ModalFooter from 'Components/Modal/ModalFooter';
|
||||||
|
import ModalHeader from 'Components/Modal/ModalHeader';
|
||||||
|
import { inputTypes } from 'Helpers/Props';
|
||||||
|
import translate from 'Utilities/String/translate';
|
||||||
|
import styles from './ManageDownloadClientsEditModalContent.css';
|
||||||
|
|
||||||
|
interface SavePayload {
|
||||||
|
enable?: boolean;
|
||||||
|
removeCompletedDownloads?: boolean;
|
||||||
|
removeFailedDownloads?: boolean;
|
||||||
|
priority?: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ManageDownloadClientsEditModalContentProps {
|
||||||
|
downloadClientIds: number[];
|
||||||
|
onSavePress(payload: object): void;
|
||||||
|
onModalClose(): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
const NO_CHANGE = 'noChange';
|
||||||
|
|
||||||
|
const enableOptions = [
|
||||||
|
{ key: NO_CHANGE, value: 'No Change', disabled: true },
|
||||||
|
{ key: 'enabled', value: 'Enabled' },
|
||||||
|
{ key: 'disabled', value: 'Disabled' },
|
||||||
|
];
|
||||||
|
|
||||||
|
function ManageDownloadClientsEditModalContent(
|
||||||
|
props: ManageDownloadClientsEditModalContentProps
|
||||||
|
) {
|
||||||
|
const { downloadClientIds, onSavePress, onModalClose } = props;
|
||||||
|
|
||||||
|
const [enable, setEnable] = useState(NO_CHANGE);
|
||||||
|
const [removeCompletedDownloads, setRemoveCompletedDownloads] =
|
||||||
|
useState(NO_CHANGE);
|
||||||
|
const [removeFailedDownloads, setRemoveFailedDownloads] = useState(NO_CHANGE);
|
||||||
|
const [priority, setPriority] = useState<null | string | number>(null);
|
||||||
|
|
||||||
|
const save = useCallback(() => {
|
||||||
|
let hasChanges = false;
|
||||||
|
const payload: SavePayload = {};
|
||||||
|
|
||||||
|
if (enable !== NO_CHANGE) {
|
||||||
|
hasChanges = true;
|
||||||
|
payload.enable = enable === 'enabled';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (removeCompletedDownloads !== NO_CHANGE) {
|
||||||
|
hasChanges = true;
|
||||||
|
payload.removeCompletedDownloads = removeCompletedDownloads === 'enabled';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (removeFailedDownloads !== NO_CHANGE) {
|
||||||
|
hasChanges = true;
|
||||||
|
payload.removeFailedDownloads = removeFailedDownloads === 'enabled';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (priority !== null) {
|
||||||
|
hasChanges = true;
|
||||||
|
payload.priority = priority as number;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hasChanges) {
|
||||||
|
onSavePress(payload);
|
||||||
|
}
|
||||||
|
|
||||||
|
onModalClose();
|
||||||
|
}, [
|
||||||
|
enable,
|
||||||
|
priority,
|
||||||
|
removeCompletedDownloads,
|
||||||
|
removeFailedDownloads,
|
||||||
|
onSavePress,
|
||||||
|
onModalClose,
|
||||||
|
]);
|
||||||
|
|
||||||
|
const onInputChange = useCallback(
|
||||||
|
({ name, value }: { name: string; value: string }) => {
|
||||||
|
switch (name) {
|
||||||
|
case 'enable':
|
||||||
|
setEnable(value);
|
||||||
|
break;
|
||||||
|
case 'priority':
|
||||||
|
setPriority(value);
|
||||||
|
break;
|
||||||
|
case 'removeCompletedDownloads':
|
||||||
|
setRemoveCompletedDownloads(value);
|
||||||
|
break;
|
||||||
|
case 'removeFailedDownloads':
|
||||||
|
setRemoveFailedDownloads(value);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
console.warn('EditDownloadClientsModalContent Unknown Input');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
[]
|
||||||
|
);
|
||||||
|
|
||||||
|
const selectedCount = downloadClientIds.length;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<ModalContent onModalClose={onModalClose}>
|
||||||
|
<ModalHeader>{translate('EditSelectedDownloadClients')}</ModalHeader>
|
||||||
|
|
||||||
|
<ModalBody>
|
||||||
|
<FormGroup>
|
||||||
|
<FormLabel>{translate('Enabled')}</FormLabel>
|
||||||
|
|
||||||
|
<FormInputGroup
|
||||||
|
type={inputTypes.SELECT}
|
||||||
|
name="enable"
|
||||||
|
value={enable}
|
||||||
|
values={enableOptions}
|
||||||
|
onChange={onInputChange}
|
||||||
|
/>
|
||||||
|
</FormGroup>
|
||||||
|
|
||||||
|
<FormGroup>
|
||||||
|
<FormLabel>{translate('Priority')}</FormLabel>
|
||||||
|
|
||||||
|
<FormInputGroup
|
||||||
|
type={inputTypes.NUMBER}
|
||||||
|
name="priority"
|
||||||
|
value={priority}
|
||||||
|
min={1}
|
||||||
|
max={50}
|
||||||
|
onChange={onInputChange}
|
||||||
|
/>
|
||||||
|
</FormGroup>
|
||||||
|
|
||||||
|
<FormGroup>
|
||||||
|
<FormLabel>{translate('RemoveCompletedDownloads')}</FormLabel>
|
||||||
|
|
||||||
|
<FormInputGroup
|
||||||
|
type={inputTypes.SELECT}
|
||||||
|
name="removeCompletedDownloads"
|
||||||
|
value={removeCompletedDownloads}
|
||||||
|
values={enableOptions}
|
||||||
|
onChange={onInputChange}
|
||||||
|
/>
|
||||||
|
</FormGroup>
|
||||||
|
|
||||||
|
<FormGroup>
|
||||||
|
<FormLabel>{translate('RemoveFailedDownloads')}</FormLabel>
|
||||||
|
|
||||||
|
<FormInputGroup
|
||||||
|
type={inputTypes.SELECT}
|
||||||
|
name="removeFailedDownloads"
|
||||||
|
value={removeFailedDownloads}
|
||||||
|
values={enableOptions}
|
||||||
|
onChange={onInputChange}
|
||||||
|
/>
|
||||||
|
</FormGroup>
|
||||||
|
</ModalBody>
|
||||||
|
|
||||||
|
<ModalFooter className={styles.modalFooter}>
|
||||||
|
<div className={styles.selected}>
|
||||||
|
{translate('{count} download clients selected', {
|
||||||
|
count: selectedCount,
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<Button onPress={onModalClose}>{translate('Cancel')}</Button>
|
||||||
|
|
||||||
|
<Button onPress={save}>{translate('Apply Changes')}</Button>
|
||||||
|
</div>
|
||||||
|
</ModalFooter>
|
||||||
|
</ModalContent>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default ManageDownloadClientsEditModalContent;
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import Modal from 'Components/Modal/Modal';
|
||||||
|
import ManageDownloadClientsModalContent from './ManageDownloadClientsModalContent';
|
||||||
|
|
||||||
|
interface ManageDownloadClientsModalProps {
|
||||||
|
isOpen: boolean;
|
||||||
|
onModalClose(): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
function ManageDownloadClientsModal(props: ManageDownloadClientsModalProps) {
|
||||||
|
const { isOpen, onModalClose } = props;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Modal isOpen={isOpen} onModalClose={onModalClose}>
|
||||||
|
<ManageDownloadClientsModalContent onModalClose={onModalClose} />
|
||||||
|
</Modal>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default ManageDownloadClientsModal;
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
.leftButtons,
|
||||||
|
.rightButtons {
|
||||||
|
display: flex;
|
||||||
|
flex: 1 0 50%;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rightButtons {
|
||||||
|
justify-content: flex-end;
|
||||||
|
}
|
||||||
|
|
||||||
|
.deleteButton {
|
||||||
|
composes: button from '~Components/Link/Button.css';
|
||||||
|
|
||||||
|
margin-right: 10px;
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
// This file is automatically generated.
|
||||||
|
// Please do not change this file!
|
||||||
|
interface CssExports {
|
||||||
|
'deleteButton': string;
|
||||||
|
'leftButtons': string;
|
||||||
|
'rightButtons': string;
|
||||||
|
}
|
||||||
|
export const cssExports: CssExports;
|
||||||
|
export default cssExports;
|
||||||
@@ -0,0 +1,241 @@
|
|||||||
|
import React, { useCallback, useMemo, useState } from 'react';
|
||||||
|
import { useDispatch, useSelector } from 'react-redux';
|
||||||
|
import { DownloadClientAppState } from 'App/State/SettingsAppState';
|
||||||
|
import Button from 'Components/Link/Button';
|
||||||
|
import SpinnerButton from 'Components/Link/SpinnerButton';
|
||||||
|
import LoadingIndicator from 'Components/Loading/LoadingIndicator';
|
||||||
|
import ConfirmModal from 'Components/Modal/ConfirmModal';
|
||||||
|
import ModalBody from 'Components/Modal/ModalBody';
|
||||||
|
import ModalContent from 'Components/Modal/ModalContent';
|
||||||
|
import ModalFooter from 'Components/Modal/ModalFooter';
|
||||||
|
import ModalHeader from 'Components/Modal/ModalHeader';
|
||||||
|
import Table from 'Components/Table/Table';
|
||||||
|
import TableBody from 'Components/Table/TableBody';
|
||||||
|
import useSelectState from 'Helpers/Hooks/useSelectState';
|
||||||
|
import { kinds } from 'Helpers/Props';
|
||||||
|
import {
|
||||||
|
bulkDeleteDownloadClients,
|
||||||
|
bulkEditDownloadClients,
|
||||||
|
} from 'Store/Actions/settingsActions';
|
||||||
|
import createClientSideCollectionSelector from 'Store/Selectors/createClientSideCollectionSelector';
|
||||||
|
import { SelectStateInputProps } from 'typings/props';
|
||||||
|
import getErrorMessage from 'Utilities/Object/getErrorMessage';
|
||||||
|
import getSelectedIds from 'Utilities/Table/getSelectedIds';
|
||||||
|
import ManageDownloadClientsEditModal from './Edit/ManageDownloadClientsEditModal';
|
||||||
|
import ManageDownloadClientsModalRow from './ManageDownloadClientsModalRow';
|
||||||
|
import styles from './ManageDownloadClientsModalContent.css';
|
||||||
|
|
||||||
|
// TODO: This feels janky to do, but not sure of a better way currently
|
||||||
|
type OnSelectedChangeCallback = React.ComponentProps<
|
||||||
|
typeof ManageDownloadClientsModalRow
|
||||||
|
>['onSelectedChange'];
|
||||||
|
|
||||||
|
const COLUMNS = [
|
||||||
|
{
|
||||||
|
name: 'name',
|
||||||
|
label: 'Name',
|
||||||
|
isSortable: true,
|
||||||
|
isVisible: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'implementation',
|
||||||
|
label: 'Implementation',
|
||||||
|
isSortable: true,
|
||||||
|
isVisible: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'enable',
|
||||||
|
label: 'Enabled',
|
||||||
|
isSortable: true,
|
||||||
|
isVisible: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'priority',
|
||||||
|
label: 'Priority',
|
||||||
|
isSortable: true,
|
||||||
|
isVisible: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'removeCompletedDownloads',
|
||||||
|
label: 'Remove Completed',
|
||||||
|
isSortable: true,
|
||||||
|
isVisible: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'removeFailedDownloads',
|
||||||
|
label: 'Remove Failed',
|
||||||
|
isSortable: true,
|
||||||
|
isVisible: true,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
interface ManageDownloadClientsModalContentProps {
|
||||||
|
onModalClose(): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
function ManageDownloadClientsModalContent(
|
||||||
|
props: ManageDownloadClientsModalContentProps
|
||||||
|
) {
|
||||||
|
const { onModalClose } = props;
|
||||||
|
|
||||||
|
const {
|
||||||
|
isFetching,
|
||||||
|
isPopulated,
|
||||||
|
isDeleting,
|
||||||
|
isSaving,
|
||||||
|
error,
|
||||||
|
items,
|
||||||
|
}: DownloadClientAppState = useSelector(
|
||||||
|
createClientSideCollectionSelector('settings.downloadClients')
|
||||||
|
);
|
||||||
|
const dispatch = useDispatch();
|
||||||
|
|
||||||
|
const [isDeleteModalOpen, setIsDeleteModalOpen] = useState(false);
|
||||||
|
const [isEditModalOpen, setIsEditModalOpen] = useState(false);
|
||||||
|
|
||||||
|
const [selectState, setSelectState] = useSelectState();
|
||||||
|
|
||||||
|
const { allSelected, allUnselected, selectedState } = selectState;
|
||||||
|
|
||||||
|
const selectedIds: number[] = useMemo(() => {
|
||||||
|
return getSelectedIds(selectedState);
|
||||||
|
}, [selectedState]);
|
||||||
|
|
||||||
|
const selectedCount = selectedIds.length;
|
||||||
|
|
||||||
|
const onDeletePress = useCallback(() => {
|
||||||
|
setIsDeleteModalOpen(true);
|
||||||
|
}, [setIsDeleteModalOpen]);
|
||||||
|
|
||||||
|
const onDeleteModalClose = useCallback(() => {
|
||||||
|
setIsDeleteModalOpen(false);
|
||||||
|
}, [setIsDeleteModalOpen]);
|
||||||
|
|
||||||
|
const onEditPress = useCallback(() => {
|
||||||
|
setIsEditModalOpen(true);
|
||||||
|
}, [setIsEditModalOpen]);
|
||||||
|
|
||||||
|
const onEditModalClose = useCallback(() => {
|
||||||
|
setIsEditModalOpen(false);
|
||||||
|
}, [setIsEditModalOpen]);
|
||||||
|
|
||||||
|
const onConfirmDelete = useCallback(() => {
|
||||||
|
dispatch(bulkDeleteDownloadClients({ ids: selectedIds }));
|
||||||
|
setIsDeleteModalOpen(false);
|
||||||
|
}, [selectedIds, dispatch]);
|
||||||
|
|
||||||
|
const onSavePress = useCallback(
|
||||||
|
(payload: object) => {
|
||||||
|
setIsEditModalOpen(false);
|
||||||
|
|
||||||
|
dispatch(
|
||||||
|
bulkEditDownloadClients({
|
||||||
|
ids: selectedIds,
|
||||||
|
...payload,
|
||||||
|
})
|
||||||
|
);
|
||||||
|
},
|
||||||
|
[selectedIds, dispatch]
|
||||||
|
);
|
||||||
|
|
||||||
|
const onSelectAllChange = useCallback(
|
||||||
|
({ value }: SelectStateInputProps) => {
|
||||||
|
setSelectState({ type: value ? 'selectAll' : 'unselectAll', items });
|
||||||
|
},
|
||||||
|
[items, setSelectState]
|
||||||
|
);
|
||||||
|
|
||||||
|
const onSelectedChange = useCallback<OnSelectedChangeCallback>(
|
||||||
|
({ id, value, shiftKey = false }) => {
|
||||||
|
setSelectState({
|
||||||
|
type: 'toggleSelected',
|
||||||
|
items,
|
||||||
|
id,
|
||||||
|
isSelected: value,
|
||||||
|
shiftKey,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
[items, setSelectState]
|
||||||
|
);
|
||||||
|
|
||||||
|
const errorMessage = getErrorMessage(error, 'Unable to load import lists.');
|
||||||
|
const anySelected = selectedCount > 0;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<ModalContent onModalClose={onModalClose}>
|
||||||
|
<ModalHeader>Manage Import Lists</ModalHeader>
|
||||||
|
<ModalBody>
|
||||||
|
{isFetching ? <LoadingIndicator /> : null}
|
||||||
|
|
||||||
|
{error ? <div>{errorMessage}</div> : null}
|
||||||
|
|
||||||
|
{isPopulated && !!items.length && !isFetching && !isFetching ? (
|
||||||
|
<Table
|
||||||
|
columns={COLUMNS}
|
||||||
|
horizontalScroll={true}
|
||||||
|
selectAll={true}
|
||||||
|
allSelected={allSelected}
|
||||||
|
allUnselected={allUnselected}
|
||||||
|
onSelectAllChange={onSelectAllChange}
|
||||||
|
>
|
||||||
|
<TableBody>
|
||||||
|
{items.map((item) => {
|
||||||
|
return (
|
||||||
|
<ManageDownloadClientsModalRow
|
||||||
|
key={item.id}
|
||||||
|
isSelected={selectedState[item.id]}
|
||||||
|
{...item}
|
||||||
|
columns={COLUMNS}
|
||||||
|
onSelectedChange={onSelectedChange}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</TableBody>
|
||||||
|
</Table>
|
||||||
|
) : null}
|
||||||
|
</ModalBody>
|
||||||
|
|
||||||
|
<ModalFooter>
|
||||||
|
<div className={styles.leftButtons}>
|
||||||
|
<SpinnerButton
|
||||||
|
kind={kinds.DANGER}
|
||||||
|
isSpinning={isDeleting}
|
||||||
|
isDisabled={!anySelected}
|
||||||
|
onPress={onDeletePress}
|
||||||
|
>
|
||||||
|
Delete
|
||||||
|
</SpinnerButton>
|
||||||
|
|
||||||
|
<SpinnerButton
|
||||||
|
isSpinning={isSaving}
|
||||||
|
isDisabled={!anySelected}
|
||||||
|
onPress={onEditPress}
|
||||||
|
>
|
||||||
|
Edit
|
||||||
|
</SpinnerButton>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<Button onPress={onModalClose}>Close</Button>
|
||||||
|
</ModalFooter>
|
||||||
|
|
||||||
|
<ManageDownloadClientsEditModal
|
||||||
|
isOpen={isEditModalOpen}
|
||||||
|
onModalClose={onEditModalClose}
|
||||||
|
onSavePress={onSavePress}
|
||||||
|
downloadClientIds={selectedIds}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<ConfirmModal
|
||||||
|
isOpen={isDeleteModalOpen}
|
||||||
|
kind={kinds.DANGER}
|
||||||
|
title="Delete Download Clients(s)"
|
||||||
|
message={`Are you sure you want to delete ${selectedIds.length} download clients(s)?`}
|
||||||
|
confirmLabel="Delete"
|
||||||
|
onConfirm={onConfirmDelete}
|
||||||
|
onCancel={onDeleteModalClose}
|
||||||
|
/>
|
||||||
|
</ModalContent>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default ManageDownloadClientsModalContent;
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
.name,
|
||||||
|
.enable,
|
||||||
|
.tags,
|
||||||
|
.priority,
|
||||||
|
.removeCompletedDownloads,
|
||||||
|
.removeFailedDownloads,
|
||||||
|
.implementation {
|
||||||
|
composes: cell from '~Components/Table/Cells/TableRowCell.css';
|
||||||
|
|
||||||
|
word-break: break-all;
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
// This file is automatically generated.
|
||||||
|
// Please do not change this file!
|
||||||
|
interface CssExports {
|
||||||
|
'enable': string;
|
||||||
|
'implementation': string;
|
||||||
|
'name': string;
|
||||||
|
'priority': string;
|
||||||
|
'removeCompletedDownloads': string;
|
||||||
|
'removeFailedDownloads': string;
|
||||||
|
'tags': string;
|
||||||
|
}
|
||||||
|
export const cssExports: CssExports;
|
||||||
|
export default cssExports;
|
||||||
@@ -0,0 +1,77 @@
|
|||||||
|
import React, { useCallback } from 'react';
|
||||||
|
import TableRowCell from 'Components/Table/Cells/TableRowCell';
|
||||||
|
import TableSelectCell from 'Components/Table/Cells/TableSelectCell';
|
||||||
|
import Column from 'Components/Table/Column';
|
||||||
|
import TableRow from 'Components/Table/TableRow';
|
||||||
|
import { SelectStateInputProps } from 'typings/props';
|
||||||
|
import styles from './ManageDownloadClientsModalRow.css';
|
||||||
|
|
||||||
|
interface ManageDownloadClientsModalRowProps {
|
||||||
|
id: number;
|
||||||
|
name: string;
|
||||||
|
enable: boolean;
|
||||||
|
priority: number;
|
||||||
|
removeCompletedDownloads: boolean;
|
||||||
|
removeFailedDownloads: boolean;
|
||||||
|
implementation: string;
|
||||||
|
columns: Column[];
|
||||||
|
isSelected?: boolean;
|
||||||
|
onSelectedChange(result: SelectStateInputProps): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
function ManageDownloadClientsModalRow(
|
||||||
|
props: ManageDownloadClientsModalRowProps
|
||||||
|
) {
|
||||||
|
const {
|
||||||
|
id,
|
||||||
|
isSelected,
|
||||||
|
name,
|
||||||
|
enable,
|
||||||
|
priority,
|
||||||
|
removeCompletedDownloads,
|
||||||
|
removeFailedDownloads,
|
||||||
|
implementation,
|
||||||
|
onSelectedChange,
|
||||||
|
} = props;
|
||||||
|
|
||||||
|
const onSelectedChangeWrapper = useCallback(
|
||||||
|
(result: SelectStateInputProps) => {
|
||||||
|
onSelectedChange({
|
||||||
|
...result,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
[onSelectedChange]
|
||||||
|
);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<TableRow>
|
||||||
|
<TableSelectCell
|
||||||
|
id={id}
|
||||||
|
isSelected={isSelected}
|
||||||
|
onSelectedChange={onSelectedChangeWrapper}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<TableRowCell className={styles.name}>{name}</TableRowCell>
|
||||||
|
|
||||||
|
<TableRowCell className={styles.implementation}>
|
||||||
|
{implementation}
|
||||||
|
</TableRowCell>
|
||||||
|
|
||||||
|
<TableRowCell className={styles.enable}>
|
||||||
|
{enable ? 'Yes' : 'No'}
|
||||||
|
</TableRowCell>
|
||||||
|
|
||||||
|
<TableRowCell className={styles.priority}>{priority}</TableRowCell>
|
||||||
|
|
||||||
|
<TableRowCell className={styles.removeCompletedDownloads}>
|
||||||
|
{removeCompletedDownloads ? 'Yes' : 'No'}
|
||||||
|
</TableRowCell>
|
||||||
|
|
||||||
|
<TableRowCell className={styles.removeFailedDownloads}>
|
||||||
|
{removeFailedDownloads ? 'Yes' : 'No'}
|
||||||
|
</TableRowCell>
|
||||||
|
</TableRow>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default ManageDownloadClientsModalRow;
|
||||||
@@ -29,9 +29,9 @@ function DownloadClientOptions(props) {
|
|||||||
|
|
||||||
{
|
{
|
||||||
!isFetching && error &&
|
!isFetching && error &&
|
||||||
<div>
|
<Alert kind={kinds.DANGER}>
|
||||||
{translate('UnableToLoadDownloadClientOptions')}
|
{translate('UnableToLoadDownloadClientOptions')}
|
||||||
</div>
|
</Alert>
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -88,8 +88,8 @@ class RemotePathMapping extends Component {
|
|||||||
<ConfirmModal
|
<ConfirmModal
|
||||||
isOpen={this.state.isDeleteRemotePathMappingModalOpen}
|
isOpen={this.state.isDeleteRemotePathMappingModalOpen}
|
||||||
kind={kinds.DANGER}
|
kind={kinds.DANGER}
|
||||||
title={translate('DeleteDelayProfile')}
|
title={translate('DeleteRemotePathMapping')}
|
||||||
message={translate('AreYouSureYouWantToDeleteThisRemotePathMapping')}
|
message={translate('DeleteRemotePathMappingMessageText')}
|
||||||
confirmLabel={translate('Delete')}
|
confirmLabel={translate('Delete')}
|
||||||
onConfirm={this.onConfirmDeleteRemotePathMapping}
|
onConfirm={this.onConfirmDeleteRemotePathMapping}
|
||||||
onCancel={this.onDeleteRemotePathMappingModalClose}
|
onCancel={this.onDeleteRemotePathMappingModalClose}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import React, { Component } from 'react';
|
import React, { Component } from 'react';
|
||||||
|
import Alert from 'Components/Alert';
|
||||||
import Form from 'Components/Form/Form';
|
import Form from 'Components/Form/Form';
|
||||||
import LoadingIndicator from 'Components/Loading/LoadingIndicator';
|
import LoadingIndicator from 'Components/Loading/LoadingIndicator';
|
||||||
import ConfirmModal from 'Components/Modal/ConfirmModal';
|
import ConfirmModal from 'Components/Modal/ConfirmModal';
|
||||||
@@ -123,9 +124,9 @@ class GeneralSettings extends Component {
|
|||||||
|
|
||||||
{
|
{
|
||||||
!isFetching && error &&
|
!isFetching && error &&
|
||||||
<div>
|
<Alert kind={kinds.DANGER}>
|
||||||
{translate('UnableToLoadGeneralSettings')}
|
{translate('UnableToLoadGeneralSettings')}
|
||||||
</div>
|
</Alert>
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -168,7 +168,7 @@ class SecuritySettings extends Component {
|
|||||||
isOpen={this.state.isConfirmApiKeyResetModalOpen}
|
isOpen={this.state.isConfirmApiKeyResetModalOpen}
|
||||||
kind={kinds.DANGER}
|
kind={kinds.DANGER}
|
||||||
title={translate('ResetAPIKey')}
|
title={translate('ResetAPIKey')}
|
||||||
message={translate('AreYouSureYouWantToResetYourAPIKey')}
|
message={translate('ResetAPIKeyMessageText')}
|
||||||
confirmLabel={translate('Reset')}
|
confirmLabel={translate('Reset')}
|
||||||
onConfirm={this.onConfirmResetApiKey}
|
onConfirm={this.onConfirmResetApiKey}
|
||||||
onCancel={this.onCloseResetApiKeyModal}
|
onCancel={this.onCloseResetApiKeyModal}
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ class ImportListExclusion extends Component {
|
|||||||
isOpen={this.state.isDeleteImportExclusionModalOpen}
|
isOpen={this.state.isDeleteImportExclusionModalOpen}
|
||||||
kind={kinds.DANGER}
|
kind={kinds.DANGER}
|
||||||
title={translate('DeleteImportListExclusion')}
|
title={translate('DeleteImportListExclusion')}
|
||||||
message={translate('AreYouSureYouWantToDeleteThisImportListExclusion')}
|
message={translate('DeleteImportListExclusionMessageText')}
|
||||||
confirmLabel={translate('Delete')}
|
confirmLabel={translate('Delete')}
|
||||||
onConfirm={this.onConfirmDeleteImportExclusion}
|
onConfirm={this.onConfirmDeleteImportExclusion}
|
||||||
onCancel={this.onDeleteImportExclusionModalClose}
|
onCancel={this.onDeleteImportExclusionModalClose}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import SettingsToolbarConnector from 'Settings/SettingsToolbarConnector';
|
|||||||
import translate from 'Utilities/String/translate';
|
import translate from 'Utilities/String/translate';
|
||||||
import ImportListExclusionsConnector from './ImportListExclusions/ImportListExclusionsConnector';
|
import ImportListExclusionsConnector from './ImportListExclusions/ImportListExclusionsConnector';
|
||||||
import ImportListsConnector from './ImportLists/ImportListsConnector';
|
import ImportListsConnector from './ImportLists/ImportListsConnector';
|
||||||
|
import ManageImportListsModal from './ImportLists/Manage/ManageImportListsModal';
|
||||||
import ImportListOptionsConnector from './Options/ImportListOptionsConnector';
|
import ImportListOptionsConnector from './Options/ImportListOptionsConnector';
|
||||||
|
|
||||||
class ImportListSettings extends Component {
|
class ImportListSettings extends Component {
|
||||||
@@ -23,7 +24,8 @@ class ImportListSettings extends Component {
|
|||||||
|
|
||||||
this.state = {
|
this.state = {
|
||||||
isSaving: false,
|
isSaving: false,
|
||||||
hasPendingChanges: false
|
hasPendingChanges: false,
|
||||||
|
isManageImportListsOpen: false
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -38,6 +40,14 @@ class ImportListSettings extends Component {
|
|||||||
this.setState(payload);
|
this.setState(payload);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
onManageImportListsPress = () => {
|
||||||
|
this.setState({ isManageImportListsOpen: true });
|
||||||
|
};
|
||||||
|
|
||||||
|
onManageImportListsModalClose = () => {
|
||||||
|
this.setState({ isManageImportListsOpen: false });
|
||||||
|
};
|
||||||
|
|
||||||
onSavePress = () => {
|
onSavePress = () => {
|
||||||
if (this._saveCallback) {
|
if (this._saveCallback) {
|
||||||
this._saveCallback();
|
this._saveCallback();
|
||||||
@@ -55,7 +65,8 @@ class ImportListSettings extends Component {
|
|||||||
|
|
||||||
const {
|
const {
|
||||||
isSaving,
|
isSaving,
|
||||||
hasPendingChanges
|
hasPendingChanges,
|
||||||
|
isManageImportListsOpen
|
||||||
} = this.state;
|
} = this.state;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -73,6 +84,12 @@ class ImportListSettings extends Component {
|
|||||||
isSpinning={isTestingAll}
|
isSpinning={isTestingAll}
|
||||||
onPress={dispatchTestAllImportList}
|
onPress={dispatchTestAllImportList}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<PageToolbarButton
|
||||||
|
label="Manage Lists"
|
||||||
|
iconName={icons.MANAGE}
|
||||||
|
onPress={this.onManageImportListsPress}
|
||||||
|
/>
|
||||||
</Fragment>
|
</Fragment>
|
||||||
}
|
}
|
||||||
onSavePress={this.onSavePress}
|
onSavePress={this.onSavePress}
|
||||||
@@ -88,6 +105,11 @@ class ImportListSettings extends Component {
|
|||||||
|
|
||||||
<ImportListExclusionsConnector />
|
<ImportListExclusionsConnector />
|
||||||
|
|
||||||
|
<ManageImportListsModal
|
||||||
|
isOpen={isManageImportListsOpen}
|
||||||
|
onModalClose={this.onManageImportListsModalClose}
|
||||||
|
/>
|
||||||
|
|
||||||
</PageContentBody>
|
</PageContentBody>
|
||||||
</PageContent>
|
</PageContent>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -0,0 +1,26 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import Modal from 'Components/Modal/Modal';
|
||||||
|
import ManageImportListsEditModalContent from './ManageImportListsEditModalContent';
|
||||||
|
|
||||||
|
interface ManageImportListsEditModalProps {
|
||||||
|
isOpen: boolean;
|
||||||
|
importListIds: number[];
|
||||||
|
onSavePress(payload: object): void;
|
||||||
|
onModalClose(): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
function ManageImportListsEditModal(props: ManageImportListsEditModalProps) {
|
||||||
|
const { isOpen, importListIds, onSavePress, onModalClose } = props;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Modal isOpen={isOpen} onModalClose={onModalClose}>
|
||||||
|
<ManageImportListsEditModalContent
|
||||||
|
importListIds={importListIds}
|
||||||
|
onSavePress={onSavePress}
|
||||||
|
onModalClose={onModalClose}
|
||||||
|
/>
|
||||||
|
</Modal>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default ManageImportListsEditModal;
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
.modalFooter {
|
||||||
|
composes: modalFooter from '~Components/Modal/ModalFooter.css';
|
||||||
|
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
|
||||||
|
.selected {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media only screen and (max-width: $breakpointExtraSmall) {
|
||||||
|
.modalFooter {
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 10px;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
// This file is automatically generated.
|
||||||
|
// Please do not change this file!
|
||||||
|
interface CssExports {
|
||||||
|
'modalFooter': string;
|
||||||
|
'selected': string;
|
||||||
|
}
|
||||||
|
export const cssExports: CssExports;
|
||||||
|
export default cssExports;
|
||||||
@@ -0,0 +1,152 @@
|
|||||||
|
import React, { useCallback, useState } from 'react';
|
||||||
|
import FormGroup from 'Components/Form/FormGroup';
|
||||||
|
import FormInputGroup from 'Components/Form/FormInputGroup';
|
||||||
|
import FormLabel from 'Components/Form/FormLabel';
|
||||||
|
import Button from 'Components/Link/Button';
|
||||||
|
import ModalBody from 'Components/Modal/ModalBody';
|
||||||
|
import ModalContent from 'Components/Modal/ModalContent';
|
||||||
|
import ModalFooter from 'Components/Modal/ModalFooter';
|
||||||
|
import ModalHeader from 'Components/Modal/ModalHeader';
|
||||||
|
import { inputTypes } from 'Helpers/Props';
|
||||||
|
import translate from 'Utilities/String/translate';
|
||||||
|
import styles from './ManageImportListsEditModalContent.css';
|
||||||
|
|
||||||
|
interface SavePayload {
|
||||||
|
enableAuto?: boolean;
|
||||||
|
qualityProfileId?: number;
|
||||||
|
rootFolderPath?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ManageImportListsEditModalContentProps {
|
||||||
|
importListIds: number[];
|
||||||
|
onSavePress(payload: object): void;
|
||||||
|
onModalClose(): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
const NO_CHANGE = 'noChange';
|
||||||
|
|
||||||
|
const autoAddOptions = [
|
||||||
|
{ key: NO_CHANGE, value: 'No Change', disabled: true },
|
||||||
|
{ key: 'enabled', value: 'Enabled' },
|
||||||
|
{ key: 'disabled', value: 'Disabled' },
|
||||||
|
];
|
||||||
|
|
||||||
|
function ManageImportListsEditModalContent(
|
||||||
|
props: ManageImportListsEditModalContentProps
|
||||||
|
) {
|
||||||
|
const { importListIds, onSavePress, onModalClose } = props;
|
||||||
|
|
||||||
|
const [enableAuto, setenableAuto] = useState(NO_CHANGE);
|
||||||
|
const [qualityProfileId, setQualityProfileId] = useState<string | number>(
|
||||||
|
NO_CHANGE
|
||||||
|
);
|
||||||
|
const [rootFolderPath, setRootFolderPath] = useState(NO_CHANGE);
|
||||||
|
|
||||||
|
const save = useCallback(() => {
|
||||||
|
let hasChanges = false;
|
||||||
|
const payload: SavePayload = {};
|
||||||
|
|
||||||
|
if (enableAuto !== NO_CHANGE) {
|
||||||
|
hasChanges = true;
|
||||||
|
payload.enableAuto = enableAuto === 'enabled';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (qualityProfileId !== NO_CHANGE) {
|
||||||
|
hasChanges = true;
|
||||||
|
payload.qualityProfileId = qualityProfileId as number;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rootFolderPath !== NO_CHANGE) {
|
||||||
|
hasChanges = true;
|
||||||
|
payload.rootFolderPath = rootFolderPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hasChanges) {
|
||||||
|
onSavePress(payload);
|
||||||
|
}
|
||||||
|
|
||||||
|
onModalClose();
|
||||||
|
}, [enableAuto, qualityProfileId, rootFolderPath, onSavePress, onModalClose]);
|
||||||
|
|
||||||
|
const onInputChange = useCallback(
|
||||||
|
({ name, value }: { name: string; value: string }) => {
|
||||||
|
switch (name) {
|
||||||
|
case 'enableAuto':
|
||||||
|
setenableAuto(value);
|
||||||
|
break;
|
||||||
|
case 'qualityProfileId':
|
||||||
|
setQualityProfileId(value);
|
||||||
|
break;
|
||||||
|
case 'rootFolderPath':
|
||||||
|
setRootFolderPath(value);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
console.warn('EditImportListModalContent Unknown Input');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
[]
|
||||||
|
);
|
||||||
|
|
||||||
|
const selectedCount = importListIds.length;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<ModalContent onModalClose={onModalClose}>
|
||||||
|
<ModalHeader>{translate('EditSelectedImportLists')}</ModalHeader>
|
||||||
|
|
||||||
|
<ModalBody>
|
||||||
|
<FormGroup>
|
||||||
|
<FormLabel>{translate('AutomaticAdd')}</FormLabel>
|
||||||
|
|
||||||
|
<FormInputGroup
|
||||||
|
type={inputTypes.SELECT}
|
||||||
|
name="enableAuto"
|
||||||
|
value={enableAuto}
|
||||||
|
values={autoAddOptions}
|
||||||
|
onChange={onInputChange}
|
||||||
|
/>
|
||||||
|
</FormGroup>
|
||||||
|
|
||||||
|
<FormGroup>
|
||||||
|
<FormLabel>{translate('QualityProfile')}</FormLabel>
|
||||||
|
|
||||||
|
<FormInputGroup
|
||||||
|
type={inputTypes.QUALITY_PROFILE_SELECT}
|
||||||
|
name="qualityProfileId"
|
||||||
|
value={qualityProfileId}
|
||||||
|
includeNoChange={true}
|
||||||
|
includeNoChangeDisabled={false}
|
||||||
|
onChange={onInputChange}
|
||||||
|
/>
|
||||||
|
</FormGroup>
|
||||||
|
|
||||||
|
<FormGroup>
|
||||||
|
<FormLabel>{translate('RootFolder')}</FormLabel>
|
||||||
|
|
||||||
|
<FormInputGroup
|
||||||
|
type={inputTypes.ROOT_FOLDER_SELECT}
|
||||||
|
name="rootFolderPath"
|
||||||
|
value={rootFolderPath}
|
||||||
|
includeNoChange={true}
|
||||||
|
includeNoChangeDisabled={false}
|
||||||
|
selectedValueOptions={{ includeFreeSpace: false }}
|
||||||
|
onChange={onInputChange}
|
||||||
|
/>
|
||||||
|
</FormGroup>
|
||||||
|
</ModalBody>
|
||||||
|
|
||||||
|
<ModalFooter className={styles.modalFooter}>
|
||||||
|
<div className={styles.selected}>
|
||||||
|
{translate('{count} import lists selected', { count: selectedCount })}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<Button onPress={onModalClose}>{translate('Cancel')}</Button>
|
||||||
|
|
||||||
|
<Button onPress={save}>{translate('ApplyChanges')}</Button>
|
||||||
|
</div>
|
||||||
|
</ModalFooter>
|
||||||
|
</ModalContent>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default ManageImportListsEditModalContent;
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import Modal from 'Components/Modal/Modal';
|
||||||
|
import ManageImportListsModalContent from './ManageImportListsModalContent';
|
||||||
|
|
||||||
|
interface ManageImportListsModalProps {
|
||||||
|
isOpen: boolean;
|
||||||
|
onModalClose(): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
function ManageImportListsModal(props: ManageImportListsModalProps) {
|
||||||
|
const { isOpen, onModalClose } = props;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Modal isOpen={isOpen} onModalClose={onModalClose}>
|
||||||
|
<ManageImportListsModalContent onModalClose={onModalClose} />
|
||||||
|
</Modal>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default ManageImportListsModal;
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
.leftButtons,
|
||||||
|
.rightButtons {
|
||||||
|
display: flex;
|
||||||
|
flex: 1 0 50%;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rightButtons {
|
||||||
|
justify-content: flex-end;
|
||||||
|
}
|
||||||
|
|
||||||
|
.deleteButton {
|
||||||
|
composes: button from '~Components/Link/Button.css';
|
||||||
|
|
||||||
|
margin-right: 10px;
|
||||||
|
}
|
||||||
9
frontend/src/Settings/ImportLists/ImportLists/Manage/ManageImportListsModalContent.css.d.ts
vendored
Normal file
9
frontend/src/Settings/ImportLists/ImportLists/Manage/ManageImportListsModalContent.css.d.ts
vendored
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
// This file is automatically generated.
|
||||||
|
// Please do not change this file!
|
||||||
|
interface CssExports {
|
||||||
|
'deleteButton': string;
|
||||||
|
'leftButtons': string;
|
||||||
|
'rightButtons': string;
|
||||||
|
}
|
||||||
|
export const cssExports: CssExports;
|
||||||
|
export default cssExports;
|
||||||
@@ -0,0 +1,283 @@
|
|||||||
|
import React, { useCallback, useMemo, useState } from 'react';
|
||||||
|
import { useDispatch, useSelector } from 'react-redux';
|
||||||
|
import { ImportListAppState } from 'App/State/SettingsAppState';
|
||||||
|
import Button from 'Components/Link/Button';
|
||||||
|
import SpinnerButton from 'Components/Link/SpinnerButton';
|
||||||
|
import LoadingIndicator from 'Components/Loading/LoadingIndicator';
|
||||||
|
import ConfirmModal from 'Components/Modal/ConfirmModal';
|
||||||
|
import ModalBody from 'Components/Modal/ModalBody';
|
||||||
|
import ModalContent from 'Components/Modal/ModalContent';
|
||||||
|
import ModalFooter from 'Components/Modal/ModalFooter';
|
||||||
|
import ModalHeader from 'Components/Modal/ModalHeader';
|
||||||
|
import Table from 'Components/Table/Table';
|
||||||
|
import TableBody from 'Components/Table/TableBody';
|
||||||
|
import useSelectState from 'Helpers/Hooks/useSelectState';
|
||||||
|
import { kinds } from 'Helpers/Props';
|
||||||
|
import {
|
||||||
|
bulkDeleteImportLists,
|
||||||
|
bulkEditImportLists,
|
||||||
|
} from 'Store/Actions/settingsActions';
|
||||||
|
import createClientSideCollectionSelector from 'Store/Selectors/createClientSideCollectionSelector';
|
||||||
|
import { SelectStateInputProps } from 'typings/props';
|
||||||
|
import getErrorMessage from 'Utilities/Object/getErrorMessage';
|
||||||
|
import getSelectedIds from 'Utilities/Table/getSelectedIds';
|
||||||
|
import ManageImportListsEditModal from './Edit/ManageImportListsEditModal';
|
||||||
|
import ManageImportListsModalRow from './ManageImportListsModalRow';
|
||||||
|
import TagsModal from './Tags/TagsModal';
|
||||||
|
import styles from './ManageImportListsModalContent.css';
|
||||||
|
|
||||||
|
// TODO: This feels janky to do, but not sure of a better way currently
|
||||||
|
type OnSelectedChangeCallback = React.ComponentProps<
|
||||||
|
typeof ManageImportListsModalRow
|
||||||
|
>['onSelectedChange'];
|
||||||
|
|
||||||
|
const COLUMNS = [
|
||||||
|
{
|
||||||
|
name: 'name',
|
||||||
|
label: 'Name',
|
||||||
|
isSortable: true,
|
||||||
|
isVisible: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'implementation',
|
||||||
|
label: 'Implementation',
|
||||||
|
isSortable: true,
|
||||||
|
isVisible: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'qualityProfileId',
|
||||||
|
label: 'Quality Profile',
|
||||||
|
isSortable: true,
|
||||||
|
isVisible: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'rootFolderPath',
|
||||||
|
label: 'Root Folder',
|
||||||
|
isSortable: true,
|
||||||
|
isVisible: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'enableAuto',
|
||||||
|
label: 'Auto Add',
|
||||||
|
isSortable: true,
|
||||||
|
isVisible: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'tags',
|
||||||
|
label: 'Tags',
|
||||||
|
isSortable: true,
|
||||||
|
isVisible: true,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
interface ManageImportListsModalContentProps {
|
||||||
|
onModalClose(): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
function ManageImportListsModalContent(
|
||||||
|
props: ManageImportListsModalContentProps
|
||||||
|
) {
|
||||||
|
const { onModalClose } = props;
|
||||||
|
|
||||||
|
const {
|
||||||
|
isFetching,
|
||||||
|
isPopulated,
|
||||||
|
isDeleting,
|
||||||
|
isSaving,
|
||||||
|
error,
|
||||||
|
items,
|
||||||
|
}: ImportListAppState = useSelector(
|
||||||
|
createClientSideCollectionSelector('settings.importLists')
|
||||||
|
);
|
||||||
|
const dispatch = useDispatch();
|
||||||
|
|
||||||
|
const [isDeleteModalOpen, setIsDeleteModalOpen] = useState(false);
|
||||||
|
const [isEditModalOpen, setIsEditModalOpen] = useState(false);
|
||||||
|
const [isTagsModalOpen, setIsTagsModalOpen] = useState(false);
|
||||||
|
const [isSavingTags, setIsSavingTags] = useState(false);
|
||||||
|
|
||||||
|
const [selectState, setSelectState] = useSelectState();
|
||||||
|
|
||||||
|
const { allSelected, allUnselected, selectedState } = selectState;
|
||||||
|
|
||||||
|
const selectedIds: number[] = useMemo(() => {
|
||||||
|
return getSelectedIds(selectedState);
|
||||||
|
}, [selectedState]);
|
||||||
|
|
||||||
|
const selectedCount = selectedIds.length;
|
||||||
|
|
||||||
|
const onDeletePress = useCallback(() => {
|
||||||
|
setIsDeleteModalOpen(true);
|
||||||
|
}, [setIsDeleteModalOpen]);
|
||||||
|
|
||||||
|
const onDeleteModalClose = useCallback(() => {
|
||||||
|
setIsDeleteModalOpen(false);
|
||||||
|
}, [setIsDeleteModalOpen]);
|
||||||
|
|
||||||
|
const onEditPress = useCallback(() => {
|
||||||
|
setIsEditModalOpen(true);
|
||||||
|
}, [setIsEditModalOpen]);
|
||||||
|
|
||||||
|
const onEditModalClose = useCallback(() => {
|
||||||
|
setIsEditModalOpen(false);
|
||||||
|
}, [setIsEditModalOpen]);
|
||||||
|
|
||||||
|
const onConfirmDelete = useCallback(() => {
|
||||||
|
dispatch(bulkDeleteImportLists({ ids: selectedIds }));
|
||||||
|
setIsDeleteModalOpen(false);
|
||||||
|
}, [selectedIds, dispatch]);
|
||||||
|
|
||||||
|
const onSavePress = useCallback(
|
||||||
|
(payload: object) => {
|
||||||
|
setIsEditModalOpen(false);
|
||||||
|
|
||||||
|
dispatch(
|
||||||
|
bulkEditImportLists({
|
||||||
|
ids: selectedIds,
|
||||||
|
...payload,
|
||||||
|
})
|
||||||
|
);
|
||||||
|
},
|
||||||
|
[selectedIds, dispatch]
|
||||||
|
);
|
||||||
|
|
||||||
|
const onTagsPress = useCallback(() => {
|
||||||
|
setIsTagsModalOpen(true);
|
||||||
|
}, [setIsTagsModalOpen]);
|
||||||
|
|
||||||
|
const onTagsModalClose = useCallback(() => {
|
||||||
|
setIsTagsModalOpen(false);
|
||||||
|
}, [setIsTagsModalOpen]);
|
||||||
|
|
||||||
|
const onApplyTagsPress = useCallback(
|
||||||
|
(tags: number[], applyTags: string) => {
|
||||||
|
setIsSavingTags(true);
|
||||||
|
setIsTagsModalOpen(false);
|
||||||
|
|
||||||
|
dispatch(
|
||||||
|
bulkEditImportLists({
|
||||||
|
ids: selectedIds,
|
||||||
|
tags,
|
||||||
|
applyTags,
|
||||||
|
})
|
||||||
|
);
|
||||||
|
},
|
||||||
|
[selectedIds, dispatch]
|
||||||
|
);
|
||||||
|
|
||||||
|
const onSelectAllChange = useCallback(
|
||||||
|
({ value }: SelectStateInputProps) => {
|
||||||
|
setSelectState({ type: value ? 'selectAll' : 'unselectAll', items });
|
||||||
|
},
|
||||||
|
[items, setSelectState]
|
||||||
|
);
|
||||||
|
|
||||||
|
const onSelectedChange = useCallback<OnSelectedChangeCallback>(
|
||||||
|
({ id, value, shiftKey = false }) => {
|
||||||
|
setSelectState({
|
||||||
|
type: 'toggleSelected',
|
||||||
|
items,
|
||||||
|
id,
|
||||||
|
isSelected: value,
|
||||||
|
shiftKey,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
[items, setSelectState]
|
||||||
|
);
|
||||||
|
|
||||||
|
const errorMessage = getErrorMessage(error, 'Unable to load import lists.');
|
||||||
|
const anySelected = selectedCount > 0;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<ModalContent onModalClose={onModalClose}>
|
||||||
|
<ModalHeader>Manage Import Lists</ModalHeader>
|
||||||
|
<ModalBody>
|
||||||
|
{isFetching ? <LoadingIndicator /> : null}
|
||||||
|
|
||||||
|
{error ? <div>{errorMessage}</div> : null}
|
||||||
|
|
||||||
|
{isPopulated && !!items.length && !isFetching && !isFetching ? (
|
||||||
|
<Table
|
||||||
|
columns={COLUMNS}
|
||||||
|
horizontalScroll={true}
|
||||||
|
selectAll={true}
|
||||||
|
allSelected={allSelected}
|
||||||
|
allUnselected={allUnselected}
|
||||||
|
onSelectAllChange={onSelectAllChange}
|
||||||
|
>
|
||||||
|
<TableBody>
|
||||||
|
{items.map((item) => {
|
||||||
|
return (
|
||||||
|
<ManageImportListsModalRow
|
||||||
|
key={item.id}
|
||||||
|
isSelected={selectedState[item.id]}
|
||||||
|
{...item}
|
||||||
|
columns={COLUMNS}
|
||||||
|
onSelectedChange={onSelectedChange}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</TableBody>
|
||||||
|
</Table>
|
||||||
|
) : null}
|
||||||
|
</ModalBody>
|
||||||
|
|
||||||
|
<ModalFooter>
|
||||||
|
<div className={styles.leftButtons}>
|
||||||
|
<SpinnerButton
|
||||||
|
kind={kinds.DANGER}
|
||||||
|
isSpinning={isDeleting}
|
||||||
|
isDisabled={!anySelected}
|
||||||
|
onPress={onDeletePress}
|
||||||
|
>
|
||||||
|
Delete
|
||||||
|
</SpinnerButton>
|
||||||
|
|
||||||
|
<SpinnerButton
|
||||||
|
isSpinning={isSaving}
|
||||||
|
isDisabled={!anySelected}
|
||||||
|
onPress={onEditPress}
|
||||||
|
>
|
||||||
|
Edit
|
||||||
|
</SpinnerButton>
|
||||||
|
|
||||||
|
<SpinnerButton
|
||||||
|
isSpinning={isSaving && isSavingTags}
|
||||||
|
isDisabled={!anySelected}
|
||||||
|
onPress={onTagsPress}
|
||||||
|
>
|
||||||
|
Set Tags
|
||||||
|
</SpinnerButton>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<Button onPress={onModalClose}>Close</Button>
|
||||||
|
</ModalFooter>
|
||||||
|
|
||||||
|
<ManageImportListsEditModal
|
||||||
|
isOpen={isEditModalOpen}
|
||||||
|
onModalClose={onEditModalClose}
|
||||||
|
onSavePress={onSavePress}
|
||||||
|
importListIds={selectedIds}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<TagsModal
|
||||||
|
isOpen={isTagsModalOpen}
|
||||||
|
ids={selectedIds}
|
||||||
|
onApplyTagsPress={onApplyTagsPress}
|
||||||
|
onModalClose={onTagsModalClose}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<ConfirmModal
|
||||||
|
isOpen={isDeleteModalOpen}
|
||||||
|
kind={kinds.DANGER}
|
||||||
|
title="Delete Import List(s)"
|
||||||
|
message={`Are you sure you want to delete ${selectedIds.length} import list(s)?`}
|
||||||
|
confirmLabel="Delete"
|
||||||
|
onConfirm={onConfirmDelete}
|
||||||
|
onCancel={onDeleteModalClose}
|
||||||
|
/>
|
||||||
|
</ModalContent>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default ManageImportListsModalContent;
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
.name,
|
||||||
|
.tags,
|
||||||
|
.enableAuto,
|
||||||
|
.qualityProfileId,
|
||||||
|
.rootFolderPath,
|
||||||
|
.implementation {
|
||||||
|
composes: cell from '~Components/Table/Cells/TableRowCell.css';
|
||||||
|
|
||||||
|
word-break: break-all;
|
||||||
|
}
|
||||||
12
frontend/src/Settings/ImportLists/ImportLists/Manage/ManageImportListsModalRow.css.d.ts
vendored
Normal file
12
frontend/src/Settings/ImportLists/ImportLists/Manage/ManageImportListsModalRow.css.d.ts
vendored
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
// This file is automatically generated.
|
||||||
|
// Please do not change this file!
|
||||||
|
interface CssExports {
|
||||||
|
'enableAuto': string;
|
||||||
|
'implementation': string;
|
||||||
|
'name': string;
|
||||||
|
'qualityProfileId': string;
|
||||||
|
'rootFolderPath': string;
|
||||||
|
'tags': string;
|
||||||
|
}
|
||||||
|
export const cssExports: CssExports;
|
||||||
|
export default cssExports;
|
||||||
@@ -0,0 +1,84 @@
|
|||||||
|
import React, { useCallback } from 'react';
|
||||||
|
import { useSelector } from 'react-redux';
|
||||||
|
import TableRowCell from 'Components/Table/Cells/TableRowCell';
|
||||||
|
import TableSelectCell from 'Components/Table/Cells/TableSelectCell';
|
||||||
|
import Column from 'Components/Table/Column';
|
||||||
|
import TableRow from 'Components/Table/TableRow';
|
||||||
|
import TagListConnector from 'Components/TagListConnector';
|
||||||
|
import { createQualityProfileSelectorForHook } from 'Store/Selectors/createQualityProfileSelector';
|
||||||
|
import { SelectStateInputProps } from 'typings/props';
|
||||||
|
import styles from './ManageImportListsModalRow.css';
|
||||||
|
|
||||||
|
interface ManageImportListsModalRowProps {
|
||||||
|
id: number;
|
||||||
|
name: string;
|
||||||
|
rootFolderPath: string;
|
||||||
|
qualityProfileId: number;
|
||||||
|
implementation: string;
|
||||||
|
tags: number[];
|
||||||
|
enableAuto: boolean;
|
||||||
|
columns: Column[];
|
||||||
|
isSelected?: boolean;
|
||||||
|
onSelectedChange(result: SelectStateInputProps): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
function ManageImportListsModalRow(props: ManageImportListsModalRowProps) {
|
||||||
|
const {
|
||||||
|
id,
|
||||||
|
isSelected,
|
||||||
|
name,
|
||||||
|
rootFolderPath,
|
||||||
|
qualityProfileId,
|
||||||
|
implementation,
|
||||||
|
enableAuto,
|
||||||
|
tags,
|
||||||
|
onSelectedChange,
|
||||||
|
} = props;
|
||||||
|
|
||||||
|
const qualityProfile = useSelector(
|
||||||
|
createQualityProfileSelectorForHook(qualityProfileId)
|
||||||
|
);
|
||||||
|
|
||||||
|
const onSelectedChangeWrapper = useCallback(
|
||||||
|
(result: SelectStateInputProps) => {
|
||||||
|
onSelectedChange({
|
||||||
|
...result,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
[onSelectedChange]
|
||||||
|
);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<TableRow>
|
||||||
|
<TableSelectCell
|
||||||
|
id={id}
|
||||||
|
isSelected={isSelected}
|
||||||
|
onSelectedChange={onSelectedChangeWrapper}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<TableRowCell className={styles.name}>{name}</TableRowCell>
|
||||||
|
|
||||||
|
<TableRowCell className={styles.implementation}>
|
||||||
|
{implementation}
|
||||||
|
</TableRowCell>
|
||||||
|
|
||||||
|
<TableRowCell className={styles.qualityProfileId}>
|
||||||
|
{qualityProfile?.name ?? 'None'}
|
||||||
|
</TableRowCell>
|
||||||
|
|
||||||
|
<TableRowCell className={styles.rootFolderPath}>
|
||||||
|
{rootFolderPath}
|
||||||
|
</TableRowCell>
|
||||||
|
|
||||||
|
<TableRowCell className={styles.enableAuto}>
|
||||||
|
{enableAuto ? 'Yes' : 'No'}
|
||||||
|
</TableRowCell>
|
||||||
|
|
||||||
|
<TableRowCell className={styles.tags}>
|
||||||
|
<TagListConnector tags={tags} />
|
||||||
|
</TableRowCell>
|
||||||
|
</TableRow>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default ManageImportListsModalRow;
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import Modal from 'Components/Modal/Modal';
|
||||||
|
import TagsModalContent from './TagsModalContent';
|
||||||
|
|
||||||
|
interface TagsModalProps {
|
||||||
|
isOpen: boolean;
|
||||||
|
ids: number[];
|
||||||
|
onApplyTagsPress: (tags: number[], applyTags: string) => void;
|
||||||
|
onModalClose: () => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
function TagsModal(props: TagsModalProps) {
|
||||||
|
const { isOpen, onModalClose, ...otherProps } = props;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Modal isOpen={isOpen} onModalClose={onModalClose}>
|
||||||
|
<TagsModalContent {...otherProps} onModalClose={onModalClose} />
|
||||||
|
</Modal>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default TagsModal;
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
.renameIcon {
|
||||||
|
margin-left: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.message {
|
||||||
|
margin-top: 20px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.result {
|
||||||
|
padding-top: 4px;
|
||||||
|
}
|
||||||
9
frontend/src/Settings/ImportLists/ImportLists/Manage/Tags/TagsModalContent.css.d.ts
vendored
Normal file
9
frontend/src/Settings/ImportLists/ImportLists/Manage/Tags/TagsModalContent.css.d.ts
vendored
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
// This file is automatically generated.
|
||||||
|
// Please do not change this file!
|
||||||
|
interface CssExports {
|
||||||
|
'message': string;
|
||||||
|
'renameIcon': string;
|
||||||
|
'result': string;
|
||||||
|
}
|
||||||
|
export const cssExports: CssExports;
|
||||||
|
export default cssExports;
|
||||||
@@ -0,0 +1,178 @@
|
|||||||
|
import { uniq } from 'lodash';
|
||||||
|
import React, { useCallback, useMemo, useState } from 'react';
|
||||||
|
import { useSelector } from 'react-redux';
|
||||||
|
import AppState from 'App/State/AppState';
|
||||||
|
import { ImportListAppState } from 'App/State/SettingsAppState';
|
||||||
|
import { Tag } from 'App/State/TagsAppState';
|
||||||
|
import Form from 'Components/Form/Form';
|
||||||
|
import FormGroup from 'Components/Form/FormGroup';
|
||||||
|
import FormInputGroup from 'Components/Form/FormInputGroup';
|
||||||
|
import FormLabel from 'Components/Form/FormLabel';
|
||||||
|
import Label from 'Components/Label';
|
||||||
|
import Button from 'Components/Link/Button';
|
||||||
|
import ModalBody from 'Components/Modal/ModalBody';
|
||||||
|
import ModalContent from 'Components/Modal/ModalContent';
|
||||||
|
import ModalFooter from 'Components/Modal/ModalFooter';
|
||||||
|
import ModalHeader from 'Components/Modal/ModalHeader';
|
||||||
|
import { inputTypes, kinds, sizes } from 'Helpers/Props';
|
||||||
|
import createTagsSelector from 'Store/Selectors/createTagsSelector';
|
||||||
|
import ImportList from 'typings/ImportList';
|
||||||
|
import styles from './TagsModalContent.css';
|
||||||
|
|
||||||
|
interface TagsModalContentProps {
|
||||||
|
ids: number[];
|
||||||
|
onApplyTagsPress: (tags: number[], applyTags: string) => void;
|
||||||
|
onModalClose: () => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
function TagsModalContent(props: TagsModalContentProps) {
|
||||||
|
const { ids, onModalClose, onApplyTagsPress } = props;
|
||||||
|
|
||||||
|
const allImportLists: ImportListAppState = useSelector(
|
||||||
|
(state: AppState) => state.settings.importLists
|
||||||
|
);
|
||||||
|
const tagList: Tag[] = useSelector(createTagsSelector());
|
||||||
|
|
||||||
|
const [tags, setTags] = useState<number[]>([]);
|
||||||
|
const [applyTags, setApplyTags] = useState('add');
|
||||||
|
|
||||||
|
const seriesTags = useMemo(() => {
|
||||||
|
const tags = ids.reduce((acc: number[], id) => {
|
||||||
|
const s = allImportLists.items.find((s: ImportList) => s.id === id);
|
||||||
|
|
||||||
|
if (s) {
|
||||||
|
acc.push(...s.tags);
|
||||||
|
}
|
||||||
|
|
||||||
|
return acc;
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
return uniq(tags);
|
||||||
|
}, [ids, allImportLists]);
|
||||||
|
|
||||||
|
const onTagsChange = useCallback(
|
||||||
|
({ value }: { value: number[] }) => {
|
||||||
|
setTags(value);
|
||||||
|
},
|
||||||
|
[setTags]
|
||||||
|
);
|
||||||
|
|
||||||
|
const onApplyTagsChange = useCallback(
|
||||||
|
({ value }: { value: string }) => {
|
||||||
|
setApplyTags(value);
|
||||||
|
},
|
||||||
|
[setApplyTags]
|
||||||
|
);
|
||||||
|
|
||||||
|
const onApplyPress = useCallback(() => {
|
||||||
|
onApplyTagsPress(tags, applyTags);
|
||||||
|
}, [tags, applyTags, onApplyTagsPress]);
|
||||||
|
|
||||||
|
const applyTagsOptions = [
|
||||||
|
{ key: 'add', value: 'Add' },
|
||||||
|
{ key: 'remove', value: 'Remove' },
|
||||||
|
{ key: 'replace', value: 'Replace' },
|
||||||
|
];
|
||||||
|
|
||||||
|
return (
|
||||||
|
<ModalContent onModalClose={onModalClose}>
|
||||||
|
<ModalHeader>Tags</ModalHeader>
|
||||||
|
|
||||||
|
<ModalBody>
|
||||||
|
<Form>
|
||||||
|
<FormGroup>
|
||||||
|
<FormLabel>Tags</FormLabel>
|
||||||
|
|
||||||
|
<FormInputGroup
|
||||||
|
type={inputTypes.TAG}
|
||||||
|
name="tags"
|
||||||
|
value={tags}
|
||||||
|
onChange={onTagsChange}
|
||||||
|
/>
|
||||||
|
</FormGroup>
|
||||||
|
|
||||||
|
<FormGroup>
|
||||||
|
<FormLabel>Apply Tags</FormLabel>
|
||||||
|
|
||||||
|
<FormInputGroup
|
||||||
|
type={inputTypes.SELECT}
|
||||||
|
name="applyTags"
|
||||||
|
value={applyTags}
|
||||||
|
values={applyTagsOptions}
|
||||||
|
helpTexts={[
|
||||||
|
'How to apply tags to the selected list',
|
||||||
|
'Add: Add the tags the existing list of tags',
|
||||||
|
'Remove: Remove the entered tags',
|
||||||
|
'Replace: Replace the tags with the entered tags (enter no tags to clear all tags)',
|
||||||
|
]}
|
||||||
|
onChange={onApplyTagsChange}
|
||||||
|
/>
|
||||||
|
</FormGroup>
|
||||||
|
|
||||||
|
<FormGroup>
|
||||||
|
<FormLabel>Result</FormLabel>
|
||||||
|
|
||||||
|
<div className={styles.result}>
|
||||||
|
{seriesTags.map((id) => {
|
||||||
|
const tag = tagList.find((t) => t.id === id);
|
||||||
|
|
||||||
|
if (!tag) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const removeTag =
|
||||||
|
(applyTags === 'remove' && tags.indexOf(id) > -1) ||
|
||||||
|
(applyTags === 'replace' && tags.indexOf(id) === -1);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Label
|
||||||
|
key={tag.id}
|
||||||
|
title={removeTag ? 'Removing tag' : 'Existing tag'}
|
||||||
|
kind={removeTag ? kinds.INVERSE : kinds.INFO}
|
||||||
|
size={sizes.LARGE}
|
||||||
|
>
|
||||||
|
{tag.label}
|
||||||
|
</Label>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
|
||||||
|
{(applyTags === 'add' || applyTags === 'replace') &&
|
||||||
|
tags.map((id) => {
|
||||||
|
const tag = tagList.find((t) => t.id === id);
|
||||||
|
|
||||||
|
if (!tag) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (seriesTags.indexOf(id) > -1) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Label
|
||||||
|
key={tag.id}
|
||||||
|
title={'Adding tag'}
|
||||||
|
kind={kinds.SUCCESS}
|
||||||
|
size={sizes.LARGE}
|
||||||
|
>
|
||||||
|
{tag.label}
|
||||||
|
</Label>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
</FormGroup>
|
||||||
|
</Form>
|
||||||
|
</ModalBody>
|
||||||
|
|
||||||
|
<ModalFooter>
|
||||||
|
<Button onPress={onModalClose}>Cancel</Button>
|
||||||
|
|
||||||
|
<Button kind={kinds.PRIMARY} onPress={onApplyPress}>
|
||||||
|
Apply
|
||||||
|
</Button>
|
||||||
|
</ModalFooter>
|
||||||
|
</ModalContent>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default TagsModalContent;
|
||||||
@@ -1,12 +1,13 @@
|
|||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import Alert from 'Components/Alert';
|
||||||
import FieldSet from 'Components/FieldSet';
|
import FieldSet from 'Components/FieldSet';
|
||||||
import Form from 'Components/Form/Form';
|
import Form from 'Components/Form/Form';
|
||||||
import FormGroup from 'Components/Form/FormGroup';
|
import FormGroup from 'Components/Form/FormGroup';
|
||||||
import FormInputGroup from 'Components/Form/FormInputGroup';
|
import FormInputGroup from 'Components/Form/FormInputGroup';
|
||||||
import FormLabel from 'Components/Form/FormLabel';
|
import FormLabel from 'Components/Form/FormLabel';
|
||||||
import LoadingIndicator from 'Components/Loading/LoadingIndicator';
|
import LoadingIndicator from 'Components/Loading/LoadingIndicator';
|
||||||
import { inputTypes } from 'Helpers/Props';
|
import { inputTypes, kinds } from 'Helpers/Props';
|
||||||
import translate from 'Utilities/String/translate';
|
import translate from 'Utilities/String/translate';
|
||||||
|
|
||||||
function ImportListOptions(props) {
|
function ImportListOptions(props) {
|
||||||
@@ -37,9 +38,9 @@ function ImportListOptions(props) {
|
|||||||
|
|
||||||
{
|
{
|
||||||
!isFetching && error &&
|
!isFetching && error &&
|
||||||
<div>
|
<Alert kind={kinds.DANGER}>
|
||||||
{translate('UnableToLoadListOptions')}
|
{translate('UnableToLoadListOptions')}
|
||||||
</div>
|
</Alert>
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import { icons } from 'Helpers/Props';
|
|||||||
import SettingsToolbarConnector from 'Settings/SettingsToolbarConnector';
|
import SettingsToolbarConnector from 'Settings/SettingsToolbarConnector';
|
||||||
import translate from 'Utilities/String/translate';
|
import translate from 'Utilities/String/translate';
|
||||||
import IndexersConnector from './Indexers/IndexersConnector';
|
import IndexersConnector from './Indexers/IndexersConnector';
|
||||||
|
import ManageIndexersModal from './Indexers/Manage/ManageIndexersModal';
|
||||||
import IndexerOptionsConnector from './Options/IndexerOptionsConnector';
|
import IndexerOptionsConnector from './Options/IndexerOptionsConnector';
|
||||||
import RestrictionsConnector from './Restrictions/RestrictionsConnector';
|
import RestrictionsConnector from './Restrictions/RestrictionsConnector';
|
||||||
|
|
||||||
@@ -23,7 +24,8 @@ class IndexerSettings extends Component {
|
|||||||
|
|
||||||
this.state = {
|
this.state = {
|
||||||
isSaving: false,
|
isSaving: false,
|
||||||
hasPendingChanges: false
|
hasPendingChanges: false,
|
||||||
|
isManageIndexersOpen: false
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -38,6 +40,14 @@ class IndexerSettings extends Component {
|
|||||||
this.setState(payload);
|
this.setState(payload);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
onManageIndexersPress = () => {
|
||||||
|
this.setState({ isManageIndexersOpen: true });
|
||||||
|
};
|
||||||
|
|
||||||
|
onManageIndexersModalClose = () => {
|
||||||
|
this.setState({ isManageIndexersOpen: false });
|
||||||
|
};
|
||||||
|
|
||||||
onSavePress = () => {
|
onSavePress = () => {
|
||||||
if (this._saveCallback) {
|
if (this._saveCallback) {
|
||||||
this._saveCallback();
|
this._saveCallback();
|
||||||
@@ -55,7 +65,8 @@ class IndexerSettings extends Component {
|
|||||||
|
|
||||||
const {
|
const {
|
||||||
isSaving,
|
isSaving,
|
||||||
hasPendingChanges
|
hasPendingChanges,
|
||||||
|
isManageIndexersOpen
|
||||||
} = this.state;
|
} = this.state;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -73,6 +84,12 @@ class IndexerSettings extends Component {
|
|||||||
isSpinning={isTestingAll}
|
isSpinning={isTestingAll}
|
||||||
onPress={dispatchTestAllIndexers}
|
onPress={dispatchTestAllIndexers}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<PageToolbarButton
|
||||||
|
label="Manage Indexers"
|
||||||
|
iconName={icons.MANAGE}
|
||||||
|
onPress={this.onManageIndexersPress}
|
||||||
|
/>
|
||||||
</Fragment>
|
</Fragment>
|
||||||
}
|
}
|
||||||
onSavePress={this.onSavePress}
|
onSavePress={this.onSavePress}
|
||||||
@@ -87,6 +104,11 @@ class IndexerSettings extends Component {
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
<RestrictionsConnector />
|
<RestrictionsConnector />
|
||||||
|
|
||||||
|
<ManageIndexersModal
|
||||||
|
isOpen={isManageIndexersOpen}
|
||||||
|
onModalClose={this.onManageIndexersModalClose}
|
||||||
|
/>
|
||||||
</PageContentBody>
|
</PageContentBody>
|
||||||
</PageContent>
|
</PageContent>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -0,0 +1,26 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import Modal from 'Components/Modal/Modal';
|
||||||
|
import ManageIndexersEditModalContent from './ManageIndexersEditModalContent';
|
||||||
|
|
||||||
|
interface ManageIndexersEditModalProps {
|
||||||
|
isOpen: boolean;
|
||||||
|
indexerIds: number[];
|
||||||
|
onSavePress(payload: object): void;
|
||||||
|
onModalClose(): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
function ManageIndexersEditModal(props: ManageIndexersEditModalProps) {
|
||||||
|
const { isOpen, indexerIds, onSavePress, onModalClose } = props;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Modal isOpen={isOpen} onModalClose={onModalClose}>
|
||||||
|
<ManageIndexersEditModalContent
|
||||||
|
indexerIds={indexerIds}
|
||||||
|
onSavePress={onSavePress}
|
||||||
|
onModalClose={onModalClose}
|
||||||
|
/>
|
||||||
|
</Modal>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default ManageIndexersEditModal;
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
.modalFooter {
|
||||||
|
composes: modalFooter from '~Components/Modal/ModalFooter.css';
|
||||||
|
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
|
||||||
|
.selected {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media only screen and (max-width: $breakpointExtraSmall) {
|
||||||
|
.modalFooter {
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 10px;
|
||||||
|
}
|
||||||
|
}
|
||||||
8
frontend/src/Settings/Indexers/Indexers/Manage/Edit/ManageIndexersEditModalContent.css.d.ts
vendored
Normal file
8
frontend/src/Settings/Indexers/Indexers/Manage/Edit/ManageIndexersEditModalContent.css.d.ts
vendored
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
// This file is automatically generated.
|
||||||
|
// Please do not change this file!
|
||||||
|
interface CssExports {
|
||||||
|
'modalFooter': string;
|
||||||
|
'selected': string;
|
||||||
|
}
|
||||||
|
export const cssExports: CssExports;
|
||||||
|
export default cssExports;
|
||||||
@@ -0,0 +1,178 @@
|
|||||||
|
import React, { useCallback, useState } from 'react';
|
||||||
|
import FormGroup from 'Components/Form/FormGroup';
|
||||||
|
import FormInputGroup from 'Components/Form/FormInputGroup';
|
||||||
|
import FormLabel from 'Components/Form/FormLabel';
|
||||||
|
import Button from 'Components/Link/Button';
|
||||||
|
import ModalBody from 'Components/Modal/ModalBody';
|
||||||
|
import ModalContent from 'Components/Modal/ModalContent';
|
||||||
|
import ModalFooter from 'Components/Modal/ModalFooter';
|
||||||
|
import ModalHeader from 'Components/Modal/ModalHeader';
|
||||||
|
import { inputTypes } from 'Helpers/Props';
|
||||||
|
import translate from 'Utilities/String/translate';
|
||||||
|
import styles from './ManageIndexersEditModalContent.css';
|
||||||
|
|
||||||
|
interface SavePayload {
|
||||||
|
enableRss?: boolean;
|
||||||
|
enableAutomaticSearch?: boolean;
|
||||||
|
enableInteractiveSearch?: boolean;
|
||||||
|
priority?: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ManageIndexersEditModalContentProps {
|
||||||
|
indexerIds: number[];
|
||||||
|
onSavePress(payload: object): void;
|
||||||
|
onModalClose(): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
const NO_CHANGE = 'noChange';
|
||||||
|
|
||||||
|
const enableOptions = [
|
||||||
|
{ key: NO_CHANGE, value: 'No Change', disabled: true },
|
||||||
|
{ key: 'enabled', value: 'Enabled' },
|
||||||
|
{ key: 'disabled', value: 'Disabled' },
|
||||||
|
];
|
||||||
|
|
||||||
|
function ManageIndexersEditModalContent(
|
||||||
|
props: ManageIndexersEditModalContentProps
|
||||||
|
) {
|
||||||
|
const { indexerIds, onSavePress, onModalClose } = props;
|
||||||
|
|
||||||
|
const [enableRss, setEnableRss] = useState(NO_CHANGE);
|
||||||
|
const [enableAutomaticSearch, setEnableAutomaticSearch] = useState(NO_CHANGE);
|
||||||
|
const [enableInteractiveSearch, setEnableInteractiveSearch] =
|
||||||
|
useState(NO_CHANGE);
|
||||||
|
const [priority, setPriority] = useState<null | string | number>(null);
|
||||||
|
|
||||||
|
const save = useCallback(() => {
|
||||||
|
let hasChanges = false;
|
||||||
|
const payload: SavePayload = {};
|
||||||
|
|
||||||
|
if (enableRss !== NO_CHANGE) {
|
||||||
|
hasChanges = true;
|
||||||
|
payload.enableRss = enableRss === 'enabled';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (enableAutomaticSearch !== NO_CHANGE) {
|
||||||
|
hasChanges = true;
|
||||||
|
payload.enableAutomaticSearch = enableAutomaticSearch === 'enabled';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (enableInteractiveSearch !== NO_CHANGE) {
|
||||||
|
hasChanges = true;
|
||||||
|
payload.enableInteractiveSearch = enableInteractiveSearch === 'enabled';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (priority !== null) {
|
||||||
|
hasChanges = true;
|
||||||
|
payload.priority = priority as number;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hasChanges) {
|
||||||
|
onSavePress(payload);
|
||||||
|
}
|
||||||
|
|
||||||
|
onModalClose();
|
||||||
|
}, [
|
||||||
|
enableRss,
|
||||||
|
enableAutomaticSearch,
|
||||||
|
enableInteractiveSearch,
|
||||||
|
priority,
|
||||||
|
onSavePress,
|
||||||
|
onModalClose,
|
||||||
|
]);
|
||||||
|
|
||||||
|
const onInputChange = useCallback(
|
||||||
|
({ name, value }: { name: string; value: string }) => {
|
||||||
|
switch (name) {
|
||||||
|
case 'enableRss':
|
||||||
|
setEnableRss(value);
|
||||||
|
break;
|
||||||
|
case 'enableAutomaticSearch':
|
||||||
|
setEnableAutomaticSearch(value);
|
||||||
|
break;
|
||||||
|
case 'enableInteractiveSearch':
|
||||||
|
setEnableInteractiveSearch(value);
|
||||||
|
break;
|
||||||
|
case 'priority':
|
||||||
|
setPriority(value);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
console.warn('EditIndexersModalContent Unknown Input');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
[]
|
||||||
|
);
|
||||||
|
|
||||||
|
const selectedCount = indexerIds.length;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<ModalContent onModalClose={onModalClose}>
|
||||||
|
<ModalHeader>{translate('EditSelectedIndexers')}</ModalHeader>
|
||||||
|
|
||||||
|
<ModalBody>
|
||||||
|
<FormGroup>
|
||||||
|
<FormLabel>{translate('EnableRss')}</FormLabel>
|
||||||
|
|
||||||
|
<FormInputGroup
|
||||||
|
type={inputTypes.SELECT}
|
||||||
|
name="enableRss"
|
||||||
|
value={enableRss}
|
||||||
|
values={enableOptions}
|
||||||
|
onChange={onInputChange}
|
||||||
|
/>
|
||||||
|
</FormGroup>
|
||||||
|
|
||||||
|
<FormGroup>
|
||||||
|
<FormLabel>{translate('EnableAutomaticSearch')}</FormLabel>
|
||||||
|
|
||||||
|
<FormInputGroup
|
||||||
|
type={inputTypes.SELECT}
|
||||||
|
name="enableAutomaticSearch"
|
||||||
|
value={enableAutomaticSearch}
|
||||||
|
values={enableOptions}
|
||||||
|
onChange={onInputChange}
|
||||||
|
/>
|
||||||
|
</FormGroup>
|
||||||
|
|
||||||
|
<FormGroup>
|
||||||
|
<FormLabel>{translate('EnableInteractiveSearch')}</FormLabel>
|
||||||
|
|
||||||
|
<FormInputGroup
|
||||||
|
type={inputTypes.SELECT}
|
||||||
|
name="enableInteractiveSearch"
|
||||||
|
value={enableInteractiveSearch}
|
||||||
|
values={enableOptions}
|
||||||
|
onChange={onInputChange}
|
||||||
|
/>
|
||||||
|
</FormGroup>
|
||||||
|
|
||||||
|
<FormGroup>
|
||||||
|
<FormLabel>{translate('Priority')}</FormLabel>
|
||||||
|
|
||||||
|
<FormInputGroup
|
||||||
|
type={inputTypes.NUMBER}
|
||||||
|
name="priority"
|
||||||
|
value={priority}
|
||||||
|
min={1}
|
||||||
|
max={50}
|
||||||
|
onChange={onInputChange}
|
||||||
|
/>
|
||||||
|
</FormGroup>
|
||||||
|
</ModalBody>
|
||||||
|
|
||||||
|
<ModalFooter className={styles.modalFooter}>
|
||||||
|
<div className={styles.selected}>
|
||||||
|
{translate('{count} indexers selected', { count: selectedCount })}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<Button onPress={onModalClose}>{translate('Cancel')}</Button>
|
||||||
|
|
||||||
|
<Button onPress={save}>{translate('Apply Changes')}</Button>
|
||||||
|
</div>
|
||||||
|
</ModalFooter>
|
||||||
|
</ModalContent>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default ManageIndexersEditModalContent;
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import Modal from 'Components/Modal/Modal';
|
||||||
|
import ManageIndexersModalContent from './ManageIndexersModalContent';
|
||||||
|
|
||||||
|
interface ManageIndexersModalProps {
|
||||||
|
isOpen: boolean;
|
||||||
|
onModalClose(): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
function ManageIndexersModal(props: ManageIndexersModalProps) {
|
||||||
|
const { isOpen, onModalClose } = props;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Modal isOpen={isOpen} onModalClose={onModalClose}>
|
||||||
|
<ManageIndexersModalContent onModalClose={onModalClose} />
|
||||||
|
</Modal>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default ManageIndexersModal;
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
.leftButtons,
|
||||||
|
.rightButtons {
|
||||||
|
display: flex;
|
||||||
|
flex: 1 0 50%;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rightButtons {
|
||||||
|
justify-content: flex-end;
|
||||||
|
}
|
||||||
|
|
||||||
|
.deleteButton {
|
||||||
|
composes: button from '~Components/Link/Button.css';
|
||||||
|
|
||||||
|
margin-right: 10px;
|
||||||
|
}
|
||||||
9
frontend/src/Settings/Indexers/Indexers/Manage/ManageIndexersModalContent.css.d.ts
vendored
Normal file
9
frontend/src/Settings/Indexers/Indexers/Manage/ManageIndexersModalContent.css.d.ts
vendored
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
// This file is automatically generated.
|
||||||
|
// Please do not change this file!
|
||||||
|
interface CssExports {
|
||||||
|
'deleteButton': string;
|
||||||
|
'leftButtons': string;
|
||||||
|
'rightButtons': string;
|
||||||
|
}
|
||||||
|
export const cssExports: CssExports;
|
||||||
|
export default cssExports;
|
||||||
@@ -0,0 +1,287 @@
|
|||||||
|
import React, { useCallback, useMemo, useState } from 'react';
|
||||||
|
import { useDispatch, useSelector } from 'react-redux';
|
||||||
|
import { IndexerAppState } from 'App/State/SettingsAppState';
|
||||||
|
import Button from 'Components/Link/Button';
|
||||||
|
import SpinnerButton from 'Components/Link/SpinnerButton';
|
||||||
|
import LoadingIndicator from 'Components/Loading/LoadingIndicator';
|
||||||
|
import ConfirmModal from 'Components/Modal/ConfirmModal';
|
||||||
|
import ModalBody from 'Components/Modal/ModalBody';
|
||||||
|
import ModalContent from 'Components/Modal/ModalContent';
|
||||||
|
import ModalFooter from 'Components/Modal/ModalFooter';
|
||||||
|
import ModalHeader from 'Components/Modal/ModalHeader';
|
||||||
|
import Table from 'Components/Table/Table';
|
||||||
|
import TableBody from 'Components/Table/TableBody';
|
||||||
|
import useSelectState from 'Helpers/Hooks/useSelectState';
|
||||||
|
import { kinds } from 'Helpers/Props';
|
||||||
|
import {
|
||||||
|
bulkDeleteIndexers,
|
||||||
|
bulkEditIndexers,
|
||||||
|
} from 'Store/Actions/settingsActions';
|
||||||
|
import createClientSideCollectionSelector from 'Store/Selectors/createClientSideCollectionSelector';
|
||||||
|
import { SelectStateInputProps } from 'typings/props';
|
||||||
|
import getErrorMessage from 'Utilities/Object/getErrorMessage';
|
||||||
|
import getSelectedIds from 'Utilities/Table/getSelectedIds';
|
||||||
|
import ManageIndexersEditModal from './Edit/ManageIndexersEditModal';
|
||||||
|
import ManageIndexersModalRow from './ManageIndexersModalRow';
|
||||||
|
import TagsModal from './Tags/TagsModal';
|
||||||
|
import styles from './ManageIndexersModalContent.css';
|
||||||
|
|
||||||
|
// TODO: This feels janky to do, but not sure of a better way currently
|
||||||
|
type OnSelectedChangeCallback = React.ComponentProps<
|
||||||
|
typeof ManageIndexersModalRow
|
||||||
|
>['onSelectedChange'];
|
||||||
|
|
||||||
|
const COLUMNS = [
|
||||||
|
{
|
||||||
|
name: 'name',
|
||||||
|
label: 'Name',
|
||||||
|
isSortable: true,
|
||||||
|
isVisible: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'implementation',
|
||||||
|
label: 'Implementation',
|
||||||
|
isSortable: true,
|
||||||
|
isVisible: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'enableRss',
|
||||||
|
label: 'Enable RSS',
|
||||||
|
isSortable: true,
|
||||||
|
isVisible: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'enableAutomaticSearch',
|
||||||
|
label: 'Enable Automatic Search',
|
||||||
|
isSortable: true,
|
||||||
|
isVisible: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'enableInteractiveSearch',
|
||||||
|
label: 'Enable Interactive Search',
|
||||||
|
isSortable: true,
|
||||||
|
isVisible: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'priority',
|
||||||
|
label: 'Priority',
|
||||||
|
isSortable: true,
|
||||||
|
isVisible: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'tags',
|
||||||
|
label: 'Tags',
|
||||||
|
isSortable: true,
|
||||||
|
isVisible: true,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
interface ManageIndexersModalContentProps {
|
||||||
|
onModalClose(): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
function ManageIndexersModalContent(props: ManageIndexersModalContentProps) {
|
||||||
|
const { onModalClose } = props;
|
||||||
|
|
||||||
|
const {
|
||||||
|
isFetching,
|
||||||
|
isPopulated,
|
||||||
|
isDeleting,
|
||||||
|
isSaving,
|
||||||
|
error,
|
||||||
|
items,
|
||||||
|
}: IndexerAppState = useSelector(
|
||||||
|
createClientSideCollectionSelector('settings.indexers')
|
||||||
|
);
|
||||||
|
const dispatch = useDispatch();
|
||||||
|
|
||||||
|
const [isDeleteModalOpen, setIsDeleteModalOpen] = useState(false);
|
||||||
|
const [isEditModalOpen, setIsEditModalOpen] = useState(false);
|
||||||
|
const [isTagsModalOpen, setIsTagsModalOpen] = useState(false);
|
||||||
|
const [isSavingTags, setIsSavingTags] = useState(false);
|
||||||
|
|
||||||
|
const [selectState, setSelectState] = useSelectState();
|
||||||
|
|
||||||
|
const { allSelected, allUnselected, selectedState } = selectState;
|
||||||
|
|
||||||
|
const selectedIds: number[] = useMemo(() => {
|
||||||
|
return getSelectedIds(selectedState);
|
||||||
|
}, [selectedState]);
|
||||||
|
|
||||||
|
const selectedCount = selectedIds.length;
|
||||||
|
|
||||||
|
const onDeletePress = useCallback(() => {
|
||||||
|
setIsDeleteModalOpen(true);
|
||||||
|
}, [setIsDeleteModalOpen]);
|
||||||
|
|
||||||
|
const onDeleteModalClose = useCallback(() => {
|
||||||
|
setIsDeleteModalOpen(false);
|
||||||
|
}, [setIsDeleteModalOpen]);
|
||||||
|
|
||||||
|
const onEditPress = useCallback(() => {
|
||||||
|
setIsEditModalOpen(true);
|
||||||
|
}, [setIsEditModalOpen]);
|
||||||
|
|
||||||
|
const onEditModalClose = useCallback(() => {
|
||||||
|
setIsEditModalOpen(false);
|
||||||
|
}, [setIsEditModalOpen]);
|
||||||
|
|
||||||
|
const onConfirmDelete = useCallback(() => {
|
||||||
|
dispatch(bulkDeleteIndexers({ ids: selectedIds }));
|
||||||
|
setIsDeleteModalOpen(false);
|
||||||
|
}, [selectedIds, dispatch]);
|
||||||
|
|
||||||
|
const onSavePress = useCallback(
|
||||||
|
(payload: object) => {
|
||||||
|
setIsEditModalOpen(false);
|
||||||
|
|
||||||
|
dispatch(
|
||||||
|
bulkEditIndexers({
|
||||||
|
ids: selectedIds,
|
||||||
|
...payload,
|
||||||
|
})
|
||||||
|
);
|
||||||
|
},
|
||||||
|
[selectedIds, dispatch]
|
||||||
|
);
|
||||||
|
|
||||||
|
const onTagsPress = useCallback(() => {
|
||||||
|
setIsTagsModalOpen(true);
|
||||||
|
}, [setIsTagsModalOpen]);
|
||||||
|
|
||||||
|
const onTagsModalClose = useCallback(() => {
|
||||||
|
setIsTagsModalOpen(false);
|
||||||
|
}, [setIsTagsModalOpen]);
|
||||||
|
|
||||||
|
const onApplyTagsPress = useCallback(
|
||||||
|
(tags: number[], applyTags: string) => {
|
||||||
|
setIsSavingTags(true);
|
||||||
|
setIsTagsModalOpen(false);
|
||||||
|
|
||||||
|
dispatch(
|
||||||
|
bulkEditIndexers({
|
||||||
|
ids: selectedIds,
|
||||||
|
tags,
|
||||||
|
applyTags,
|
||||||
|
})
|
||||||
|
);
|
||||||
|
},
|
||||||
|
[selectedIds, dispatch]
|
||||||
|
);
|
||||||
|
|
||||||
|
const onSelectAllChange = useCallback(
|
||||||
|
({ value }: SelectStateInputProps) => {
|
||||||
|
setSelectState({ type: value ? 'selectAll' : 'unselectAll', items });
|
||||||
|
},
|
||||||
|
[items, setSelectState]
|
||||||
|
);
|
||||||
|
|
||||||
|
const onSelectedChange = useCallback<OnSelectedChangeCallback>(
|
||||||
|
({ id, value, shiftKey = false }) => {
|
||||||
|
setSelectState({
|
||||||
|
type: 'toggleSelected',
|
||||||
|
items,
|
||||||
|
id,
|
||||||
|
isSelected: value,
|
||||||
|
shiftKey,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
[items, setSelectState]
|
||||||
|
);
|
||||||
|
|
||||||
|
const errorMessage = getErrorMessage(error, 'Unable to load import lists.');
|
||||||
|
const anySelected = selectedCount > 0;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<ModalContent onModalClose={onModalClose}>
|
||||||
|
<ModalHeader>Manage Import Lists</ModalHeader>
|
||||||
|
<ModalBody>
|
||||||
|
{isFetching ? <LoadingIndicator /> : null}
|
||||||
|
|
||||||
|
{error ? <div>{errorMessage}</div> : null}
|
||||||
|
|
||||||
|
{isPopulated && !!items.length && !isFetching && !isFetching ? (
|
||||||
|
<Table
|
||||||
|
columns={COLUMNS}
|
||||||
|
horizontalScroll={true}
|
||||||
|
selectAll={true}
|
||||||
|
allSelected={allSelected}
|
||||||
|
allUnselected={allUnselected}
|
||||||
|
onSelectAllChange={onSelectAllChange}
|
||||||
|
>
|
||||||
|
<TableBody>
|
||||||
|
{items.map((item) => {
|
||||||
|
return (
|
||||||
|
<ManageIndexersModalRow
|
||||||
|
key={item.id}
|
||||||
|
isSelected={selectedState[item.id]}
|
||||||
|
{...item}
|
||||||
|
columns={COLUMNS}
|
||||||
|
onSelectedChange={onSelectedChange}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</TableBody>
|
||||||
|
</Table>
|
||||||
|
) : null}
|
||||||
|
</ModalBody>
|
||||||
|
|
||||||
|
<ModalFooter>
|
||||||
|
<div className={styles.leftButtons}>
|
||||||
|
<SpinnerButton
|
||||||
|
kind={kinds.DANGER}
|
||||||
|
isSpinning={isDeleting}
|
||||||
|
isDisabled={!anySelected}
|
||||||
|
onPress={onDeletePress}
|
||||||
|
>
|
||||||
|
Delete
|
||||||
|
</SpinnerButton>
|
||||||
|
|
||||||
|
<SpinnerButton
|
||||||
|
isSpinning={isSaving}
|
||||||
|
isDisabled={!anySelected}
|
||||||
|
onPress={onEditPress}
|
||||||
|
>
|
||||||
|
Edit
|
||||||
|
</SpinnerButton>
|
||||||
|
|
||||||
|
<SpinnerButton
|
||||||
|
isSpinning={isSaving && isSavingTags}
|
||||||
|
isDisabled={!anySelected}
|
||||||
|
onPress={onTagsPress}
|
||||||
|
>
|
||||||
|
Set Tags
|
||||||
|
</SpinnerButton>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<Button onPress={onModalClose}>Close</Button>
|
||||||
|
</ModalFooter>
|
||||||
|
|
||||||
|
<ManageIndexersEditModal
|
||||||
|
isOpen={isEditModalOpen}
|
||||||
|
onModalClose={onEditModalClose}
|
||||||
|
onSavePress={onSavePress}
|
||||||
|
indexerIds={selectedIds}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<TagsModal
|
||||||
|
isOpen={isTagsModalOpen}
|
||||||
|
ids={selectedIds}
|
||||||
|
onApplyTagsPress={onApplyTagsPress}
|
||||||
|
onModalClose={onTagsModalClose}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<ConfirmModal
|
||||||
|
isOpen={isDeleteModalOpen}
|
||||||
|
kind={kinds.DANGER}
|
||||||
|
title="Delete Import List(s)"
|
||||||
|
message={`Are you sure you want to delete ${selectedIds.length} import list(s)?`}
|
||||||
|
confirmLabel="Delete"
|
||||||
|
onConfirm={onConfirmDelete}
|
||||||
|
onCancel={onDeleteModalClose}
|
||||||
|
/>
|
||||||
|
</ModalContent>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default ManageIndexersModalContent;
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
.name,
|
||||||
|
.tags,
|
||||||
|
.enableRss,
|
||||||
|
.enableAutomaticSearch,
|
||||||
|
.enableInteractiveSearch,
|
||||||
|
.priority,
|
||||||
|
.implementation {
|
||||||
|
composes: cell from '~Components/Table/Cells/TableRowCell.css';
|
||||||
|
|
||||||
|
word-break: break-all;
|
||||||
|
}
|
||||||
13
frontend/src/Settings/Indexers/Indexers/Manage/ManageIndexersModalRow.css.d.ts
vendored
Normal file
13
frontend/src/Settings/Indexers/Indexers/Manage/ManageIndexersModalRow.css.d.ts
vendored
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
// This file is automatically generated.
|
||||||
|
// Please do not change this file!
|
||||||
|
interface CssExports {
|
||||||
|
'enableAutomaticSearch': string;
|
||||||
|
'enableInteractiveSearch': string;
|
||||||
|
'enableRss': string;
|
||||||
|
'implementation': string;
|
||||||
|
'name': string;
|
||||||
|
'priority': string;
|
||||||
|
'tags': string;
|
||||||
|
}
|
||||||
|
export const cssExports: CssExports;
|
||||||
|
export default cssExports;
|
||||||
@@ -0,0 +1,82 @@
|
|||||||
|
import React, { useCallback } from 'react';
|
||||||
|
import TableRowCell from 'Components/Table/Cells/TableRowCell';
|
||||||
|
import TableSelectCell from 'Components/Table/Cells/TableSelectCell';
|
||||||
|
import Column from 'Components/Table/Column';
|
||||||
|
import TableRow from 'Components/Table/TableRow';
|
||||||
|
import TagListConnector from 'Components/TagListConnector';
|
||||||
|
import { SelectStateInputProps } from 'typings/props';
|
||||||
|
import styles from './ManageIndexersModalRow.css';
|
||||||
|
|
||||||
|
interface ManageIndexersModalRowProps {
|
||||||
|
id: number;
|
||||||
|
name: string;
|
||||||
|
enableRss: boolean;
|
||||||
|
enableAutomaticSearch: boolean;
|
||||||
|
enableInteractiveSearch: boolean;
|
||||||
|
priority: number;
|
||||||
|
implementation: string;
|
||||||
|
tags: number[];
|
||||||
|
columns: Column[];
|
||||||
|
isSelected?: boolean;
|
||||||
|
onSelectedChange(result: SelectStateInputProps): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
function ManageIndexersModalRow(props: ManageIndexersModalRowProps) {
|
||||||
|
const {
|
||||||
|
id,
|
||||||
|
isSelected,
|
||||||
|
name,
|
||||||
|
enableRss,
|
||||||
|
enableAutomaticSearch,
|
||||||
|
enableInteractiveSearch,
|
||||||
|
priority,
|
||||||
|
implementation,
|
||||||
|
tags,
|
||||||
|
onSelectedChange,
|
||||||
|
} = props;
|
||||||
|
|
||||||
|
const onSelectedChangeWrapper = useCallback(
|
||||||
|
(result: SelectStateInputProps) => {
|
||||||
|
onSelectedChange({
|
||||||
|
...result,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
[onSelectedChange]
|
||||||
|
);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<TableRow>
|
||||||
|
<TableSelectCell
|
||||||
|
id={id}
|
||||||
|
isSelected={isSelected}
|
||||||
|
onSelectedChange={onSelectedChangeWrapper}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<TableRowCell className={styles.name}>{name}</TableRowCell>
|
||||||
|
|
||||||
|
<TableRowCell className={styles.implementation}>
|
||||||
|
{implementation}
|
||||||
|
</TableRowCell>
|
||||||
|
|
||||||
|
<TableRowCell className={styles.enableRss}>
|
||||||
|
{enableRss ? 'Yes' : 'No'}
|
||||||
|
</TableRowCell>
|
||||||
|
|
||||||
|
<TableRowCell className={styles.enableAutomaticSearch}>
|
||||||
|
{enableAutomaticSearch ? 'Yes' : 'No'}
|
||||||
|
</TableRowCell>
|
||||||
|
|
||||||
|
<TableRowCell className={styles.enableInteractiveSearch}>
|
||||||
|
{enableInteractiveSearch ? 'Yes' : 'No'}
|
||||||
|
</TableRowCell>
|
||||||
|
|
||||||
|
<TableRowCell className={styles.priority}>{priority}</TableRowCell>
|
||||||
|
|
||||||
|
<TableRowCell className={styles.tags}>
|
||||||
|
<TagListConnector tags={tags} />
|
||||||
|
</TableRowCell>
|
||||||
|
</TableRow>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default ManageIndexersModalRow;
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import Modal from 'Components/Modal/Modal';
|
||||||
|
import TagsModalContent from './TagsModalContent';
|
||||||
|
|
||||||
|
interface TagsModalProps {
|
||||||
|
isOpen: boolean;
|
||||||
|
ids: number[];
|
||||||
|
onApplyTagsPress: (tags: number[], applyTags: string) => void;
|
||||||
|
onModalClose: () => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
function TagsModal(props: TagsModalProps) {
|
||||||
|
const { isOpen, onModalClose, ...otherProps } = props;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Modal isOpen={isOpen} onModalClose={onModalClose}>
|
||||||
|
<TagsModalContent {...otherProps} onModalClose={onModalClose} />
|
||||||
|
</Modal>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default TagsModal;
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
.renameIcon {
|
||||||
|
margin-left: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.message {
|
||||||
|
margin-top: 20px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.result {
|
||||||
|
padding-top: 4px;
|
||||||
|
}
|
||||||
9
frontend/src/Settings/Indexers/Indexers/Manage/Tags/TagsModalContent.css.d.ts
vendored
Normal file
9
frontend/src/Settings/Indexers/Indexers/Manage/Tags/TagsModalContent.css.d.ts
vendored
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
// This file is automatically generated.
|
||||||
|
// Please do not change this file!
|
||||||
|
interface CssExports {
|
||||||
|
'message': string;
|
||||||
|
'renameIcon': string;
|
||||||
|
'result': string;
|
||||||
|
}
|
||||||
|
export const cssExports: CssExports;
|
||||||
|
export default cssExports;
|
||||||
@@ -0,0 +1,178 @@
|
|||||||
|
import { uniq } from 'lodash';
|
||||||
|
import React, { useCallback, useMemo, useState } from 'react';
|
||||||
|
import { useSelector } from 'react-redux';
|
||||||
|
import AppState from 'App/State/AppState';
|
||||||
|
import { IndexerAppState } from 'App/State/SettingsAppState';
|
||||||
|
import { Tag } from 'App/State/TagsAppState';
|
||||||
|
import Form from 'Components/Form/Form';
|
||||||
|
import FormGroup from 'Components/Form/FormGroup';
|
||||||
|
import FormInputGroup from 'Components/Form/FormInputGroup';
|
||||||
|
import FormLabel from 'Components/Form/FormLabel';
|
||||||
|
import Label from 'Components/Label';
|
||||||
|
import Button from 'Components/Link/Button';
|
||||||
|
import ModalBody from 'Components/Modal/ModalBody';
|
||||||
|
import ModalContent from 'Components/Modal/ModalContent';
|
||||||
|
import ModalFooter from 'Components/Modal/ModalFooter';
|
||||||
|
import ModalHeader from 'Components/Modal/ModalHeader';
|
||||||
|
import { inputTypes, kinds, sizes } from 'Helpers/Props';
|
||||||
|
import createTagsSelector from 'Store/Selectors/createTagsSelector';
|
||||||
|
import Indexer from 'typings/Indexer';
|
||||||
|
import styles from './TagsModalContent.css';
|
||||||
|
|
||||||
|
interface TagsModalContentProps {
|
||||||
|
ids: number[];
|
||||||
|
onApplyTagsPress: (tags: number[], applyTags: string) => void;
|
||||||
|
onModalClose: () => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
function TagsModalContent(props: TagsModalContentProps) {
|
||||||
|
const { ids, onModalClose, onApplyTagsPress } = props;
|
||||||
|
|
||||||
|
const allIndexers: IndexerAppState = useSelector(
|
||||||
|
(state: AppState) => state.settings.indexers
|
||||||
|
);
|
||||||
|
const tagList: Tag[] = useSelector(createTagsSelector());
|
||||||
|
|
||||||
|
const [tags, setTags] = useState<number[]>([]);
|
||||||
|
const [applyTags, setApplyTags] = useState('add');
|
||||||
|
|
||||||
|
const seriesTags = useMemo(() => {
|
||||||
|
const tags = ids.reduce((acc: number[], id) => {
|
||||||
|
const s = allIndexers.items.find((s: Indexer) => s.id === id);
|
||||||
|
|
||||||
|
if (s) {
|
||||||
|
acc.push(...s.tags);
|
||||||
|
}
|
||||||
|
|
||||||
|
return acc;
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
return uniq(tags);
|
||||||
|
}, [ids, allIndexers]);
|
||||||
|
|
||||||
|
const onTagsChange = useCallback(
|
||||||
|
({ value }: { value: number[] }) => {
|
||||||
|
setTags(value);
|
||||||
|
},
|
||||||
|
[setTags]
|
||||||
|
);
|
||||||
|
|
||||||
|
const onApplyTagsChange = useCallback(
|
||||||
|
({ value }: { value: string }) => {
|
||||||
|
setApplyTags(value);
|
||||||
|
},
|
||||||
|
[setApplyTags]
|
||||||
|
);
|
||||||
|
|
||||||
|
const onApplyPress = useCallback(() => {
|
||||||
|
onApplyTagsPress(tags, applyTags);
|
||||||
|
}, [tags, applyTags, onApplyTagsPress]);
|
||||||
|
|
||||||
|
const applyTagsOptions = [
|
||||||
|
{ key: 'add', value: 'Add' },
|
||||||
|
{ key: 'remove', value: 'Remove' },
|
||||||
|
{ key: 'replace', value: 'Replace' },
|
||||||
|
];
|
||||||
|
|
||||||
|
return (
|
||||||
|
<ModalContent onModalClose={onModalClose}>
|
||||||
|
<ModalHeader>Tags</ModalHeader>
|
||||||
|
|
||||||
|
<ModalBody>
|
||||||
|
<Form>
|
||||||
|
<FormGroup>
|
||||||
|
<FormLabel>Tags</FormLabel>
|
||||||
|
|
||||||
|
<FormInputGroup
|
||||||
|
type={inputTypes.TAG}
|
||||||
|
name="tags"
|
||||||
|
value={tags}
|
||||||
|
onChange={onTagsChange}
|
||||||
|
/>
|
||||||
|
</FormGroup>
|
||||||
|
|
||||||
|
<FormGroup>
|
||||||
|
<FormLabel>Apply Tags</FormLabel>
|
||||||
|
|
||||||
|
<FormInputGroup
|
||||||
|
type={inputTypes.SELECT}
|
||||||
|
name="applyTags"
|
||||||
|
value={applyTags}
|
||||||
|
values={applyTagsOptions}
|
||||||
|
helpTexts={[
|
||||||
|
'How to apply tags to the selected indexer(s)',
|
||||||
|
'Add: Add the tags the existing list of tags',
|
||||||
|
'Remove: Remove the entered tags',
|
||||||
|
'Replace: Replace the tags with the entered tags (enter no tags to clear all tags)',
|
||||||
|
]}
|
||||||
|
onChange={onApplyTagsChange}
|
||||||
|
/>
|
||||||
|
</FormGroup>
|
||||||
|
|
||||||
|
<FormGroup>
|
||||||
|
<FormLabel>Result</FormLabel>
|
||||||
|
|
||||||
|
<div className={styles.result}>
|
||||||
|
{seriesTags.map((id) => {
|
||||||
|
const tag = tagList.find((t) => t.id === id);
|
||||||
|
|
||||||
|
if (!tag) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const removeTag =
|
||||||
|
(applyTags === 'remove' && tags.indexOf(id) > -1) ||
|
||||||
|
(applyTags === 'replace' && tags.indexOf(id) === -1);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Label
|
||||||
|
key={tag.id}
|
||||||
|
title={removeTag ? 'Removing tag' : 'Existing tag'}
|
||||||
|
kind={removeTag ? kinds.INVERSE : kinds.INFO}
|
||||||
|
size={sizes.LARGE}
|
||||||
|
>
|
||||||
|
{tag.label}
|
||||||
|
</Label>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
|
||||||
|
{(applyTags === 'add' || applyTags === 'replace') &&
|
||||||
|
tags.map((id) => {
|
||||||
|
const tag = tagList.find((t) => t.id === id);
|
||||||
|
|
||||||
|
if (!tag) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (seriesTags.indexOf(id) > -1) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Label
|
||||||
|
key={tag.id}
|
||||||
|
title={'Adding tag'}
|
||||||
|
kind={kinds.SUCCESS}
|
||||||
|
size={sizes.LARGE}
|
||||||
|
>
|
||||||
|
{tag.label}
|
||||||
|
</Label>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
</FormGroup>
|
||||||
|
</Form>
|
||||||
|
</ModalBody>
|
||||||
|
|
||||||
|
<ModalFooter>
|
||||||
|
<Button onPress={onModalClose}>Cancel</Button>
|
||||||
|
|
||||||
|
<Button kind={kinds.PRIMARY} onPress={onApplyPress}>
|
||||||
|
Apply
|
||||||
|
</Button>
|
||||||
|
</ModalFooter>
|
||||||
|
</ModalContent>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default TagsModalContent;
|
||||||
@@ -1,12 +1,13 @@
|
|||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import Alert from 'Components/Alert';
|
||||||
import FieldSet from 'Components/FieldSet';
|
import FieldSet from 'Components/FieldSet';
|
||||||
import Form from 'Components/Form/Form';
|
import Form from 'Components/Form/Form';
|
||||||
import FormGroup from 'Components/Form/FormGroup';
|
import FormGroup from 'Components/Form/FormGroup';
|
||||||
import FormInputGroup from 'Components/Form/FormInputGroup';
|
import FormInputGroup from 'Components/Form/FormInputGroup';
|
||||||
import FormLabel from 'Components/Form/FormLabel';
|
import FormLabel from 'Components/Form/FormLabel';
|
||||||
import LoadingIndicator from 'Components/Loading/LoadingIndicator';
|
import LoadingIndicator from 'Components/Loading/LoadingIndicator';
|
||||||
import { inputTypes } from 'Helpers/Props';
|
import { inputTypes, kinds } from 'Helpers/Props';
|
||||||
import translate from 'Utilities/String/translate';
|
import translate from 'Utilities/String/translate';
|
||||||
|
|
||||||
function IndexerOptions(props) {
|
function IndexerOptions(props) {
|
||||||
@@ -28,9 +29,9 @@ function IndexerOptions(props) {
|
|||||||
|
|
||||||
{
|
{
|
||||||
!isFetching && error &&
|
!isFetching && error &&
|
||||||
<div>
|
<Alert kind={kinds.DANGER}>
|
||||||
{translate('UnableToLoadIndexerOptions')}
|
{translate('UnableToLoadIndexerOptions')}
|
||||||
</div>
|
</Alert>
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import React, { Component } from 'react';
|
import React, { Component } from 'react';
|
||||||
|
import Alert from 'Components/Alert';
|
||||||
import FieldSet from 'Components/FieldSet';
|
import FieldSet from 'Components/FieldSet';
|
||||||
import Form from 'Components/Form/Form';
|
import Form from 'Components/Form/Form';
|
||||||
import FormGroup from 'Components/Form/FormGroup';
|
import FormGroup from 'Components/Form/FormGroup';
|
||||||
@@ -8,7 +9,7 @@ import FormLabel from 'Components/Form/FormLabel';
|
|||||||
import LoadingIndicator from 'Components/Loading/LoadingIndicator';
|
import LoadingIndicator from 'Components/Loading/LoadingIndicator';
|
||||||
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 { inputTypes, sizes } from 'Helpers/Props';
|
import { inputTypes, kinds, sizes } from 'Helpers/Props';
|
||||||
import RootFoldersConnector from 'RootFolder/RootFoldersConnector';
|
import RootFoldersConnector from 'RootFolder/RootFoldersConnector';
|
||||||
import SettingsToolbarConnector from 'Settings/SettingsToolbarConnector';
|
import SettingsToolbarConnector from 'Settings/SettingsToolbarConnector';
|
||||||
import translate from 'Utilities/String/translate';
|
import translate from 'Utilities/String/translate';
|
||||||
@@ -63,29 +64,29 @@ class MediaManagement extends Component {
|
|||||||
<NamingConnector />
|
<NamingConnector />
|
||||||
|
|
||||||
{
|
{
|
||||||
isFetching &&
|
isFetching ?
|
||||||
<FieldSet legend={translate('NamingSettings')}>
|
<FieldSet legend={translate('NamingSettings')}>
|
||||||
<LoadingIndicator />
|
<LoadingIndicator />
|
||||||
</FieldSet>
|
</FieldSet> : null
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
!isFetching && error &&
|
!isFetching && error ?
|
||||||
<FieldSet legend={translate('NamingSettings')}>
|
<FieldSet legend={translate('NamingSettings')}>
|
||||||
<div>
|
<Alert kind={kinds.DANGER}>
|
||||||
{translate('UnableToLoadMediaManagementSettings')}
|
{translate('UnableToLoadMediaManagementSettings')}
|
||||||
</div>
|
</Alert>
|
||||||
</FieldSet>
|
</FieldSet> : null
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
hasSettings && !isFetching && !error &&
|
hasSettings && !isFetching && !error ?
|
||||||
<Form
|
<Form
|
||||||
id="mediaManagementSettings"
|
id="mediaManagementSettings"
|
||||||
{...otherProps}
|
{...otherProps}
|
||||||
>
|
>
|
||||||
{
|
{
|
||||||
advancedSettings &&
|
advancedSettings ?
|
||||||
<FieldSet legend={translate('Folders')}>
|
<FieldSet legend={translate('Folders')}>
|
||||||
<FormGroup
|
<FormGroup
|
||||||
advancedSettings={advancedSettings}
|
advancedSettings={advancedSettings}
|
||||||
@@ -120,11 +121,11 @@ class MediaManagement extends Component {
|
|||||||
{...settings.deleteEmptyFolders}
|
{...settings.deleteEmptyFolders}
|
||||||
/>
|
/>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
</FieldSet>
|
</FieldSet> : null
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
advancedSettings &&
|
advancedSettings ?
|
||||||
<FieldSet
|
<FieldSet
|
||||||
legend={translate('Importing')}
|
legend={translate('Importing')}
|
||||||
>
|
>
|
||||||
@@ -181,6 +182,41 @@ class MediaManagement extends Component {
|
|||||||
/>
|
/>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
|
|
||||||
|
<FormGroup
|
||||||
|
advancedSettings={advancedSettings}
|
||||||
|
isAdvanced={true}
|
||||||
|
size={sizes.MEDIUM}
|
||||||
|
>
|
||||||
|
<FormLabel>{translate('ImportUsingScript')}</FormLabel>
|
||||||
|
|
||||||
|
<FormInputGroup
|
||||||
|
type={inputTypes.CHECK}
|
||||||
|
name="useScriptImport"
|
||||||
|
helpText={translate('UseScriptImportHelpText')}
|
||||||
|
onChange={onInputChange}
|
||||||
|
{...settings.useScriptImport}
|
||||||
|
/>
|
||||||
|
</FormGroup>
|
||||||
|
|
||||||
|
{
|
||||||
|
settings.useScriptImport.value ?
|
||||||
|
<FormGroup
|
||||||
|
advancedSettings={advancedSettings}
|
||||||
|
isAdvanced={true}
|
||||||
|
>
|
||||||
|
<FormLabel>{translate('ImportScriptPath')}</FormLabel>
|
||||||
|
|
||||||
|
<FormInputGroup
|
||||||
|
type={inputTypes.PATH}
|
||||||
|
includeFiles={true}
|
||||||
|
name="scriptImportPath"
|
||||||
|
helpText={translate('ScriptImportPathHelpText')}
|
||||||
|
onChange={onInputChange}
|
||||||
|
{...settings.scriptImportPath}
|
||||||
|
/>
|
||||||
|
</FormGroup> : null
|
||||||
|
}
|
||||||
|
|
||||||
<FormGroup size={sizes.MEDIUM}>
|
<FormGroup size={sizes.MEDIUM}>
|
||||||
<FormLabel>{translate('ImportExtraFiles')}</FormLabel>
|
<FormLabel>{translate('ImportExtraFiles')}</FormLabel>
|
||||||
|
|
||||||
@@ -194,7 +230,7 @@ class MediaManagement extends Component {
|
|||||||
</FormGroup>
|
</FormGroup>
|
||||||
|
|
||||||
{
|
{
|
||||||
settings.importExtraFiles.value &&
|
settings.importExtraFiles.value ?
|
||||||
<FormGroup
|
<FormGroup
|
||||||
advancedSettings={advancedSettings}
|
advancedSettings={advancedSettings}
|
||||||
isAdvanced={true}
|
isAdvanced={true}
|
||||||
@@ -211,9 +247,9 @@ class MediaManagement extends Component {
|
|||||||
onChange={onInputChange}
|
onChange={onInputChange}
|
||||||
{...settings.extraFileExtensions}
|
{...settings.extraFileExtensions}
|
||||||
/>
|
/>
|
||||||
</FormGroup>
|
</FormGroup> : null
|
||||||
}
|
}
|
||||||
</FieldSet>
|
</FieldSet> : null
|
||||||
}
|
}
|
||||||
|
|
||||||
<FieldSet
|
<FieldSet
|
||||||
@@ -339,7 +375,7 @@ class MediaManagement extends Component {
|
|||||||
</FieldSet>
|
</FieldSet>
|
||||||
|
|
||||||
{
|
{
|
||||||
advancedSettings && !isWindows &&
|
advancedSettings && !isWindows ?
|
||||||
<FieldSet
|
<FieldSet
|
||||||
legend={translate('Permissions')}
|
legend={translate('Permissions')}
|
||||||
>
|
>
|
||||||
@@ -392,9 +428,9 @@ class MediaManagement extends Component {
|
|||||||
{...settings.chownGroup}
|
{...settings.chownGroup}
|
||||||
/>
|
/>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
</FieldSet>
|
</FieldSet> : null
|
||||||
}
|
}
|
||||||
</Form>
|
</Form> : null
|
||||||
}
|
}
|
||||||
|
|
||||||
<FieldSet legend={translate('RootFolders')}>
|
<FieldSet legend={translate('RootFolders')}>
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import React, { Component } from 'react';
|
import React, { Component } from 'react';
|
||||||
|
import Alert from 'Components/Alert';
|
||||||
import FieldSet from 'Components/FieldSet';
|
import FieldSet from 'Components/FieldSet';
|
||||||
import Form from 'Components/Form/Form';
|
import Form from 'Components/Form/Form';
|
||||||
import FormGroup from 'Components/Form/FormGroup';
|
import FormGroup from 'Components/Form/FormGroup';
|
||||||
@@ -7,7 +8,7 @@ import FormInputButton from 'Components/Form/FormInputButton';
|
|||||||
import FormInputGroup from 'Components/Form/FormInputGroup';
|
import FormInputGroup from 'Components/Form/FormInputGroup';
|
||||||
import FormLabel from 'Components/Form/FormLabel';
|
import FormLabel from 'Components/Form/FormLabel';
|
||||||
import LoadingIndicator from 'Components/Loading/LoadingIndicator';
|
import LoadingIndicator from 'Components/Loading/LoadingIndicator';
|
||||||
import { inputTypes, sizes } from 'Helpers/Props';
|
import { inputTypes, kinds, sizes } from 'Helpers/Props';
|
||||||
import translate from 'Utilities/String/translate';
|
import translate from 'Utilities/String/translate';
|
||||||
import NamingModal from './NamingModal';
|
import NamingModal from './NamingModal';
|
||||||
import styles from './Naming.css';
|
import styles from './Naming.css';
|
||||||
@@ -110,9 +111,9 @@ class Naming extends Component {
|
|||||||
|
|
||||||
{
|
{
|
||||||
!isFetching && error &&
|
!isFetching && error &&
|
||||||
<div>
|
<Alert kind={kinds.DANGER}>
|
||||||
{translate('UnableToLoadNamingSettings')}
|
{translate('UnableToLoadNamingSettings')}
|
||||||
</div>
|
</Alert>
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,8 +6,9 @@ import FormGroup from 'Components/Form/FormGroup';
|
|||||||
import FormInputGroup from 'Components/Form/FormInputGroup';
|
import FormInputGroup from 'Components/Form/FormInputGroup';
|
||||||
import FormLabel from 'Components/Form/FormLabel';
|
import FormLabel from 'Components/Form/FormLabel';
|
||||||
import LoadingIndicator from 'Components/Loading/LoadingIndicator';
|
import LoadingIndicator from 'Components/Loading/LoadingIndicator';
|
||||||
import { inputTypes } from 'Helpers/Props';
|
import { inputTypes, kinds } from 'Helpers/Props';
|
||||||
import translate from 'Utilities/String/translate';
|
import translate from 'Utilities/String/translate';
|
||||||
|
import Alert from '../../../Components/Alert';
|
||||||
|
|
||||||
// Note: Do Not Translate Certification Countries
|
// Note: Do Not Translate Certification Countries
|
||||||
|
|
||||||
@@ -43,9 +44,9 @@ function MetadataOptions(props) {
|
|||||||
|
|
||||||
{
|
{
|
||||||
!isFetching && error &&
|
!isFetching && error &&
|
||||||
<div>
|
<Alert kind={kinds.DANGER}>
|
||||||
{translate('UnableToLoadIndexerOptions')}
|
{translate('UnableToLoadIndexerOptions')}
|
||||||
</div>
|
</Alert>
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -141,7 +141,7 @@ class DelayProfile extends Component {
|
|||||||
isOpen={this.state.isDeleteDelayProfileModalOpen}
|
isOpen={this.state.isDeleteDelayProfileModalOpen}
|
||||||
kind={kinds.DANGER}
|
kind={kinds.DANGER}
|
||||||
title={translate('DeleteDelayProfile')}
|
title={translate('DeleteDelayProfile')}
|
||||||
message={translate('AreYouSureYouWantToDeleteThisDelayProfile')}
|
message={translate('DeleteDelayProfileMessageText')}
|
||||||
confirmLabel={translate('Delete')}
|
confirmLabel={translate('Delete')}
|
||||||
onConfirm={this.onConfirmDeleteDelayProfile}
|
onConfirm={this.onConfirmDeleteDelayProfile}
|
||||||
onCancel={this.onDeleteDelayProfileModalClose}
|
onCancel={this.onDeleteDelayProfileModalClose}
|
||||||
|
|||||||
@@ -60,17 +60,19 @@ class ResetQualityDefinitionsModalContent extends Component {
|
|||||||
|
|
||||||
<ModalBody>
|
<ModalBody>
|
||||||
<div className={styles.messageContainer}>
|
<div className={styles.messageContainer}>
|
||||||
{translate('AreYouSureYouWantToResetQualityDefinitions')}
|
{translate('ResetQualityDefinitionsMessageText')}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<FormGroup>
|
<FormGroup>
|
||||||
<FormLabel>{translate('ResetTitles')}</FormLabel>
|
<FormLabel>
|
||||||
|
{translate('ResetTitles')}
|
||||||
|
</FormLabel>
|
||||||
|
|
||||||
<FormInputGroup
|
<FormInputGroup
|
||||||
type={inputTypes.CHECK}
|
type={inputTypes.CHECK}
|
||||||
name="resetDefinitionTitles"
|
name="resetDefinitionTitles"
|
||||||
value={resetDefinitionTitles}
|
value={resetDefinitionTitles}
|
||||||
helpText={translate('ResetTitlesHelpText')}
|
helpText={translate('ResetDefinitionTitlesHelpText')}
|
||||||
onChange={this.onResetDefinitionTitlesChange}
|
onChange={this.onResetDefinitionTitlesChange}
|
||||||
/>
|
/>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import React, { Component } from 'react';
|
import React, { Component } from 'react';
|
||||||
|
import Alert from 'Components/Alert';
|
||||||
import FieldSet from 'Components/FieldSet';
|
import FieldSet from 'Components/FieldSet';
|
||||||
import Form from 'Components/Form/Form';
|
import Form from 'Components/Form/Form';
|
||||||
import FormGroup from 'Components/Form/FormGroup';
|
import FormGroup from 'Components/Form/FormGroup';
|
||||||
@@ -8,7 +9,7 @@ import FormLabel from 'Components/Form/FormLabel';
|
|||||||
import LoadingIndicator from 'Components/Loading/LoadingIndicator';
|
import LoadingIndicator from 'Components/Loading/LoadingIndicator';
|
||||||
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 { inputTypes } from 'Helpers/Props';
|
import { inputTypes, kinds } from 'Helpers/Props';
|
||||||
import SettingsToolbarConnector from 'Settings/SettingsToolbarConnector';
|
import SettingsToolbarConnector from 'Settings/SettingsToolbarConnector';
|
||||||
import themes from 'Styles/Themes';
|
import themes from 'Styles/Themes';
|
||||||
import titleCase from 'Utilities/String/titleCase';
|
import titleCase from 'Utilities/String/titleCase';
|
||||||
@@ -87,9 +88,9 @@ class UISettings extends Component {
|
|||||||
|
|
||||||
{
|
{
|
||||||
!isFetching && error &&
|
!isFetching && error &&
|
||||||
<div>
|
<Alert kind={kinds.DANGER}>
|
||||||
{translate('UnableToLoadUISettings')}
|
{translate('UnableToLoadUISettings')}
|
||||||
</div>
|
</Alert>
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -0,0 +1,54 @@
|
|||||||
|
import { batchActions } from 'redux-batched-actions';
|
||||||
|
import createAjaxRequest from 'Utilities/createAjaxRequest';
|
||||||
|
import { set, updateItem } from '../baseActions';
|
||||||
|
|
||||||
|
function createBulkEditItemHandler(section, url) {
|
||||||
|
return function(getState, payload, dispatch) {
|
||||||
|
|
||||||
|
dispatch(set({ section, isSaving: true }));
|
||||||
|
|
||||||
|
const ajaxOptions = {
|
||||||
|
url: `${url}`,
|
||||||
|
method: 'PUT',
|
||||||
|
data: JSON.stringify(payload),
|
||||||
|
dataType: 'json'
|
||||||
|
};
|
||||||
|
|
||||||
|
const promise = createAjaxRequest(ajaxOptions).request;
|
||||||
|
|
||||||
|
promise.done((data) => {
|
||||||
|
dispatch(batchActions([
|
||||||
|
set({
|
||||||
|
section,
|
||||||
|
isSaving: false,
|
||||||
|
saveError: null
|
||||||
|
}),
|
||||||
|
|
||||||
|
...data.map((provider) => {
|
||||||
|
|
||||||
|
const {
|
||||||
|
...propsToUpdate
|
||||||
|
} = provider;
|
||||||
|
|
||||||
|
return updateItem({
|
||||||
|
id: provider.id,
|
||||||
|
section,
|
||||||
|
...propsToUpdate
|
||||||
|
});
|
||||||
|
})
|
||||||
|
]));
|
||||||
|
});
|
||||||
|
|
||||||
|
promise.fail((xhr) => {
|
||||||
|
dispatch(set({
|
||||||
|
section,
|
||||||
|
isSaving: false,
|
||||||
|
saveError: xhr
|
||||||
|
}));
|
||||||
|
});
|
||||||
|
|
||||||
|
return promise;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export default createBulkEditItemHandler;
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
import { batchActions } from 'redux-batched-actions';
|
||||||
|
import createAjaxRequest from 'Utilities/createAjaxRequest';
|
||||||
|
import { removeItem, set } from '../baseActions';
|
||||||
|
|
||||||
|
function createBulkRemoveItemHandler(section, url) {
|
||||||
|
return function(getState, payload, dispatch) {
|
||||||
|
const {
|
||||||
|
ids
|
||||||
|
} = payload;
|
||||||
|
|
||||||
|
dispatch(set({ section, isDeleting: true }));
|
||||||
|
|
||||||
|
const ajaxOptions = {
|
||||||
|
url: `${url}`,
|
||||||
|
method: 'DELETE',
|
||||||
|
data: JSON.stringify(payload),
|
||||||
|
dataType: 'json'
|
||||||
|
};
|
||||||
|
|
||||||
|
const promise = createAjaxRequest(ajaxOptions).request;
|
||||||
|
|
||||||
|
promise.done((data) => {
|
||||||
|
dispatch(batchActions([
|
||||||
|
set({
|
||||||
|
section,
|
||||||
|
isDeleting: false,
|
||||||
|
deleteError: null
|
||||||
|
}),
|
||||||
|
|
||||||
|
...ids.map((id) => {
|
||||||
|
return removeItem({ section, id });
|
||||||
|
})
|
||||||
|
]));
|
||||||
|
});
|
||||||
|
|
||||||
|
promise.fail((xhr) => {
|
||||||
|
dispatch(set({
|
||||||
|
section,
|
||||||
|
isDeleting: false,
|
||||||
|
deleteError: xhr
|
||||||
|
}));
|
||||||
|
});
|
||||||
|
|
||||||
|
return promise;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export default createBulkRemoveItemHandler;
|
||||||
@@ -32,9 +32,9 @@ function createSaveProviderHandler(section, url, options = {}) {
|
|||||||
const params = { ...queryParams };
|
const params = { ...queryParams };
|
||||||
|
|
||||||
// If the user is re-saving the same provider without changes
|
// If the user is re-saving the same provider without changes
|
||||||
// force it to be saved. Only applies to editing existing providers.
|
// force it to be saved.
|
||||||
|
|
||||||
if (id && _.isEqual(saveData, lastSaveData)) {
|
if (_.isEqual(saveData, lastSaveData)) {
|
||||||
params.forceSave = true;
|
params.forceSave = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user