logo

pleroma-fe

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

settings_modal_admin_content.js (2313B)


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