From f95829adc6020fb263ed13bc25f8e23baf08281c Mon Sep 17 00:00:00 2001 From: baldo Date: Fri, 17 Jun 2022 15:30:29 +0200 Subject: [PATCH] Admin: Added filter / search panel to nodes list. --- frontend/src/App.vue | 38 ++ frontend/src/components/Pager.vue | 1 - .../src/components/admin/StatisticsCard.vue | 12 +- .../src/components/nodes/NodesFilterPanel.vue | 382 ++++++++++++++++++ frontend/src/components/page/PageFooter.vue | 7 - frontend/src/components/page/PageHeader.vue | 6 - frontend/src/main.ts | 5 + frontend/src/router/index.ts | 22 +- frontend/src/scss/_variables.scss | 31 +- frontend/src/stores/nodes.ts | 10 +- frontend/src/stores/version.ts | 6 +- frontend/src/views/AdminNodesView.vue | 72 +++- server/types/shared.ts | 21 +- 13 files changed, 568 insertions(+), 45 deletions(-) create mode 100644 frontend/src/components/nodes/NodesFilterPanel.vue diff --git a/frontend/src/App.vue b/frontend/src/App.vue index 04bf32f..a46af30 100644 --- a/frontend/src/App.vue +++ b/frontend/src/App.vue @@ -32,5 +32,43 @@ main { a { color: $link-color; text-decoration: none; + + &:hover { + color: $link-hover-color; + } + + &:focus { + outline: 0.1em solid $link-hover-color; + } +} + +button { + padding: $button-padding; + border-radius: $button-border-radius; + border-width: $button-border-width; + border-style: $button-border-style; + + cursor: pointer; + + @each $variant, $color in $variant-colors { + &.#{$variant} { + background-color: map-get($variant-text-colors, $variant); + border-color: $color; + color: $color; + + &:hover, &:active { + background-color: $color; + border-color: $color; + color: map-get($variant-text-colors, $variant); + } + + &:focus { + background-color: $color; + border-color: $page-background-color; + color: map-get($variant-text-colors, $variant); + outline: 0.1em solid $color; + } + } + } } diff --git a/frontend/src/components/Pager.vue b/frontend/src/components/Pager.vue index c738ced..d9f7c26 100644 --- a/frontend/src/components/Pager.vue +++ b/frontend/src/components/Pager.vue @@ -17,7 +17,6 @@ const props = defineProps({ }); const firstItem = computed(() => { - console.log(props.totalItems, props.page, props.itemsPerPage); return Math.min(props.totalItems, (props.page - 1) * props.itemsPerPage + 1) }); const lastItem = computed(() => Math.min(props.totalItems, firstItem.value + props.itemsPerPage - 1)); diff --git a/frontend/src/components/admin/StatisticsCard.vue b/frontend/src/components/admin/StatisticsCard.vue index 24400ba..98f47c7 100644 --- a/frontend/src/components/admin/StatisticsCard.vue +++ b/frontend/src/components/admin/StatisticsCard.vue @@ -17,7 +17,9 @@ const linkTarget = computed(() => { if (props.filter) { return { path: props.link, - query: props.filter, + query: { + filter: JSON.stringify(props.filter), + }, } } else { return props.link; @@ -47,11 +49,19 @@ const linkTarget = computed(() => { padding: $statistics-card-padding; border-radius: $statistics-card-border-radius; + border-width: 0.2em; + border-style: solid; @each $variant, $color in $variant-colors { &.statistics-card-#{$variant} { background-color: $color; color: map-get($variant-text-colors, $variant); + border-color: $color; + + &:focus { + border-color: $page-background-color; + outline: 0.2em solid $color; + } } } diff --git a/frontend/src/components/nodes/NodesFilterPanel.vue b/frontend/src/components/nodes/NodesFilterPanel.vue new file mode 100644 index 0000000..f308b0b --- /dev/null +++ b/frontend/src/components/nodes/NodesFilterPanel.vue @@ -0,0 +1,382 @@ + + + + + diff --git a/frontend/src/components/page/PageFooter.vue b/frontend/src/components/page/PageFooter.vue index fbe359f..86ab4ac 100644 --- a/frontend/src/components/page/PageFooter.vue +++ b/frontend/src/components/page/PageFooter.vue @@ -4,13 +4,6 @@ import {useVersionStore} from "@/stores/version"; const config = useConfigStore(); const version = useVersionStore(); - -function refresh(): void { - config.refresh(); - version.refresh(); -} - -refresh();