mailer tab + beginning of monitoring tab
This commit is contained in:
parent
3bc8800c35
commit
b38343705c
9 changed files with 322 additions and 12 deletions
68
src/components/settings_modal/admin_tabs/mailer_tab.js
Normal file
68
src/components/settings_modal/admin_tabs/mailer_tab.js
Normal file
|
|
@ -0,0 +1,68 @@
|
||||||
|
import BooleanSetting from '../helpers/boolean_setting.vue'
|
||||||
|
import ChoiceSetting from '../helpers/choice_setting.vue'
|
||||||
|
import IntegerSetting from '../helpers/integer_setting.vue'
|
||||||
|
import StringSetting from '../helpers/string_setting.vue'
|
||||||
|
import GroupSetting from '../helpers/group_setting.vue'
|
||||||
|
import AttachmentSetting from '../helpers/attachment_setting.vue'
|
||||||
|
|
||||||
|
import SharedComputedObject from '../helpers/shared_computed_object.js'
|
||||||
|
import { library } from '@fortawesome/fontawesome-svg-core'
|
||||||
|
import {
|
||||||
|
faGlobe
|
||||||
|
} from '@fortawesome/free-solid-svg-icons'
|
||||||
|
|
||||||
|
library.add(
|
||||||
|
faGlobe
|
||||||
|
)
|
||||||
|
|
||||||
|
const MailerTab = {
|
||||||
|
provide () {
|
||||||
|
return {
|
||||||
|
defaultDraftMode: true,
|
||||||
|
defaultSource: 'admin'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
components: {
|
||||||
|
BooleanSetting,
|
||||||
|
ChoiceSetting,
|
||||||
|
IntegerSetting,
|
||||||
|
StringSetting,
|
||||||
|
AttachmentSetting,
|
||||||
|
GroupSetting
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
adaptersLabels () {
|
||||||
|
const prefix = 'Swoosh.Adapters.'
|
||||||
|
const descriptions = this.$store.state.adminSettings.descriptions
|
||||||
|
const options = descriptions[':pleroma']['Pleroma.Emails.Mailer'][':adapter'].suggestions
|
||||||
|
|
||||||
|
return Object.fromEntries(options.map(value => [
|
||||||
|
value, value.replace(prefix, '')
|
||||||
|
]))
|
||||||
|
},
|
||||||
|
startTLSLabels () {
|
||||||
|
return {
|
||||||
|
':always': this.$t('admin_dash.generic_enforcement.always'),
|
||||||
|
':if_available': this.$t('admin_dash.generic_enforcement.if_available'),
|
||||||
|
':never': this.$t('admin_dash.generic_enforcement.never')
|
||||||
|
}
|
||||||
|
// return Object.fromEntries(options.map(value => [
|
||||||
|
// value, value.replace(prefix, '')
|
||||||
|
// ]))
|
||||||
|
},
|
||||||
|
adapter () {
|
||||||
|
return this.$store.state.adminSettings.draft[':pleroma']['Pleroma.Emails.Mailer'][':adapter']
|
||||||
|
},
|
||||||
|
...SharedComputedObject()
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
adapterHasKey (key) {
|
||||||
|
const descriptions = this.$store.state.adminSettings.descriptions
|
||||||
|
const mailerStuff = descriptions[':pleroma']['Pleroma.Emails.Mailer']
|
||||||
|
const adapterStuff = mailerStuff[':subgroup,' + this.adapter]
|
||||||
|
return Object.prototype.hasOwnProperty.call(adapterStuff, key)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default MailerTab
|
||||||
146
src/components/settings_modal/admin_tabs/mailer_tab.vue
Normal file
146
src/components/settings_modal/admin_tabs/mailer_tab.vue
Normal file
|
|
@ -0,0 +1,146 @@
|
||||||
|
<template>
|
||||||
|
<div :label="$t('admin_dash.tabs.mailer')">
|
||||||
|
<div class="setting-item">
|
||||||
|
<h3>{{ $t('admin_dash.mailer.adapter') }}</h3>
|
||||||
|
<ul class="setting-list">
|
||||||
|
<li>
|
||||||
|
<BooleanSetting :path="[':pleroma','Pleroma.Emails.NewUsersDigestEmail',':enabled']" />
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<ChoiceSetting
|
||||||
|
:path="[':pleroma','Pleroma.Emails.Mailer',':adapter']"
|
||||||
|
:option-label-map="adaptersLabels"
|
||||||
|
/>
|
||||||
|
</li>
|
||||||
|
<h4>{{ $t('admin_dash.mailer.auth') }}</h4>
|
||||||
|
<li v-if="adapterHasKey(':api_key')">
|
||||||
|
|
||||||
|
<!-- authentication info -->
|
||||||
|
<StringSetting
|
||||||
|
:path="[':pleroma','Pleroma.Emails.Mailer',':api_key']"
|
||||||
|
:password="true"
|
||||||
|
:subgroup="adapter"
|
||||||
|
/>
|
||||||
|
</li>
|
||||||
|
<li v-if="adapterHasKey(':access_key')">
|
||||||
|
<StringSetting
|
||||||
|
:path="[':pleroma','Pleroma.Emails.Mailer',':access_key']"
|
||||||
|
:password="true"
|
||||||
|
:subgroup="adapter"
|
||||||
|
/>
|
||||||
|
</li>
|
||||||
|
<li v-if="adapterHasKey(':access_token')">
|
||||||
|
<StringSetting
|
||||||
|
:path="[':pleroma','Pleroma.Emails.Mailer',':access_token']"
|
||||||
|
:password="true"
|
||||||
|
:subgroup="adapter"
|
||||||
|
/>
|
||||||
|
</li>
|
||||||
|
<li v-if="adapterHasKey(':username')">
|
||||||
|
<StringSetting :path="[':pleroma','Pleroma.Emails.Mailer',':username']"
|
||||||
|
:subgroup="adapter"
|
||||||
|
/>
|
||||||
|
</li>
|
||||||
|
<li v-if="adapterHasKey(':password')">
|
||||||
|
<StringSetting
|
||||||
|
:path="[':pleroma','Pleroma.Emails.Mailer',':password']"
|
||||||
|
:password="true"
|
||||||
|
:subgroup="adapter"
|
||||||
|
/>
|
||||||
|
</li>
|
||||||
|
<li v-if="adapterHasKey(':secret')">
|
||||||
|
<StringSetting
|
||||||
|
:path="[':pleroma','Pleroma.Emails.Mailer',':secret']"
|
||||||
|
:subgroup="adapter"
|
||||||
|
/>
|
||||||
|
</li>
|
||||||
|
<li v-if="adapterHasKey(':auth')">
|
||||||
|
<ChoiceSetting
|
||||||
|
:path="[':pleroma','Pleroma.Emails.Mailer',':auth']"
|
||||||
|
:password="true"
|
||||||
|
:subgroup="adapter"
|
||||||
|
/>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<!-- server info -->
|
||||||
|
<li v-if="adapterHasKey(':relay')">
|
||||||
|
<StringSetting
|
||||||
|
:path="[':pleroma','Pleroma.Emails.Mailer',':relay']"
|
||||||
|
:password="true"
|
||||||
|
:subgroup="adapter"
|
||||||
|
/>
|
||||||
|
</li>
|
||||||
|
<li v-if="adapterHasKey(':ssl')">
|
||||||
|
<BooleanSetting
|
||||||
|
:path="[':pleroma','Pleroma.Emails.Mailer',':ssl']"
|
||||||
|
:password="true"
|
||||||
|
:subgroup="adapter"
|
||||||
|
/>
|
||||||
|
</li>
|
||||||
|
<li v-if="adapterHasKey(':tls')">
|
||||||
|
<ChoiceSetting
|
||||||
|
:path="[':pleroma','Pleroma.Emails.Mailer',':tls']"
|
||||||
|
:option-label-map="startTLSLabels"
|
||||||
|
:password="true"
|
||||||
|
:subgroup="adapter"
|
||||||
|
/>
|
||||||
|
</li>
|
||||||
|
<li v-if="adapterHasKey(':port')">
|
||||||
|
<IntegerSetting
|
||||||
|
:path="[':pleroma','Pleroma.Emails.Mailer',':port']"
|
||||||
|
:subgroup="adapter"
|
||||||
|
/>
|
||||||
|
</li>
|
||||||
|
<li v-if="adapterHasKey(':server_id')">
|
||||||
|
<StringSetting
|
||||||
|
:path="[':pleroma','Pleroma.Emails.Mailer',':server_id']"
|
||||||
|
:subgroup="adapter"
|
||||||
|
/>
|
||||||
|
</li>
|
||||||
|
<li v-if="adapterHasKey(':region')">
|
||||||
|
<StringSetting
|
||||||
|
:path="[':pleroma','Pleroma.Emails.Mailer',':region']"
|
||||||
|
:subgroup="adapter"
|
||||||
|
/>
|
||||||
|
</li>
|
||||||
|
<li v-if="adapterHasKey(':domain')">
|
||||||
|
<StringSetting
|
||||||
|
:path="[':pleroma','Pleroma.Emails.Mailer',':domain']"
|
||||||
|
:subgroup="adapter"
|
||||||
|
/>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<!-- sendmail exclusive -->
|
||||||
|
<li v-if="adapterHasKey(':cmd_path')">
|
||||||
|
<StringSetting
|
||||||
|
:path="[':pleroma','Pleroma.Emails.Mailer',':cmd_path']"
|
||||||
|
:password="true"
|
||||||
|
:subgroup="adapter"
|
||||||
|
/>
|
||||||
|
</li>
|
||||||
|
<li v-if="adapterHasKey(':cmd_args')">
|
||||||
|
<StringSetting
|
||||||
|
:path="[':pleroma','Pleroma.Emails.Mailer',':cmd_args']"
|
||||||
|
:password="true"
|
||||||
|
:subgroup="adapter"
|
||||||
|
/>
|
||||||
|
</li>
|
||||||
|
<li v-if="adapterHasKey(':qmail')">
|
||||||
|
<BooleanSetting
|
||||||
|
:path="[':pleroma','Pleroma.Emails.Mailer',':qmail']"
|
||||||
|
:password="true"
|
||||||
|
:subgroup="adapter"
|
||||||
|
/>
|
||||||
|
</li>
|
||||||
|
<li v-if="adapterHasKey(':retries')">
|
||||||
|
<IntegerSetting
|
||||||
|
:path="[':pleroma','Pleroma.Emails.Mailer',':retries']"
|
||||||
|
:subgroup="adapter"
|
||||||
|
/>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script src="./mailer_tab.js"></script>
|
||||||
40
src/components/settings_modal/admin_tabs/monitoring_tab.js
Normal file
40
src/components/settings_modal/admin_tabs/monitoring_tab.js
Normal file
|
|
@ -0,0 +1,40 @@
|
||||||
|
import BooleanSetting from '../helpers/boolean_setting.vue'
|
||||||
|
import ChoiceSetting from '../helpers/choice_setting.vue'
|
||||||
|
import IntegerSetting from '../helpers/integer_setting.vue'
|
||||||
|
import StringSetting from '../helpers/string_setting.vue'
|
||||||
|
import GroupSetting from '../helpers/group_setting.vue'
|
||||||
|
import AttachmentSetting from '../helpers/attachment_setting.vue'
|
||||||
|
|
||||||
|
import SharedComputedObject from '../helpers/shared_computed_object.js'
|
||||||
|
import { library } from '@fortawesome/fontawesome-svg-core'
|
||||||
|
import {
|
||||||
|
faGlobe
|
||||||
|
} from '@fortawesome/free-solid-svg-icons'
|
||||||
|
|
||||||
|
library.add(
|
||||||
|
faGlobe
|
||||||
|
)
|
||||||
|
|
||||||
|
const MonitoringTab = {
|
||||||
|
provide () {
|
||||||
|
return {
|
||||||
|
defaultDraftMode: true,
|
||||||
|
defaultSource: 'admin'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
components: {
|
||||||
|
BooleanSetting,
|
||||||
|
ChoiceSetting,
|
||||||
|
IntegerSetting,
|
||||||
|
StringSetting,
|
||||||
|
AttachmentSetting,
|
||||||
|
GroupSetting
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
...SharedComputedObject()
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default MonitoringTab
|
||||||
14
src/components/settings_modal/admin_tabs/monitoring_tab.vue
Normal file
14
src/components/settings_modal/admin_tabs/monitoring_tab.vue
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
<template>
|
||||||
|
<div :label="$t('admin_dash.tabs.monitoring')">
|
||||||
|
<div class="setting-item">
|
||||||
|
<h3>{{ $t('admin_dash.monitoring.mail_digest') }}</h3>
|
||||||
|
<ul class="setting-list">
|
||||||
|
<li>
|
||||||
|
<BooleanSetting :path="[':pleroma','Pleroma.Emails.NewUsersDigestEmail',':enabled']" />
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script src="./monitoring_tab.js"></script>
|
||||||
|
|
@ -18,6 +18,10 @@ export default {
|
||||||
type: [String, Array],
|
type: [String, Array],
|
||||||
required: false
|
required: false
|
||||||
},
|
},
|
||||||
|
subgroup: {
|
||||||
|
type: String,
|
||||||
|
required: false
|
||||||
|
},
|
||||||
disabled: {
|
disabled: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false
|
default: false
|
||||||
|
|
@ -114,7 +118,7 @@ export default {
|
||||||
return typeof this.draftMode === 'undefined' ? this.defaultDraftMode : this.draftMode
|
return typeof this.draftMode === 'undefined' ? this.defaultDraftMode : this.draftMode
|
||||||
},
|
},
|
||||||
backendDescription () {
|
backendDescription () {
|
||||||
return get(this.$store.state.adminSettings.descriptions, this.path)
|
return get(this.$store.state.adminSettings.descriptions, this.descriptionPath)
|
||||||
},
|
},
|
||||||
backendDescriptionLabel () {
|
backendDescriptionLabel () {
|
||||||
if (this.realSource !== 'admin') return ''
|
if (this.realSource !== 'admin') return ''
|
||||||
|
|
@ -209,6 +213,18 @@ export default {
|
||||||
if (this.path == null) return null
|
if (this.path == null) return null
|
||||||
return Array.isArray(this.path) ? this.path : this.path.split('.')
|
return Array.isArray(this.path) ? this.path : this.path.split('.')
|
||||||
},
|
},
|
||||||
|
descriptionPath () {
|
||||||
|
if (this.path == null) return null
|
||||||
|
const path = Array.isArray(this.path) ? this.path : this.path.split('.')
|
||||||
|
if (this.subgroup) {
|
||||||
|
return [
|
||||||
|
...path.slice(0, path.length - 1),
|
||||||
|
':subgroup,' + this.subgroup,
|
||||||
|
...path.slice(path.length - 1)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
return path
|
||||||
|
},
|
||||||
isDirty () {
|
isDirty () {
|
||||||
if (this.path == null) return false
|
if (this.path == null) return false
|
||||||
if (this.realSource === 'admin' && this.canonPath.length > 3) {
|
if (this.realSource === 'admin' && this.canonPath.length > 3) {
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,8 @@ import InstanceTab from './admin_tabs/instance_tab.vue'
|
||||||
import LimitsTab from './admin_tabs/limits_tab.vue'
|
import LimitsTab from './admin_tabs/limits_tab.vue'
|
||||||
import FrontendsTab from './admin_tabs/frontends_tab.vue'
|
import FrontendsTab from './admin_tabs/frontends_tab.vue'
|
||||||
import EmojiTab from './admin_tabs/emoji_tab.vue'
|
import EmojiTab from './admin_tabs/emoji_tab.vue'
|
||||||
|
import MailerTab from './admin_tabs/mailer_tab.vue'
|
||||||
|
import MonitoringTab from './admin_tabs/monitoring_tab.vue'
|
||||||
import { useInterfaceStore } from 'src/stores/interface'
|
import { useInterfaceStore } from 'src/stores/interface'
|
||||||
|
|
||||||
import { library } from '@fortawesome/fontawesome-svg-core'
|
import { library } from '@fortawesome/fontawesome-svg-core'
|
||||||
|
|
@ -11,22 +13,16 @@ import {
|
||||||
faWrench,
|
faWrench,
|
||||||
faHand,
|
faHand,
|
||||||
faLaptopCode,
|
faLaptopCode,
|
||||||
faPaintBrush,
|
faEnvelope,
|
||||||
faBell,
|
faChartLine
|
||||||
faDownload,
|
|
||||||
faEyeSlash,
|
|
||||||
faInfo
|
|
||||||
} from '@fortawesome/free-solid-svg-icons'
|
} from '@fortawesome/free-solid-svg-icons'
|
||||||
|
|
||||||
library.add(
|
library.add(
|
||||||
faWrench,
|
faWrench,
|
||||||
faHand,
|
faHand,
|
||||||
faLaptopCode,
|
faLaptopCode,
|
||||||
faPaintBrush,
|
faEnvelope,
|
||||||
faBell,
|
faChartLine
|
||||||
faDownload,
|
|
||||||
faEyeSlash,
|
|
||||||
faInfo
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const SettingsModalAdminContent = {
|
const SettingsModalAdminContent = {
|
||||||
|
|
@ -36,7 +32,9 @@ const SettingsModalAdminContent = {
|
||||||
InstanceTab,
|
InstanceTab,
|
||||||
LimitsTab,
|
LimitsTab,
|
||||||
FrontendsTab,
|
FrontendsTab,
|
||||||
EmojiTab
|
MailerTab,
|
||||||
|
EmojiTab,
|
||||||
|
MonitoringTab
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
user () {
|
user () {
|
||||||
|
|
|
||||||
|
|
@ -71,6 +71,22 @@
|
||||||
>
|
>
|
||||||
<EmojiTab />
|
<EmojiTab />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div
|
||||||
|
:label="$t('admin_dash.tabs.mailer')"
|
||||||
|
icon="envelope"
|
||||||
|
data-tab-name="mailer"
|
||||||
|
>
|
||||||
|
<MailerTab />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div
|
||||||
|
:label="$t('admin_dash.tabs.monitoring')"
|
||||||
|
icon="chart-line"
|
||||||
|
data-tab-name="monitoring"
|
||||||
|
>
|
||||||
|
<MonitoringTab />
|
||||||
|
</div>
|
||||||
</vertical-tab-switcher>
|
</vertical-tab-switcher>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1152,6 +1152,7 @@
|
||||||
"instance": "Instance",
|
"instance": "Instance",
|
||||||
"limits": "Limits",
|
"limits": "Limits",
|
||||||
"frontends": "Front-ends",
|
"frontends": "Front-ends",
|
||||||
|
"mailer": "EMails",
|
||||||
"emoji": "Emoji"
|
"emoji": "Emoji"
|
||||||
},
|
},
|
||||||
"nodb": {
|
"nodb": {
|
||||||
|
|
@ -1178,6 +1179,10 @@
|
||||||
"activities": "Statuses/activities access"
|
"activities": "Statuses/activities access"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"mailer": {
|
||||||
|
"adapter": "Mailing Adapter",
|
||||||
|
"auth": "Authentication"
|
||||||
|
},
|
||||||
"limits": {
|
"limits": {
|
||||||
"arbitrary_limits": "Arbitrary limits",
|
"arbitrary_limits": "Arbitrary limits",
|
||||||
"posts": "Post limits",
|
"posts": "Post limits",
|
||||||
|
|
@ -1257,6 +1262,11 @@
|
||||||
"replace_warning": "This will REPLACE the local pack of the same name",
|
"replace_warning": "This will REPLACE the local pack of the same name",
|
||||||
"copied_successfully": "Successfully copied emoji \"{0}\" to pack \"{1}\""
|
"copied_successfully": "Successfully copied emoji \"{0}\" to pack \"{1}\""
|
||||||
},
|
},
|
||||||
|
"generic_enforcement": {
|
||||||
|
"if_available": "If available",
|
||||||
|
"always": "Always",
|
||||||
|
"never": "Never"
|
||||||
|
},
|
||||||
"temp_overrides": {
|
"temp_overrides": {
|
||||||
":pleroma": {
|
":pleroma": {
|
||||||
":instance": {
|
":instance": {
|
||||||
|
|
|
||||||
|
|
@ -105,6 +105,7 @@ const adminSettingsStorage = {
|
||||||
}
|
}
|
||||||
set(config, path, convert(c.value))
|
set(config, path, convert(c.value))
|
||||||
})
|
})
|
||||||
|
console.log('CONFIG', config)
|
||||||
commit('updateAdminSettings', { config, modifiedPaths })
|
commit('updateAdminSettings', { config, modifiedPaths })
|
||||||
commit('resetAdminDraft')
|
commit('resetAdminDraft')
|
||||||
},
|
},
|
||||||
|
|
@ -122,6 +123,7 @@ const adminSettingsStorage = {
|
||||||
|
|
||||||
const descriptions = {}
|
const descriptions = {}
|
||||||
backendDescriptions.forEach(d => convert(d, '', descriptions))
|
backendDescriptions.forEach(d => convert(d, '', descriptions))
|
||||||
|
console.log('DESCRIPTIONS', descriptions)
|
||||||
commit('updateAdminDescriptions', { descriptions })
|
commit('updateAdminDescriptions', { descriptions })
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue