You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

FederationControlAction.vue 2.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <!--
  2. - @copyright 2021 Christopher Ng <chrng8@gmail.com>
  3. -
  4. - @author Christopher Ng <chrng8@gmail.com>
  5. -
  6. - @license GNU AGPL version 3 or any later version
  7. -
  8. - This program is free software: you can redistribute it and/or modify
  9. - it under the terms of the GNU Affero General Public License as
  10. - published by the Free Software Foundation, either version 3 of the
  11. - License, or (at your option) any later version.
  12. -
  13. - This program is distributed in the hope that it will be useful,
  14. - but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. - GNU Affero General Public License for more details.
  17. -
  18. - You should have received a copy of the GNU Affero General Public License
  19. - along with this program. If not, see <http://www.gnu.org/licenses/>.
  20. -
  21. -->
  22. <template>
  23. <NcActionButton :aria-label="isSupportedScope ? tooltip : tooltipDisabled"
  24. class="federation-actions__btn"
  25. :class="{ 'federation-actions__btn--active': activeScope === name }"
  26. :close-after-click="true"
  27. :disabled="!isSupportedScope"
  28. :icon="iconClass"
  29. :title="displayName"
  30. @click.stop.prevent="updateScope">
  31. {{ isSupportedScope ? tooltip : tooltipDisabled }}
  32. </NcActionButton>
  33. </template>
  34. <script>
  35. import NcActionButton from '@nextcloud/vue/dist/Components/NcActionButton.js'
  36. export default {
  37. name: 'FederationControlAction',
  38. components: {
  39. NcActionButton,
  40. },
  41. props: {
  42. activeScope: {
  43. type: String,
  44. required: true,
  45. },
  46. displayName: {
  47. type: String,
  48. required: true,
  49. },
  50. handleScopeChange: {
  51. type: Function,
  52. default: () => {},
  53. },
  54. iconClass: {
  55. type: String,
  56. required: true,
  57. },
  58. isSupportedScope: {
  59. type: Boolean,
  60. required: true,
  61. },
  62. name: {
  63. type: String,
  64. required: true,
  65. },
  66. tooltipDisabled: {
  67. type: String,
  68. default: '',
  69. },
  70. tooltip: {
  71. type: String,
  72. required: true,
  73. },
  74. },
  75. methods: {
  76. updateScope() {
  77. this.handleScopeChange(this.name)
  78. },
  79. },
  80. }
  81. </script>
  82. <style lang="scss" scoped>
  83. .federation-actions__btn {
  84. &::v-deep p {
  85. width: 150px !important;
  86. padding: 8px 0 !important;
  87. color: var(--color-main-text) !important;
  88. font-size: 12.8px !important;
  89. line-height: 1.5em !important;
  90. }
  91. }
  92. .federation-actions__btn--active {
  93. background-color: var(--color-primary-element-light) !important;
  94. box-shadow: inset 2px 0 var(--color-primary-element) !important;
  95. }
  96. </style>