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-notification>
|
||||||
|
|
||||||
<b-field>
|
<b-field>
|
||||||
<b-checkbox name="use_profile_settings"
|
<b-checkbox name="rattail.datasync.use_profile_settings"
|
||||||
v-model="useProfileSettings"
|
v-model="simpleSettings['rattail.datasync.use_profile_settings']"
|
||||||
native-value="true"
|
native-value="true"
|
||||||
@input="settingsNeedSaved = true">
|
@input="settingsNeedSaved = true">
|
||||||
Use these Settings to configure watchers and consumers
|
Use these Settings to configure watchers and consumers
|
||||||
|
@ -99,7 +99,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="level-right">
|
<div class="level-right">
|
||||||
<div class="level-item"
|
<div class="level-item"
|
||||||
v-show="useProfileSettings">
|
v-show="simpleSettings['rattail.datasync.use_profile_settings']">
|
||||||
<b-button type="is-primary"
|
<b-button type="is-primary"
|
||||||
@click="newProfile()"
|
@click="newProfile()"
|
||||||
icon-pack="fas"
|
icon-pack="fas"
|
||||||
|
@ -162,7 +162,7 @@
|
||||||
</${b}-table-column>
|
</${b}-table-column>
|
||||||
<${b}-table-column label="Actions"
|
<${b}-table-column label="Actions"
|
||||||
v-slot="props"
|
v-slot="props"
|
||||||
v-if="useProfileSettings">
|
v-if="simpleSettings['rattail.datasync.use_profile_settings']">
|
||||||
<a href="#"
|
<a href="#"
|
||||||
class="grid-action"
|
class="grid-action"
|
||||||
@click.prevent="editProfile(props.row)">
|
@click.prevent="editProfile(props.row)">
|
||||||
|
@ -580,18 +580,27 @@
|
||||||
<b-field label="Supervisor Process Name"
|
<b-field label="Supervisor Process Name"
|
||||||
message="This should be the complete name, including group - e.g. poser:poser_datasync"
|
message="This should be the complete name, including group - e.g. poser:poser_datasync"
|
||||||
expanded>
|
expanded>
|
||||||
<b-input name="supervisor_process_name"
|
<b-input name="rattail.datasync.supervisor_process_name"
|
||||||
v-model="supervisorProcessName"
|
v-model="simpleSettings['rattail.datasync.supervisor_process_name']"
|
||||||
@input="settingsNeedSaved = true"
|
@input="settingsNeedSaved = true"
|
||||||
expanded>
|
expanded>
|
||||||
</b-input>
|
</b-input>
|
||||||
</b-field>
|
</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"
|
<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"
|
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>
|
expanded>
|
||||||
<b-input name="restart_command"
|
<b-input name="tailbone.datasync.restart"
|
||||||
v-model="restartCommand"
|
v-model="simpleSettings['tailbone.datasync.restart']"
|
||||||
@input="settingsNeedSaved = true"
|
@input="settingsNeedSaved = true"
|
||||||
expanded>
|
expanded>
|
||||||
</b-input>
|
</b-input>
|
||||||
|
@ -606,7 +615,6 @@
|
||||||
ThisPageData.showConfigFilesNote = false
|
ThisPageData.showConfigFilesNote = false
|
||||||
ThisPageData.profilesData = ${json.dumps(profiles_data)|n}
|
ThisPageData.profilesData = ${json.dumps(profiles_data)|n}
|
||||||
ThisPageData.showDisabledProfiles = false
|
ThisPageData.showDisabledProfiles = false
|
||||||
ThisPageData.useProfileSettings = ${json.dumps(use_profile_settings)|n}
|
|
||||||
|
|
||||||
ThisPageData.editProfileShowDialog = false
|
ThisPageData.editProfileShowDialog = false
|
||||||
ThisPageData.editingProfile = null
|
ThisPageData.editingProfile = null
|
||||||
|
@ -631,9 +639,6 @@
|
||||||
ThisPageData.editingConsumerRunas = null
|
ThisPageData.editingConsumerRunas = null
|
||||||
ThisPageData.editingConsumerEnabled = true
|
ThisPageData.editingConsumerEnabled = true
|
||||||
|
|
||||||
ThisPageData.supervisorProcessName = ${json.dumps(supervisor_process_name)|n}
|
|
||||||
ThisPageData.restartCommand = ${json.dumps(restart_command)|n}
|
|
||||||
|
|
||||||
ThisPage.computed.updateConsumerDisabled = function() {
|
ThisPage.computed.updateConsumerDisabled = function() {
|
||||||
if (!this.editingConsumerKey) {
|
if (!this.editingConsumerKey) {
|
||||||
return true
|
return true
|
||||||
|
|
|
@ -202,10 +202,36 @@ class DataSyncThreadView(MasterView):
|
||||||
return self.redirect(self.request.get_referrer(
|
return self.redirect(self.request.get_referrer(
|
||||||
default=self.request.route_url('datasyncchanges')))
|
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(
|
profiles = self.datasync_handler.get_configured_profiles(
|
||||||
include_disabled=True,
|
include_disabled=True,
|
||||||
ignore_problems=True)
|
ignore_problems=True)
|
||||||
|
context['profiles'] = profiles
|
||||||
|
|
||||||
profiles_data = []
|
profiles_data = []
|
||||||
for profile in sorted(profiles.values(), key=lambda p: p.key):
|
for profile in sorted(profiles.values(), key=lambda p: p.key):
|
||||||
|
@ -243,26 +269,16 @@ class DataSyncThreadView(MasterView):
|
||||||
data['consumers_data'] = consumers
|
data['consumers_data'] = consumers
|
||||||
profiles_data.append(data)
|
profiles_data.append(data)
|
||||||
|
|
||||||
return {
|
context['profiles_data'] = profiles_data
|
||||||
'profiles': profiles,
|
return context
|
||||||
'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'),
|
|
||||||
}
|
|
||||||
|
|
||||||
def configure_gather_settings(self, data):
|
def configure_gather_settings(self, data, **kwargs):
|
||||||
settings = []
|
""" """
|
||||||
|
settings = super().configure_gather_settings(data, **kwargs)
|
||||||
|
|
||||||
|
if data.get('rattail.datasync.use_profile_settings') == 'true':
|
||||||
watch = []
|
watch = []
|
||||||
|
|
||||||
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:
|
|
||||||
|
|
||||||
for profile in json.loads(data['profiles']):
|
for profile in json.loads(data['profiles']):
|
||||||
pkey = profile['key']
|
pkey = profile['key']
|
||||||
if profile['enabled']:
|
if profile['enabled']:
|
||||||
|
@ -323,17 +339,12 @@ class DataSyncThreadView(MasterView):
|
||||||
settings.append({'name': 'rattail.datasync.watch',
|
settings.append({'name': 'rattail.datasync.watch',
|
||||||
'value': ', '.join(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
|
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())
|
purge_datasync_settings(self.rattail_config, self.Session())
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
|
Loading…
Reference in a new issue