Skip to content

Commit

Permalink
new configuration parameter custom_workflow_default
Browse files Browse the repository at this point in the history
to set the default value for the switch in the UI
  • Loading branch information
wagner-intevation committed Sep 19, 2024
1 parent 79a6168 commit dd0ce98
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 1 deletion.
8 changes: 7 additions & 1 deletion client/src/components/WebinputCSV.vue
Original file line number Diff line number Diff line change
Expand Up @@ -867,7 +867,7 @@ export default ({
// returns only the names of assigned columns
return this.tableHeader.slice(1).map(header => header.field).filter(entry => entry)
},
...mapState(['user', 'loggedIn', 'hasAuth', 'classificationTypes', 'harmonizationFields', 'customFieldsMapping', 'requiredFields', 'mailgenAvailable', 'botsAvailable', 'mailgenAvailableTargetGroups', 'mailgenAvailableTargetGroupsStatus', 'backendVersion', 'mailgenTemplatesServer', 'mailgenTemplates', 'mailgenMultiTemplatesEnabled', 'mailgenTemplateDefaultTemplateName']),
...mapState(['user', 'loggedIn', 'hasAuth', 'classificationTypes', 'harmonizationFields', 'customFieldsMapping', 'requiredFields', 'mailgenAvailable', 'botsAvailable', 'mailgenAvailableTargetGroups', 'mailgenAvailableTargetGroupsStatus', 'backendVersion', 'mailgenTemplatesServer', 'mailgenTemplates', 'mailgenMultiTemplatesEnabled', 'mailgenTemplateDefaultTemplateName', 'customWorkflowDefault']),
},
mounted() {
this.$store.dispatch("fetchBackendVersion");
Expand All @@ -894,6 +894,11 @@ export default ({
this.timezones[j] = this.timezones[j] + ':00';
}
},
watch: {
customWorkflowDefault: function (newCustomWorkflowDefault) {
this.customWorkflow = newCustomWorkflowDefault;
}
},
methods: {
csvToArray(maxRows=null) {
/**
Expand Down Expand Up @@ -1108,6 +1113,7 @@ export default ({
this.$store.dispatch("fetchBotsAvailable");
this.$store.dispatch("fetchMailgenAvailableTargetGroups");
this.$store.dispatch("fetchMailgenTemplates");
this.$store.dispatch("fetchSettings");
}, (response) => {
if (response.status !== 200) {
this.loginErrorText = "Server not reachable.";
Expand Down
13 changes: 13 additions & 0 deletions client/src/store/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export default new Vuex.Store({
mailgenTemplatesServer: [],
mailgenMultiTemplatesEnabled: false,
mailgenTemplateDefaultTemplateName: null,
customWorkflowDefault: false,
},
mutations: {
SET_USER (state, user) {
Expand Down Expand Up @@ -83,6 +84,9 @@ export default new Vuex.Store({
},
SET_MAILGEN_DEFAULT_TEMPLATE_NAME(state, data) {
state.mailgenTemplateDefaultTemplateName = data;
},
SET_SETTNGS(state, data) {
state.customWorkflowDefault = data['custom_workflow_default'];
}
},
actions: {
Expand Down Expand Up @@ -248,6 +252,15 @@ export default new Vuex.Store({
context.commit("SET_MAILGEN_DEFAULT_TEMPLATE_NAME", data['default_template_name']);
})
);
},
fetchSettings(context) {
Vue.http.get('api/settings').then(
response => {
response.json().then(data => {
context.commit("SET_SETTNGS", data)
})
}
)
}
},
modules: {
Expand Down
2 changes: 2 additions & 0 deletions docs/user-guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ Usual configuration parameters
allowed for user input. If left empty, all fields are allowed (default).
The check is applied in the frontend (field selection for columns) and backend.
The check does **not** apply to constant fields and custom input fields!
- ``custom_workflow_default``: If true (default: false), then the switch "Use custom workflow"
in the "Data validation and submission" section is enabled by default.

Mailgen configuration parameters
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
10 changes: 10 additions & 0 deletions intelmq_webinput_csv/serve.py
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,16 @@ def mailgen_settings():
}


@hug.get(ENDPOINT_PREFIX + '/api/settings', requires=session.token_authentication)
def settings():
"""
Returns some configuration options
"""
return {
'custom_workflow_default': CONFIG.get('custom_workflow_default', False)
}


@hug.post(ENDPOINT_PREFIX + '/api/mailgen/run', requires=session.token_authentication)
def mailgen_run(body, request, response):
"""
Expand Down

0 comments on commit dd0ce98

Please sign in to comment.