vrrp_sync_group.js 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. 'use strict';
  2. 'require view';
  3. 'require ui';
  4. 'require form';
  5. 'require uci';
  6. return view.extend({
  7. load: function() {
  8. return Promise.all([
  9. uci.load('keepalived'),
  10. ]);
  11. },
  12. render: function(data) {
  13. let m, s, o;
  14. var instances;
  15. instances = uci.sections('keepalived', 'vrrp_instance');
  16. if (instances == '' || instances.length < 1) {
  17. ui.addNotification(null, E('p', _('Instances must be configured for VRRP Groups')));
  18. }
  19. m = new form.Map('keepalived');
  20. s = m.section(form.GridSection, 'vrrp_sync_group', _('VRRP synchronization group'),
  21. _('VRRP Sync Group is an extension to VRRP protocol.') + '<br/>' +
  22. _('The main goal is to define a bundle of VRRP instance to get synchronized together') + '<br/>' +
  23. _('so that transition of one instance will be reflected to others group members'));
  24. s.anonymous = true;
  25. s.addremove = true;
  26. s.nodescriptions = true;
  27. o = s.option(form.Value, 'name', _('Name'));
  28. o.rmempty = false;
  29. o.optional = false;
  30. o.placeholder = 'name';
  31. o = s.option(form.DynamicList, 'group', _('Instance Group'));
  32. o.rmempty = false;
  33. o.optional = false;
  34. for (var i = 0; i < instances.length; i++) {
  35. o.value(instances[i]['name']);
  36. }
  37. o = s.option(form.Flag, 'smtp_alert', _('Email Notification'),
  38. _('Send email notification during state transition'));
  39. o.optional = true;
  40. o.default = false;
  41. o = s.option(form.Flag, 'global_tracking', _('Global Tracking'),
  42. _('Track interfaces, scripts and files'));
  43. o.optional = true;
  44. o.default = false;
  45. return m.render();
  46. }
  47. });