fix: expose datasync consumer batch size via configure page
This commit is contained in:
parent
55f45ae8a0
commit
8df52bf2a2
|
@ -83,8 +83,8 @@
|
|||
</b-notification>
|
||||
|
||||
<b-field>
|
||||
<b-checkbox name="use_profile_settings"
|
||||
v-model="useProfileSettings"
|
||||
<b-checkbox name="rattail.datasync.use_profile_settings"
|
||||
v-model="simpleSettings['rattail.datasync.use_profile_settings']"
|
||||
native-value="true"
|
||||
@input="settingsNeedSaved = true">
|
||||
Use these Settings to configure watchers and consumers
|
||||
|
@ -99,7 +99,7 @@
|
|||
</div>
|
||||
<div class="level-right">
|
||||
<div class="level-item"
|
||||
v-show="useProfileSettings">
|
||||
v-show="simpleSettings['rattail.datasync.use_profile_settings']">
|
||||
<b-button type="is-primary"
|
||||
@click="newProfile()"
|
||||
icon-pack="fas"
|
||||
|
@ -162,7 +162,7 @@
|
|||
</${b}-table-column>
|
||||
<${b}-table-column label="Actions"
|
||||
v-slot="props"
|
||||
v-if="useProfileSettings">
|
||||
v-if="simpleSettings['rattail.datasync.use_profile_settings']">
|
||||
<a href="#"
|
||||
class="grid-action"
|
||||
@click.prevent="editProfile(props.row)">
|
||||
|
@ -580,18 +580,27 @@
|
|||
<b-field label="Supervisor Process Name"
|
||||
message="This should be the complete name, including group - e.g. poser:poser_datasync"
|
||||
expanded>
|
||||
<b-input name="supervisor_process_name"
|
||||
v-model="supervisorProcessName"
|
||||
<b-input name="rattail.datasync.supervisor_process_name"
|
||||
v-model="simpleSettings['rattail.datasync.supervisor_process_name']"
|
||||
@input="settingsNeedSaved = true"
|
||||
expanded>
|
||||
</b-input>
|
||||
</b-field>
|
||||
|
||||
<b-field label="Consumer Batch Size"
|
||||
message="Max number of changes to be consumed at once."
|
||||
expanded>
|
||||
<numeric-input name="rattail.datasync.batch_size_limit"
|
||||
v-model="simpleSettings['rattail.datasync.batch_size_limit']"
|
||||
@input="settingsNeedSaved = true" />
|
||||
</b-field>
|
||||
|
||||
<h3 class="is-size-3">Legacy</h3>
|
||||
<b-field label="Restart Command"
|
||||
message="This will run as '${system_user}' system user - please configure sudoers as needed. Typical command is like: sudo supervisorctl restart poser:poser_datasync"
|
||||
expanded>
|
||||
<b-input name="restart_command"
|
||||
v-model="restartCommand"
|
||||
<b-input name="tailbone.datasync.restart"
|
||||
v-model="simpleSettings['tailbone.datasync.restart']"
|
||||
@input="settingsNeedSaved = true"
|
||||
expanded>
|
||||
</b-input>
|
||||
|
@ -606,7 +615,6 @@
|
|||
ThisPageData.showConfigFilesNote = false
|
||||
ThisPageData.profilesData = ${json.dumps(profiles_data)|n}
|
||||
ThisPageData.showDisabledProfiles = false
|
||||
ThisPageData.useProfileSettings = ${json.dumps(use_profile_settings)|n}
|
||||
|
||||
ThisPageData.editProfileShowDialog = false
|
||||
ThisPageData.editingProfile = null
|
||||
|
@ -631,9 +639,6 @@
|
|||
ThisPageData.editingConsumerRunas = null
|
||||
ThisPageData.editingConsumerEnabled = true
|
||||
|
||||
ThisPageData.supervisorProcessName = ${json.dumps(supervisor_process_name)|n}
|
||||
ThisPageData.restartCommand = ${json.dumps(restart_command)|n}
|
||||
|
||||
ThisPage.computed.updateConsumerDisabled = function() {
|
||||
if (!this.editingConsumerKey) {
|
||||
return true
|
||||
|
|
|
@ -202,10 +202,36 @@ class DataSyncThreadView(MasterView):
|
|||
return self.redirect(self.request.get_referrer(
|
||||
default=self.request.route_url('datasyncchanges')))
|
||||
|
||||
def configure_get_context(self):
|
||||
def configure_get_simple_settings(self):
|
||||
""" """
|
||||
return [
|
||||
|
||||
# basic
|
||||
{'section': 'rattail.datasync',
|
||||
'option': 'use_profile_settings',
|
||||
'type': bool},
|
||||
|
||||
# misc.
|
||||
{'section': 'rattail.datasync',
|
||||
'option': 'supervisor_process_name'},
|
||||
{'section': 'rattail.datasync',
|
||||
'option': 'batch_size_limit',
|
||||
'type': int},
|
||||
|
||||
# legacy
|
||||
{'section': 'tailbone',
|
||||
'option': 'datasync.restart'},
|
||||
|
||||
]
|
||||
|
||||
def configure_get_context(self, **kwargs):
|
||||
""" """
|
||||
context = super().configure_get_context(**kwargs)
|
||||
|
||||
profiles = self.datasync_handler.get_configured_profiles(
|
||||
include_disabled=True,
|
||||
ignore_problems=True)
|
||||
context['profiles'] = profiles
|
||||
|
||||
profiles_data = []
|
||||
for profile in sorted(profiles.values(), key=lambda p: p.key):
|
||||
|
@ -243,25 +269,15 @@ class DataSyncThreadView(MasterView):
|
|||
data['consumers_data'] = consumers
|
||||
profiles_data.append(data)
|
||||
|
||||
return {
|
||||
'profiles': profiles,
|
||||
'profiles_data': profiles_data,
|
||||
'use_profile_settings': self.datasync_handler.should_use_profile_settings(),
|
||||
'supervisor_process_name': self.rattail_config.get(
|
||||
'rattail.datasync', 'supervisor_process_name'),
|
||||
'restart_command': self.rattail_config.get(
|
||||
'tailbone', 'datasync.restart'),
|
||||
}
|
||||
context['profiles_data'] = profiles_data
|
||||
return context
|
||||
|
||||
def configure_gather_settings(self, data):
|
||||
settings = []
|
||||
watch = []
|
||||
def configure_gather_settings(self, data, **kwargs):
|
||||
""" """
|
||||
settings = super().configure_gather_settings(data, **kwargs)
|
||||
|
||||
use_profile_settings = data.get('use_profile_settings') == 'true'
|
||||
settings.append({'name': 'rattail.datasync.use_profile_settings',
|
||||
'value': 'true' if use_profile_settings else 'false'})
|
||||
|
||||
if use_profile_settings:
|
||||
if data.get('rattail.datasync.use_profile_settings') == 'true':
|
||||
watch = []
|
||||
|
||||
for profile in json.loads(data['profiles']):
|
||||
pkey = profile['key']
|
||||
|
@ -323,17 +339,12 @@ class DataSyncThreadView(MasterView):
|
|||
settings.append({'name': 'rattail.datasync.watch',
|
||||
'value': ', '.join(watch)})
|
||||
|
||||
if data['supervisor_process_name']:
|
||||
settings.append({'name': 'rattail.datasync.supervisor_process_name',
|
||||
'value': data['supervisor_process_name']})
|
||||
|
||||
if data['restart_command']:
|
||||
settings.append({'name': 'tailbone.datasync.restart',
|
||||
'value': data['restart_command']})
|
||||
|
||||
return settings
|
||||
|
||||
def configure_remove_settings(self):
|
||||
def configure_remove_settings(self, **kwargs):
|
||||
""" """
|
||||
super().configure_remove_settings(**kwargs)
|
||||
|
||||
purge_datasync_settings(self.rattail_config, self.Session())
|
||||
|
||||
@classmethod
|
||||
|
|
Loading…
Reference in a new issue