:
@@ -64,7 +73,7 @@ export default {
return Array.isArray(this.setting.type) && this.setting.type.includes('keyword') && this.setting.type.includes('integer')
},
editableKeywordWithString() {
- return Array.isArray(this.setting.type) && (
+ return Array.isArray(this.setting.type) && this.setting.key !== ':crontab' && (
(this.setting.type.includes('keyword') && this.setting.type.includes('string')) ||
(this.setting.type.includes('tuple') && this.setting.type.includes('list'))
)
@@ -98,6 +107,10 @@ export default {
generateID() {
return `f${(~~(Math.random() * 1e8)).toString(16)}`
},
+ getCrontabWorkerLabel(worker) {
+ const workerKey = this.getKey(worker)
+ return workerKey.includes('Pleroma.Workers.Cron.') ? workerKey.replace('Pleroma.Workers.Cron.', '') : workerKey
+ },
getKey(element) {
return Object.keys(element)[0]
},
@@ -105,6 +118,9 @@ export default {
const { id } = Object.values(element)[0]
return id
},
+ getSuggestion(worker) {
+ return this.setting.suggestions.find(suggestion => suggestion[1] === this.getKey(worker))[0]
+ },
getValue(element) {
const { value } = Object.values(element)[0]
return value
@@ -122,6 +138,25 @@ export default {
this.updateSetting(updatedValue, this.settingGroup.group, this.settingGroup.key, this.setting.key, this.setting.type)
},
+ updateCrontab(value, inputType, worker) {
+ const updatedId = this.getId(worker)
+ const updatedValue = this.data.map((worker, index) => {
+ if (Object.values(worker)[0].id === updatedId) {
+ return { [Object.keys(worker)[0]]: { ...Object.values(this.data[index])[0], value }}
+ }
+ return worker
+ })
+ const updatedValueWithType = updatedValue.reduce((acc, worker) => {
+ return { ...acc, [Object.keys(worker)[0]]: ['reversed_tuple', Object.values(worker)[0].value] }
+ }, {})
+
+ this.$store.dispatch('UpdateSettings',
+ { group: this.settingGroup.group, key: this.settingGroup.key, input: this.setting.key, value: updatedValueWithType, type: this.setting.type }
+ )
+ this.$store.dispatch('UpdateState',
+ { group: this.settingGroup.group, key: this.settingGroup.key, input: this.setting.key, value: updatedValue }
+ )
+ },
updateSetting(value, group, key, input, type) {
const wrappedSettings = this.wrapUpdatedSettings(value, input, type)
diff --git a/src/views/settings/components/inputComponents/index.js b/src/views/settings/components/inputComponents/index.js
index 3b9bc788..d95ebd05 100644
--- a/src/views/settings/components/inputComponents/index.js
+++ b/src/views/settings/components/inputComponents/index.js
@@ -1,6 +1,5 @@
export { default as AutoLinkerInput } from './AutoLinkerInput'
export { default as EditableKeywordInput } from './EditableKeywordInput'
-export { default as CrontabInput } from './CrontabInput'
export { default as IconsInput } from './IconsInput'
export { default as MascotsInput } from './MascotsInput'
export { default as ProxyUrlInput } from './ProxyUrlInput'