fix: fix settings persistence bug(s) for datasync/configure page
also hide the Changes context menu link, within the Configure page
This commit is contained in:
parent
ca660f4087
commit
ee781ec489
|
@ -1,6 +1,15 @@
|
||||||
## -*- coding: utf-8; -*-
|
## -*- coding: utf-8; -*-
|
||||||
<%inherit file="/configure.mako" />
|
<%inherit file="/configure.mako" />
|
||||||
|
|
||||||
|
<%def name="extra_styles()">
|
||||||
|
${parent.extra_styles()}
|
||||||
|
<style>
|
||||||
|
.invisible-watcher {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</%def>
|
||||||
|
|
||||||
<%def name="buttons_row()">
|
<%def name="buttons_row()">
|
||||||
<div class="level">
|
<div class="level">
|
||||||
<div class="level-left">
|
<div class="level-left">
|
||||||
|
@ -106,8 +115,8 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<${b}-table :data="filteredProfilesData"
|
<${b}-table :data="profilesData"
|
||||||
:row-class="(row, i) => row.enabled ? null : 'has-background-warning'">
|
:row-class="getWatcherRowClass">
|
||||||
<${b}-table-column field="key"
|
<${b}-table-column field="key"
|
||||||
label="Watcher Key"
|
label="Watcher Key"
|
||||||
v-slot="props">
|
v-slot="props">
|
||||||
|
@ -625,19 +634,6 @@
|
||||||
ThisPageData.supervisorProcessName = ${json.dumps(supervisor_process_name)|n}
|
ThisPageData.supervisorProcessName = ${json.dumps(supervisor_process_name)|n}
|
||||||
ThisPageData.restartCommand = ${json.dumps(restart_command)|n}
|
ThisPageData.restartCommand = ${json.dumps(restart_command)|n}
|
||||||
|
|
||||||
ThisPage.computed.filteredProfilesData = function() {
|
|
||||||
if (this.showDisabledProfiles) {
|
|
||||||
return this.profilesData
|
|
||||||
}
|
|
||||||
let data = []
|
|
||||||
for (let row of this.profilesData) {
|
|
||||||
if (row.enabled) {
|
|
||||||
data.push(row)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return data
|
|
||||||
}
|
|
||||||
|
|
||||||
ThisPage.computed.updateConsumerDisabled = function() {
|
ThisPage.computed.updateConsumerDisabled = function() {
|
||||||
if (!this.editingConsumerKey) {
|
if (!this.editingConsumerKey) {
|
||||||
return true
|
return true
|
||||||
|
@ -665,6 +661,15 @@
|
||||||
this.showDisabledProfiles = !this.showDisabledProfiles
|
this.showDisabledProfiles = !this.showDisabledProfiles
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ThisPage.methods.getWatcherRowClass = function(row, i) {
|
||||||
|
if (!row.enabled) {
|
||||||
|
if (!this.showDisabledProfiles) {
|
||||||
|
return 'invisible-watcher'
|
||||||
|
}
|
||||||
|
return 'has-background-warning'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ThisPage.methods.consumerShortList = function(row) {
|
ThisPage.methods.consumerShortList = function(row) {
|
||||||
let keys = []
|
let keys = []
|
||||||
if (row.watcher_consumes_self) {
|
if (row.watcher_consumes_self) {
|
||||||
|
@ -795,9 +800,10 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
ThisPage.methods.updateProfile = function() {
|
ThisPage.methods.updateProfile = function() {
|
||||||
let row = this.editingProfile
|
const row = this.editingProfile
|
||||||
|
|
||||||
if (!row.key) {
|
const newRow = !row.key
|
||||||
|
if (newRow) {
|
||||||
row.consumers_data = []
|
row.consumers_data = []
|
||||||
this.profilesData.push(row)
|
this.profilesData.push(row)
|
||||||
}
|
}
|
||||||
|
@ -874,10 +880,31 @@
|
||||||
row.consumers_data.splice(i, 1)
|
row.consumers_data.splice(i, 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (newRow) {
|
||||||
|
|
||||||
|
// nb. must explicitly update the original data row;
|
||||||
|
// otherwise (with vue3) it will remain stale and
|
||||||
|
// submitting the form will keep same settings!
|
||||||
|
// TODO: this probably means i am doing something
|
||||||
|
// sloppy, but at least this hack fixes for now.
|
||||||
|
const profile = this.findProfile(row)
|
||||||
|
for (const key of Object.keys(row)) {
|
||||||
|
profile[key] = row[key]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.settingsNeedSaved = true
|
this.settingsNeedSaved = true
|
||||||
this.editProfileShowDialog = false
|
this.editProfileShowDialog = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ThisPage.methods.findProfile = function(row) {
|
||||||
|
for (const profile of this.profilesData) {
|
||||||
|
if (profile.key == row.key) {
|
||||||
|
return profile
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ThisPage.methods.deleteProfile = function(row) {
|
ThisPage.methods.deleteProfile = function(row) {
|
||||||
if (confirm("Are you sure you want to delete the '" + row.key + "' profile?")) {
|
if (confirm("Are you sure you want to delete the '" + row.key + "' profile?")) {
|
||||||
let i = this.profilesData.indexOf(row)
|
let i = this.profilesData.indexOf(row)
|
||||||
|
|
|
@ -79,11 +79,13 @@ class DataSyncThreadView(MasterView):
|
||||||
|
|
||||||
def get_context_menu_items(self, thread=None):
|
def get_context_menu_items(self, thread=None):
|
||||||
items = super().get_context_menu_items(thread)
|
items = super().get_context_menu_items(thread)
|
||||||
|
route_prefix = self.get_route_prefix()
|
||||||
|
|
||||||
# nb. just one view here, no need to check if listing etc.
|
# nb. do not show this for /configure page
|
||||||
if self.request.has_perm('datasync_changes.list'):
|
if self.request.matched_route.name != f'{route_prefix}.configure':
|
||||||
url = self.request.route_url('datasyncchanges')
|
if self.request.has_perm('datasync_changes.list'):
|
||||||
items.append(tags.link_to("View DataSync Changes", url))
|
url = self.request.route_url('datasyncchanges')
|
||||||
|
items.append(tags.link_to("View DataSync Changes", url))
|
||||||
|
|
||||||
return items
|
return items
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue