diff --git a/src/components/settings_modal/admin_tabs/mailer_tab.js b/src/components/settings_modal/admin_tabs/mailer_tab.js new file mode 100644 index 000000000..b1b3d1590 --- /dev/null +++ b/src/components/settings_modal/admin_tabs/mailer_tab.js @@ -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 diff --git a/src/components/settings_modal/admin_tabs/mailer_tab.vue b/src/components/settings_modal/admin_tabs/mailer_tab.vue new file mode 100644 index 000000000..b6d3dc496 --- /dev/null +++ b/src/components/settings_modal/admin_tabs/mailer_tab.vue @@ -0,0 +1,146 @@ + + + diff --git a/src/components/settings_modal/admin_tabs/monitoring_tab.js b/src/components/settings_modal/admin_tabs/monitoring_tab.js new file mode 100644 index 000000000..8bde81377 --- /dev/null +++ b/src/components/settings_modal/admin_tabs/monitoring_tab.js @@ -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 diff --git a/src/components/settings_modal/admin_tabs/monitoring_tab.vue b/src/components/settings_modal/admin_tabs/monitoring_tab.vue new file mode 100644 index 000000000..6b09989cd --- /dev/null +++ b/src/components/settings_modal/admin_tabs/monitoring_tab.vue @@ -0,0 +1,14 @@ + + + diff --git a/src/components/settings_modal/helpers/setting.js b/src/components/settings_modal/helpers/setting.js index df137157a..c11de6a2f 100644 --- a/src/components/settings_modal/helpers/setting.js +++ b/src/components/settings_modal/helpers/setting.js @@ -18,6 +18,10 @@ export default { type: [String, Array], required: false }, + subgroup: { + type: String, + required: false + }, disabled: { type: Boolean, default: false @@ -114,7 +118,7 @@ export default { return typeof this.draftMode === 'undefined' ? this.defaultDraftMode : this.draftMode }, backendDescription () { - return get(this.$store.state.adminSettings.descriptions, this.path) + return get(this.$store.state.adminSettings.descriptions, this.descriptionPath) }, backendDescriptionLabel () { if (this.realSource !== 'admin') return '' @@ -209,6 +213,18 @@ export default { if (this.path == null) return null 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 () { if (this.path == null) return false if (this.realSource === 'admin' && this.canonPath.length > 3) { diff --git a/src/components/settings_modal/settings_modal_admin_content.js b/src/components/settings_modal/settings_modal_admin_content.js index bc0039118..42dee7adb 100644 --- a/src/components/settings_modal/settings_modal_admin_content.js +++ b/src/components/settings_modal/settings_modal_admin_content.js @@ -4,6 +4,8 @@ import InstanceTab from './admin_tabs/instance_tab.vue' import LimitsTab from './admin_tabs/limits_tab.vue' import FrontendsTab from './admin_tabs/frontends_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 { library } from '@fortawesome/fontawesome-svg-core' @@ -11,22 +13,16 @@ import { faWrench, faHand, faLaptopCode, - faPaintBrush, - faBell, - faDownload, - faEyeSlash, - faInfo + faEnvelope, + faChartLine } from '@fortawesome/free-solid-svg-icons' library.add( faWrench, faHand, faLaptopCode, - faPaintBrush, - faBell, - faDownload, - faEyeSlash, - faInfo + faEnvelope, + faChartLine ) const SettingsModalAdminContent = { @@ -36,7 +32,9 @@ const SettingsModalAdminContent = { InstanceTab, LimitsTab, FrontendsTab, - EmojiTab + MailerTab, + EmojiTab, + MonitoringTab }, computed: { user () { diff --git a/src/components/settings_modal/settings_modal_admin_content.vue b/src/components/settings_modal/settings_modal_admin_content.vue index 501a3acf6..8e5aee049 100644 --- a/src/components/settings_modal/settings_modal_admin_content.vue +++ b/src/components/settings_modal/settings_modal_admin_content.vue @@ -71,6 +71,22 @@ > + +
+ +
+ +
+ +
diff --git a/src/i18n/en.json b/src/i18n/en.json index e1f5fb23d..4f1a9a4dc 100644 --- a/src/i18n/en.json +++ b/src/i18n/en.json @@ -1152,6 +1152,7 @@ "instance": "Instance", "limits": "Limits", "frontends": "Front-ends", + "mailer": "EMails", "emoji": "Emoji" }, "nodb": { @@ -1178,6 +1179,10 @@ "activities": "Statuses/activities access" } }, + "mailer": { + "adapter": "Mailing Adapter", + "auth": "Authentication" + }, "limits": { "arbitrary_limits": "Arbitrary limits", "posts": "Post limits", @@ -1257,6 +1262,11 @@ "replace_warning": "This will REPLACE the local pack of the same name", "copied_successfully": "Successfully copied emoji \"{0}\" to pack \"{1}\"" }, + "generic_enforcement": { + "if_available": "If available", + "always": "Always", + "never": "Never" + }, "temp_overrides": { ":pleroma": { ":instance": { diff --git a/src/modules/adminSettings.js b/src/modules/adminSettings.js index 38fb5305a..a6729f645 100644 --- a/src/modules/adminSettings.js +++ b/src/modules/adminSettings.js @@ -105,6 +105,7 @@ const adminSettingsStorage = { } set(config, path, convert(c.value)) }) + console.log('CONFIG', config) commit('updateAdminSettings', { config, modifiedPaths }) commit('resetAdminDraft') }, @@ -122,6 +123,7 @@ const adminSettingsStorage = { const descriptions = {} backendDescriptions.forEach(d => convert(d, '', descriptions)) + console.log('DESCRIPTIONS', descriptions) commit('updateAdminDescriptions', { descriptions }) },