Skip to content
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
8 changes: 6 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ pnpm-debug.log*
*.sln
*.sw?

#Electron-builder output
# Electron-builder output
/dist_electron
/builds
/builds

# Exports
flight-log-export
plots.html
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cats-configurator",
"version": "0.3.7",
"version": "0.3.8",
"private": true,
"scripts": {
"start": "vue-cli-service electron:serve",
Expand Down
15 changes: 6 additions & 9 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<v-app>
<AppBar />
<NavPanel :items="navItems" />
<Snackbar />
<Footer />

<v-main>
Expand All @@ -11,16 +12,18 @@
</template>

<script>
import { mapState, mapActions } from "vuex";
import { mapActions } from "vuex";
import AppBar from "@/components/AppBar";
import NavPanel from "@/components/NavigationPanel";
import Snackbar from "@/components/Snackbar";
import Footer from "@/components/Footer";

export default {
name: "App",
components: {
AppBar,
NavPanel,
Snackbar,
Footer,
},
data() {
Expand All @@ -34,11 +37,6 @@ export default {
],
};
},
computed: {
...mapState({
successSetMessage: (state) => state.successSetMessage,
}),
},
mounted() {
if (this.$route.path !== "/") this.$router.push("/");

Expand All @@ -59,8 +57,7 @@ export default {
else this.setConfig(config);
});
window.renderer.on("SET_CONFIG_RESPONSE", () => {
if (this.successSetMessage) return;
this.setSuccessMessage("Values saved successfully!");
this.showSuccessSnackbar("Values saved successfully!");
});
},
methods: {
Expand All @@ -71,7 +68,7 @@ export default {
"setEvent",
"setTimer",
"setLog",
"setSuccessMessage",
"showSuccessSnackbar",
]),
},
};
Expand Down
11 changes: 0 additions & 11 deletions src/components/ActionsBar.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
<template>
<v-app-bar flat dense absolute bottom>
<div v-if="message">
<v-icon color="success" class="mr-2">mdi-check-circle-outline</v-icon>
<span v-text="message" class="success--text caption" />
</div>
<v-spacer></v-spacer>
<div>
<v-btn class="mr-2" @click="$emit('refresh')"> Refresh </v-btn>
Expand All @@ -13,15 +9,8 @@
</template>

<script>
import { mapState } from "vuex";

export default {
name: "ActionsBar",
computed: {
...mapState({
message: (state) => state.successSetMessage,
}),
},
};
</script>

Expand Down
40 changes: 40 additions & 0 deletions src/components/Snackbar.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<template>
<v-snackbar
v-model="snackbarState.isVisible"
:color="snackbarState.color"
:timeout="snackbarState.timeout"
@input="handleSnackbarInput"
bottom
>
{{ snackbarState.message }}

<template v-slot:action="{ attrs }">
<v-btn
text
v-bind="attrs"
@click="hideSnackbar"
>
<v-icon>mdi-close</v-icon>
</v-btn>
</template>
</v-snackbar>
</template>

<script>
import { mapGetters, mapActions } from "vuex";

export default {
name: "Snackbar",
computed: {
...mapGetters([ "snackbarState" ]),
},
methods: {
...mapActions([ "hideSnackbar" ]),
handleSnackbarInput(value) {
if (!value) {
this.hideSnackbar();
}
}
}
};
</script>
32 changes: 26 additions & 6 deletions src/store/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ export default new Vuex.Store({
state: {
serialPorts: [],
active: false,
successSetMessage: null,
changedTab: null,
static: {},
config: {},
Expand All @@ -18,6 +17,12 @@ export default new Vuex.Store({
rec_speed: {},
rec_elements: {},
},
snackbar: {
isVisible: false,
message: "",
color: "success",
timeout: 3000,
},
useImperialUnits: false,
},
mutations: {
Expand Down Expand Up @@ -57,8 +62,18 @@ export default new Vuex.Store({
REMOVE_EVENT_ACTION(state, { key, index }) {
state.events[key].actions.splice(index, 1);
},
SET_SUCCESS_MESSAGE(state, value) {
state.successSetMessage = value;
SET_SNACKBAR_PROPS(state, payload) {
state.snackbar = { ...state.snackbar, ...payload };
},
SHOW_SNACKBAR(state, { message, color = "success", timeout = 3000 }) {
state.snackbar.isVisible = true;
state.snackbar.message = message;
state.snackbar.color = color;
state.snackbar.timeout = timeout;
},
HIDE_SNACKBAR(state) {
state.snackbar.isVisible = false;
state.snackbar.message = "";
},
SET_USE_IMPERIAL_UNITS(state, value) {
state.useImperialUnits = value;
Expand Down Expand Up @@ -124,9 +139,11 @@ export default new Vuex.Store({
removeEventAction({ commit }, payload) {
commit("REMOVE_EVENT_ACTION", payload);
},
setSuccessMessage({ commit }, value) {
commit("SET_SUCCESS_MESSAGE", value);
setTimeout(() => commit("SET_SUCCESS_MESSAGE", null), 5000);
showSuccessSnackbar({ commit }, message) {
commit("SHOW_SNACKBAR", { message, color: "success" });
},
hideSnackbar({ commit }) {
commit("HIDE_SNACKBAR");
},
toggleUnitSystem({ commit, state }) {
const newValue = !state.useImperialUnits;
Expand All @@ -152,6 +169,9 @@ export default new Vuex.Store({

return changed;
},
snackbarState(state) {
return state.snackbar;
},
useImperialUnits(state) {
return state.useImperialUnits;
}
Expand Down
7 changes: 5 additions & 2 deletions src/views/Config.vue
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,10 @@ export default {
},
mounted() {
this.init();
window.renderer.on("BOARD:DUMP", () => (this.backupLoading = false));
window.renderer.on("BOARD:DUMP", () => {
this.backupLoading = false
this.showSuccessSnackbar("Backup created!");
});
window.renderer.on("BOARD:RESTORE", () => {
this.restoreLoading = false;
setTimeout(this.init, 100);
Expand All @@ -438,7 +441,7 @@ export default {
clearInterval(this.timer);
},
methods: {
...mapActions(["setChangedTab"]),
...mapActions(["setChangedTab", "showSuccessSnackbar"]),
init() {
getConfigs();
this.getInfo();
Expand Down
6 changes: 5 additions & 1 deletion src/views/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
</template>

<script>
import { mapState } from 'vuex';
import { mapState, mapActions } from 'vuex';
import { makePlots } from '../modules/plots'

export default {
Expand Down Expand Up @@ -102,17 +102,21 @@ export default {
}
this.errorString = "";
this.flightLog = flightLog;
this.showSuccessSnackbar("Flight logs loaded successfully!");

if (el) makePlots(flightLog, el, this.useImperialUnits);
});
window.renderer.on("EXPORT_FLIGHTLOG_CSVS", (flightLog) => {
this.exportButtonLoading = false;
this.showSuccessSnackbar("Flight log CSVs exported!");
});
window.renderer.on("EXPORT_FLIGHTLOG_HTML", (flightLog) => {
this.exportButtonLoading = false;
this.showSuccessSnackbar("Flight log HTML plots exported!");
});
},
methods: {
...mapActions(["showSuccessSnackbar"]),
loadFlightLog(file) {
this.loadButtonLoading = true;
this.flightLog = null
Expand Down
Loading