(cherry picked from commit 4c622fd41289cd293a68a6a9f6b8da2a086edecb) Closes #10110pull/10115/head
parent
7bdb3e437d
commit
085b1db77f
@ -0,0 +1,25 @@
|
||||
import getSectionState from 'Utilities/State/getSectionState';
|
||||
import updateSectionState from 'Utilities/State/updateSectionState';
|
||||
|
||||
function createSetProviderFieldValuesReducer(section) {
|
||||
return (state, { payload }) => {
|
||||
if (section === payload.section) {
|
||||
const { properties } = payload;
|
||||
const newState = getSectionState(state, section);
|
||||
newState.pendingChanges = Object.assign({}, newState.pendingChanges);
|
||||
const fields = Object.assign({}, newState.pendingChanges.fields || {});
|
||||
|
||||
Object.keys(properties).forEach((name) => {
|
||||
fields[name] = properties[name];
|
||||
});
|
||||
|
||||
newState.pendingChanges.fields = fields;
|
||||
|
||||
return updateSectionState(state, section, newState);
|
||||
}
|
||||
|
||||
return state;
|
||||
};
|
||||
}
|
||||
|
||||
export default createSetProviderFieldValuesReducer;
|
@ -0,0 +1,32 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Newtonsoft.Json;
|
||||
using NzbDrone.Common.Extensions;
|
||||
|
||||
namespace NzbDrone.Core.Notifications.Plex.PlexTv
|
||||
{
|
||||
public class PlexTvResource
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public bool Owned { get; set; }
|
||||
|
||||
public List<PlexTvResourceConnection> Connections { get; set; }
|
||||
|
||||
[JsonProperty("provides")]
|
||||
public string ProvidesRaw { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public List<string> Provides => ProvidesRaw.Split(",").ToList();
|
||||
}
|
||||
|
||||
public class PlexTvResourceConnection
|
||||
{
|
||||
public string Uri { get; set; }
|
||||
public string Protocol { get; set; }
|
||||
public string Address { get; set; }
|
||||
public int Port { get; set; }
|
||||
public bool Local { get; set; }
|
||||
public string Host => Uri.IsNullOrWhiteSpace() ? Address : new Uri(Uri).Host;
|
||||
}
|
||||
}
|
Loading…
Reference in new issue