Skip to content

Commit

Permalink
Merge branch 'dev-testing'
Browse files Browse the repository at this point in the history
  • Loading branch information
RickyGrassmuck committed Feb 18, 2017
2 parents 940ac07 + f15cc42 commit 20d7428
Show file tree
Hide file tree
Showing 28 changed files with 1,743 additions and 925 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
_site
*.log
/data
.idea/
*.idea/
3 changes: 0 additions & 3 deletions .meteor/packages
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,5 @@ multiply:iron-router-progress
useraccounts:bootstrap
npm-container

lokenx:couchpotatowrapper
lokenx:sickragewrapper
# lokenx:sonarrwrapper
meteorhacks:npm
davidyaha:collection2-migrations
2 changes: 0 additions & 2 deletions .meteor/versions
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@ [email protected]
[email protected]
[email protected]
[email protected]
lokenx:[email protected]
lokenx:[email protected]
[email protected]
[email protected]
meteorhacks:[email protected]
Expand Down
2 changes: 2 additions & 0 deletions client/helpers/authentication.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//TODO: Get rid of this file as it doesn't look to be needed anymore

// Plex user authentication
// Session.get("auth")

Expand Down
38 changes: 38 additions & 0 deletions client/templates/admin/admin.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ <h1>Admin</h1>
<a href="#"><li class="list-group-item">Users</li></a>
{{/if}}
<a href="#"><li class="list-group-item">CouchPotato</li></a>
<a href="#"><li class="list-group-item">Radarr</li></a>
<a href="#"><li class="list-group-item">SickRage</li></a>
<a href="#"><li class="list-group-item">Sonarr</li></a>
<a href="#"><li class="list-group-item">Notifications</li></a>
Expand Down Expand Up @@ -175,6 +176,43 @@ <h1>Admin</h1>
{{/autoForm}}
</div>

<div class="col-md-8 settings-pane" style="display: none;" id="SettingsRadarr">
{{#autoForm collection="Settings" doc=settings id="updateRadarrSettingsForm" type="update" resetOnSuccess="false"}}
{{> afQuickField name='radarrENABLED'}}
<p class="text-muted">Enabled Radarr for automated tv downloading.</p>
<br>
<p><button class="btn btn-secondary-outline" id="radarrTest">Test Radar server</button></p>
<p class="text-muted">Test your Radarr server. Remember to save your settings first!</p>
<br>
{{> afQuickField name='radarrURL'}}
<p class="text-muted">Enter the IP address or Hostname of your Radarr server. Do not include http:// or any slashes.</p>
<br>
{{> afQuickField name='radarrPORT'}}
<p class="text-muted">Enter the port used by Radarr. The default is 8989.</p>
<br>
{{> afQuickField name='radarrAPI' size="40"}}
<p class="text-muted">Enter your API from Radarr. It can be found in Sonarr Settings -> General.</p>
<br>
{{> afQuickField name='radarrDIRECTORY' size="40"}}
<p class="text-muted">Enter your sub-directory for Radarr if used. It should also include the slash (/) at the start.</p>
<br>
{{> afQuickField name='radarrSSL'}}
<p class="text-muted">Enabled if you use SSL on your Radarr server.</p>
<br>
{{> afQuickField name='radarrQUALITYPROFILEID' type='select' options=radarrProfiles firstOption=false}}
<button class="btn btn-info-outline" id="getRadarrProfiles">Get Profiles</button>
<br>
<br>
<p class="text-muted">Select a Radarr Quality Profile.</p>
<br>
{{> afQuickField name='radarrROOTFOLDERPATH'}}
<p class="text-muted">Enter the root folder where movies are saved. For example C:\Media\TV.</p>
<br>
<button type="submit" class="btn btn-primary-outline btn-block">Update Settings</button>
{{/autoForm}}
</div>


<div class="col-md-8 settings-pane" style="display: none;" id="SettingsSickRage">
{{#autoForm collection="Settings" doc=settings id="updateSickRageSettingsForm" type="update" resetOnSuccess="false"}}
{{> afQuickField name='sickRageENABLED'}}
Expand Down
69 changes: 66 additions & 3 deletions client/templates/admin/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,20 @@ AutoForm.hooks({
Bert.alert('Update failed, please try again', 'danger');
}
},
updateRadarrSettingsForm: {
onSuccess: function(formType, result) {
if (result) {
Bert.alert('Updated successfully', 'success');
Meteor.call("settingsUpdate");
}
this.event.preventDefault();
return false;
},
onError: function(formType, error) {
console.error(error);
Bert.alert('Update failed, please try again', 'danger');
}
},
updateNotificationsSettingsForm: {
onSuccess: function(formType, result) {
if (result) {
Expand Down Expand Up @@ -100,6 +114,14 @@ Template.admin.helpers({
};
});
},
radarrProfiles: function () {
return Template.instance().radarrProfiles.get().map(function (profile) {
return {
label: profile.name,
value: profile.id
};
});
},
version: function () {
return Template.instance().version.get();
},
Expand Down Expand Up @@ -132,6 +154,7 @@ Template.admin.onCreated(function(){
instance.version = new ReactiveVar("");
instance.update = new ReactiveVar(false);
instance.sonarrProfiles = new ReactiveVar([]);
instance.radarrProfiles = new ReactiveVar([]);
instance.latestVersion = new ReactiveVar("");
instance.latestNotes = new ReactiveVar("");
instance.previousVersion = new ReactiveVar("");
Expand Down Expand Up @@ -164,13 +187,13 @@ Template.admin.onCreated(function(){
instance.latestNotes.set(notesArray.filter(Boolean));

instance.previousVersion.set(result.data[1].name);
var notesArray = result.data[1].body.split("- ");
notesArray = result.data[1].body.split("- ");
instance.previousNotes.set(notesArray.filter(Boolean));
});
});

Template.admin.events({
'click .list-group-item' : function (event, template) {
'click .list-group-item' : function (event) {
var target = $(event.target);

//Update permissions collection
Expand All @@ -184,10 +207,12 @@ Template.admin.events({
$('.settings-pane').hide();
$('#Settings' + target.text()).show();
},

'submit #updateSettingsForm' : function (event) {
event.preventDefault();
return false;
},

'click #usersSettingsSubmit' : function (event) {
event.preventDefault();

Expand All @@ -200,6 +225,7 @@ Template.admin.events({
Bert.alert('Update failed, please try again', 'danger');
}
},

'click #couchPotatoTest' : function (event) {
event.preventDefault();
var btn = $(event.target);
Expand All @@ -214,6 +240,7 @@ Template.admin.events({
}
})
},

'click #sickRageTest' : function (event) {
event.preventDefault();
var btn = $(event.target);
Expand All @@ -228,6 +255,7 @@ Template.admin.events({
}
})
},

'click #sonarrTest' : function (event) {
event.preventDefault();
var btn = $(event.target);
Expand All @@ -242,6 +270,22 @@ Template.admin.events({
}
})
},

'click #radarrTest' : function (event) {
event.preventDefault();
var btn = $(event.target);
btn.html("Testing... <i class='fa fa-spin fa-refresh'></i>").removeClass().addClass("btn btn-info-outline");
Meteor.call("testRadarr", function (error, result) {
if (error || !result) {
btn.removeClass("btn-info-outline").addClass("btn-danger-outline");
btn.html("Error!");
} else {
btn.removeClass("btn-info-outline").addClass("btn-success-outline");
btn.html("Success!");
}
})
},

'click #iftttTest' : function (event) {
event.preventDefault();
var btn = $(event.target);
Expand All @@ -257,6 +301,7 @@ Template.admin.events({
}
})
},

'click #pushbulletTest' : function (event) {
event.preventDefault();
var btn = $(event.target);
Expand All @@ -272,6 +317,7 @@ Template.admin.events({
}
})
},

'click #pushoverTest' : function (event) {
event.preventDefault();
var btn = $(event.target);
Expand All @@ -287,6 +333,7 @@ Template.admin.events({
}
})
},

'click #slackTest' : function (event) {
event.preventDefault();
var btn = $(event.target);
Expand All @@ -302,6 +349,7 @@ Template.admin.events({
}
})
},

'click #plexsubmit' : function (event) {
event.preventDefault();
$('#plexsubmit').html("Getting Token... <i class='fa fa-spin fa-refresh'></i>");
Expand All @@ -323,7 +371,7 @@ Template.admin.events({
event.preventDefault();
var btn = $(event.target);
btn.html("Get Profiles <i class='fa fa-spin fa-refresh'></i>").removeClass().addClass("btn btn-info-outline");
Meteor.call("sonarrProfiles", function (error, result) {
Meteor.call('SonarrProfiles', function (error, result) {
if (result.length) {
template.sonarrProfiles.set(result);
Bert.alert('Retrieved Sonarr Profiles!', "success");
Expand All @@ -332,5 +380,20 @@ Template.admin.events({
}
btn.html("Get Profiles");
});
},

'click #getRadarrProfiles': function (event, template) {
event.preventDefault();
var btn = $(event.target);
btn.html("Get Profiles <i class='fa fa-spin fa-refresh'></i>").removeClass().addClass("btn btn-info-outline");
Meteor.call("RadarrProfiles", function (error, result) {
if (result.length) {
template.radarrProfiles.set(result);
Bert.alert('Retrieved Radarr Profiles!', "success");
} else {
Bert.alert('Unable to retrieve Radarr Profiles!', "danger");
}
btn.html("Get Profiles");
});
}
});
Loading

0 comments on commit 20d7428

Please sign in to comment.