mirror of
https://github.com/xiaoxinpro/nginx-proxy-manager-zh.git
synced 2025-02-03 10:08:15 -05:00
55 lines
1.5 KiB
JavaScript
55 lines
1.5 KiB
JavaScript
|
const Mn = require('backbone.marionette');
|
||
|
const App = require('../../../main');
|
||
|
const template = require('./item.ejs');
|
||
|
|
||
|
module.exports = Mn.View.extend({
|
||
|
template: template,
|
||
|
tagName: 'tr',
|
||
|
|
||
|
ui: {
|
||
|
able: 'a.able',
|
||
|
edit: 'a.edit',
|
||
|
delete: 'a.delete'
|
||
|
},
|
||
|
|
||
|
events: {
|
||
|
'click @ui.able': function (e) {
|
||
|
e.preventDefault();
|
||
|
let id = this.model.get('id');
|
||
|
App.Api.Nginx.SslPassthroughHosts[this.model.get('enabled') ? 'disable' : 'enable'](id)
|
||
|
.then(() => {
|
||
|
return App.Api.Nginx.SslPassthroughHosts.get(id)
|
||
|
.then(row => {
|
||
|
this.model.set(row);
|
||
|
});
|
||
|
});
|
||
|
},
|
||
|
|
||
|
'click @ui.edit': function (e) {
|
||
|
e.preventDefault();
|
||
|
App.Controller.showNginxSslPassthroughForm(this.model);
|
||
|
},
|
||
|
|
||
|
'click @ui.delete': function (e) {
|
||
|
e.preventDefault();
|
||
|
App.Controller.showNginxSslPassthroughDeleteConfirm(this.model);
|
||
|
}
|
||
|
},
|
||
|
|
||
|
templateContext: {
|
||
|
canManage: App.Cache.User.canManage('ssl_passthrough_hosts'),
|
||
|
|
||
|
isOnline: function () {
|
||
|
return typeof this.meta.nginx_online === 'undefined' ? null : this.meta.nginx_online;
|
||
|
},
|
||
|
|
||
|
getOfflineError: function () {
|
||
|
return this.meta.nginx_err || '';
|
||
|
}
|
||
|
},
|
||
|
|
||
|
initialize: function () {
|
||
|
this.listenTo(this.model, 'change', this.render);
|
||
|
}
|
||
|
});
|