1
0

balancers.html 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. {{define "settings/xray/balancers"}}
  2. <template v-if="balancersData.length > 0">
  3. <a-space direction="vertical" size="middle">
  4. <a-button type="primary" icon="plus" @click="addBalancer()">
  5. <span>{{ i18n "pages.xray.balancer.addBalancer"}}</span>
  6. </a-button>
  7. <a-table :columns="balancerColumns" bordered :row-key="r => r.key" :data-source="balancersData"
  8. :scroll="isMobile ? {} : { x: 200 }" :pagination="false" :indent-size="0"
  9. :locale='{ filterConfirm: `{{ i18n "confirm" }}`, filterReset: `{{ i18n "reset" }}` }'>
  10. <template slot="action" slot-scope="text, balancer, index">
  11. <span>[[ index+1 ]]</span>
  12. <a-dropdown :trigger="['click']">
  13. <a-icon @click="e => e.preventDefault()" type="more"
  14. :style="{ fontSize: '16px', textDecoration: 'bold' }"></a-icon>
  15. <a-menu slot="overlay" :theme="themeSwitcher.currentTheme">
  16. <a-menu-item @click="editBalancer(index)">
  17. <a-icon type="edit"></a-icon>
  18. <span>{{ i18n "edit" }}</span>
  19. </a-menu-item>
  20. <a-menu-item @click="deleteBalancer(index)">
  21. <span :style="{ color: '#FF4D4F' }">
  22. <a-icon type="delete"></a-icon>
  23. <span>{{ i18n "delete"}}</span>
  24. </span>
  25. </a-menu-item>
  26. </a-menu>
  27. </a-dropdown>
  28. </template>
  29. <template slot="strategy" slot-scope="text, balancer, index">
  30. <a-tag :style="{ margin: '0' }" v-if="balancer.strategy=='random'" color="purple">Random</a-tag>
  31. <a-tag :style="{ margin: '0' }" v-if="balancer.strategy=='roundRobin'" color="green">Round Robin</a-tag>
  32. <a-tag :style="{ margin: '0' }" v-if="balancer.strategy=='leastLoad'" color="green">Least Load</a-tag>
  33. <a-tag :style="{ margin: '0' }" v-if="balancer.strategy=='leastPing'" color="green">Least Ping</a-tag>
  34. </template>
  35. <template slot="selector" slot-scope="text, balancer, index">
  36. <a-tag class="info-large-tag" :style="{ margin: '1' }" v-for="sel in balancer.selector">[[ sel
  37. ]]</a-tag>
  38. </template>
  39. </a-table>
  40. <a-radio-group v-if="observatoryEnable || burstObservatoryEnable" v-model="obsSettings" @change="changeObsCode"
  41. button-style="solid" :size="isMobile ? 'small' : ''">
  42. <a-radio-button value="observatory" v-if="observatoryEnable">Observatory</a-radio-button>
  43. <a-radio-button value="burstObservatory" v-if="burstObservatoryEnable">Burst Observatory</a-radio-button>
  44. </a-radio-group>
  45. <textarea :style="{ position: 'absolute', left: '-800px' }" id="obsSetting"></textarea>
  46. </a-space>
  47. </template>
  48. <template v-else>
  49. <a-empty description='{{ i18n "emptyBalancersDesc" }}' :style="{ margin: '10px' }">
  50. <a-button type="primary" icon="plus" @click="addBalancer()" :style="{ marginTop: '10px' }">
  51. <span>{{ i18n "pages.xray.balancer.addBalancer"}}</span>
  52. </a-button>
  53. </a-empty>
  54. </template>
  55. {{end}}