Skip to content

Commit

Permalink
feat: переключатель "Устройство с экраном" (meta.interfaces.screen)
Browse files Browse the repository at this point in the history
Closes #2
  • Loading branch information
popstas committed Jun 16, 2020
1 parent 978c9fe commit 81189f3
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 3 deletions.
17 changes: 17 additions & 0 deletions components/Sidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@
></el-switch>
</el-row>

<el-row>
<el-switch
active-text="Устройство с экраном"
v-model="isScreen"
></el-switch>
</el-row>

<el-row>
<el-switch active-text="Показывать JSON в консоли" v-model="isConsoleRequests"></el-switch>
</el-row>
Expand Down Expand Up @@ -130,6 +137,7 @@ import "vue-awesome/icons/brands/github";
import {
SET_IS_BOTTOM_TESTS,
SET_IS_PROXY,
SET_IS_SCREEN,
SET_IS_SCENARIOS,
SET_IS_CONSOLE_REQUESTS,
SET_MESSAGE_LIMIT,
Expand All @@ -156,6 +164,15 @@ export default {
}
},
isScreen: {
get() {
return this.$store.state.settings.isScreen;
},
set(val) {
this.$store.commit(`settings/${SET_IS_SCREEN}`, val);
}
},
isScenarios: {
get() {
return this.$store.state.settings.isScenarios;
Expand Down
8 changes: 5 additions & 3 deletions store/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,9 +211,7 @@ export const actions = {
locale: 'ru-RU',
timezone: timezone,
client_id: userAgent,
interfaces: {
screen: {}
}
interfaces: {}
},
request: requestOpts,
session: {
Expand All @@ -226,6 +224,10 @@ export const actions = {
version: '1.0'
};

if(state.settings.isScreen) {
data.meta.interfaces.screen = {};
}

if (state.sessionNew) {
commit(SET_SESSION_NEW, false);
}
Expand Down
5 changes: 5 additions & 0 deletions store/settings.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export const SET_IS_BOTTOM_TESTS = 'SET_IS_BOTTOM_TESTS';
export const SET_IS_PROXY = 'SET_IS_PROXY';
export const SET_IS_SCREEN = 'SET_IS_SCREEN';
export const SET_IS_SCENARIOS = 'SET_IS_SCENARIOS';
export const SET_IS_CONSOLE_REQUESTS = 'SET_IS_CONSOLE_REQUESTS';
export const SET_MESSAGE_LIMIT = 'SET_MESSAGE_LIMIT';
Expand All @@ -10,6 +11,7 @@ export const state = () => ({
isBottomTests: false,
isProxy: process.env.isProxy,
isConsoleRequests: false,
isScreen: true,
isScenarios: false,
messageLimit: 200, // никогда не может быть больше этого
messageStoreLimit: 20, // после обновления страницы
Expand All @@ -23,6 +25,9 @@ export const mutations = {
[SET_IS_PROXY](state, isProxy) {
state.isProxy = isProxy;
},
[SET_IS_SCREEN](state, isScreen) {
state.isScreen = isScreen;
},
[SET_IS_SCENARIOS](state, isScenarios) {
state.isScenarios = isScenarios;
},
Expand Down

0 comments on commit 81189f3

Please sign in to comment.