Skip to content

Commit 7d8d5d3

Browse files
committed
merged with dev
2 parents 5118a74 + f03554c commit 7d8d5d3

File tree

12 files changed

+190
-31
lines changed

12 files changed

+190
-31
lines changed

.env.example

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55

66
SLACK_CLIENT_SECRET = "ENTER_CLIENT_SECRET_HERE"
77
SLACK_CLIENT_ID = "ENTER_CLIENT_ID_HERE"
8-
SLACK_REDIRECT_URI = "REDIRECT URL HERE Currently 'overvuedev://test' for .env and 'overvue://slack' for .env.development"
8+
SLACK_REDIRECT_URI = "REDIRECT URL HERE"
99

1010
# https://www.npmjs.com/package/dotenv
11-
# https://www.npmjs.com/package/quasar-dotenv
12-
# https://v1.quasar.dev/quasar-cli/handling-process-env
13-
# https://v1.quasar.dev/quasar-cli/quasar-conf-js#using-dotenv
11+
# https://www.npmjs.com/package/quasar-dotenv
12+
# https://v1.quasar.dev/quasar-cli/handling-process-env
13+
# https://v1.quasar.dev/quasar-cli/quasar-conf-js#using-dotenv

.gitignore

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
#secret Api keys, Webhook URLs etc
2-
slackApiStuff.js
1+
#
32
.env
43
.env.development
54
#
@@ -17,7 +16,10 @@ npm-debug.log*
1716
yarn-debug.log*
1817
yarn-error.log*
1918
/coverage
20-
package-lock.json
19+
<<<<<<< HEAD
20+
# package-lock.json
21+
=======
22+
>>>>>>> dev
2123
vetur.config.js
2224

2325
# Editor directories and files
@@ -37,7 +39,4 @@ build/
3739
dist/
3840
node_modules/
3941
aws-exports.js
40-
awsconfiguration.json
41-
42-
#secret Api keys, Webhook URLs etc
43-
slackApiStuff.js
42+
awsconfiguration.json

README.md

Lines changed: 58 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@
2020
* [Tutorial](#how-to-use)
2121
+ [New Features Tutorial 2.0](#overvue-v20-how-to)
2222
+ [New Features Tutorial 3.0](#overvue-v30-how-to)
23-
* [How to Run](#running-a-local-version)
23+
* [Installation](#installation)
24+
+ [General Installation](#installation)
25+
+ [For WSL](#wsl-installation)
26+
+ [For Slack OAuth](#slack-oauth)
2427
* [Contributing](#contributing)
2528
* [Authors](#authors)
2629

@@ -157,7 +160,8 @@ package.json
157160

158161
[↥Back to top](#table-of-contents)
159162

160-
### Running a local version
163+
### Installation
164+
161165
This app was developed using the Quasar framework, so first you will need to install the Quasar cli
162166
```
163167
npm i -g @quasar/cli
@@ -166,18 +170,66 @@ Install dependencies
166170
```
167171
npm i
168172
```
173+
To open Vuejs devtools (devtools should be open before devmode, otherwise, you can justforce reload electron app in dev mode after opening dev tools)
174+
```
175+
./node_modules/.bin/vue-devtools
176+
```
169177
To run electron app in dev mode
170178
```
171179
quasar dev -m electron
172180
```
173-
**For WSL users, the ability to load the application requires a tool/application to run a linux display as WSL does not have any display drivers
174-
since it is based off of just a CLI.
175-
I recommend X410 (https://www.microsoft.com/en-us/p/x410/9nlp712zmn9q), althought it does cost $10, for ease of use. There are free options such as VcXsrv(https://sourceforge.net/projects/vcxsrv/) that you can get, but require more set up.**
176-
177181
To build a new .dmg / windows .exe
178182
```
179183
quasar build -m electron
180184
```
185+
### WSL Installation
186+
187+
**The ability to load the application and/or devtools requires a tool/application to run a linux display as WSL does not have any display drivers since it is based off of just a CLI.
188+
I recommend X410 (https://x410.dev/), althought it does cost $15, for ease of use. There are free options such as VcXsrv(https://sourceforge.net/projects/vcxsrv/) that you can get, but requires more set up.**
189+
190+
If you choose to use x410, you will need to set the environment DISPLAY variable on each console:
191+
192+
So, to open either the Vue devtools or OverVue in dev mode, first start your X Server then enter into the terminal:
193+
For WSL 1 :
194+
```
195+
export DISPLAY=:0
196+
```
197+
For WSL 2 :
198+
```
199+
export DISPLAY=$(awk '/nameserver / {print $2; exit}' /etc/resolv.conf 2>/dev/null):0
200+
export LIBGL_ALWAYS_INDIRECT=1
201+
```
202+
followed by the command for the devtools or devmode. If you want both open, enter commands above followed by starting the devtools:
203+
```
204+
./node_modules/.bin/vue-devtools
205+
```
206+
Then open a new terminal instance, set the DISPLAY value again (re-enter above command for DISPLAY), and start OverVue in dev mode:
207+
```
208+
quasar dev -m electron
209+
```
210+
211+
### Slack OAuth
212+
213+
For the Slack OAuth, you will need to create a Slack app through their website (https://api.slack.com/apps?new_app=1), so that you have your own Client Secret and Client ID. Then create two .env files (one for development and one for production).
214+
215+
1. Create a Slack App from the link above. Copy your Client ID and Client Secret somewhere safe.
216+
2. Create two .env files in the main root of this repository. Name them:
217+
```
218+
.env
219+
.env.development
220+
```
221+
3. Open .env and add these three environment variables. Replace <client secret> and <client id> with the client id and client secret given to you when you created your Slack App.
222+
```
223+
SLACK_CLIENT_SECRET = "<client secret>"
224+
SLACK_CLIENT_ID = "<client id>"
225+
SLACK_REDIRECT_URI = "overvue://slack"
226+
```
227+
4. Next, open .env.development and do the same, just note that the SLACK_REDIRECT_URI will be different here:
228+
```
229+
SLACK_CLIENT_SECRET = "<client secret>"
230+
SLACK_CLIENT_ID = "<client id>"
231+
SLACK_REDIRECT_URI = "overvuedev://test"
232+
```
181233

182234
[↥Back to top](#table-of-contents)
183235

src-electron/main-process/electron-main.dev.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* This file is used specifically and only for development. It installs
3-
* `electron-debug` & `vue-devtools`. There shouldn't be any need to
3+
* `electron-debug`. There shouldn't be any need to
44
* modify this file, but it can be used to extend your development
55
* environment.
66
*/

src/components/ComponentDisplay.vue

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,19 @@ export default {
137137
}
138138
}
139139
});
140+
// listener for the copy
141+
window.addEventListener('copy', () => {
142+
// if there is an activeComponent, copy info to state using dispatch
143+
if (this.activeComponent) {
144+
console.log('copied!', this.activeComponent);
145+
this.$store.dispatch("copyActiveComponent");
146+
}
147+
});
148+
149+
window.addEventListener('paste', () => {
150+
this.$store.dispatch("pasteActiveComponent");
151+
console.log('pasted');
152+
})
140153
},
141154
142155
computed: {
@@ -394,7 +407,13 @@ export default {
394407
if (event.target.className === "component-display grid-bg") {
395408
if (!(this.activeComponent === "")) this.setActiveComponent("");
396409
}
410+
},
411+
412+
// event handler for copying (ctrl+C)
413+
copyActiveComponent() {
414+
console.log('copied');
397415
}
416+
398417
},
399418
watch: {
400419
activeComponent: function() {

src/components/dashboard_items/Dashboard.vue

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Description:
2020
>
2121
<q-tab name="detail" id="label-text"><i class="fas fa-code"></i></q-tab>
2222
<q-tab name="tree" id="label-text"><i class="fas fa-code-branch fa-flip-vertical" /></q-tab>
23-
<q-tab name="store" id="label-text" ><i class="fas fa-store-alt"></i></q-tab>
23+
<!-- <q-tab name="store" id="label-text" ><i class="fas fa-store-alt"></i></q-tab> -->
2424
</q-tabs>
2525
<q-tab-panels v-model="tab" animated class="html-bg text-white ">
2626
<q-tab-panel name="detail">
@@ -29,9 +29,9 @@ Description:
2929
<q-tab-panel name="tree" >
3030
<Tree />
3131
</q-tab-panel>
32-
<q-tab-panel name="store">
32+
<!-- <q-tab-panel name="store">
3333
<VuexStore />
34-
</q-tab-panel>
34+
</q-tab-panel> -->
3535
</q-tab-panels>
3636
</q-card>
3737
</div>
@@ -41,13 +41,13 @@ Description:
4141
<script>
4242
import { mapState, mapActions } from "vuex";
4343
import Tree from "./Tree";
44-
import VuexStore from "./DashboardVuexStore.vue";
44+
// import VuexStore from "./DashboardVuexStore.vue";
4545
import ComponentDetails from "./ComponentDetails";
4646
4747
export default {
4848
components: {
4949
Tree,
50-
VuexStore,
50+
// VuexStore,
5151
ComponentDetails
5252
},
5353
computed: {

src/components/home_sidebar_items/ComponentTab/ComponentTab.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Functionality includes: if active component is selected, will switch view to editing mode. If not, it will be in create mode -->
33
<template>
44
<q-card id="store-cards">
5-
<!-- <UploadImage v-if="activeComponent === ''" /> -->
5+
<UploadImage v-if="activeComponent === ''" />
66
<CreateComponent v-if="activeComponent === ''"/>
77
<EditDeleteComponents v-if="activeComponent !== ''"/>
88
</q-card>
@@ -12,7 +12,7 @@ Functionality includes: if active component is selected, will switch view to edi
1212
import CreateComponent from './CreateComponent.vue'
1313
import EditDeleteComponents from './EditDeleteComponents.vue'
1414
import { mapState } from 'vuex'
15-
// import UploadImage from '../UploadImage.vue'
15+
import UploadImage from '../UploadImage.vue'
1616
1717
export default {
1818
data () {
@@ -29,7 +29,7 @@ export default {
2929
components: {
3030
CreateComponent,
3131
EditDeleteComponents,
32-
// UploadImage,
32+
UploadImage,
3333
}
3434
}
3535
</script>

src/components/home_sidebar_items/ComponentTab/EditDeleteComponents.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ Description:
6464
active-color="secondary"
6565
indicator-color="secondary"
6666
>
67+
<!-- Accordion for component settings -->
6768
<!-- HTML item that has Icon component -->
6869
<q-expansion-item
6970
group="accordion"

src/store/actions.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,23 @@ const actions = {
7676
commit(types.UPDATE_COMPONENT_SIZE, payload)
7777
},
7878

79+
// copy the active component
80+
[types.copyActiveComponent]: ({ commit }, payload) => {
81+
commit(types.COPY_ACTIVE_COMPONENT, payload)
82+
},
83+
// paste the active component copy
84+
[types.pasteActiveComponent]: ({ commit, state }) => {
85+
commit(types.PASTE_ACTIVE_COMPONENT);
86+
// if no other parents, update as parent of active route in componentMap
87+
if (!Object.keys(state.pastedComponent.parent).length) {
88+
commit(types.ADD_COMPONENT_TO_ACTIVE_ROUTE_CHILDREN, state.pastedComponent.componentName)
89+
// if parents, update parent of pastedComponent to include as a child
90+
} else {
91+
commit(types.ADD_COPIED_PARENT, state.pastedComponent)
92+
};
93+
// add pastedComponent as a child of route in activeRoutes
94+
commit(types.ADD_COMPONENT_TO_ACTIVE_ROUTE_IN_ROUTE_MAP, state.pastedComponent);
95+
},
7996
// End of componentDisplay Section//////////////////////////////////
8097

8198
// Actions that affect Routing //////////////////////////////////////

src/store/mutations.js

Lines changed: 66 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {
1212
breadthFirstSearch,
1313
breadthFirstSearchParent
1414
} from '../utils/search.util'
15+
import _ from 'lodash'
1516

1617
const cloneDeep = require('lodash.clonedeep')
1718

@@ -220,17 +221,70 @@ const mutations = {
220221
},
221222

222223
[types.DELETE_USER_STATE]: (state, payload) => {
223-
// delete state.userState[payload];
224-
// console.log('userState: ', state.userState);
224+
// need to loop through components and take out matching state
225+
for (const component in state.componentMap) {
226+
// first don't go through if component is App or Homeview
227+
if (component === 'App' || component === 'HomeView') continue;
228+
// splice out if there is a match
229+
const newState = state.componentMap[component].state;
230+
const index = newState.indexOf(payload);
231+
if (index > -1) {
232+
newState.splice(index, 1);
233+
state.componentMap[component].state = newState;
234+
} else {
235+
continue;
236+
}
237+
}
238+
// remove from userState
225239
let index = state.userState.indexOf(payload);
226240
state.userState.splice(index, 1);
227241
},
228242

229243
[types.DELETE_USER_ACTIONS]: (state, payload) => {
230-
// payload should be a string of the name of the action to remove
244+
for (const component in state.componentMap) {
245+
// first don't go through if component is App or Homeview
246+
if (component === 'App' || component === 'HomeView') continue;
247+
// splice out if there is a match
248+
const newActions = state.componentMap[component].actions;
249+
const index = newActions.indexOf(payload);
250+
if (index > -1) {
251+
newActions.splice(index, 1);
252+
state.componentMap[component].actions = newActions;
253+
} else {
254+
continue;
255+
}
256+
}
231257
let index = state.userActions.indexOf(payload);
232258
state.userActions.splice(index, 1);
233259
},
260+
// copy and paste functionality
261+
[types.COPY_ACTIVE_COMPONENT]: (state, payload) => {
262+
// copy activeComponentObj and place in the state but without children
263+
const copy = { ...state.activeComponentObj };
264+
copy.componentName;
265+
copy.children = [];
266+
copy.isActive = false;
267+
state.copiedComponent = copy;
268+
// reset the number of copies created
269+
state.copyNumber = 0;
270+
},
271+
272+
[types.PASTE_ACTIVE_COMPONENT]: (state) => {
273+
// check if copied exists
274+
if (state.copiedComponent) {
275+
const { copiedComponent } = state;
276+
// offset duplicate's coordinates
277+
copiedComponent.x += 20;
278+
copiedComponent.y += 20;
279+
const pastedComponent = { ...copiedComponent }
280+
state.componentMap[pastedComponent.componentName += ` (${state.copyNumber})`] = pastedComponent;
281+
282+
// increment copyNumber
283+
state.copyNumber += 1;
284+
// track for pastedComponent
285+
state.pastedComponent = pastedComponent;
286+
}
287+
},
234288

235289
// *** EDIT FUNCTIONALITY *** //////////////////////////////////////////////
236290

@@ -447,7 +501,7 @@ const mutations = {
447501
},
448502

449503
[types.ADD_PARENT]: (state, payload) => {
450-
state.componentMap[payload.componentName].parent[state.parentSelected] = state.componentMap[state.parentSelected]
504+
state.componentMap[payload.componentName].parent[state.parentSelected] = state.componentMap[state.parentSelected];
451505
state.componentMap[state.parentSelected].children.push(
452506
payload.componentName
453507
)
@@ -456,6 +510,14 @@ const mutations = {
456510
)
457511
},
458512

513+
[types.ADD_COPIED_PARENT]: (state, payload) => {
514+
const parentSelected = Object.values(payload.parent)[0].componentName;
515+
// push into parent's children array
516+
state.componentMap[parentSelected].children.push(payload.componentName)
517+
// push into parent's htmlList array
518+
state.componentMap[parentSelected].htmlList.push(payload.componentName)
519+
},
520+
459521
[types.DELETE_ACTIVE_COMPONENT]: state => {
460522
const { componentMap, activeComponent, activeRoute } = state
461523

0 commit comments

Comments
 (0)