inbound_client_table.html 3.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. {{define "client_table"}}
  2. <template slot="actions" slot-scope="text, client, index">
  3. <a-tooltip>
  4. <template slot="title">{{ i18n "qrCode" }}</template>
  5. <a-icon style="font-size: 24px;" type="qrcode" v-if="record.hasLink()" @click="showQrcode(record,index);"></a-icon>
  6. </a-tooltip>
  7. <a-tooltip>
  8. <template slot="title">{{ i18n "pages.client.edit" }}</template>
  9. <a-icon style="font-size: 24px;" type="edit" @click="openEditClient(record.id,client);"></a-icon>
  10. </a-tooltip>
  11. <a-tooltip>
  12. <template slot="title">{{ i18n "info" }}</template>
  13. <a-icon style="font-size: 24px;" type="info-circle" @click="showInfo(record,index);"></a-icon>
  14. </a-tooltip>
  15. <a-tooltip>
  16. <template slot="title">{{ i18n "pages.inbounds.resetTraffic" }}</template>
  17. <a-icon style="font-size: 24px;" type="retweet" @click="resetClientTraffic(client,record.id)" v-if="client.email.length > 0"></a-icon>
  18. </a-tooltip>
  19. <a-tooltip>
  20. <template slot="title"><span style="color: #FF4D4F"> {{ i18n "delete"}}</span></template>
  21. <a-icon style="font-size: 24px;" type="delete" v-if="isRemovable(record.id)" @click="delClient(record.id,client)"></a-icon>
  22. </a-tooltip>
  23. </template>
  24. <template slot="enable" slot-scope="text, client, index">
  25. <a-switch v-model="client.enable" @change="switchEnableClient(record.id,client)"></a-switch>
  26. </template>
  27. <template slot="client" slot-scope="text, client">
  28. [[ client.email ]]
  29. <a-tag v-if="!isClientEnabled(record, client.email)" color="red">{{ i18n "depleted" }}</a-tag>
  30. </template>
  31. <template slot="traffic" slot-scope="text, client">
  32. <a-popover :overlay-class-name="themeSwitcher.darkClass">
  33. <template slot="content" v-if="client.email">
  34. <table cellpadding="2" width="100%">
  35. <tr>
  36. <td>↑[[ sizeFormat(getUpStats(record, client.email)) ]]</td>
  37. <td>↓[[ sizeFormat(getDownStats(record, client.email)) ]]</td>
  38. </tr>
  39. <tr v-if="client.totalGB > 0">
  40. <td>{{ i18n "remained" }}</td>
  41. <td>[[ sizeFormat(client.totalGB - getUpStats(record, client.email) - getDownStats(record, client.email)) ]]</td>
  42. </tr>
  43. </table>
  44. </template>
  45. <a-tag :color="statsColor(record, client.email)">
  46. [[ sizeFormat(getUpStats(record, client.email) + getDownStats(record, client.email)) ]] /
  47. <template v-if="client.totalGB > 0">[[client._totalGB]]GB</template>
  48. <template v-else>
  49. <svg style="fill: currentColor; height: 10px;" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512"><path d="M484.4 96C407 96 349.2 164.1 320 208.5C290.8 164.1 233 96 155.6 96C69.75 96 0 167.8 0 256s69.75 160 155.6 160C233.1 416 290.8 347.9 320 303.5C349.2 347.9 407 416 484.4 416C570.3 416 640 344.2 640 256S570.3 96 484.4 96zM155.6 368C96.25 368 48 317.8 48 256s48.25-112 107.6-112c67.75 0 120.5 82.25 137.1 112C276 285.8 223.4 368 155.6 368zM484.4 368c-67.75 0-120.5-82.25-137.1-112C364 226.2 416.6 144 484.4 144C543.8 144 592 194.2 592 256S543.8 368 484.4 368z"/></svg>
  50. </template>
  51. </a-tag>
  52. </a-popover>
  53. </template>
  54. <template slot="expiryTime" slot-scope="text, client, index">
  55. <template v-if="client.expiryTime > 0">
  56. <a-tag :color="usageColor(new Date().getTime(), app.expireDiff, client.expiryTime)">
  57. [[ DateUtil.formatMillis(client._expiryTime) ]]
  58. </a-tag>
  59. </template>
  60. <a-tag v-else-if="client.expiryTime < 0" color="cyan">
  61. [[ client._expiryTime ]] {{ i18n "pages.client.days" }}
  62. </a-tag>
  63. <a-tag v-else color="green">{{ i18n "indefinite" }}</a-tag>
  64. </template>
  65. {{end}}