Skip to content

Commit

Permalink
added stats counter to status page
Browse files Browse the repository at this point in the history
  • Loading branch information
mgineer85 committed May 21, 2024
1 parent a9a7e56 commit 3896047
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 18 deletions.
2 changes: 1 addition & 1 deletion src/components/GalleryImageDetail.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<q-layout v-if="!emptyRepository" view="hhh Lpr ffr" @click="abortTimer">
<q-header elevated class="bg-primary text-white">
<q-header class="bg-primary text-white">
<q-toolbar v-if="showToolbar" id="gallery-toolbar" class="toolbar">
<q-btn dense flat icon="close" size="1.5rem" @click="$emit('closeEvent')" />

Expand Down
2 changes: 1 addition & 1 deletion src/components/form/layouts/GroupRenderer.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<q-card v-if="layout.visible" :class="classes" :elevation="!bare ? 2 : undefined" :outlined="bare" v-bind="quasarProps('q-card')">
<q-card v-if="layout.visible" flat :class="classes" :elevation="!bare ? 2 : undefined" :outlined="bare" v-bind="quasarProps('q-card')">
<q-card-section v-if="layout.label" :class="styles.group.label" v-bind="quasarProps('q-card-section')">
<div class="text-h6">{{ layout.label }}</div>
</q-card-section>
Expand Down
4 changes: 3 additions & 1 deletion src/i18n/locales/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,5 +97,7 @@
"computer model": "Computer model",
"Are you sure you want to reset the configuration and delete config.json?": "Are you sure you want to reset the configuration and delete config.json?",
"Clear recycle directory": "Clear recycle directory",
"Are you sure to clear the recycle directory?": "Are you sure to clear the recycle directory?"
"Are you sure to clear the recycle directory?": "Are you sure to clear the recycle directory?",
"Stats counter": "Stats counter",
"Are you sure to reset stats counter?": "Are you sure to reset stats counter?"
}
4 changes: 2 additions & 2 deletions src/layouts/AdminLayout.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<template>
<q-layout id="admin-layout" view="hHh lpR fFf">
<q-header elevated class="bg-secondary text-white">
<q-header class="bg-secondary text-white">
<q-toolbar class="q-pa-none">
<q-btn class="q-mx-sm" stack to="/" icon="arrow_back_ios_new" :label="$t('BTN_LABEL_BACK')" />
<q-tabs mobile-arrows shrink stretch>
<q-route-tab class="bg-primary" to="/" icon="arrow_back_ios_new" :label="$t('BTN_LABEL_BACK')" />
<q-route-tab to="/admin" icon="dashboard" :label="$t('TAB_LABEL_DASHBOARD')" />

<!--q-route-tab to="/admin/gallery" icon="photo_library" :label="$t('TAB_LABEL_GALLERY')" /-->
Expand Down
8 changes: 4 additions & 4 deletions src/pages/AdminPage.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<q-page id="admin-page" padding>
<q-card class="q-pa-md">
<q-card flat class="q-pa-md">
<div class="text-h5">{{ $t('TITLE_SERVER_CONTROL') }}</div>
<div class="row">
<div class="q-ma-sm">
Expand Down Expand Up @@ -122,7 +122,7 @@
</div>
</div>
</q-card>
<q-card class="q-pa-md q-mt-md">
<q-card flat class="q-pa-md q-mt-md">
<div class="text-h5">{{ $t('TITLE_MAINTAIN_GALLERY') }}</div>
<div class="row">
<div class="q-ma-sm">
Expand Down Expand Up @@ -150,7 +150,7 @@

<q-card-actions align="right">
<q-btn v-close-popup flat label="Cancel" color="primary" />
<q-btn v-close-popup label="Yes, clear!" color="primary" @click="remoteProcedureCall('/api/admin/files/clear_recycle_dir')" />
<q-btn v-close-popup label="Yes, clear!" color="primary" @click="remoteProcedureCall('/api/admin/files/clearrecycledir')" />
</q-card-actions>
</q-card>
</q-dialog>
Expand All @@ -162,7 +162,7 @@
</div>
</q-card>

<q-card class="q-pa-md q-mt-md">
<q-card flat class="q-pa-md q-mt-md">
<div class="text-h5">{{ $t('TITLE_LOCAL_UI_SETTINGS') }}</div>
<div class="row">
<language-switcher />
Expand Down
47 changes: 42 additions & 5 deletions src/pages/AdminStatusPage.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<q-page id="status-page" padding>
<div class="row col-xs-12 col-sm-4 col-md-3 col-lg-3">
<q-card class="q-mr-md q-mb-md">
<q-card flat class="q-mr-md q-mb-md">
<q-card-section>
<q-list separator>
<q-item-label header>{{ $t('system information') }}</q-item-label>
Expand Down Expand Up @@ -58,7 +58,7 @@
</q-card-section>
</q-card>

<q-card class="q-mr-md q-mb-md">
<q-card flat class="q-mr-md q-mb-md">
<q-card-section>
<q-list separator>
<q-item-label header>{{ $t('platform') }}</q-item-label>
Expand Down Expand Up @@ -114,7 +114,7 @@
</q-card-section>
</q-card>

<q-card class="q-mr-md q-mb-md">
<q-card flat class="q-mr-md q-mb-md">
<q-card-section>
<q-list separator>
<q-item-label header>{{ $t('primary backend') }}</q-item-label>
Expand All @@ -127,7 +127,7 @@
</q-list>
</q-card-section>
</q-card>
<q-card v-if="Object.keys(store.information.backends.secondary).length > 0" class="q-mr-md q-mb-md">
<q-card v-if="Object.keys(store.information.backends.secondary).length > 0" flat class="q-mr-md q-mb-md">
<q-card-section>
<q-list separator>
<q-item-label header>{{ $t('secondary backend') }}</q-item-label>
Expand All @@ -140,12 +140,47 @@
</q-list>
</q-card-section>
</q-card>

<q-card flat class="q-mr-md q-mb-md">
<q-card-section>
<q-list separator>
<q-item-label header>{{ $t('Stats counter') }}</q-item-label>

<q-item v-for="(value, key, index) in store.information.stats_counter" :key="index">
<q-item-section>
<q-item-label caption>{{ key }}</q-item-label>
<q-item-label>{{ value }}</q-item-label>
</q-item-section>
</q-item>
</q-list>
</q-card-section>

<q-separator />

<q-card-actions align="right">
<q-btn flat color="primary" icon="history" label="reset" @click="confirm_reset_stats_counter = true" />
</q-card-actions>
</q-card>
</div>

<q-dialog v-model="confirm_reset_stats_counter">
<q-card class="q-pa-sm">
<q-card-section class="row items-center" style="flex-wrap: nowrap">
<q-avatar icon="history" color="primary" text-color="white" />
<span class="q-ml-sm">{{ $t('Are you sure to reset stats counter?') }}</span>
</q-card-section>

<q-card-actions align="right">
<q-btn v-close-popup flat label="Cancel" color="primary" />
<q-btn v-close-popup label="Yes, reset!" color="primary" @click="remoteProcedureCall('/api/admin/information/sttscntr/reset')" />
</q-card-actions>
</q-card>
</q-dialog>
</q-page>
</template>

<script>
import { defineComponent } from 'vue';
import { defineComponent, ref } from 'vue';
import { useMainStore } from '../stores/main-store.js';
import { remoteProcedureCall } from '../util/fetch_api.js';
import { QBtn } from 'quasar';
Expand All @@ -156,11 +191,13 @@ export default defineComponent({
components: { QBtn },
setup() {
const store = useMainStore();
const confirm_reset_stats_counter = ref(false);
return {
// you can return the whole store instance to use it in the template
store,
remoteProcedureCall,
confirm_reset_stats_counter,
};
},
methods: {},
Expand Down
5 changes: 1 addition & 4 deletions src/stores/main-store.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@ export const useMainStore = defineStore('main-store', {
primary: {},
secondary: {},
},
printer: {
is_blocked: null,
waiting_time: null,
},
version: null,
platform_system: null,
platform_release: null,
Expand All @@ -41,6 +37,7 @@ export const useMainStore = defineStore('main-store', {
platform_cpu_count: null,
data_directory: null,
python_executable: null,
stats_counter: {},
},

lastHeartbeat: null,
Expand Down

0 comments on commit 3896047

Please sign in to comment.