New: Default name when adding providers

This commit is contained in:
Bogdan
2023-08-14 02:27:59 +03:00
parent 27928103c5
commit a758161e31
16 changed files with 48 additions and 18 deletions

View File

@@ -263,6 +263,7 @@ class AddIndexerModalContent extends Component {
<SelectIndexerRowConnector
key={`${indexer.implementation}-${indexer.name}`}
implementation={indexer.implementation}
implementationName={indexer.implementationName}
{...indexer}
onIndexerSelect={onIndexerSelect}
/>

View File

@@ -49,8 +49,8 @@ class AddIndexerModalContentConnector extends Component {
//
// Listeners
onIndexerSelect = ({ implementation, name }) => {
this.props.selectIndexerSchema({ implementation, name });
onIndexerSelect = ({ implementation, implementationName, name }) => {
this.props.selectIndexerSchema({ implementation, implementationName, name });
this.props.onSelectIndexer();
};

View File

@@ -10,12 +10,14 @@ class AddIndexerPresetMenuItem extends Component {
onPress = () => {
const {
name,
implementation
implementation,
implementationName
} = this.props;
this.props.onPress({
name,
implementation
implementation,
implementationName
});
};
@@ -26,6 +28,7 @@ class AddIndexerPresetMenuItem extends Component {
const {
name,
implementation,
implementationName,
...otherProps
} = this.props;
@@ -43,6 +46,7 @@ class AddIndexerPresetMenuItem extends Component {
AddIndexerPresetMenuItem.propTypes = {
name: PropTypes.string.isRequired,
implementation: PropTypes.string.isRequired,
implementationName: PropTypes.string.isRequired,
onPress: PropTypes.func.isRequired
};

View File

@@ -17,10 +17,11 @@ class SelectIndexerRow extends Component {
onPress = () => {
const {
implementation,
implementationName,
name
} = this.props;
this.props.onIndexerSelect({ implementation, name });
this.props.onIndexerSelect({ implementation, implementationName, name });
};
//
@@ -81,6 +82,7 @@ SelectIndexerRow.propTypes = {
language: PropTypes.string.isRequired,
description: PropTypes.string.isRequired,
implementation: PropTypes.string.isRequired,
implementationName: PropTypes.string.isRequired,
onIndexerSelect: PropTypes.func.isRequired,
isExistingIndexer: PropTypes.bool.isRequired
};

View File

@@ -61,7 +61,7 @@ function EditIndexerModalContent(props) {
return (
<ModalContent onModalClose={onModalClose}>
<ModalHeader>
{`${id ? translate('EditIndexer') : translate('AddIndexer')} - ${indexerDisplayName}`}
{id ? translate('EditIndexerImplementation', { implementationName: indexerDisplayName }) : translate('AddIndexerImplementation', { implementationName: indexerDisplayName })}
</ModalHeader>
<ModalBody>

View File

@@ -16,10 +16,11 @@ class AddApplicationItem extends Component {
onApplicationSelect = () => {
const {
implementation
implementation,
implementationName
} = this.props;
this.props.onApplicationSelect({ implementation });
this.props.onApplicationSelect({ implementation, implementationName });
};
//
@@ -77,6 +78,7 @@ class AddApplicationItem extends Component {
key={preset.name}
name={preset.name}
implementation={implementation}
implementationName={implementationName}
onPress={onApplicationSelect}
/>
);

View File

@@ -10,12 +10,14 @@ class AddApplicationPresetMenuItem extends Component {
onPress = () => {
const {
name,
implementation
implementation,
implementationName
} = this.props;
this.props.onPress({
name,
implementation
implementation,
implementationName
});
};
@@ -26,6 +28,7 @@ class AddApplicationPresetMenuItem extends Component {
const {
name,
implementation,
implementationName,
...otherProps
} = this.props;
@@ -43,6 +46,7 @@ class AddApplicationPresetMenuItem extends Component {
AddApplicationPresetMenuItem.propTypes = {
name: PropTypes.string.isRequired,
implementation: PropTypes.string.isRequired,
implementationName: PropTypes.string.isRequired,
onPress: PropTypes.func.isRequired
};

View File

@@ -71,7 +71,7 @@ function EditApplicationModalContent(props) {
return (
<ModalContent onModalClose={onModalClose}>
<ModalHeader>
{`${id ? translate('Edit') : translate('Add')} ${translate('Application')} - ${implementationName}`}
{id ? translate('EditApplicationImplementation', { implementationName }) : translate('AddApplicationImplementation', { implementationName })}
</ModalHeader>
<ModalBody>

View File

@@ -35,7 +35,7 @@ function AddCategoryModalContent(props) {
return (
<ModalContent onModalClose={onCancelPress}>
<ModalHeader>
{`${id ? 'Edit' : 'Add'} Category`}
{id ? translate('EditCategory') : translate('AddCategory')}
</ModalHeader>
<ModalBody>

View File

@@ -84,7 +84,7 @@ class EditDownloadClientModalContent extends Component {
return (
<ModalContent onModalClose={onModalClose}>
<ModalHeader>
{`${id ? translate('Edit') : translate('Add')} ${translate('DownloadClient')} - ${implementationName}`}
{id ? translate('EditDownloadClientImplementation', { implementationName }) : translate('AddDownloadClientImplementation', { implementationName })}
</ModalHeader>
<ModalBody>

View File

@@ -16,10 +16,11 @@ class AddIndexerProxyItem extends Component {
onIndexerProxySelect = () => {
const {
implementation
implementation,
implementationName
} = this.props;
this.props.onIndexerProxySelect({ implementation });
this.props.onIndexerProxySelect({ implementation, implementationName });
};
//
@@ -77,6 +78,7 @@ class AddIndexerProxyItem extends Component {
key={preset.name}
name={preset.name}
implementation={implementation}
implementationName={implementationName}
onPress={onIndexerProxySelect}
/>
);

View File

@@ -47,7 +47,7 @@ function EditIndexerProxyModalContent(props) {
return (
<ModalContent onModalClose={onModalClose}>
<ModalHeader>
{`${id ? 'Edit' : 'Add'} Proxy - ${implementationName}`}
{id ? translate('EditIndexerProxyImplementation', { implementationName }) : translate('AddIndexerProxyImplementation', { implementationName })}
</ModalHeader>
<ModalBody>

View File

@@ -28,7 +28,7 @@ class AddNotificationModalContent extends Component {
return (
<ModalContent onModalClose={onModalClose}>
<ModalHeader>
Add Notification
{translate('AddConnection')}
</ModalHeader>
<ModalBody>

View File

@@ -48,7 +48,7 @@ function EditNotificationModalContent(props) {
return (
<ModalContent onModalClose={onModalClose}>
<ModalHeader>
{`${id ? 'Edit' : 'Add'} Connection - ${implementationName}`}
{id ? translate('EditConnectionImplementation', { implementationName }) : translate('AddConnectionImplementation', { implementationName })}
</ModalHeader>
<ModalBody>

View File

@@ -184,6 +184,8 @@ export const reducers = createHandleActions({
[SELECT_INDEXER_SCHEMA]: (state, { payload }) => {
return selectSchema(state, payload, (selectedSchema) => {
selectedSchema.name = payload.name ?? payload.implementationName;
selectedSchema.implementationName = payload.implementationName;
selectedSchema.enable = selectedSchema.supportsRss;
return selectedSchema;