diff --git a/CHANGELOG.md b/CHANGELOG.md index 061b637b..d9b1844c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Replace regular inputs with textareas for setting welcome messages in the Settings section - Update rendering Moderation Log Messages so that all usernames are links to the pages of the corresponding users in Admin-FE - Remove Websocket based federation settings +- Move Settings tab navigation from the tabbed menu to the main sidebar menu. A separate route is created for each tab. +- Move Emoji packs configuration to the Emoji tab in the Settings section - 401 and 404 error pages updated - Remove unused components diff --git a/package.json b/package.json index 48f9ac1b..4cafe400 100644 --- a/package.json +++ b/package.json @@ -69,7 +69,7 @@ "vue": "^2.6.8", "vue-count-to": "1.0.13", "vue-i18n": "^8.9.0", - "vue-router": "3.0.2", + "vue-router": "^3.5.1", "vue-splitpane": "1.0.2", "vuedraggable": "^2.16.0", "vuex": "3.0.1", diff --git a/src/api/settings.js b/src/api/settings.js index f07ece4d..28397d13 100644 --- a/src/api/settings.js +++ b/src/api/settings.js @@ -15,7 +15,16 @@ export async function deleteInstanceDocument(name, authHost, token) { export async function fetchDescription(authHost, token) { return await request({ baseURL: baseName(authHost), - url: `/api/pleroma/admin/config/descriptions`, + url: `/api/v1/pleroma/admin/config/descriptions`, + method: 'get', + headers: authHeaders(token) + }) +} + +export async function fetchDescription2(authHost, token) { + return await request({ + baseURL: baseName(authHost), + url: `/api/v2/pleroma/admin/config/descriptions`, method: 'get', headers: authHeaders(token) }) diff --git a/src/lang/en.js b/src/lang/en.js index 04ae5356..033348f4 100644 --- a/src/lang/en.js +++ b/src/lang/en.js @@ -70,6 +70,7 @@ export default { chats: 'Chats', settings: 'Settings', moderationLog: 'Moderation Log', + relays: 'Relays', mediaProxyCache: 'MediaProxy Cache', 'emoji-packs': 'Emoji packs' }, @@ -426,6 +427,7 @@ export default { activityPub: 'ActivityPub', auth: 'Authentication', captcha: 'Captcha', + emoji: 'Emoji', frontend: 'Frontend', http: 'HTTP', mrf: 'MRF', @@ -437,11 +439,6 @@ export default { esshd: 'BBS / SSH access', rateLimiters: 'Rate limiters', other: 'Other', - relays: 'Relays', - follow: 'Follow', - followRelay: 'Follow new relay', - followedBack: 'Followed Back', - instanceUrl: 'Instance URL', success: 'Settings changed successfully!', description: 'Description', removeFromDB: 'Remove setting from the DB', @@ -483,6 +480,13 @@ export default { frontendStartedInstallation: 'Installation started', inProcess: 'In process' }, + relays: { + relays: 'Relays', + follow: 'Follow', + followRelay: 'Follow new relay', + followedBack: 'Followed Back', + instanceUrl: 'Instance URL' + }, invites: { inviteTokens: 'Invite tokens', createInviteToken: 'Generate invite token', diff --git a/src/permission.js b/src/permission.js index b7c82f5c..8e155e5b 100644 --- a/src/permission.js +++ b/src/permission.js @@ -28,7 +28,7 @@ export const beforeEachRoute = (to, from, next) => { store.dispatch('GetUserInfo').then(res => { const roles = res.data.pleroma.is_admin ? ['admin'] : [] store.dispatch('GenerateRoutes', { roles }).then(() => { - router.addRoutes(store.getters.addRouters) + store.getters.addRouters.forEach(route => router.addRoute(route)) next({ ...to, replace: true }) }) }).catch((err) => { diff --git a/src/router/index.js b/src/router/index.js index d5f6e53a..4d046318 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -21,19 +21,26 @@ import Layout from '@/views/layout/Layout' const disabledFeatures = process.env.DISABLED_FEATURES || [] const settingsDisabled = disabledFeatures.includes('settings') +const settingsChildren = () => { + return localStorage.getItem('settingsTabs') + ? JSON.parse(localStorage.getItem('settingsTabs')).map(({ label, path }) => { + return { + path, + component: () => import(`@/views/settings`), + name: label, + meta: { title: label } + } + }) + : [] +} const settings = { path: '/settings', component: Layout, - children: [ - { - path: 'index', - component: () => import('@/views/settings/index'), - name: 'Settings', - meta: { title: 'settings', icon: 'settings', noCache: true } - } - ] + name: 'Settings', + hasSubmenu: true, + meta: { title: 'settings', icon: 'el-icon-setting', noCache: true }, + children: settingsChildren() } - const statusesDisabled = disabledFeatures.includes('statuses') const statuses = { path: '/statuses', @@ -43,7 +50,7 @@ const statuses = { path: 'index', component: () => import('@/views/statuses/index'), name: 'Statuses', - meta: { title: 'statuses', icon: 'form', noCache: true } + meta: { title: 'statuses', icon: 'el-icon-chat-line-square', noCache: true } } ] } @@ -57,7 +64,7 @@ const reports = { path: 'index', component: () => import('@/views/reports/index'), name: 'Reports', - meta: { title: 'reports', icon: 'documentation', noCache: true } + meta: { title: 'reports', icon: 'el-icon-receiving', noCache: true } } ] } @@ -71,21 +78,21 @@ const invites = { path: 'index', component: () => import('@/views/invites/index'), name: 'Invites', - meta: { title: 'invites', icon: 'guide', noCache: true } + meta: { title: 'invites', icon: 'el-icon-postcard', noCache: true } } ] } -const emojiPacksDisabled = disabledFeatures.includes('emoji-packs') -const emojiPacks = { - path: '/emoji_packs', +const relaysDisabled = disabledFeatures.includes('relays') +const relays = { + path: '/relays', component: Layout, children: [ { path: 'index', - component: () => import('@/views/emojiPacks/index'), - name: 'Emoji Packs', - meta: { title: 'emoji-packs', icon: 'eye-open', noCache: true } + component: () => import('@/views/relays/index'), + name: 'Relays', + meta: { title: 'relays', icon: 'el-icon-connection', noCache: true } } ] } @@ -99,7 +106,7 @@ const moderationLog = { path: 'index', component: () => import('@/views/moderationLog/index'), name: 'Moderation Log', - meta: { title: 'moderationLog', icon: 'list', noCache: true } + meta: { title: 'moderationLog', icon: 'el-icon-notebook-2', noCache: true } } ] } @@ -113,7 +120,7 @@ const mediaProxyCache = { path: 'index', component: () => import('@/views/mediaProxyCache/index'), name: 'MediaProxy Cache', - meta: { title: 'mediaProxyCache', icon: 'example', noCache: true } + meta: { title: 'mediaProxyCache', icon: 'el-icon-coin', noCache: true } } ] } @@ -158,7 +165,8 @@ export const constantRouterMap = [ { path: '', component: Layout, - redirect: '/users/index' + redirect: '/users/index', + hidden: true } ] @@ -177,15 +185,15 @@ export const asyncRouterMap = [ path: 'index', component: () => import('@/views/users/index'), name: 'Users', - meta: { title: 'users', icon: 'peoples', noCache: true } + meta: { title: 'users', icon: 'el-icon-user', noCache: true } } ] }, ...(statusesDisabled ? [] : [statuses]), ...(reportsDisabled ? [] : [reports]), ...(invitesDisabled ? [] : [invites]), - ...(emojiPacksDisabled ? [] : [emojiPacks]), ...(moderationLogDisabled ? [] : [moderationLog]), + ...(relaysDisabled ? [] : [relays]), ...(mediaProxyCacheDisabled ? [] : [mediaProxyCache]), ...(settingsDisabled ? [] : [settings]), { diff --git a/src/store/getters.js b/src/store/getters.js index f58f0c6b..a287712d 100644 --- a/src/store/getters.js +++ b/src/store/getters.js @@ -17,6 +17,7 @@ const getters = { errorLogs: state => state.errorLog.logs, users: state => state.users.fetchedUsers, authHost: state => state.user.authHost, - settings: state => state.settings + settings: state => state.settings, + tabs: state => state.settings.tabs } export default getters diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js index 13f60efb..71ef5b5d 100644 --- a/src/store/modules/permission.js +++ b/src/store/modules/permission.js @@ -46,15 +46,10 @@ const permission = { } }, actions: { - GenerateRoutes({ commit }, data) { + GenerateRoutes({ commit }, { roles, _routesWithSettings }) { return new Promise(resolve => { - const { roles } = data - let accessedRouters - if (roles.includes('admin')) { - accessedRouters = asyncRouterMap - } else { - accessedRouters = filterAsyncRouter(asyncRouterMap, roles) - } + const routes = _routesWithSettings || asyncRouterMap + const accessedRouters = roles.includes('admin') ? routes : filterAsyncRouter(asyncRouterMap, roles) commit('SET_ROUTERS', accessedRouters) resolve() }) diff --git a/src/store/modules/settings.js b/src/store/modules/settings.js index 61738507..abe50ea7 100644 --- a/src/store/modules/settings.js +++ b/src/store/modules/settings.js @@ -9,11 +9,11 @@ import { updateInstanceDocument, updateSettings } from '@/api/settings' import { formSearchObject, parseNonTuples, parseTuples, valueHasTuples, wrapUpdatedSettings } from './normalizers' +import { tabs } from '../../utils/tabs' import _ from 'lodash' const settings = { state: { - activeTab: 'instance', configDisabled: true, frontends: [], db: {}, @@ -21,7 +21,9 @@ const settings = { instancePanel: '', loading: true, searchData: {}, + searchQuery: '', settings: {}, + tabs: [], termsOfServices: '', updatedSettings: {} }, @@ -38,9 +40,6 @@ const settings = { state.updatedSettings = updatedSettings } }, - SET_ACTIVE_TAB: (state, tab) => { - state.activeTab = tab - }, SET_DESCRIPTION: (state, data) => { state.description = data }, @@ -53,6 +52,9 @@ const settings = { SET_SEARCH: (state, searchObject) => { state.searchData = searchObject }, + SET_SEARCH_QUERY: (state, query) => { + state.searchQuery = query + }, SET_SETTINGS: (state, data) => { const newSettings = data.reduce((acc, { group, key, value }) => { const parsedValue = valueHasTuples(key, value) @@ -72,6 +74,9 @@ const settings = { state.settings = newSettings state.db = newDbSettings }, + SET_TABS: (state, tabs) => { + state.tabs = tabs + }, SET_TERMS_OF_SERVICES: (state, data) => { state.termsOfServices = data }, @@ -107,15 +112,16 @@ const settings = { async FetchSettings({ commit, getters }) { commit('SET_LOADING', true) try { - const response = await fetchSettings(getters.authHost, getters.token) - const description = await fetchDescription(getters.authHost, getters.token) - commit('SET_DESCRIPTION', description.data) - const searchObject = formSearchObject(description.data) + const settings = await fetchSettings(getters.authHost, getters.token) + commit('SET_SETTINGS', settings.data.configs) + + const { data } = await fetchDescription(getters.authHost, getters.token) + commit('SET_DESCRIPTION', data) + const searchObject = formSearchObject(data) commit('SET_SEARCH', searchObject) - commit('SET_SETTINGS', response.data.configs) + commit('SET_TABS', tabs) } catch (_e) { commit('TOGGLE_TABS', true) - commit('SET_ACTIVE_TAB', 'relays') commit('SET_LOADING', false) return } @@ -138,8 +144,8 @@ const settings = { commit('TOGGLE_REBOOT', response.data.need_reboot) commit('REMOVE_SETTING_FROM_UPDATED', { group, key, subkeys: subkeys || [] }) }, - SetActiveTab({ commit }, tab) { - commit('SET_ACTIVE_TAB', tab) + SetSearchQuery({ commit }, query) { + commit('SET_SEARCH_QUERY', query) }, async SubmitChanges({ getters, commit, state }) { const configs = Object.keys(state.updatedSettings).reduce((acc, group) => { diff --git a/src/styles/sidebar.scss b/src/styles/sidebar.scss index 688a295a..17d783c0 100644 --- a/src/styles/sidebar.scss +++ b/src/styles/sidebar.scss @@ -91,7 +91,7 @@ } .submenu-title-noDropdown { - padding-left: 10px !important; + padding-left: 8px !important; position: relative; .el-tooltip { diff --git a/src/styles/variables.scss b/src/styles/variables.scss index 50d9b3ef..bd67fc4a 100644 --- a/src/styles/variables.scss +++ b/src/styles/variables.scss @@ -19,7 +19,7 @@ $menuHover:#263445; $subMenuBg:#1f2d3d; $subMenuHover:#001528; -$sideBarWidth: 180px; +$sideBarWidth: 205px; // the :export directive is the magic sauce for webpack :export { diff --git a/src/utils/tabs.js b/src/utils/tabs.js new file mode 100644 index 00000000..35b24b76 --- /dev/null +++ b/src/utils/tabs.js @@ -0,0 +1,22 @@ +export const tabs = [ + { label: 'ActivityPub', path: 'activity-pub', tab: ':activity_pub' }, + { label: 'Authentication', path: 'authentication', tab: ':authentication' }, + { label: 'Captcha', path: 'captcha', tab: ':captcha' }, + { label: 'BBS / SSH access', path: 'esshd', tab: ':esshd' }, + { label: 'Emoji', path: 'emoji', tab: ':emoji' }, + { label: 'Frontend', path: 'frontend', tab: ':frontend' }, + { label: 'Gopher', path: 'gopher', tab: ':gopher' }, + { label: 'HTTP', path: 'http', tab: ':http' }, + { label: 'Instance', path: 'instance', tab: ':instance' }, + { label: 'Job queue', path: 'job-queue', tab: ':job_queue' }, + { label: 'Link Formatter', path: 'link-formatter', tab: ':link_formatter' }, + { label: 'Logger', path: 'logger', tab: ':logger' }, + { label: 'Mailer', path: 'mailer', tab: ':mailer' }, + { label: 'Media Proxy', path: 'media-proxy', tab: ':media_proxy' }, + { label: 'Metadata', path: 'metadata', tab: ':metadata' }, + { label: 'MRF', path: 'mrf', tab: ':mrf' }, + { label: 'Rate limiters', path: 'rate-limiters', tab: ':rate_limiters' }, + { label: 'Web push encryption', path: 'web-push', tab: ':web_push' }, + { label: 'Upload', path: 'upload', tab: ':upload' }, + { label: 'Other', path: 'other', tab: ':other' } +] diff --git a/src/views/emojiPacks/components/LocalEmojiPack.vue b/src/views/emojiPacks/LocalEmojiPack.vue similarity index 100% rename from src/views/emojiPacks/components/LocalEmojiPack.vue rename to src/views/emojiPacks/LocalEmojiPack.vue diff --git a/src/views/emojiPacks/components/NewEmojiUploader.vue b/src/views/emojiPacks/NewEmojiUploader.vue similarity index 100% rename from src/views/emojiPacks/components/NewEmojiUploader.vue rename to src/views/emojiPacks/NewEmojiUploader.vue diff --git a/src/views/emojiPacks/components/RemoteEmojiPack.vue b/src/views/emojiPacks/RemoteEmojiPack.vue similarity index 100% rename from src/views/emojiPacks/components/RemoteEmojiPack.vue rename to src/views/emojiPacks/RemoteEmojiPack.vue diff --git a/src/views/emojiPacks/components/SingleEmojiEditor.vue b/src/views/emojiPacks/SingleEmojiEditor.vue similarity index 100% rename from src/views/emojiPacks/components/SingleEmojiEditor.vue rename to src/views/emojiPacks/SingleEmojiEditor.vue diff --git a/src/views/layout/components/Sidebar/Item.vue b/src/views/layout/components/Sidebar/Item.vue index a19a4288..c0e49049 100644 --- a/src/views/layout/components/Sidebar/Item.vue +++ b/src/views/layout/components/Sidebar/Item.vue @@ -1,9 +1,9 @@ + + diff --git a/src/views/layout/components/Sidebar/index.vue b/src/views/layout/components/Sidebar/index.vue index e52ae6b6..f57ebf17 100644 --- a/src/views/layout/components/Sidebar/index.vue +++ b/src/views/layout/components/Sidebar/index.vue @@ -7,6 +7,7 @@ :text-color="variables.menuText" :active-text-color="variables.menuActiveText" mode="vertical" + @open="handleOpen" > @@ -17,13 +18,17 @@ import { mapGetters } from 'vuex' import SidebarItem from './SidebarItem' import variables from '@/styles/variables.scss' +import router from '@/router' +import { asyncRouterMap } from '@/router' export default { components: { SidebarItem }, computed: { ...mapGetters([ 'permission_routers', - 'sidebar' + 'roles', + 'sidebar', + 'tabs' ]), variables() { return variables @@ -34,6 +39,49 @@ export default { }, mounted() { this.$store.dispatch('FetchOpenReportsCount') + }, + methods: { + getMergedRoutes() { + const routes = router.getRoutes().filter(item => !item.hidden) + return routes.reduce((acc, element) => { + if (!element.parent || element.parent.path !== '/settings') { + return acc + } else { + const index = acc.findIndex(route => route.path === '/settings') + acc[index] = { ...acc[index], children: [...acc[index].children, element] } + return acc + } + }, [...asyncRouterMap]) + }, + async handleOpen($event) { + if ($event === '/settings') { + if (!localStorage.getItem('settingsTabs')) { + await this.$store.dispatch('FetchSettings') + const menuItems = this.tabs + localStorage.setItem('settingsTabs', JSON.stringify(menuItems)) + + menuItems.forEach(({ label, path }) => { + router.addRoute('Settings', { + path, + component: () => import(`@/views/settings`), + name: label, + meta: { title: label } + }) + }) + const routes = this.getMergedRoutes() + this.$store.dispatch('GenerateRoutes', { roles: this.roles, _routesWithSettings: routes }) + } + let isRequesting = true + const step = () => { + document.querySelector('#settings').scrollIntoView({ block: 'start', behavior: 'smooth' }) + if (isRequesting) requestAnimationFrame(step) + } + requestAnimationFrame(step) + setTimeout(() => { + isRequesting = false + }, 300) // this equals to the hide-timeout of the el-submenu + } + } } } diff --git a/src/views/moderationLog/index.vue b/src/views/moderationLog/index.vue index c8c350c4..5eeef28f 100644 --- a/src/views/moderationLog/index.vue +++ b/src/views/moderationLog/index.vue @@ -197,9 +197,6 @@ h1 { .router-link { text-decoration: none; } -.search-container { - text-align: right; -} .pagination { text-align: center; } diff --git a/src/views/settings/components/Relays.vue b/src/views/relays/index.vue similarity index 75% rename from src/views/settings/components/Relays.vue rename to src/views/relays/index.vue index 4ac29042..2c7bb7d8 100644 --- a/src/views/settings/components/Relays.vue +++ b/src/views/relays/index.vue @@ -1,15 +1,21 @@ diff --git a/src/views/settings/components/Authentication.vue b/src/views/settings/components/Authentication.vue index 006fdf0c..e5fdd074 100644 --- a/src/views/settings/components/Authentication.vue +++ b/src/views/settings/components/Authentication.vue @@ -81,6 +81,18 @@ export default { }, pleromaAuthenticatorData() { return _.get(this.settings.settings, [':pleroma', 'Pleroma.Web.Auth.Authenticator']) || {} + }, + searchQuery() { + return this.$store.state.settings.searchQuery + } + }, + mounted() { + if (this.searchQuery.length > 0) { + const selectedSetting = document.querySelector(`[data-search="${this.searchQuery}"]`) + if (selectedSetting) { + selectedSetting.scrollIntoView({ block: 'start', behavior: 'smooth' }) + } + this.$store.dispatch('SetSearchQuery', '') } }, methods: { @@ -100,6 +112,6 @@ export default { diff --git a/src/views/settings/components/Captcha.vue b/src/views/settings/components/Captcha.vue index f39c076f..ba5f4cd0 100644 --- a/src/views/settings/components/Captcha.vue +++ b/src/views/settings/components/Captcha.vue @@ -61,6 +61,18 @@ export default { }, loading() { return this.settings.loading + }, + searchQuery() { + return this.$store.state.settings.searchQuery + } + }, + mounted() { + if (this.searchQuery.length > 0) { + const selectedSetting = document.querySelector(`[data-search="${this.searchQuery}"]`) + if (selectedSetting) { + selectedSetting.scrollIntoView({ block: 'start', behavior: 'smooth' }) + } + this.$store.dispatch('SetSearchQuery', '') } }, methods: { @@ -80,6 +92,6 @@ export default { diff --git a/src/views/emojiPacks/index.vue b/src/views/settings/components/Emoji.vue similarity index 73% rename from src/views/emojiPacks/index.vue rename to src/views/settings/components/Emoji.vue index 90c5e562..0707dc20 100644 --- a/src/views/emojiPacks/index.vue +++ b/src/views/settings/components/Emoji.vue @@ -1,9 +1,5 @@ diff --git a/src/views/settings/components/Esshd.vue b/src/views/settings/components/Esshd.vue index a3141563..59b35e97 100644 --- a/src/views/settings/components/Esshd.vue +++ b/src/views/settings/components/Esshd.vue @@ -51,6 +51,18 @@ export default { }, loading() { return this.settings.loading + }, + searchQuery() { + return this.$store.state.settings.searchQuery + } + }, + mounted() { + if (this.searchQuery.length > 0) { + const selectedSetting = document.querySelector(`[data-search="${this.searchQuery}"]`) + if (selectedSetting) { + selectedSetting.scrollIntoView({ block: 'start', behavior: 'smooth' }) + } + this.$store.dispatch('SetSearchQuery', '') } }, methods: { @@ -76,6 +88,6 @@ export default { diff --git a/src/views/settings/components/Frontend.vue b/src/views/settings/components/Frontend.vue index 574051be..e37c43b9 100644 --- a/src/views/settings/components/Frontend.vue +++ b/src/views/settings/components/Frontend.vue @@ -18,10 +18,6 @@ - - - - @@ -65,12 +61,6 @@ export default { chatData() { return _.get(this.settings.settings, [':pleroma', ':chat']) || {} }, - emoji() { - return this.settings.description.find(setting => setting.key === ':emoji') - }, - emojiData() { - return _.get(this.settings.settings, [':pleroma', ':emoji']) || {} - }, frontend() { return this.settings.description.find(setting => setting.key === ':frontend_configurations') }, @@ -122,6 +112,9 @@ export default { preloadData() { return _.get(this.settings.settings, [':pleroma', 'Pleroma.Web.Preload']) || {} }, + searchQuery() { + return this.$store.state.settings.searchQuery + }, staticFe() { return this.settings.description.find(setting => setting.key === ':static_fe') }, @@ -129,6 +122,15 @@ export default { return _.get(this.settings.settings, [':pleroma', ':static_fe']) || {} } }, + mounted() { + if (this.searchQuery.length > 0) { + const selectedSetting = document.querySelector(`[data-search="${this.searchQuery}"]`) + if (selectedSetting) { + selectedSetting.scrollIntoView({ block: 'start', behavior: 'smooth' }) + } + this.$store.dispatch('SetSearchQuery', '') + } + }, methods: { async onSubmit() { try { @@ -146,6 +148,6 @@ export default { diff --git a/src/views/settings/components/Gopher.vue b/src/views/settings/components/Gopher.vue index 2382b987..630d36d9 100644 --- a/src/views/settings/components/Gopher.vue +++ b/src/views/settings/components/Gopher.vue @@ -51,6 +51,18 @@ export default { }, loading() { return this.settings.loading + }, + searchQuery() { + return this.$store.state.settings.searchQuery + } + }, + mounted() { + if (this.searchQuery.length > 0) { + const selectedSetting = document.querySelector(`[data-search="${this.searchQuery}"]`) + if (selectedSetting) { + selectedSetting.scrollIntoView({ block: 'start', behavior: 'smooth' }) + } + this.$store.dispatch('SetSearchQuery', '') } }, methods: { @@ -70,6 +82,6 @@ export default { diff --git a/src/views/settings/components/Http.vue b/src/views/settings/components/Http.vue index 87a6d94b..e64536ed 100644 --- a/src/views/settings/components/Http.vue +++ b/src/views/settings/components/Http.vue @@ -76,6 +76,9 @@ export default { loading() { return this.settings.loading }, + searchQuery() { + return this.$store.state.settings.searchQuery + }, webCacheTtl() { return this.settings.description.find(setting => setting.key === ':web_cache_ttl') }, @@ -83,6 +86,15 @@ export default { return _.get(this.settings.settings, [':pleroma', ':web_cache_ttl']) || {} } }, + mounted() { + if (this.searchQuery.length > 0) { + const selectedSetting = document.querySelector(`[data-search="${this.searchQuery}"]`) + if (selectedSetting) { + selectedSetting.scrollIntoView({ block: 'start', behavior: 'smooth' }) + } + this.$store.dispatch('SetSearchQuery', '') + } + }, methods: { async onSubmit() { try { @@ -100,6 +112,6 @@ export default { diff --git a/src/views/settings/components/Inputs.vue b/src/views/settings/components/Inputs.vue index e052fefd..aa43bb1c 100644 --- a/src/views/settings/components/Inputs.vue +++ b/src/views/settings/components/Inputs.vue @@ -394,6 +394,6 @@ export default { diff --git a/src/views/settings/components/Instance.vue b/src/views/settings/components/Instance.vue index f751e8dc..9e947667 100644 --- a/src/views/settings/components/Instance.vue +++ b/src/views/settings/components/Instance.vue @@ -146,6 +146,9 @@ export default { restrictUnauthenticatedData() { return _.get(this.settings.settings, [':pleroma', ':restrict_unauthenticated']) || {} }, + searchQuery() { + return this.$store.state.settings.searchQuery + }, scheduledActivity() { return this.$store.state.settings.description.find(setting => setting.key === 'Pleroma.ScheduledActivity') }, @@ -172,6 +175,14 @@ export default { } }, async mounted() { + if (this.searchQuery.length > 0) { + const selectedSetting = document.querySelector(`[data-search="${this.searchQuery}"]`) + if (selectedSetting) { + selectedSetting.scrollIntoView({ block: 'start', behavior: 'smooth' }) + } + this.$store.dispatch('SetSearchQuery', '') + } + await this.$store.dispatch('FetchInstanceDocument', 'instance-panel') }, methods: { @@ -198,6 +209,6 @@ export default { diff --git a/src/views/settings/components/JobQueue.vue b/src/views/settings/components/JobQueue.vue index 1a07356d..a4b4dac0 100644 --- a/src/views/settings/components/JobQueue.vue +++ b/src/views/settings/components/JobQueue.vue @@ -96,6 +96,9 @@ export default { poolsData() { return _.get(this.settings.settings, [':pleroma', ':pools']) || {} }, + searchQuery() { + return this.$store.state.settings.searchQuery + }, workers() { return this.settings.description.find(setting => setting.key === ':workers') }, @@ -103,6 +106,15 @@ export default { return _.get(this.settings.settings, [':pleroma', ':workers']) || {} } }, + mounted() { + if (this.searchQuery.length > 0) { + const selectedSetting = document.querySelector(`[data-search="${this.searchQuery}"]`) + if (selectedSetting) { + selectedSetting.scrollIntoView({ block: 'start', behavior: 'smooth' }) + } + this.$store.dispatch('SetSearchQuery', '') + } + }, methods: { async onSubmit() { try { @@ -120,6 +132,6 @@ export default { diff --git a/src/views/settings/components/LinkFormatter.vue b/src/views/settings/components/LinkFormatter.vue index c92f1a4f..36bd30a3 100644 --- a/src/views/settings/components/LinkFormatter.vue +++ b/src/views/settings/components/LinkFormatter.vue @@ -51,6 +51,18 @@ export default { }, loading() { return this.settings.loading + }, + searchQuery() { + return this.$store.state.settings.searchQuery + } + }, + mounted() { + if (this.searchQuery.length > 0) { + const selectedSetting = document.querySelector(`[data-search="${this.searchQuery}"]`) + if (selectedSetting) { + selectedSetting.scrollIntoView({ block: 'start', behavior: 'smooth' }) + } + this.$store.dispatch('SetSearchQuery', '') } }, methods: { @@ -70,6 +82,6 @@ export default { diff --git a/src/views/settings/components/Logger.vue b/src/views/settings/components/Logger.vue index b350c07d..cad76df5 100644 --- a/src/views/settings/components/Logger.vue +++ b/src/views/settings/components/Logger.vue @@ -76,6 +76,9 @@ export default { loggerData() { return _.get(this.settings.settings, [':logger', ':backends']) || {} }, + searchQuery() { + return this.$store.state.settings.searchQuery + }, quack() { return this.settings.description.find(setting => setting.group === ':quack') }, @@ -83,6 +86,15 @@ export default { return _.get(this.settings.settings, [':quack']) || {} } }, + mounted() { + if (this.searchQuery.length > 0) { + const selectedSetting = document.querySelector(`[data-search="${this.searchQuery}"]`) + if (selectedSetting) { + selectedSetting.scrollIntoView({ block: 'start', behavior: 'smooth' }) + } + this.$store.dispatch('SetSearchQuery', '') + } + }, methods: { async onSubmit() { try { @@ -100,6 +112,6 @@ export default { diff --git a/src/views/settings/components/MRF.vue b/src/views/settings/components/MRF.vue index 36e548c2..40d75929 100644 --- a/src/views/settings/components/MRF.vue +++ b/src/views/settings/components/MRF.vue @@ -51,6 +51,18 @@ export default { }, mrfSettings() { return this.settings.description.filter(el => el.tab === 'mrf') + }, + searchQuery() { + return this.$store.state.settings.searchQuery + } + }, + mounted() { + if (this.searchQuery.length > 0) { + const selectedSetting = document.querySelector(`[data-search="${this.searchQuery}"]`) + if (selectedSetting) { + selectedSetting.scrollIntoView({ block: 'start', behavior: 'smooth' }) + } + this.$store.dispatch('SetSearchQuery', '') } }, methods: { @@ -83,6 +95,6 @@ export default { diff --git a/src/views/settings/components/Mailer.vue b/src/views/settings/components/Mailer.vue index ee0e8475..3252dd69 100644 --- a/src/views/settings/components/Mailer.vue +++ b/src/views/settings/components/Mailer.vue @@ -82,6 +82,9 @@ export default { newUsersDigestEmailData() { return _.get(this.settings.settings, [':pleroma', 'Pleroma.Emails.NewUsersDigestEmail']) || {} }, + searchQuery() { + return this.$store.state.settings.searchQuery + }, swoosh() { return this.settings.description.find(setting => setting.group === ':swoosh') }, @@ -95,6 +98,15 @@ export default { return _.get(this.settings.settings, [':pleroma', 'Pleroma.Emails.UserEmail']) || {} } }, + mounted() { + if (this.searchQuery.length > 0) { + const selectedSetting = document.querySelector(`[data-search="${this.searchQuery}"]`) + if (selectedSetting) { + selectedSetting.scrollIntoView({ block: 'start', behavior: 'smooth' }) + } + this.$store.dispatch('SetSearchQuery', '') + } + }, methods: { async onSubmit() { try { @@ -112,6 +124,6 @@ export default { diff --git a/src/views/settings/components/MediaProxy.vue b/src/views/settings/components/MediaProxy.vue index 3c9ebc47..596c1dd4 100644 --- a/src/views/settings/components/MediaProxy.vue +++ b/src/views/settings/components/MediaProxy.vue @@ -76,6 +76,9 @@ export default { mediaProxyData() { return _.get(this.settings.settings, [':pleroma', ':media_proxy']) || {} }, + searchQuery() { + return this.$store.state.settings.searchQuery + }, scriptInvalidation() { return this.settings.description.find(setting => setting.key === 'Pleroma.Web.MediaProxy.Invalidation.Script') }, @@ -83,6 +86,15 @@ export default { return _.get(this.settings.settings, [':pleroma', 'Pleroma.Web.MediaProxy.Invalidation.Script']) || {} } }, + mounted() { + if (this.searchQuery.length > 0) { + const selectedSetting = document.querySelector(`[data-search="${this.searchQuery}"]`) + if (selectedSetting) { + selectedSetting.scrollIntoView({ block: 'start', behavior: 'smooth' }) + } + this.$store.dispatch('SetSearchQuery', '') + } + }, methods: { async onSubmit() { try { @@ -100,6 +112,6 @@ export default { diff --git a/src/views/settings/components/Metadata.vue b/src/views/settings/components/Metadata.vue index 3326bb6f..29549930 100644 --- a/src/views/settings/components/Metadata.vue +++ b/src/views/settings/components/Metadata.vue @@ -56,6 +56,9 @@ export default { metadataData() { return _.get(this.settings.settings, [':pleroma', 'Pleroma.Web.Metadata']) || {} }, + searchQuery() { + return this.$store.state.settings.searchQuery + }, richMedia() { return this.settings.description.find(setting => setting.key === ':rich_media') }, @@ -63,6 +66,15 @@ export default { return _.get(this.settings.settings, [':pleroma', ':rich_media']) || {} } }, + mounted() { + if (this.searchQuery.length > 0) { + const selectedSetting = document.querySelector(`[data-search="${this.searchQuery}"]`) + if (selectedSetting) { + selectedSetting.scrollIntoView({ block: 'start', behavior: 'smooth' }) + } + this.$store.dispatch('SetSearchQuery', '') + } + }, methods: { async onSubmit() { try { @@ -80,6 +92,6 @@ export default { diff --git a/src/views/settings/components/Other.vue b/src/views/settings/components/Other.vue index 86a5507e..d507c648 100644 --- a/src/views/settings/components/Other.vue +++ b/src/views/settings/components/Other.vue @@ -110,6 +110,9 @@ export default { remoteIpData() { return _.get(this.settings.settings, [':pleroma', 'Pleroma.Web.Plugs.RemoteIp']) || {} }, + searchQuery() { + return this.$store.state.settings.searchQuery + }, termsOfServicesContent: { get() { return this.$store.state.settings.termsOfServices @@ -120,6 +123,14 @@ export default { } }, async mounted() { + if (this.searchQuery.length > 0) { + const selectedSetting = document.querySelector(`[data-search="${this.searchQuery}"]`) + if (selectedSetting) { + selectedSetting.scrollIntoView({ block: 'start', behavior: 'smooth' }) + } + this.$store.dispatch('SetSearchQuery', '') + } + await this.$store.dispatch('FetchInstanceDocument', 'terms-of-service') }, methods: { @@ -146,6 +157,6 @@ export default { diff --git a/src/views/settings/components/RateLimiters.vue b/src/views/settings/components/RateLimiters.vue index 42b84782..f886ac16 100644 --- a/src/views/settings/components/RateLimiters.vue +++ b/src/views/settings/components/RateLimiters.vue @@ -51,6 +51,18 @@ export default { }, loading() { return this.$store.state.settings.loading + }, + searchQuery() { + return this.$store.state.settings.searchQuery + } + }, + mounted() { + if (this.searchQuery.length > 0) { + const selectedSetting = document.querySelector(`[data-search="${this.searchQuery}"]`) + if (selectedSetting) { + selectedSetting.scrollIntoView({ block: 'start', behavior: 'smooth' }) + } + this.$store.dispatch('SetSearchQuery', '') } }, methods: { @@ -70,6 +82,6 @@ export default { diff --git a/src/views/settings/components/Setting.vue b/src/views/settings/components/Setting.vue index 28080b21..b7e7a7f6 100644 --- a/src/views/settings/components/Setting.vue +++ b/src/views/settings/components/Setting.vue @@ -179,6 +179,6 @@ export default { diff --git a/src/views/settings/components/Upload.vue b/src/views/settings/components/Upload.vue index 2251df24..144ca944 100644 --- a/src/views/settings/components/Upload.vue +++ b/src/views/settings/components/Upload.vue @@ -72,6 +72,9 @@ export default { s3Data() { return _.get(this.settings.settings, [':ex_aws', ':s3']) || {} }, + searchQuery() { + return this.$store.state.settings.searchQuery + }, showUploadersS3() { const uploader = _.get(this.settings.settings, [':pleroma', 'Pleroma.Upload', ':uploader']) return uploader === 'Pleroma.Uploaders.S3' @@ -111,6 +114,15 @@ export default { return _.get(this.settings.settings, [':pleroma', 'Pleroma.Upload.Filter.AnonymizeFilename']) || {} } }, + mounted() { + if (this.searchQuery.length > 0) { + const selectedSetting = document.querySelector(`[data-search="${this.searchQuery}"]`) + if (selectedSetting) { + selectedSetting.scrollIntoView({ block: 'start', behavior: 'smooth' }) + } + this.$store.dispatch('SetSearchQuery', '') + } + }, methods: { async onSubmit() { try { @@ -128,6 +140,6 @@ export default { diff --git a/src/views/settings/components/WebPush.vue b/src/views/settings/components/WebPush.vue index c84cae18..f19ba9bb 100644 --- a/src/views/settings/components/WebPush.vue +++ b/src/views/settings/components/WebPush.vue @@ -46,6 +46,9 @@ export default { loading() { return this.settings.loading }, + searchQuery() { + return this.$store.state.settings.searchQuery + }, vapidDetails() { return this.settings.description.find(setting => setting.key === ':vapid_details') }, @@ -53,6 +56,15 @@ export default { return _.get(this.settings.settings, [':web_push_encryption', ':vapid_details']) || {} } }, + mounted() { + if (this.searchQuery.length > 0) { + const selectedSetting = document.querySelector(`[data-search="${this.searchQuery}"]`) + if (selectedSetting) { + selectedSetting.scrollIntoView({ block: 'start', behavior: 'smooth' }) + } + this.$store.dispatch('SetSearchQuery', '') + } + }, methods: { async onSubmit() { try { @@ -70,6 +82,6 @@ export default { diff --git a/src/views/settings/components/index.js b/src/views/settings/components/index.js index 75f10e33..8d0e6348 100644 --- a/src/views/settings/components/index.js +++ b/src/views/settings/components/index.js @@ -1,6 +1,7 @@ export { default as ActivityPub } from './ActivityPub' export { default as Authentication } from './Authentication' export { default as Captcha } from './Captcha' +export { default as Emoji } from './Emoji' export { default as Esshd } from './Esshd' export { default as Frontend } from './Frontend' export { default as Gopher } from './Gopher' @@ -15,6 +16,5 @@ export { default as Metadata } from './Metadata' export { default as Mrf } from './MRF' export { default as Other } from './Other' export { default as RateLimiters } from './RateLimiters' -export { default as Relays } from './Relays' export { default as Upload } from './Upload' export { default as WebPush } from './WebPush' diff --git a/src/views/settings/components/inputComponents/BooleanCombinedInput.vue b/src/views/settings/components/inputComponents/BooleanCombinedInput.vue index e47ade3d..173daf72 100644 --- a/src/views/settings/components/inputComponents/BooleanCombinedInput.vue +++ b/src/views/settings/components/inputComponents/BooleanCombinedInput.vue @@ -115,6 +115,6 @@ export default { diff --git a/src/views/settings/components/inputComponents/EditableKeywordInput.vue b/src/views/settings/components/inputComponents/EditableKeywordInput.vue index 727ff0da..a3727547 100644 --- a/src/views/settings/components/inputComponents/EditableKeywordInput.vue +++ b/src/views/settings/components/inputComponents/EditableKeywordInput.vue @@ -192,6 +192,6 @@ export default { diff --git a/src/views/settings/components/inputComponents/EditorInput.vue b/src/views/settings/components/inputComponents/EditorInput.vue index df2ca77c..3e397b7d 100644 --- a/src/views/settings/components/inputComponents/EditorInput.vue +++ b/src/views/settings/components/inputComponents/EditorInput.vue @@ -202,6 +202,6 @@ export default { diff --git a/src/views/settings/components/inputComponents/IconsInput.vue b/src/views/settings/components/inputComponents/IconsInput.vue index 1b4f1e9d..2aeaaf12 100644 --- a/src/views/settings/components/inputComponents/IconsInput.vue +++ b/src/views/settings/components/inputComponents/IconsInput.vue @@ -103,6 +103,6 @@ export default { diff --git a/src/views/settings/components/inputComponents/ImageUploadInput.vue b/src/views/settings/components/inputComponents/ImageUploadInput.vue index f54b4190..08dc1464 100644 --- a/src/views/settings/components/inputComponents/ImageUploadInput.vue +++ b/src/views/settings/components/inputComponents/ImageUploadInput.vue @@ -124,7 +124,7 @@ export default { diff --git a/src/views/settings/components/inputComponents/ProxyUrlInput.vue b/src/views/settings/components/inputComponents/ProxyUrlInput.vue index c2ee2381..6979619d 100644 --- a/src/views/settings/components/inputComponents/ProxyUrlInput.vue +++ b/src/views/settings/components/inputComponents/ProxyUrlInput.vue @@ -99,6 +99,6 @@ export default { diff --git a/src/views/settings/components/inputComponents/PruneInput.vue b/src/views/settings/components/inputComponents/PruneInput.vue index 7864a156..24651ee7 100644 --- a/src/views/settings/components/inputComponents/PruneInput.vue +++ b/src/views/settings/components/inputComponents/PruneInput.vue @@ -77,6 +77,6 @@ export default { diff --git a/src/views/settings/components/inputComponents/RateLimitInput.vue b/src/views/settings/components/inputComponents/RateLimitInput.vue index 18deaf0d..2da336ac 100644 --- a/src/views/settings/components/inputComponents/RateLimitInput.vue +++ b/src/views/settings/components/inputComponents/RateLimitInput.vue @@ -148,6 +148,6 @@ export default { diff --git a/src/views/settings/components/inputComponents/RegInvitesInput.vue b/src/views/settings/components/inputComponents/RegInvitesInput.vue index 79e629cd..63f2cc4c 100644 --- a/src/views/settings/components/inputComponents/RegInvitesInput.vue +++ b/src/views/settings/components/inputComponents/RegInvitesInput.vue @@ -69,6 +69,6 @@ export default { diff --git a/src/views/settings/components/inputComponents/SelectInputWithReducedLabels.vue b/src/views/settings/components/inputComponents/SelectInputWithReducedLabels.vue index 9b6b6140..62cf62a1 100644 --- a/src/views/settings/components/inputComponents/SelectInputWithReducedLabels.vue +++ b/src/views/settings/components/inputComponents/SelectInputWithReducedLabels.vue @@ -110,6 +110,6 @@ export default { diff --git a/src/views/settings/components/inputComponents/SenderInput.vue b/src/views/settings/components/inputComponents/SenderInput.vue index 3e303c8a..60799e1d 100644 --- a/src/views/settings/components/inputComponents/SenderInput.vue +++ b/src/views/settings/components/inputComponents/SenderInput.vue @@ -93,6 +93,6 @@ export default { diff --git a/src/views/settings/components/inputComponents/SpecificMultipleSelect.vue b/src/views/settings/components/inputComponents/SpecificMultipleSelect.vue index a9fb60eb..36beddff 100644 --- a/src/views/settings/components/inputComponents/SpecificMultipleSelect.vue +++ b/src/views/settings/components/inputComponents/SpecificMultipleSelect.vue @@ -62,6 +62,6 @@ export default { diff --git a/src/views/settings/components/tabs.js b/src/views/settings/components/tabs.js index e3a98a3c..19dccb91 100644 --- a/src/views/settings/components/tabs.js +++ b/src/views/settings/components/tabs.js @@ -16,9 +16,13 @@ export const tabs = description => { label: 'settings.captcha', settings: ['Pleroma.Captcha', 'Pleroma.Captcha.Kocaptcha'] }, + 'emoji': { + label: 'settings.emoji', + settings: [':emoji'] + }, 'frontend': { label: 'settings.frontend', - settings: [':assets', ':chat', ':frontends', ':emoji', ':frontend_configurations', ':markup', ':static_fe'] + settings: [':assets', ':chat', ':frontends', ':emoji', ':frontend_configurations', ':markup', ':static_fe', 'Pleroma.Web.Preload'] }, 'gopher': { label: 'settings.gopher', @@ -64,10 +68,6 @@ export const tabs = description => { label: 'settings.rateLimiters', settings: [':rate_limit'] }, - 'relays': { - label: 'settings.relays', - settings: ['relays'] - }, 'web-push': { label: 'settings.webPush', settings: [':vapid_details'] diff --git a/src/views/settings/index.vue b/src/views/settings/index.vue index 08f0cb64..52816107 100644 --- a/src/views/settings/index.vue +++ b/src/views/settings/index.vue @@ -4,7 +4,7 @@
-
+

{{ $t('settings.settings') }}

- - - - - +

{{ $t('settings.settings') }}

-
- -
- - - - - - - - - - - - - - - - - - - - +
+ +
+
diff --git a/src/views/styles/main.scss b/src/views/styles/main.scss new file mode 100644 index 00000000..042928d8 --- /dev/null +++ b/src/views/styles/main.scss @@ -0,0 +1,31 @@ +@mixin relays { + .follow-relay { + width: 350px; + margin-right: 7px; + } + .relays-container { + margin: 0 15px; + } + .relays-header-container { + display: flex; + align-items: center; + justify-content: space-between; + } + @media only screen and (max-width:480px) { + .follow-relay { + width: 75%; + margin-right: 5px; + input { + width: 100%; + } + } + .follow-relay-container { + display: flex; + justify-content: space-between; + margin: 0 5px; + } + .relays-container { + margin: 0 10px; + } + } +} \ No newline at end of file diff --git a/src/views/settings/styles/main.scss b/src/views/styles/settings.scss similarity index 87% rename from src/views/settings/styles/main.scss rename to src/views/styles/settings.scss index 5858267b..80b20485 100644 --- a/src/views/settings/styles/main.scss +++ b/src/views/styles/settings.scss @@ -30,7 +30,8 @@ height: 2px; } .docs-search-container { - float: right; + display: flex; + justify-content: flex-end; margin-right: 30px; } .editable-keyword-container { @@ -68,10 +69,6 @@ padding: 2px 3px; } } - .follow-relay { - width: 350px; - margin-right: 7px; - } .form-container { margin-bottom: 80px; } @@ -271,9 +268,6 @@ right: 0; z-index: 2000; } - .relays-container { - margin: 0 15px; - } .replacement-input { width: 80%; margin-left: 8px; @@ -325,9 +319,6 @@ .header-sidebar-closed { max-width: 1728px; } - .settings-header-container { - height: 87px; - } .settings-search-input { width: 350px; margin-left: 5px; @@ -457,18 +448,6 @@ .divider .thick-line { height: 2px; } - .follow-relay { - width: 75%; - margin-right: 5px; - input { - width: 100%; - } - } - .follow-relay-container { - display: flex; - justify-content: space-between; - margin: 0 5px; - } .frontend-container { margin: 0 15px 10px 15px; .description-container { @@ -515,13 +494,6 @@ .limit-input { width: 45%; } - .nav-container { - display: flex; - height: 36px; - justify-content: space-between; - align-items: center; - margin: 15px; - } .proxy-url-input { flex-direction: column; align-items: flex-start; @@ -567,19 +539,9 @@ display: inline-block; margin: 10px 15px 15px 15px; } - .docs-search-container { - float: right; - } .settings-search-input { - width: 100%; - margin-left: 0; - } - .settings-search-input-container { - margin: 0 15px 15px 15px; - } - .settings-menu { - width: 163px; - margin-right: 5px; + margin: 0 15px 25px 15px; + width: stretch; } .socks5-checkbox-container { width: 100%; @@ -660,16 +622,15 @@ width: 40%; margin-right: 4px } - .relays-container { - margin: 0 10px; - } .replacement-input { width: 60%; margin-left: 4px; margin-right: 5px } .settings-header-container { - height: 45px; + display: flex; + justify-content: space-between; + margin-right: 15px; } .value-input { width: 60%; @@ -677,6 +638,7 @@ margin-right: 8px } } + @media only screen and (max-width:818px) and (min-width: 481px) { .delete-setting-button { margin: 4px 0 0 10px; @@ -708,13 +670,6 @@ display: flex; justify-content: space-between; } - .nav-container { - display: flex; - height: 36px; - justify-content: space-between; - align-items: center; - margin: 15px 30px 15px 15px; - } .rate-limit-content { width: 65%; } @@ -725,7 +680,14 @@ float: right; } .settings-header-container { - height: 36px; + display: flex; + justify-content: space-between; + margin-right: 15px; + } + .settings-search-container { + display: flex; + justify-content: flex-end; + margin-right: 15px; } .settings-search-input { width: 250px; @@ -898,3 +860,122 @@ } } } + +@mixin emoji { + .create-pack { + display: flex; + justify-content: space-between + } + .create-pack-button { + margin-left: 10px; + } + .emoji-header-container { + display: flex; + align-items: center; + justify-content: space-between; + margin: 0 15px 22px 15px; + } + .emoji-name-warning { + color: #666666; + font-size: 13px; + line-height: 22px; + margin: 5px 0 0 0; + overflow-wrap: break-word; + overflow: hidden; + text-overflow: ellipsis; + } + .emoji-packs-header-button-container { + display: flex; + } + .emoji-packs-form { + margin-top: 15px; + } + .emoji-packs-header { + display: flex; + align-items: center; + justify-content: space-between; + margin: 10px 15px 15px 15px; + } + .emoji-packs-tabs { + margin: 0 15px 15px 15px; + } + .import-pack-button { + margin-left: 10px; + width: 30%; + max-width: 700px; + } + h1 { + margin: 0; + } + .line { + width: 100%; + height: 0; + border: 1px solid #eee; + margin-bottom: 22px; + } + .pagination { + margin: 25px 0; + text-align: center; + } + .reboot-button { + padding: 10px; + margin: 0; + width: 145px; + } + + @media only screen and (min-width: 1824px) { + .emoji-packs { + max-width: 1824px; + margin: auto; + } + } + + @media only screen and (max-width:480px) { + .create-pack { + height: 82px; + flex-direction: column; + } + .create-pack-button { + margin-left: 0; + } + .divider { + margin: 15px 0; + } + .el-message { + min-width: 80%; + } + .el-message-box { + width: 80%; + } + .emoji-header-container { + flex-direction: column; + align-items: flex-start; + } + .emoji-packs-form { + margin: 0 7px; + label { + padding-right: 8px; + } + .el-form-item { + margin-bottom: 15px; + } + } + .emoji-packs-header { + margin: 15px; + } + .emoji-packs-header-button-container { + height: 82px; + flex-direction: column; + .el-button+.el-button { + margin: 7px 0 0 0; + width: fit-content; + } + } + .import-pack-button { + width: 90%; + } + .reload-emoji-button { + width: fit-content; + } + } +} diff --git a/test/views/settings/formSearchObject.test.js b/test/views/settings/formSearchObject.test.js index 8fffa7f2..140da88b 100644 --- a/test/views/settings/formSearchObject.test.js +++ b/test/views/settings/formSearchObject.test.js @@ -173,27 +173,29 @@ describe('Form search object', () => { label: "Admin token" } ] }] - const expected = [{ - label: "Admin token", - key: ":admin_token", - groupKey: ":pleroma", - groupLabel: "Pleroma", - search: [":admin_token", "admin token", "token"] - }, - { - groupKey: ':instance_panel', - groupLabel: 'Instance Panel', - key: ':instance_panel', - label: 'Instance Panel', - search: ['Instance Panel', ':instance_panel'] - }, - { - groupKey: ':terms_of_services', - groupLabel: 'Terms of Services', - key: ':terms_of_services', - label: 'Terms of Services', - search: ['Terms of Services', ':terms_of_services'] - }] + const expected = [ + { + label: "Admin token", + key: ":admin_token", + groupKey: ":pleroma", + groupLabel: "Pleroma", + search: [":admin_token", "admin token", "token"] + }, + { + groupKey: ':instance_panel', + groupLabel: 'Instance Panel', + key: ':instance_panel', + label: 'Instance Panel', + search: ['Instance Panel', ':instance_panel'] + }, + { + groupKey: ':terms_of_services', + groupLabel: 'Terms of Services', + key: ':terms_of_services', + label: 'Terms of Services', + search: ['Terms of Services', ':terms_of_services'] + } + ] expect(_.isEqual(formSearchObject(description), expected)).toBeTruthy() }) @@ -269,7 +271,8 @@ describe('Form search object', () => { key: ':instance_panel', label: 'Instance Panel', search: ['Instance Panel', ':instance_panel'] - }, { + }, + { groupKey: ':terms_of_services', groupLabel: 'Terms of Services', key: ':terms_of_services', diff --git a/test/views/settings/index.test.js b/test/views/settings/index.test.js index 961a739d..1a9e4d9c 100644 --- a/test/views/settings/index.test.js +++ b/test/views/settings/index.test.js @@ -7,6 +7,7 @@ import app from '@/store/modules/app' import settings from '@/store/modules/settings' import user from '@/store/modules/user' import getters from '@/store/getters' +import _ from 'lodash' config.mocks["$t"] = () => {} @@ -22,6 +23,8 @@ describe('Settings search', () => { let store let actions let appActions + let $route + let $router beforeEach(() => { appActions = { ...app.actions, NeedReboot: jest.fn() } @@ -34,11 +37,17 @@ describe('Settings search', () => { }, getters }) + $route = { path: '/settings/path' } + $router = { push: jest.fn(), currentRoute: {} } }) it('shows search input', async (done) => { const wrapper = mount(Settings, { store, + mocks: { + $route, + $router + }, localVue }) @@ -47,22 +56,31 @@ describe('Settings search', () => { expect(searchInput.exists()).toBe(true) done() }) + it('changes tab when search value was selected', async (done) => { const wrapper = mount(Settings, { store, + mocks: { + $route, + $router + }, localVue }) wrapper.vm.handleSearchSelect({ group: 'Pleroma.Upload', key: 'Pleroma.Upload' }) - expect(store.state.settings.activeTab).toBe('upload') + expect(store.state.settings.searchQuery).toBe('Pleroma.Upload') + expect($router.push).toHaveBeenCalledWith({ path: '/settings/upload' }) wrapper.vm.handleSearchSelect({ group: ':swoosh', key: ':serve_mailbox' }) - expect(store.state.settings.activeTab).toBe('mailer') + expect(store.state.settings.searchQuery).toBe(':serve_mailbox') + expect($router.push).toHaveBeenCalledWith({ path: '/settings/mailer' }) wrapper.vm.handleSearchSelect({ group: ':pleroma', key: ':admin_token' }) - expect(store.state.settings.activeTab).toBe('instance') + expect(store.state.settings.searchQuery).toBe(':admin_token') + expect($router.push).toHaveBeenCalledWith({ path: '/settings/instance' }) wrapper.vm.handleSearchSelect({ group: ':media_proxy', key: ':ssl_options' }) - expect(store.state.settings.activeTab).toBe('media-proxy') + expect(store.state.settings.searchQuery).toBe(':ssl_options') + expect($router.push).toHaveBeenCalledWith({ path: '/settings/media-proxy' }) done() }) diff --git a/yarn.lock b/yarn.lock index adb36aba..658c9961 100644 --- a/yarn.lock +++ b/yarn.lock @@ -11258,10 +11258,10 @@ vue-loader@15.3.0: vue-hot-reload-api "^2.3.0" vue-style-loader "^4.1.0" -vue-router@3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/vue-router/-/vue-router-3.0.2.tgz#dedc67afe6c4e2bc25682c8b1c2a8c0d7c7e56be" - integrity sha512-opKtsxjp9eOcFWdp6xLQPLmRGgfM932Tl56U9chYTnoWqKxQ8M20N7AkdEbM5beUh6wICoFGYugAX9vQjyJLFg== +vue-router@^3.5.1: + version "3.5.1" + resolved "https://registry.yarnpkg.com/vue-router/-/vue-router-3.5.1.tgz#edf3cf4907952d1e0583e079237220c5ff6eb6c9" + integrity sha512-RRQNLT8Mzr8z7eL4p7BtKvRaTSGdCbTy2+Mm5HTJvLGYSSeG9gDzNasJPP/yOYKLy+/cLG/ftrqq5fvkFwBJEw== vue-splitpane@1.0.2: version "1.0.2"