diff --git a/src/frontend/js/app/api.js b/src/frontend/js/app/api.js index d6c4764..26886ef 100644 --- a/src/frontend/js/app/api.js +++ b/src/frontend/js/app/api.js @@ -163,17 +163,22 @@ module.exports = { }, /** - * @param {Integer} [offset] - * @param {Integer} [limit] - * @param {String} [sort] * @param {Array} [expand] * @param {String} [query] * @returns {Promise} */ - getAll: function (offset, limit, sort, expand, query) { - return fetch('get', 'users?offset=' + (offset ? offset : 0) + '&limit=' + (limit ? limit : 20) + (sort ? '&sort=' + sort : '') + - (typeof expand === 'object' && expand !== null && expand.length ? '&expand=' + makeExpansionString(expand) : '') + - (typeof query === 'string' ? '&query=' + query : '')); + getAll: function (expand, query) { + let params = []; + + if (typeof expand === 'object' && expand !== null && expand.length) { + params.push('expand=' + makeExpansionString(expand)); + } + + if (typeof query === 'string') { + params.push('query=' + query); + } + + return fetch('get', 'users' + (params.length ? '?' + params.join('&') : '')); }, /** diff --git a/src/frontend/js/app/controller.js b/src/frontend/js/app/controller.js index e217d1d..2802d59 100644 --- a/src/frontend/js/app/controller.js +++ b/src/frontend/js/app/controller.js @@ -26,34 +26,30 @@ module.exports = { /** * Users - * - * @param {Number} [offset] - * @param {Number} [limit] - * @param {String} [sort] */ - showUsers: function (offset, limit, sort) { - /* + showUsers: function () { let controller = this; if (Cache.User.isAdmin()) { require(['./main', './users/main'], (App, View) => { controller.navigate('/users'); - App.UI.showMainLoading(); - let view = new View({ - sort: (typeof sort !== 'undefined' && sort ? sort : Cache.Session.Users.sort), - offset: (typeof offset !== 'undefined' ? offset : Cache.Session.Users.offset), - limit: (typeof limit !== 'undefined' && limit ? limit : Cache.Session.Users.limit) - }); - - view.on('loaded', function () { - App.UI.hideMainLoading(); - }); - - App.UI.showAppContent(view); + App.UI.showAppContent(new View()); }); } else { - this.showRules(); + this.showDashboard(); + } + }, + + /** + * User Form + * + * @param model + */ + showUserForm: function (model) { + if (Cache.User.isAdmin()) { + require(['./main', './user/form'], function (App, View) { + App.UI.showModalDialog(new View({model: model})); + }); } - */ }, /** diff --git a/src/frontend/js/app/main.js b/src/frontend/js/app/main.js index 4ef25c6..3fe2210 100644 --- a/src/frontend/js/app/main.js +++ b/src/frontend/js/app/main.js @@ -12,13 +12,17 @@ const UI = require('./ui/main'); const App = Mn.Application.extend({ - region: '#app', Cache: Cache, Api: Api, UI: null, Controller: Controller, version: null, + region: { + el: '#app', + replaceElement: true + }, + onStart: function (app, options) { console.log('Welcome to Nginx Proxy Manager'); diff --git a/src/frontend/js/app/ui/footer/main.ejs b/src/frontend/js/app/ui/footer/main.ejs index eeea09e..2a16c68 100644 --- a/src/frontend/js/app/ui/footer/main.ejs +++ b/src/frontend/js/app/ui/footer/main.ejs @@ -9,6 +9,6 @@