1
0

balancers.html 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. <template slot="action" slot-scope="text, balancer, index">
  10. <span>[[ index+1 ]]</span>
  11. <a-dropdown :trigger="['click']">
  12. <a-icon @click="e => e.preventDefault()" type="more"
  13. :style="{ fontSize: '16px', textDecoration: 'bold' }"></a-icon>
  14. <a-menu slot="overlay" :theme="themeSwitcher.currentTheme">
  15. <a-menu-item @click="editBalancer(index)">
  16. <a-icon type="edit"></a-icon>
  17. <span>{{ i18n "edit" }}</span>
  18. </a-menu-item>
  19. <a-menu-item @click="deleteBalancer(index)">
  20. <span :style="{ color: '#FF4D4F' }">
  21. <a-icon type="delete"></a-icon>
  22. <span>{{ i18n "delete"}}</span>
  23. </span>
  24. </a-menu-item>
  25. </a-menu>
  26. </a-dropdown>
  27. </template>
  28. <template slot="strategy" slot-scope="text, balancer, index">
  29. <a-tag :style="{ margin: '0' }" v-if="balancer.strategy=='random'" color="purple">Random</a-tag>
  30. <a-tag :style="{ margin: '0' }" v-if="balancer.strategy=='roundRobin'" color="green">Round Robin</a-tag>
  31. <a-tag :style="{ margin: '0' }" v-if="balancer.strategy=='leastLoad'" color="green">Least Load</a-tag>
  32. <a-tag :style="{ margin: '0' }" v-if="balancer.strategy=='leastPing'" color="green">Least Ping</a-tag>
  33. </template>
  34. <template slot="selector" slot-scope="text, balancer, index">
  35. <a-tag class="info-large-tag" :style="{ margin: '1' }" v-for="sel in balancer.selector">[[ sel ]]</a-tag>
  36. </template>
  37. </a-table>
  38. <a-radio-group v-if="observatoryEnable || burstObservatoryEnable" v-model="obsSettings" @change="changeObsCode"
  39. button-style="solid" :size="isMobile ? 'small' : ''">
  40. <a-radio-button value="observatory" v-if="observatoryEnable">Observatory</a-radio-button>
  41. <a-radio-button value="burstObservatory" v-if="burstObservatoryEnable">Burst Observatory</a-radio-button>
  42. </a-radio-group>
  43. <textarea :style="{ position: 'absolute', left: '-800px' }" id="obsSetting"></textarea>
  44. </a-space>
  45. </template>
  46. <template v-else>
  47. <a-empty description='{{ i18n "emptyBalancersDesc" }}' :style="{ margin: '10px' }">
  48. <a-button type="primary" icon="plus" @click="addBalancer()" :style="{ marginTop: '10px' }">
  49. <span>{{ i18n "pages.xray.balancer.addBalancer"}}</span>
  50. </a-button>
  51. </a-empty>
  52. </template>
  53. {{end}}