mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-14 10:36:54 -07:00
All Sln changes
This commit is contained in:
parent
b5855f2644
commit
796f0fc188
615 changed files with 68 additions and 747 deletions
51
Ombi.UI/Content/app/requests/requestsController.js
Normal file
51
Ombi.UI/Content/app/requests/requestsController.js
Normal file
|
@ -0,0 +1,51 @@
|
|||
(function () {
|
||||
var controller = function($scope, requestsService) {
|
||||
|
||||
$scope.requests = [];
|
||||
$scope.selectedTab = {};
|
||||
$scope.currentPage = 1;
|
||||
$scope.tabs = [];
|
||||
|
||||
$scope.plexSettings = {};
|
||||
$scope.requestSettings = {};
|
||||
|
||||
// Search
|
||||
$scope.searchTerm = "";
|
||||
|
||||
|
||||
// Called on page load
|
||||
$scope.init = function() {
|
||||
// Get the settings
|
||||
$scope.plexSettings = requestsService.getPlexRequestSettings(getBaseUrl());
|
||||
$scope.requestSettings = requestsService.getRequestSettings(getBaseUrl());
|
||||
|
||||
if ($scope.plexSettings.SearchForMovies) {
|
||||
$scope.selectedTab = "movies";
|
||||
|
||||
// Load the movie Requests
|
||||
$scope.requests = requestsService.getRequests("movie", getBaseUrl());
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
$scope.changeTab = function(tab) {
|
||||
// load the data from the tab
|
||||
switch (tab) {
|
||||
// Set the selected tab and load the appropriate data
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
$scope.search = function() {
|
||||
$scope.requests = requestsService.getRequests
|
||||
};
|
||||
|
||||
function getBaseUrl() {
|
||||
return $('#baseUrl').val();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
angular.module('PlexRequests').controller('requestsController', ["$scope", "requestsService", controller]);
|
||||
}());
|
49
Ombi.UI/Content/app/requests/requestsService.js
Normal file
49
Ombi.UI/Content/app/requests/requestsService.js
Normal file
|
@ -0,0 +1,49 @@
|
|||
(function () {
|
||||
|
||||
var requestsService = function ($http) {
|
||||
|
||||
$http.defaults.headers.common['Content-Type'] = 'application/json'; // Set default headers
|
||||
|
||||
var getRequests = function (type, baseUrl) {
|
||||
switch (type) {
|
||||
case "movie":
|
||||
return $http.get(createBaseUrl(baseUrl, "/requestsbeta/movies"));
|
||||
case "tv":
|
||||
return $http.get(createBaseUrl(baseUrl, "/requestsbeta/tvshows"));
|
||||
case "album":
|
||||
return $http.get(createBaseUrl(baseUrl, "/requestsbeta/albums"));
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
var getPlexRequestSettings = function (baseUrl) {
|
||||
return $http.get(createBaseUrl(baseUrl, "/requestsbeta/plexrequestsettings"));
|
||||
}
|
||||
|
||||
var getRequestsSettings = function (baseUrl) {
|
||||
return $http.get(createBaseUrl(baseUrl, "/requestsbeta/requestsettings"));
|
||||
}
|
||||
|
||||
var getRequestsSearch = function (type, baseUrl, searchTerm) {
|
||||
switch (type) {
|
||||
case "movie":
|
||||
return $http.get(createBaseUrl(baseUrl, "/requestsbeta/movies/"+ searchTerm));
|
||||
case "tv":
|
||||
return $http.get(createBaseUrl(baseUrl, "/requestsbeta/tvshows/" + searchTerm));
|
||||
case "album":
|
||||
return $http.get(createBaseUrl(baseUrl, "/requestsbeta/albums/" + searchTerm));
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
return {
|
||||
getRequests: getRequests,
|
||||
getRequestsSearch: getRequestsSearch,
|
||||
getPlexRequestSettings: getPlexRequestSettings,
|
||||
getRequestSettings: getRequestsSettings
|
||||
};
|
||||
}
|
||||
|
||||
angular.module('PlexRequests').factory('requestsService', ["$http", requestsService]);
|
||||
|
||||
}());
|
Loading…
Add table
Add a link
Reference in a new issue