mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-10-31 16:02:29 +01:00
Save and add, notif settings cleanup
This commit is contained in:
parent
7f59062215
commit
f7c340d795
@ -8,13 +8,13 @@ namespace NzbDrone.Core.Notifications.Growl
|
|||||||
{
|
{
|
||||||
public class GrowlSettings : INotifcationSettings
|
public class GrowlSettings : INotifcationSettings
|
||||||
{
|
{
|
||||||
[FieldDefinition(0, Label = "Host", HelpText = "Growl Host (IP or Hostname)")]
|
[FieldDefinition(0, Label = "Host")]
|
||||||
public String Host { get; set; }
|
public String Host { get; set; }
|
||||||
|
|
||||||
[FieldDefinition(1, Label = "Port", HelpText = "Growl Port")]
|
[FieldDefinition(1, Label = "Port")]
|
||||||
public Int32 Port { get; set; }
|
public Int32 Port { get; set; }
|
||||||
|
|
||||||
[FieldDefinition(2, Label = "Password", HelpText = "Password for Growl")]
|
[FieldDefinition(2, Label = "Password")]
|
||||||
public String Password { get; set; }
|
public String Password { get; set; }
|
||||||
|
|
||||||
public bool IsValid
|
public bool IsValid
|
||||||
|
@ -8,16 +8,16 @@ namespace NzbDrone.Core.Notifications.Plex
|
|||||||
{
|
{
|
||||||
public class PlexClientSettings : INotifcationSettings
|
public class PlexClientSettings : INotifcationSettings
|
||||||
{
|
{
|
||||||
[FieldDefinition(0, Label = "Host", HelpText = "Plex Client Host (IP or Hostname)")]
|
[FieldDefinition(0, Label = "Host")]
|
||||||
public String Host { get; set; }
|
public String Host { get; set; }
|
||||||
|
|
||||||
[FieldDefinition(1, Label = "Port", HelpText = "Plex Client Port")]
|
[FieldDefinition(1, Label = "Port")]
|
||||||
public Int32 Port { get; set; }
|
public Int32 Port { get; set; }
|
||||||
|
|
||||||
[FieldDefinition(2, Label = "Username", HelpText = "Username for Plex")]
|
[FieldDefinition(2, Label = "Username")]
|
||||||
public String Username { get; set; }
|
public String Username { get; set; }
|
||||||
|
|
||||||
[FieldDefinition(3, Label = "Password", HelpText = "Password for Plex")]
|
[FieldDefinition(3, Label = "Password")]
|
||||||
public String Password { get; set; }
|
public String Password { get; set; }
|
||||||
|
|
||||||
public bool IsValid
|
public bool IsValid
|
||||||
|
@ -8,13 +8,13 @@ namespace NzbDrone.Core.Notifications.Plex
|
|||||||
{
|
{
|
||||||
public class PlexServerSettings : INotifcationSettings
|
public class PlexServerSettings : INotifcationSettings
|
||||||
{
|
{
|
||||||
[FieldDefinition(0, Label = "Host", HelpText = "Plex Server Host (IP or Hostname)")]
|
[FieldDefinition(0, Label = "Host")]
|
||||||
public String Host { get; set; }
|
public String Host { get; set; }
|
||||||
|
|
||||||
[FieldDefinition(1, Label = "Port")]
|
[FieldDefinition(1, Label = "Port")]
|
||||||
public Int32 Port { get; set; }
|
public Int32 Port { get; set; }
|
||||||
|
|
||||||
[FieldDefinition(2, Label = "Update Library")]
|
[FieldDefinition(2, Label = "Update Library", Type = FieldType.Checkbox)]
|
||||||
public Boolean UpdateLibrary { get; set; }
|
public Boolean UpdateLibrary { get; set; }
|
||||||
|
|
||||||
public bool IsValid
|
public bool IsValid
|
||||||
|
@ -8,10 +8,10 @@ namespace NzbDrone.Core.Notifications.Prowl
|
|||||||
{
|
{
|
||||||
public class ProwlSettings : INotifcationSettings
|
public class ProwlSettings : INotifcationSettings
|
||||||
{
|
{
|
||||||
[FieldDefinition(0, Label = "API Key", HelpText = "API Key for Prowl")]
|
[FieldDefinition(0, Label = "API Key")]
|
||||||
public String ApiKey { get; set; }
|
public String ApiKey { get; set; }
|
||||||
|
|
||||||
[FieldDefinition(1, Label = "Priority", HelpText = "Priority to send messages at", Type = FieldType.Select, SelectOptions= typeof(ProwlPriority) )]
|
[FieldDefinition(1, Label = "Priority", Type = FieldType.Select, SelectOptions= typeof(ProwlPriority) )]
|
||||||
public Int32 Priority { get; set; }
|
public Int32 Priority { get; set; }
|
||||||
|
|
||||||
public bool IsValid
|
public bool IsValid
|
||||||
|
@ -11,7 +11,7 @@ define(
|
|||||||
tagName : 'tr',
|
tagName : 'tr',
|
||||||
|
|
||||||
events: {
|
events: {
|
||||||
'click .x-remove': 'removeFolder',
|
'click .x-delete': 'removeFolder',
|
||||||
'click .x-folder': 'folderSelected'
|
'click .x-folder': 'folderSelected'
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -40,5 +40,16 @@
|
|||||||
<button class="btn btn-danger pull-left x-remove">delete</button>
|
<button class="btn btn-danger pull-left x-remove">delete</button>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
<button class="btn" data-dismiss="modal">cancel</button>
|
<button class="btn" data-dismiss="modal">cancel</button>
|
||||||
|
|
||||||
|
<div class="btn-group">
|
||||||
<button class="btn btn-primary x-save">save</button>
|
<button class="btn btn-primary x-save">save</button>
|
||||||
|
<button class="btn btn-primary dropdown-toggle" data-toggle="dropdown">
|
||||||
|
<span class="caret"></span>
|
||||||
|
</button>
|
||||||
|
<ul class="dropdown-menu">
|
||||||
|
<li class="save-and-add x-save-and-add">
|
||||||
|
save and add
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -2,23 +2,54 @@
|
|||||||
|
|
||||||
define(
|
define(
|
||||||
[
|
[
|
||||||
|
'app',
|
||||||
'marionette',
|
'marionette',
|
||||||
'Mixins/AsModelBoundView'
|
'Mixins/AsModelBoundView'
|
||||||
], function (Marionette, AsModelBoundView) {
|
], function (App, Marionette, AsModelBoundView) {
|
||||||
|
|
||||||
var view = Marionette.ItemView.extend({
|
var view = Marionette.ItemView.extend({
|
||||||
template: 'Settings/Indexers/EditTemplate',
|
template: 'Settings/Indexers/EditTemplate',
|
||||||
|
|
||||||
events: {
|
events: {
|
||||||
'click .x-save': 'save'
|
'click .x-save': '_save',
|
||||||
|
'click .x-save-and-add': '_saveAndAdd'
|
||||||
},
|
},
|
||||||
|
|
||||||
initialize: function (options) {
|
initialize: function (options) {
|
||||||
this.indexerCollection = options.indexerCollection;
|
this.indexerCollection = options.indexerCollection;
|
||||||
},
|
},
|
||||||
|
|
||||||
save: function () {
|
_save: function () {
|
||||||
this.model.saveSettings();
|
var self = this;
|
||||||
|
var promise = this.model.saveSettings();
|
||||||
|
|
||||||
|
if (promise) {
|
||||||
|
promise.done(function () {
|
||||||
|
self.indexerCollection.add(self.model, { merge: true });
|
||||||
|
App.modalRegion.closeModal();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
_saveAndAdd: function () {
|
||||||
|
var self = this;
|
||||||
|
var promise = this.model.saveSettings();
|
||||||
|
|
||||||
|
if (promise) {
|
||||||
|
promise.done(function () {
|
||||||
|
self.indexerCollection.add(self.model, { merge: true });
|
||||||
|
|
||||||
|
self.model.set({
|
||||||
|
id: undefined,
|
||||||
|
name: '',
|
||||||
|
enable: false
|
||||||
|
});
|
||||||
|
|
||||||
|
_.each(self.model.get('fields'), function (value, key, list) {
|
||||||
|
self.model.set('fields.' + key +'.value', '');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -2,10 +2,9 @@
|
|||||||
define([
|
define([
|
||||||
'app',
|
'app',
|
||||||
'marionette',
|
'marionette',
|
||||||
'Settings/Notifications/Collection',
|
|
||||||
'Settings/Notifications/ItemView',
|
'Settings/Notifications/ItemView',
|
||||||
'Settings/Notifications/AddView'
|
'Settings/Notifications/SchemaModal'
|
||||||
], function (App, Marionette, NotificationCollection, NotificationItemView, AddSelectionNotificationView) {
|
], function (App, Marionette, NotificationItemView, SchemaModal) {
|
||||||
return Marionette.CompositeView.extend({
|
return Marionette.CompositeView.extend({
|
||||||
itemView : NotificationItemView,
|
itemView : NotificationItemView,
|
||||||
itemViewContainer: '.notifications',
|
itemViewContainer: '.notifications',
|
||||||
@ -16,13 +15,7 @@ define([
|
|||||||
},
|
},
|
||||||
|
|
||||||
_openSchemaModal: function () {
|
_openSchemaModal: function () {
|
||||||
var schemaCollection = new NotificationCollection();
|
SchemaModal.open(this.collection);
|
||||||
schemaCollection.url = '/api/notification/schema';
|
|
||||||
schemaCollection.fetch();
|
|
||||||
schemaCollection.url = '/api/notification';
|
|
||||||
|
|
||||||
var view = new AddSelectionNotificationView({ collection: schemaCollection, notificationCollection: this.collection});
|
|
||||||
App.modalRegion.show(view);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -61,10 +61,23 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
{{#if id}}
|
{{#if id}}
|
||||||
<button class="btn btn-danger pull-left x-remove">delete</button>
|
<button class="btn btn-danger pull-left x-delete">delete</button>
|
||||||
|
{{else}}
|
||||||
|
<button class="btn pull-left x-back">back</button>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
<button class="btn x-test">test <i class="x-test-icon"/></button>
|
|
||||||
|
|
||||||
|
<button class="btn x-test">test <i class="x-test-icon"/></button>
|
||||||
<button class="btn" data-dismiss="modal">cancel</button>
|
<button class="btn" data-dismiss="modal">cancel</button>
|
||||||
|
|
||||||
|
<div class="btn-group">
|
||||||
<button class="btn btn-primary x-save">save</button>
|
<button class="btn btn-primary x-save">save</button>
|
||||||
|
<button class="btn btn-primary dropdown-toggle" data-toggle="dropdown">
|
||||||
|
<span class="caret"></span>
|
||||||
|
</button>
|
||||||
|
<ul class="dropdown-menu">
|
||||||
|
<li class="save-and-add x-save-and-add">
|
||||||
|
save and add
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -16,7 +16,9 @@ define([
|
|||||||
|
|
||||||
events: {
|
events: {
|
||||||
'click .x-save' : '_saveNotification',
|
'click .x-save' : '_saveNotification',
|
||||||
'click .x-remove': '_deleteNotification',
|
'click .x-save-and-add' : '_saveAndAddNotification',
|
||||||
|
'click .x-delete' : '_deleteNotification',
|
||||||
|
'click .x-back' : '_back',
|
||||||
'click .x-test' : '_test'
|
'click .x-test' : '_test'
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -41,14 +43,26 @@ define([
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_saveAndAddNotification: function () {
|
||||||
|
var self = this;
|
||||||
|
var promise = this.model.saveSettings();
|
||||||
|
|
||||||
|
if (promise) {
|
||||||
|
promise.done(function () {
|
||||||
|
self.notificationCollection.add(self.model, { merge: true });
|
||||||
|
|
||||||
|
require('Settings/Notifications/SchemaModal').open(self.notificationCollection);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
_deleteNotification: function () {
|
_deleteNotification: function () {
|
||||||
var view = new DeleteView({ model: this.model });
|
var view = new DeleteView({ model: this.model });
|
||||||
App.modalRegion.show(view);
|
App.modalRegion.show(view);
|
||||||
},
|
},
|
||||||
|
|
||||||
_saveSuccess: function () {
|
_back: function () {
|
||||||
this.notificationCollection.add(this.model, { merge: true });
|
require('Settings/Notifications/SchemaModal').open(this.notificationCollection);
|
||||||
App.modalRegion.closeModal();
|
|
||||||
},
|
},
|
||||||
|
|
||||||
_test: function () {
|
_test: function () {
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div class="settings">
|
||||||
{{#if onGrab}}
|
{{#if onGrab}}
|
||||||
<span class="label label-success">On Grab</span>
|
<span class="label label-success">On Grab</span>
|
||||||
{{else}}
|
{{else}}
|
||||||
|
19
UI/Settings/Notifications/SchemaModal.js
Normal file
19
UI/Settings/Notifications/SchemaModal.js
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
'use strict';
|
||||||
|
define([
|
||||||
|
'app',
|
||||||
|
'Settings/Notifications/Collection',
|
||||||
|
'Settings/Notifications/AddView'
|
||||||
|
], function (App, NotificationCollection, AddSelectionNotificationView) {
|
||||||
|
return ({
|
||||||
|
|
||||||
|
open: function (collection) {
|
||||||
|
var schemaCollection = new NotificationCollection();
|
||||||
|
schemaCollection.url = '/api/notification/schema';
|
||||||
|
schemaCollection.fetch();
|
||||||
|
schemaCollection.url = '/api/notification';
|
||||||
|
|
||||||
|
var view = new AddSelectionNotificationView({ collection: schemaCollection, notificationCollection: collection});
|
||||||
|
App.modalRegion.show(view);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
@ -23,24 +23,27 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.notifications {
|
.notifications {
|
||||||
|
width: -webkit-fit-content;
|
||||||
|
width: -moz-fit-content;
|
||||||
|
width: fit-content;
|
||||||
|
|
||||||
li {
|
li {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
vertical-align: top;
|
vertical-align: top;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.notification-item {
|
.notification-item {
|
||||||
|
|
||||||
.card;
|
.card;
|
||||||
|
|
||||||
width: 250px;
|
width: 290px;
|
||||||
height: 80px;
|
height: 90px;
|
||||||
padding: 10px 15px;
|
padding: 20px 20px;
|
||||||
|
|
||||||
h3 {
|
h3 {
|
||||||
margin-top: 0px;
|
margin-top: 0px;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
width: 200px;
|
width: 230px;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
@ -49,4 +52,8 @@
|
|||||||
.btn-group {
|
.btn-group {
|
||||||
margin-top: 8px;
|
margin-top: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.settings {
|
||||||
|
margin-top: 5px;
|
||||||
|
}
|
||||||
}
|
}
|
@ -52,7 +52,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
{{#if id}}
|
{{#if id}}
|
||||||
<button class="btn btn-danger pull-left x-remove">delete</button>
|
<button class="btn btn-danger pull-left x-delete">delete</button>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
<button class="btn" data-dismiss="modal">cancel</button>
|
<button class="btn" data-dismiss="modal">cancel</button>
|
||||||
<button class="btn btn-primary x-save">save</button>
|
<button class="btn btn-primary x-save">save</button>
|
||||||
|
@ -1,3 +1,23 @@
|
|||||||
|
@import "../Shared/Styles/clickable.less";
|
||||||
|
|
||||||
@import "Indexers/indexers";
|
@import "Indexers/indexers";
|
||||||
@import "Quality/quality";
|
@import "Quality/quality";
|
||||||
@import "Notifications/notifications";
|
@import "Notifications/notifications";
|
||||||
|
|
||||||
|
li.save-and-add {
|
||||||
|
.clickable;
|
||||||
|
|
||||||
|
display: block;
|
||||||
|
padding: 3px 20px;
|
||||||
|
clear: both;
|
||||||
|
font-weight: normal;
|
||||||
|
line-height: 20px;
|
||||||
|
color: rgb(51, 51, 51);
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
li.save-and-add:hover {
|
||||||
|
text-decoration: none;
|
||||||
|
color: rgb(255, 255, 255);
|
||||||
|
background-color: rgb(0, 129, 194);
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user