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; -*-
|
||||
<%inherit file="/configure.mako" />
|
||||
|
||||
<%def name="extra_styles()">
|
||||
${parent.extra_styles()}
|
||||
<style>
|
||||
.invisible-watcher {
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
</%def>
|
||||
|
||||
<%def name="buttons_row()">
|
||||
<div class="level">
|
||||
<div class="level-left">
|
||||
|
@ -106,8 +115,8 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<${b}-table :data="filteredProfilesData"
|
||||
:row-class="(row, i) => row.enabled ? null : 'has-background-warning'">
|
||||
<${b}-table :data="profilesData"
|
||||
:row-class="getWatcherRowClass">
|
||||
<${b}-table-column field="key"
|
||||
label="Watcher Key"
|
||||
v-slot="props">
|
||||
|
@ -625,19 +634,6 @@
|
|||
ThisPageData.supervisorProcessName = ${json.dumps(supervisor_process_name)|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() {
|
||||
if (!this.editingConsumerKey) {
|
||||
return true
|
||||
|
@ -665,6 +661,15 @@
|
|||
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) {
|
||||
let keys = []
|
||||
if (row.watcher_consumes_self) {
|
||||
|
@ -795,9 +800,10 @@
|
|||
}
|
||||
|
||||
ThisPage.methods.updateProfile = function() {
|
||||
let row = this.editingProfile
|
||||
const row = this.editingProfile
|
||||
|
||||
if (!row.key) {
|
||||
const newRow = !row.key
|
||||
if (newRow) {
|
||||
row.consumers_data = []
|
||||
this.profilesData.push(row)
|
||||
}
|
||||
|
@ -874,10 +880,31 @@
|
|||
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.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) {
|
||||
if (confirm("Are you sure you want to delete the '" + row.key + "' profile?")) {
|
||||
let i = this.profilesData.indexOf(row)
|
||||
|
|
|
@ -79,11 +79,13 @@ class DataSyncThreadView(MasterView):
|
|||
|
||||
def get_context_menu_items(self, thread=None):
|
||||
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.
|
||||
if self.request.has_perm('datasync_changes.list'):
|
||||
url = self.request.route_url('datasyncchanges')
|
||||
items.append(tags.link_to("View DataSync Changes", url))
|
||||
# nb. do not show this for /configure page
|
||||
if self.request.matched_route.name != f'{route_prefix}.configure':
|
||||
if self.request.has_perm('datasync_changes.list'):
|
||||
url = self.request.route_url('datasyncchanges')
|
||||
items.append(tags.link_to("View DataSync Changes", url))
|
||||
|
||||
return items
|
||||
|
||||
|
|
Loading…
Reference in a new issue