diff --git a/lib/panel/components/Control.vue b/lib/panel/components/Control.vue index cbbbb41..dfeb83b 100644 --- a/lib/panel/components/Control.vue +++ b/lib/panel/components/Control.vue @@ -5,7 +5,7 @@ :ripple='false' :class='[watching ? "red--text" : "grey--text", watching ? "red lighten-4" : ""]' @click.native='toggle' - ) + ) v-icon | fiber_manual_record | REC @@ -32,3 +32,9 @@ export default { }, } + + diff --git a/lib/panel/components/EventArea.vue b/lib/panel/components/EventArea.vue index 7b92f24..26d2fe4 100644 --- a/lib/panel/components/EventArea.vue +++ b/lib/panel/components/EventArea.vue @@ -15,29 +15,46 @@ + + + diff --git a/lib/panel/components/EventGroupControl.vue b/lib/panel/components/EventGroupControl.vue new file mode 100644 index 0000000..8622513 --- /dev/null +++ b/lib/panel/components/EventGroupControl.vue @@ -0,0 +1,49 @@ + + + + + diff --git a/lib/panel/store/modules/panel.js b/lib/panel/store/modules/panel.js index fac0b3a..0559bd0 100644 --- a/lib/panel/store/modules/panel.js +++ b/lib/panel/store/modules/panel.js @@ -15,6 +15,9 @@ const actions = { toggleWatching({ commit, state }) { commit(types.PANEL_TOGGLE_WATCHING, !state.watching); }, + toggleEventGroup({ commit, state }, key) { + commit(types.PANEL_TOGGLE_EVENT_GROUP, key); + }, clearPanel({ commit }) { commit(types.PANEL_CLEAR); }, @@ -36,11 +39,19 @@ const mutations = { state.eventGroups = []; }, + [types.PANEL_TOGGLE_EVENT_GROUP](state, key) { + const index = state.eventGroups.findIndex(eg => eg.key === key); + if (~index) { + const eg = state.eventGroups[index]; + eg.open = !eg.open; + } + }, + [types.CONTENT_FIRE](state, originalEvent) { const lastEventGroup = _.last(state.eventGroups); if (isDropEvent(lastEventGroup, originalEvent)) return; - + const code = capybarize(originalEvent); if (!code) return; @@ -52,7 +63,6 @@ const mutations = { show: true, }; - if (isSameGroup(lastEventGroup, event)) { const events = lastEventGroup.events; const newEvents = createNewEvents(events, event); @@ -62,6 +72,7 @@ const mutations = { state.eventGroups.push({ key: uuid(), events: [event], + open: false, }); } }, diff --git a/lib/panel/store/mutation-types.js b/lib/panel/store/mutation-types.js index 8f9c029..18a399d 100644 --- a/lib/panel/store/mutation-types.js +++ b/lib/panel/store/mutation-types.js @@ -1,5 +1,6 @@ export const PANEL_TOGGLE_WATCHING = 'PANEL_TOGGLE_WATCHING'; export const PANEL_CLEAR = 'PANEL_CLEAR'; +export const PANEL_TOGGLE_EVENT_GROUP = 'PANEL_TOGGLE_EVENT_GROUP'; export const CONTENT_FIRE = 'CONTENT_FIRE'; export const CONTENT_CONNECT = 'CONTENT_CONNECT';