diff --git a/src/views/settings/components/Authentication.vue b/src/views/settings/components/Authentication.vue index 03c3e0c5..47c5711b 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: { diff --git a/src/views/settings/components/Captcha.vue b/src/views/settings/components/Captcha.vue index 819e2b40..fb2e6210 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: { diff --git a/src/views/settings/components/Emoji.vue b/src/views/settings/components/Emoji.vue index 0d85d825..9ff2d0df 100644 --- a/src/views/settings/components/Emoji.vue +++ b/src/views/settings/components/Emoji.vue @@ -179,6 +179,9 @@ export default { remotePacksCount() { return this.$store.state.emojiPacks.remotePacksCount }, + searchQuery() { + return this.$store.state.settings.searchQuery + }, settingsLabelWidth() { if (this.isMobile) { return '120px' @@ -193,6 +196,17 @@ export default { this.$store.dispatch('GetNodeInfo') this.$store.dispatch('NeedReboot') this.refreshLocalPacks() + + if (this.searchQuery.length > 0) { + this.activeTab = 'settings' + const selectedSetting = document.querySelector(`[data-search="${this.searchQuery}"]`) + console.log(selectedSetting) + if (selectedSetting) { + selectedSetting.scrollIntoView({ block: 'start', behavior: 'smooth' }) + } + + this.$store.dispatch('SetSearchQuery', '') + } }, methods: { closeLocalTabs() { diff --git a/src/views/settings/components/Esshd.vue b/src/views/settings/components/Esshd.vue index a46f012d..6fb8fa22 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: { diff --git a/src/views/settings/components/Frontend.vue b/src/views/settings/components/Frontend.vue index df5911a1..2c0e8993 100644 --- a/src/views/settings/components/Frontend.vue +++ b/src/views/settings/components/Frontend.vue @@ -106,6 +106,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') }, @@ -113,6 +116,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 { diff --git a/src/views/settings/components/Gopher.vue b/src/views/settings/components/Gopher.vue index ffc2fa19..b5c78013 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: { diff --git a/src/views/settings/components/Http.vue b/src/views/settings/components/Http.vue index 8aa8a23b..7aa6968d 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 { diff --git a/src/views/settings/components/Instance.vue b/src/views/settings/components/Instance.vue index e3dacea2..f3dc84b9 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: { diff --git a/src/views/settings/components/JobQueue.vue b/src/views/settings/components/JobQueue.vue index d2691af8..b4720a73 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 { diff --git a/src/views/settings/components/LinkFormatter.vue b/src/views/settings/components/LinkFormatter.vue index cb44a457..73030629 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: { diff --git a/src/views/settings/components/Logger.vue b/src/views/settings/components/Logger.vue index 3a3abdba..ce0251f3 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 { diff --git a/src/views/settings/components/MRF.vue b/src/views/settings/components/MRF.vue index dd92b3cb..f62da203 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: { diff --git a/src/views/settings/components/Mailer.vue b/src/views/settings/components/Mailer.vue index 65ec18e0..a429e233 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 { diff --git a/src/views/settings/components/MediaProxy.vue b/src/views/settings/components/MediaProxy.vue index 701a28ff..94212636 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 { diff --git a/src/views/settings/components/Metadata.vue b/src/views/settings/components/Metadata.vue index d22be109..68ede003 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 { diff --git a/src/views/settings/components/Other.vue b/src/views/settings/components/Other.vue index 91a9fe2a..9234502b 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: { diff --git a/src/views/settings/components/RateLimiters.vue b/src/views/settings/components/RateLimiters.vue index f7f0c976..9530ffa5 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: { diff --git a/src/views/settings/components/Upload.vue b/src/views/settings/components/Upload.vue index 124de255..75beb5e7 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 { diff --git a/src/views/settings/components/WebPush.vue b/src/views/settings/components/WebPush.vue index 0a09c17d..410edeb7 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 { diff --git a/src/views/settings/components/tabs.js b/src/views/settings/components/tabs.js index 1915f413..3c83feb3 100644 --- a/src/views/settings/components/tabs.js +++ b/src/views/settings/components/tabs.js @@ -22,7 +22,7 @@ export const tabs = description => { }, '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', diff --git a/src/views/settings/index.vue b/src/views/settings/index.vue index 998f597c..1e67af72 100644 --- a/src/views/settings/index.vue +++ b/src/views/settings/index.vue @@ -151,7 +151,9 @@ export default { const tab = Object.keys(this.tabs).find(tab => { return this.tabs[tab].settings.includes(selectedValue.group === ':pleroma' ? selectedValue.key : selectedValue.group) }) - this.$router.push({ path: `/settings/${tab}` }) + if (tab) { + this.$router.push({ path: `/settings/${tab}` }) + } }, querySearch(queryString, cb) { const results = this.searchData.filter(searchObj => searchObj.search.find(el => el.includes(queryString.toLowerCase())))