Skip to content
Open
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
3 changes: 2 additions & 1 deletion src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,8 @@
"dev_screens": {
"title": "Development Tools",
"vibrations": "Vibrations",
"adamant_wallets": "Adamant-Wallets"
"adamant_wallets": "Adamant-Wallets",
"logging": "Verbose logging in Console"
},
"dev_vibrations": {
"custom_pattern": "Custom Pattern",
Expand Down
3 changes: 2 additions & 1 deletion src/locales/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,8 @@
"dev_screens": {
"title": "Инструменты разработчика",
"vibrations": "Вибрации",
"adamant_wallets": "Adamant-Wallets"
"adamant_wallets": "Adamant-Wallets",
"logging": "Детализация ведения журнала в консоли"
},
"dev_vibrations": {
"custom_pattern": "Произвольный паттерн",
Expand Down
2 changes: 2 additions & 0 deletions src/store/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import botCommandsModule from './modules/bot-commands'
import bitcoinModule from './modules/btc'
import dashModule from './modules/dash'
import delegatesModule from './modules/delegates'
import devTools from './modules/dev-tools'
import dogeModule from './modules/doge'
import klyModule from './modules/kly'
import nodesModule from './modules/nodes'
Expand Down Expand Up @@ -263,6 +264,7 @@ const store = {
modules: {
adm: admModule, // ADM transfers
attachment: attachmentModule, // Files and photos attachments
devTools,
doge: dogeModule,
kly: klyModule,
dash: dashModule,
Expand Down
37 changes: 37 additions & 0 deletions src/store/modules/dev-tools/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import type { ActionTree, GetterTree, MutationTree } from 'vuex'

import { RootState } from '@/store/types'

interface VerbosityState {
levelAll: level[]
levelCurrent: level
}

const actions: ActionTree<VerbosityState, RootState> = {
setLevel({ commit }, value) {
commit('setLevel', value)
}
}
const getters: GetterTree<VerbosityState, RootState> = {
levelAll: (state) => state.levelAll,
levelCurrent: (state) => state.levelCurrent
}
const mutations: MutationTree<VerbosityState> = {
setLevel(state, value) {
state.levelCurrent = value
}
}
const state = (): VerbosityState => ({
levelAll: ['Debug', 'Info', 'Public', 'Warn'],
levelCurrent: 'Public'
})

export type level = 'Debug' | 'Info' | 'Public' | 'Warn'

export default {
actions,
getters,
mutations,
namespaced: true,
state
}
Comment on lines +1 to +37
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's pinia store

1 change: 1 addition & 0 deletions src/store/plugins/localStorage.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const vuexPersistence = new VuexPersistence({
reducer: (state) => {
return {
// modules
devTools: state.devTools,
language: state.language,
options: {
stayLoggedIn: state.options.stayLoggedIn,
Expand Down
1 change: 1 addition & 0 deletions src/store/types/root-state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export interface RootState {
btc: any
partners: any
delegates: any
devTools: any
nodes: any
snackbar: any
language: any
Expand Down
40 changes: 39 additions & 1 deletion src/views/devScreens/DevScreens.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,55 @@
</v-list>
</v-col>
</v-row>
<v-row>
<v-col cols="6">
<v-list-subheader>
{{ t('dev_screens.logging') }}
</v-list-subheader>
</v-col>
<v-col cols="6" class="text-right">
<v-menu offset-y>
<template #activator="{ props }">
<v-btn class="ma-0 btn" variant="text" v-bind="props">
{{ levelCurrent }}
</v-btn>
</template>
<v-list>
<v-list-item :key="level" @click="onSelectLevel(level)" v-for="level in levelAll">
<v-list-item-title>{{ level }}</v-list-item-title>
</v-list-item>
</v-list>
</v-menu>
</v-col>
</v-row>
</template>

<script setup lang="ts">
import type { level } from '@/store/modules/dev-tools/index.ts'
import { computed } from 'vue'
import { mdiChevronRight } from '@mdi/js'
import { useRouter } from 'vue-router'
import { useI18n } from 'vue-i18n'
import { useRouter } from 'vue-router'
import { useStore } from 'vuex'

const router = useRouter()
const store = useStore()
const { t } = useI18n()

const className = 'dev-screens-view'

const levelAll = computed(() => store.getters['devTools/levelAll'])
const levelCurrent = computed({
get() {
return store.state.devTools.levelCurrent
},
set(value) {
store.commit('devTools/setLevel', value)
}
})
const onSelectLevel = (level: level) => {
levelCurrent.value = level
}
</script>

<style lang="scss" scoped>
Expand Down