logo

pleroma-fe

My custom branche(s) on git.pleroma.social/pleroma/pleroma-fe git clone https://hacktivis.me/git/pleroma-fe.git

settings_modal_admin_content.js (2282B)


  1. import TabSwitcher from 'src/components/tab_switcher/tab_switcher.jsx'
  2. import InstanceTab from './admin_tabs/instance_tab.vue'
  3. import LimitsTab from './admin_tabs/limits_tab.vue'
  4. import FrontendsTab from './admin_tabs/frontends_tab.vue'
  5. import EmojiTab from './admin_tabs/emoji_tab.vue'
  6. import { library } from '@fortawesome/fontawesome-svg-core'
  7. import {
  8. faWrench,
  9. faHand,
  10. faLaptopCode,
  11. faPaintBrush,
  12. faBell,
  13. faDownload,
  14. faEyeSlash,
  15. faInfo
  16. } from '@fortawesome/free-solid-svg-icons'
  17. library.add(
  18. faWrench,
  19. faHand,
  20. faLaptopCode,
  21. faPaintBrush,
  22. faBell,
  23. faDownload,
  24. faEyeSlash,
  25. faInfo
  26. )
  27. const SettingsModalAdminContent = {
  28. components: {
  29. TabSwitcher,
  30. InstanceTab,
  31. LimitsTab,
  32. FrontendsTab,
  33. EmojiTab
  34. },
  35. computed: {
  36. user () {
  37. return this.$store.state.users.currentUser
  38. },
  39. isLoggedIn () {
  40. return !!this.$store.state.users.currentUser
  41. },
  42. open () {
  43. return this.$store.state.interface.settingsModalState !== 'hidden'
  44. },
  45. bodyLock () {
  46. return this.$store.state.interface.settingsModalState === 'visible'
  47. },
  48. adminDbLoaded () {
  49. return this.$store.state.adminSettings.loaded
  50. },
  51. adminDescriptionsLoaded () {
  52. return this.$store.state.adminSettings.descriptions !== null
  53. },
  54. noDb () {
  55. return this.$store.state.adminSettings.dbConfigEnabled === false
  56. }
  57. },
  58. created () {
  59. if (this.user.rights.admin) {
  60. this.$store.dispatch('loadAdminStuff')
  61. }
  62. },
  63. methods: {
  64. onOpen () {
  65. const targetTab = this.$store.state.interface.settingsModalTargetTab
  66. // We're being told to open in specific tab
  67. if (targetTab) {
  68. const tabIndex = this.$refs.tabSwitcher.$slots.default().findIndex(elm => {
  69. return elm.props && elm.props['data-tab-name'] === targetTab
  70. })
  71. if (tabIndex >= 0) {
  72. this.$refs.tabSwitcher.setTab(tabIndex)
  73. }
  74. }
  75. // Clear the state of target tab, so that next time settings is opened
  76. // it doesn't force it.
  77. this.$store.dispatch('clearSettingsModalTargetTab')
  78. }
  79. },
  80. mounted () {
  81. this.onOpen()
  82. },
  83. watch: {
  84. open: function (value) {
  85. if (value) this.onOpen()
  86. }
  87. }
  88. }
  89. export default SettingsModalAdminContent