Skip to content

Commit

Permalink
update summary, close on esc (#162)
Browse files Browse the repository at this point in the history
* update summary, close on esc
  • Loading branch information
MauserBitfly authored Apr 4, 2024
1 parent c7544eb commit c58e9d5
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 9 deletions.
3 changes: 3 additions & 0 deletions frontend/assets/css/prime.scss
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@
.p-dialog-title {
@include fonts.dialog_header;
}
.p-dialog-header-close {
display: none;
}
}
&.p-dialog-header-hidden {
.p-dialog-header {
Expand Down
1 change: 0 additions & 1 deletion frontend/components/bc/BcDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ const position = computed(() => width.value <= 430 ? 'bottom' : 'center')
modal
:header="props.header"
:dismissable-mask="true"
:closable="false"
:draggable="false"
:position="position"
class="modal_container"
Expand Down
8 changes: 7 additions & 1 deletion frontend/components/dashboard/GroupManagementModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ const newGroupName = ref<string>('')
const search = ref<string>()
const sortField = ref<string>()
const sortOrder = ref<number | null>()
const hasNoOpenDialogs = ref(true)
const data = computed<ApiPagingResponse<VDBOverviewGroup>>(() => {
let groups = (overview.value?.groups ?? [])
Expand Down Expand Up @@ -92,8 +93,12 @@ const removeGroupConfirmed = async (row: VDBOverviewGroup) => {
}
const removeGroup = (row: VDBOverviewGroup) => {
hasNoOpenDialogs.value = false
dialog.open(BcDialogConfirm, {
onClose: response => response?.data && removeGroupConfirmed(row),
onClose: (response) => {
hasNoOpenDialogs.value = true
response?.data && removeGroupConfirmed(row)
},
data: {
title: $t('dashboard.validator.group_management.remove_title'),
question: $t('dashboard.validator.group_management.remove_text', { group: row.name })
Expand Down Expand Up @@ -131,6 +136,7 @@ const premiumLimit = computed(() => (data.value?.paging?.total_count ?? 0) >= Ma
<template>
<BcDialog
v-model="visible"
:close-on-escape="hasNoOpenDialogs"
:header="$t('dashboard.validator.group_management.title')"
class="validator-group-managment-modal-container"
@update:visible="(visible: boolean)=>!visible && resetData()"
Expand Down
10 changes: 9 additions & 1 deletion frontend/components/dashboard/ValidatorManagementModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ const { value: query, bounce: setQuery } = useDebounceValue<PathValues | undefin
const data = ref<InternalGetValidatorDashboardValidatorsResponse | undefined>()
const selected = ref<VDBManageValidatorsTableRow[]>()
const hasNoOpenDialogs = ref(true)
const size = computed(() => {
return {
Expand Down Expand Up @@ -96,8 +97,10 @@ const addValidator = () => {
}
const editSelected = () => {
hasNoOpenDialogs.value = false
dialog.open(DashboardGroupSelectionDialog, {
onClose: (response) => {
hasNoOpenDialogs.value = true
if (response?.data !== undefined) {
changeGroup(mapIndexOrPubKey(selected.value), response?.data)
}
Expand Down Expand Up @@ -161,8 +164,12 @@ const removeRow = (row: VDBManageValidatorsTableRow) => {
warn('no validator to remove')
}
hasNoOpenDialogs.value = false
dialog.open(BcDialogConfirm, {
onClose: response => response?.data && removeValidators(list),
onClose: (response) => {
hasNoOpenDialogs.value = true
response?.data && removeValidators(list)
},
data: {
title: $t('dashboard.validator.management.remove_title'),
question: $t('dashboard.validator.management.remove_text', { validator: list[0] }, list.length)
Expand All @@ -183,6 +190,7 @@ const premiumLimit = computed(() => (data.value?.paging?.total_count ?? 0) >= Ma
<BcDialog
v-model="visible"
:header="$t('dashboard.validator.management.title')"
:close-on-escape="hasNoOpenDialogs"
class="validator-managment-modal-container"
@update:visible="(visible: boolean)=>!visible && resetData()"
>
Expand Down
10 changes: 5 additions & 5 deletions frontend/components/dashboard/table/DashboardTableSummary.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ const colsVisible = computed(() => {
}
})
const loadData = (query?: TableQueryParams) => {
if (!query) {
query = { limit: pageSize.value }
const loadData = (q?: TableQueryParams) => {
if (!q) {
q = query.value ? { ...query.value } : { limit: pageSize.value }
}
setQuery(query, true, true)
setQuery(q, true, true)
}
watch(() => props.dashboardKey, () => {
watch(() => [props.dashboardKey, overview.value], () => {
loadData()
}, { immediate: true })
Expand Down
1 change: 0 additions & 1 deletion frontend/composables/useBcDialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ export function useBcDialog <T> (dialogProps?: DialogProps) {
}
dialogRef.value.options.props.dismissableMask = true
dialogRef.value.options.props.modal = true
dialogRef.value.options.props.closable = false
dialogRef.value.options.props.draggable = false
dialogRef.value.options.props.position = position.value
}
Expand Down

0 comments on commit c58e9d5

Please sign in to comment.