Skip to content
This repository has been archived by the owner on Mar 23, 2021. It is now read-only.

Commit

Permalink
Merge pull request #77 from LanceGundersen/dev
Browse files Browse the repository at this point in the history
Production Push
  • Loading branch information
LanceGundersen authored Dec 10, 2020
2 parents e63ec6f + 3200b5f commit e523115
Show file tree
Hide file tree
Showing 16 changed files with 76 additions and 52 deletions.
13 changes: 4 additions & 9 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,10 @@ A clear and concise description of what you expected to happen.
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]
- OS: [e.g. macos, linux, windows]
- App Store: [e.g. snapcraft, mac, windows, n/a]
- Version [e.g. 1.4.3]


**Additional context**
Add any other context about the problem here.
13 changes: 12 additions & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ install:
- ps: Install-Product node 10 x64
- yarn
- ps: $env:package_version = (Get-Content -Raw -Path package.json | ConvertFrom-Json).version
- ps: Update-AppveyorBuild -Version "$env:package_version-$env:APPVEYOR_BUILD_NUMBER"
- ps: Update-AppveyorBuild -Version "$env:package_version"

build_script:
- yarn electron:build --win appx nsis
Expand All @@ -25,4 +25,15 @@ artifacts:
- path: dist_electron/*.appx
name: navfit

deploy:
- provider: GitHub
description: 'AppVeyor Release'
auth_token:
secure: fEkXGI1MwwnXikl6PyKr9q8U1Dcgw+yZuPznmh/YqHS4QtwLBkqxl0C4cDwB1vVf
draft: true
artifact: navfit2020
force_update: true
on:
branch: prod

test: off
Binary file added build/appx/Square150x150Logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added build/appx/Square44x44Logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added build/appx/StoreLogo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added build/appx/Wide310x150Logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "navfit",
"version": "0.5.2",
"version": "0.5.3",
"private": true,
"description": "Navy Evaluation/Fitrep Writer Modernized.",
"author": "Lance Gundersen",
Expand Down
4 changes: 2 additions & 2 deletions snap/snapcraft.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
name: navfit
version: '0.5.2'
version: '0.5.3'
summary: Navy Evaluation/Fitrep Writer Modernized
description: |
Navy evaluation and FITREP creation application to replace NavFit98. Allows for
adding, editing, deleting, and exporting to offical US Navy NAVPERS PDF's.
grade: devel
confinement: devmode

parts:
electron-navfit:
plugin: nil
1 change: 1 addition & 0 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export default Vue.extend({
data: () => ({}),
created() {
this.$store.dispatch("loadDb");
this.$router.push({ name: "home" }).catch(() => {});
}
});
</script>
Expand Down
17 changes: 11 additions & 6 deletions src/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,23 @@ if (isDevelopment) {
}
}

export function showDialog(type, title, msg, filePath, error) {
writeToLogFile(`EVAL EXPORT: ${type} ${title} ${msg} ${filePath} ${error}`);
win.webContents.send("dialog:show", { type, title, msg, filePath, error, });
}

ipcMain.on("db:load", async () => {
win.webContents.send("db:loaded", JSON.parse(JSON.stringify(await api.readDatabase())));
});

ipcMain.on("db:add:sailor", async (event, args) => {
const result = await api.addSailor(args);
win.webContents.send("db:add:sailor:result", result);
const sailor = await api.getSailor(result);
if (sailor.uuid) {
win.webContents.send("db:add:sailor:result", sailor);
} else {
showDialog("error", "Add Sailor Error", "Error adding Sailor", null, result.error);
}
});

ipcMain.on("db:update:sailor", async (event, args) => {
Expand Down Expand Up @@ -178,8 +188,3 @@ ipcMain.on("pdf:export", async (event, args) => {
if (!saveTo.canceled) exportEval(args.sailor, args.id, saveTo.filePath);
});
});

export function showDialog(type, title, msg, filePath, error) {
writeToLogFile(`EVAL EXPORT: ${type} ${title} ${msg} ${filePath} ${error}`);
win.webContents.send("dialog:show", { type, title, msg, filePath, error, });
}
12 changes: 2 additions & 10 deletions src/components/TheAddEditSailorDialogComponent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,6 @@ export default Vue.extend({
getCommandInfo() {
return this.$store.getters.getCommandInfo;
},
getSelectedSailor() {
return this.$store.getters.getSelectedSailor;
},
getSailorEditForm() {
return this.$store.getters.getSailorEditForm;
},
Expand All @@ -153,13 +150,8 @@ export default Vue.extend({
}
});
} else {
this.$store.dispatch("addSailor")
.then(() => {
if (!this.$store.getters.isError) {
this.$router.push({ name: "detail", params: { uuid: this.getSelectedSailor.uuid } }).catch(() => {});
this.closeDialog();
}
});
this.$store.dispatch("addSailor");
this.closeDialog();
}
},
},
Expand Down
1 change: 0 additions & 1 deletion src/components/TheNavigationDrawerComponent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ export default Vue.extend({
.catch(() => {
this.drawer = !this.drawer;
});
// this.$router.push({ name: "detail", params: { uuid: givenUuid } }).catch(() => {});
},
deleteSailor(givenUuid) {
this.uuid = givenUuid;
Expand Down
10 changes: 5 additions & 5 deletions src/components/TheSailorDetailComponent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,11 @@ export default Vue.extend({
return this.$store.getters.getSelectedSailor;
},
},
beforeCreate() {
if (!this.$store.getters.getSelectedSailor.uuid) {
this.$router.push({ name: "home" });
}
},
// beforeCreate() {
// if (!this.$store.getters.getSelectedSailor.uuid) {
// this.$router.push({ name: "home" });
// }
// },
methods: {
showAddEditEvalDialog(recordId) {
this.$store.dispatch("clearEvalEditForm");
Expand Down
46 changes: 29 additions & 17 deletions src/store/actions.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
import router from "@/router";

export default {
routeToSelectedSailor() {
const uuid = this.getters.getSelectedSailorId;
router.push({
name: "detail",
params: { uuid }
});
},
loadApp() {
window.ipcRenderer.send("app:load");
},
loadDb({ commit }) {
window.ipcRenderer.send("db:load");
window.ipcRenderer.on("db:loaded", (event, args) => {
window.ipcRenderer.once("db:loaded", (event, args) => {
if (args.commandInfo) {
commit("SET_COMMAND", args.commandInfo);
}
Expand All @@ -14,21 +23,21 @@ export default {
addSailor({ commit, dispatch }) {
const form = this.getters.getSailorEditForm;
window.ipcRenderer.send("db:add:sailor", form);
window.ipcRenderer.on("db:add:sailor:result", (_, args) => {
if (args.error) {
commit("setError");
commit("setErrorMsg", args.error.toString());
commit("setErrorObj", args);
}
dispatch("loadDb").then(() => {
dispatch("setSelectedSailor", args.uuid);
});
window.ipcRenderer.once("db:add:sailor:result", (event, args) => {
dispatch("loadDb");
commit("SET_SELECTED_SAILOR", { ...args });
commit("SET_SAILOR_EDIT_FORM", { ...args });
dispatch("routeToSelectedSailor");
});
window.ipcRenderer.once("dialog:show", (event, args) => {
commit("SET_DIALOG_INFO", args);
commit("SHOW_DIALOG");
});
},
updateSailor({ commit, dispatch }) {
const form = this.getters.getSailorEditForm;
window.ipcRenderer.send("db:update:sailor", form);
window.ipcRenderer.on("db:update:sailor:result", (_, args) => {
window.ipcRenderer.once("db:update:sailor:result", (_, args) => {
if (args.error) {
commit("setError");
commit("setErrorMsg", args.error.toString());
Expand All @@ -39,7 +48,7 @@ export default {
},
deleteSailor({ commit, dispatch }, payload) {
window.ipcRenderer.send("db:delete:sailor", payload);
window.ipcRenderer.on("db:delete:sailor:result", (_, args) => {
window.ipcRenderer.once("db:delete:sailor:result", (_, args) => {
if (args.error) {
commit("setError");
commit("setErrorMsg", args.error.toString());
Expand All @@ -56,7 +65,7 @@ export default {
};

window.ipcRenderer.send("db:add:record", { uuid, form });
window.ipcRenderer.on("db:add:record:result", (_, args) => {
window.ipcRenderer.once("db:add:record:result", (_, args) => {
if (args.error) {
commit("setError");
commit("setErrorMsg", args.error.toString());
Expand All @@ -72,7 +81,7 @@ export default {
const { uuid } = this.getters.getSelectedSailor;

window.ipcRenderer.send("db:update:record", { uuid, form });
window.ipcRenderer.on("db:update:record:result", (_, args) => {
window.ipcRenderer.once("db:update:record:result", (_, args) => {
if (args.error) {
commit("setError");
commit("setErrorMsg", args.error.toString());
Expand All @@ -86,7 +95,7 @@ export default {
saveCommandDefaults({ commit, dispatch }) {
const form = this.getters.getCommandEditForm;
window.ipcRenderer.send("db:add:commandDefaults", form);
window.ipcRenderer.on("db:add:commandDefaults:result", (_, args) => {
window.ipcRenderer.once("db:add:commandDefaults:result", (_, args) => {
if (args.error) {
commit("setError");
commit("setErrorMsg", args.error.toString());
Expand All @@ -104,11 +113,14 @@ export default {
clearCommandEditForm({ commit }) {
commit("CLEAR_COMMAND_EDIT_FORM");
},
setSelectedSailor({ commit }, uuid) {
async setSelectedSailor({ commit }, uuid) {
const sailorData = this.getters.getSailorById(uuid);
commit("SET_SELECTED_SAILOR", sailorData);
commit("SET_SAILOR_EDIT_FORM", sailorData);
},
async clearSelectedSailor({ commit }) {
commit("CLEAR_SELECTED_SAILOR");
},
setSailorEditForm({ commit }, payload) {
commit("SET_SAILOR_EDIT_FORM", payload);
},
Expand All @@ -130,7 +142,7 @@ export default {
exportEval({ commit }, payload) {
const sailor = this.getters.getSelectedSailor;
window.ipcRenderer.send("pdf:export", { sailor, id: payload });
window.ipcRenderer.on("dialog:show", (event, args) => {
window.ipcRenderer.once("dialog:show", (event, args) => {
commit("SET_DIALOG_INFO", args);
commit("SHOW_DIALOG");
});
Expand Down
5 changes: 5 additions & 0 deletions src/store/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ export default {
return { error };
}
},
async getSailor(payload) {
return db.get("sailors")
.find({ uuid: payload.uuid })
.value();
},
async updateSailor(payload) {
try {
await db.get("sailors")
Expand Down
4 changes: 4 additions & 0 deletions src/store/modules/selected.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@ export default {
SET_SELECTED_SAILOR(state, payload) {
state.sailor = payload;
},
CLEAR_SELECTED_SAILOR(state) {
state.sailor = {};
}
},
getters: {
getSelectedSailor: state => state.sailor,
getSelectedSailorId: state => state.sailor.uuid,
},
};

0 comments on commit e523115

Please sign in to comment.