Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reset stats one by one #47

Merged
merged 8 commits into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/css/app.scss
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,14 @@ h6 {
font-size: 1.1rem;
}
}

.btn.right {
position: absolute;
float: right;
right: 0;
top: 0;
}

.btn.right i {
font-size: 1.5em;
}
2 changes: 1 addition & 1 deletion src/i18n/locales/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
"Clear recycle directory": "Clear 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?",
"Are you sure to reset the counter?": "Are you sure to reset the counter?",
"Choose your filter": "Choose your filter",
"Service (Linux only)": "Service (Linux only)",
"Host": "Host",
Expand Down
1 change: 1 addition & 0 deletions src/i18n/locales/fr-FR.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@
"Are you sure to clear the recycle directory?": "Êtes-vous sûr de vouloir effacer le répertoire de recyclage ?",
"Stats counter": "Compteur de statistiques",
"Are you sure to reset stats counter?": "Êtes-vous sûr de vouloir réinitialiser le compteur des statistiques ?",
"Are you sure to reset limits counter?": "Êtes-vous sûr de vouloir réinitialiser le compteur des limites ?",
"Choose your filter": "Choisissez votre filtre",
"Service (Linux only)": "Service (Linux uniquement)",
"Host": "Hôte",
Expand Down
41 changes: 29 additions & 12 deletions src/pages/AdminStatusPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -146,33 +146,39 @@
<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 v-for="(value, field, 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-label caption>{{ field }}</q-item-label>
<q-item-label v-if="value && typeof value === 'object'">
<q-item-label v-for="(sub_val, sub_field, sub_index) in value" :key="sub_index"> {{ sub_field }}: {{ sub_val }} </q-item-label>
</q-item-label>
<q-item-label v-else>
{{ value }}
</q-item-label>
</q-item-section>
<q-item-section v-if="!['last_reset'].includes(field)" side>
<q-btn flat color="primary" icon="sym_o_history" @click="displayResetConfirm(field)" />
</q-item-section>
</q-item>
</q-list>
</q-card-section>

<q-separator />

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

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

Check warning on line 177 in src/pages/AdminStatusPage.vue

View workflow job for this annotation

GitHub Actions / Lint

raw text ': ' is used

<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-btn v-close-popup label="Yes, reset!" color="primary" @click="confirmAction()" />
</q-card-actions>
</q-card>
</q-dialog>
Expand All @@ -191,15 +197,26 @@
components: { QBtn },
setup() {
const store = useMainStore();
const confirm_reset_stats_counter = ref(false);
const confirm_reset_counter = ref(false);
const selected_field = ref('');

return {
// you can return the whole store instance to use it in the template
store,
remoteProcedureCall,
confirm_reset_stats_counter,
confirm_reset_counter,
selected_field,
};
},
methods: {},
methods: {
displayResetConfirm(field) {
this.selected_field = field;
this.confirm_reset_counter = true;
},
confirmAction() {
remoteProcedureCall('/api/admin/information/sttscntr/reset/' + this.selected_field);
this.confirm_reset_counter = false;
},
},
});
</script>