proxy-host-location.js 729 B

1234567891011121314151617181920212223242526272829303132333435
  1. const Backbone = require('backbone');
  2. const model = Backbone.Model.extend({
  3. idAttribute: 'id',
  4. defaults: function() {
  5. return {
  6. opened: false,
  7. path: '',
  8. advanced_config: '',
  9. forward_scheme: 'http',
  10. forward_host: '',
  11. forward_port: '80'
  12. }
  13. },
  14. toJSON() {
  15. const r = Object.assign({}, this.attributes);
  16. delete r.opened;
  17. return r;
  18. },
  19. toggleVisibility: function () {
  20. this.save({
  21. opened: !this.get('opened')
  22. });
  23. }
  24. })
  25. module.exports = {
  26. Model: model,
  27. Collection: Backbone.Collection.extend({
  28. model
  29. })
  30. }