mirror of
https://github.com/NginxProxyManager/nginx-proxy-manager.git
synced 2025-12-21 11:30:11 +00:00
404 hosts section and other fixes
This commit is contained in:
@@ -1,14 +1,12 @@
|
||||
'use strict';
|
||||
|
||||
const Mn = require('backbone.marionette');
|
||||
const App = require('../../main');
|
||||
const DeadHostModel = require('../../../models/dead-host');
|
||||
const Api = require('../../api');
|
||||
const Cache = require('../../cache');
|
||||
const Controller = require('../../controller');
|
||||
const ListView = require('./list/main');
|
||||
const ErrorView = require('../../error/main');
|
||||
const template = require('./main.ejs');
|
||||
const EmptyView = require('../../empty/main');
|
||||
const template = require('./main.ejs');
|
||||
|
||||
module.exports = Mn.View.extend({
|
||||
id: 'nginx-dead',
|
||||
@@ -27,18 +25,18 @@ module.exports = Mn.View.extend({
|
||||
events: {
|
||||
'click @ui.add': function (e) {
|
||||
e.preventDefault();
|
||||
Controller.showNginxDeadForm();
|
||||
App.Controller.showNginxDeadForm();
|
||||
}
|
||||
},
|
||||
|
||||
templateContext: {
|
||||
showAddButton: Cache.User.canManage('dead_hosts')
|
||||
showAddButton: App.Cache.User.canManage('dead_hosts')
|
||||
},
|
||||
|
||||
onRender: function () {
|
||||
let view = this;
|
||||
|
||||
Api.Nginx.DeadHosts.getAll()
|
||||
App.Api.Nginx.DeadHosts.getAll(['owner'])
|
||||
.then(response => {
|
||||
if (!view.isDestroyed()) {
|
||||
if (response && response.length) {
|
||||
@@ -46,15 +44,16 @@ module.exports = Mn.View.extend({
|
||||
collection: new DeadHostModel.Collection(response)
|
||||
}));
|
||||
} else {
|
||||
let manage = Cache.User.canManage('dead_hosts');
|
||||
let manage = App.Cache.User.canManage('dead_hosts');
|
||||
|
||||
view.showChildView('list_region', new EmptyView({
|
||||
title: 'There are no 404 Hosts',
|
||||
subtitle: manage ? 'Why don\'t you create one?' : 'And you don\'t have permission to create one.',
|
||||
link: manage ? 'Add 404 Host' : null,
|
||||
btn_color: 'danger',
|
||||
action: function () {
|
||||
Controller.showNginxDeadForm();
|
||||
title: App.i18n('dead-hosts', 'empty'),
|
||||
subtitle: App.i18n('all-hosts', 'empty-subtitle', {manage: manage}),
|
||||
link: manage ? App.i18n('dead-hosts', 'add') : null,
|
||||
btn_color: 'danger',
|
||||
permission: 'dead_hosts',
|
||||
action: function () {
|
||||
App.Controller.showNginxDeadForm();
|
||||
}
|
||||
}));
|
||||
}
|
||||
@@ -65,7 +64,7 @@ module.exports = Mn.View.extend({
|
||||
code: err.code,
|
||||
message: err.message,
|
||||
retry: function () {
|
||||
Controller.showNginxDead();
|
||||
App.Controller.showNginxDead();
|
||||
}
|
||||
}));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user