proxy-host-location.js 822 B

1234567891011121314151617181920212223242526272829303132333435363738
  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: null,
  11. forward_port: '80',
  12. root_dir: null,
  13. static: false,
  14. index_file: 'index.html',
  15. }
  16. },
  17. toJSON() {
  18. const r = Object.assign({}, this.attributes);
  19. delete r.opened;
  20. return r;
  21. },
  22. toggleVisibility: function () {
  23. this.save({
  24. opened: !this.get('opened')
  25. });
  26. }
  27. })
  28. module.exports = {
  29. Model: model,
  30. Collection: Backbone.Collection.extend({
  31. model
  32. })
  33. }