diff --git a/src/components/ControlPanel.vue b/src/components/ControlPanel.vue index e6b7426d..74c467a6 100644 --- a/src/components/ControlPanel.vue +++ b/src/components/ControlPanel.vue @@ -1153,13 +1153,7 @@ export default { this.loaded = true; this.sources = data; - if (this.viewMode === "normal") { - this.sourcePickerDialog = true; - } else { - if (this.$isElectron) { - await this.$electronService.openSourcePickerWindow(this.sources); - } - } + this.sourcePickerDialog = true; } catch (err) { console.log(err); } @@ -1196,16 +1190,10 @@ export default { this.shareSessionDialog = false; }, showNoteDialog() { - if (this.viewMode === "normal") { - this.noteDialog = true; - setTimeout(() => { - this.$refs.noteDialog.$refs.comment.editor.commands.focus(); - }); - } else { - if (this.$isElectron) { - this.$electronService.openNoteEditorWindow(this.config); - } - } + this.noteDialog = true; + setTimeout(() => { + this.$refs.noteDialog.$refs.comment.editor.commands.focus(); + }); }, hideNoteDialog() { this.noteDialog = false; @@ -1347,26 +1335,14 @@ export default { await this.$router.push({ path: "/result" }); }, showSummaryDialog() { - if (this.viewMode === "normal") { - this.summaryDialog = true; + this.summaryDialog = true; - setTimeout(() => { - this.$refs.summaryDialog.$refs.comment.editor.commands.focus(); - }, 200); - } else { - if (this.$isElectron) { - this.$electronService.openSummaryWindow(this.config); - } - } + setTimeout(() => { + this.$refs.summaryDialog.$refs.comment.editor.commands.focus(); + }, 200); }, showEndSessionDialog() { - if (this.viewMode === "normal") { - this.endSessionDialog = true; - } else { - if (this.$isElectron) { - this.$electronService.openEndSessionWindow(this.config); - } - } + this.endSessionDialog = true; }, closeEndSessionDialog(status) { this.endSessionDialog = false; @@ -1765,11 +1741,6 @@ export default { console.log(error); } }, - async openAddWindow(data) { - if (this.$isElectron) { - await this.$electronService.openAddWindow(data); - } - }, async addNote(data) { const stepID = uuidv4(); let newItem = { @@ -1827,7 +1798,6 @@ export default { }, timer_mark: this.timer, }; - // this.openAddWindow(data); this.evidenceData = data; this.addEvidenceDialog = true; }, diff --git a/src/components/NotesWrapper.vue b/src/components/NotesWrapper.vue index 813480a5..9d94464e 100644 --- a/src/components/NotesWrapper.vue +++ b/src/components/NotesWrapper.vue @@ -562,6 +562,15 @@ + @@ -571,12 +580,14 @@ import { VEmojiPicker } from "v-emoji-picker"; import { debounce } from "lodash"; import { FILE_TYPES, TEXT_TYPES } from "../modules/constants"; +import EditEvidenceDialog from "@/components/dialogs/EditEvidenceDialog.vue"; export default { name: "NotesWrapper", components: { draggable, VEmojiPicker, + EditEvidenceDialog, }, props: { items: { @@ -622,6 +633,8 @@ export default { emojiMenu: {}, selectedId: null, textTypes: TEXT_TYPES, + editEvidenceDialog: false, + itemToEdit: null, }; }, created() { @@ -713,9 +726,10 @@ export default { ); } }, + async handleActivateEditSession(id) { - const data = await this.$storageService.getItemById(id); - this.$emit("activate-edit-session", data); + this.itemToEdit = await this.$storageService.getItemById(id); + this.editEvidenceDialog = true; }, handleSelectedItem(id) { this.selectedId = id; diff --git a/src/components/TimelineWrapper.vue b/src/components/TimelineWrapper.vue index cf671249..d58501aa 100644 --- a/src/components/TimelineWrapper.vue +++ b/src/components/TimelineWrapper.vue @@ -1066,12 +1066,7 @@ export default { } } }, - async openEditorModal(data) { - if (this.$isElectron) { - // todo replace with vuetify dialog - await this.$electronService.openAddWindow(data); - } - }, + checkedItem(id) { return this.selected.includes(id); }, @@ -1152,7 +1147,8 @@ export default { ...item, timer_mark: this.$store.state.session.timer, }; - await this.openEditorModal(data); + this.evidenceData = data; + this.addEvidenceDialog = true; } this.isDragging = false; } diff --git a/src/components/WorkspaceWrapper.vue b/src/components/WorkspaceWrapper.vue index 011fd1d6..2036e4df 100644 --- a/src/components/WorkspaceWrapper.vue +++ b/src/components/WorkspaceWrapper.vue @@ -19,7 +19,6 @@ :items="itemLists" :selectedItems="selected" :event-type="eventName" - @activate-edit-session="activateEditSession" /> @@ -27,7 +26,6 @@ :items="itemLists" :selectedItems="selected" :event-type="eventName" - @activate-edit-session="activateEditSession" /> @@ -86,12 +84,6 @@ export default { currentTab: "timeline", }; }, - methods: { - activateEditSession(data) { - // TODO - Use injection here to avoid this chain of emits - this.$emit("activate-edit-session", data); - }, - }, }; diff --git a/src/views/EditEvidence.vue b/src/views/EditEvidence.vue deleted file mode 100644 index e0294855..00000000 --- a/src/views/EditEvidence.vue +++ /dev/null @@ -1,721 +0,0 @@ - - - - - diff --git a/src/views/EndSessionView.vue b/src/views/EndSessionView.vue deleted file mode 100644 index d4b83d99..00000000 --- a/src/views/EndSessionView.vue +++ /dev/null @@ -1,135 +0,0 @@ - - - diff --git a/src/views/MainView.vue b/src/views/MainView.vue index b8a791d4..d087e185 100644 --- a/src/views/MainView.vue +++ b/src/views/MainView.vue @@ -87,7 +87,6 @@ :items="items" :selectedItems="selected" event-type="dblclick" - @activate-edit-session="activateEditSession" /> @@ -243,15 +242,6 @@ export default { updateSelected(value) { this.selected = value; }, - activateEditSession(value) { - this.openEditWindow(value); - }, - openEditWindow(data) { - // todo we want to replace electron window with the vuetify dialog instead to make it work for both electron & web - if (this.$isElectron) { - this.$electronService.openEditWindow(data); - } - }, async back() { this.$store.commit("clearState"); await this.$storageService.resetData(); diff --git a/src/views/NoteEditorView.vue b/src/views/NoteEditorView.vue deleted file mode 100644 index e6dac762..00000000 --- a/src/views/NoteEditorView.vue +++ /dev/null @@ -1,233 +0,0 @@ - - - diff --git a/src/views/NoteView.vue b/src/views/NoteView.vue deleted file mode 100644 index cb839905..00000000 --- a/src/views/NoteView.vue +++ /dev/null @@ -1,59 +0,0 @@ - - - diff --git a/src/views/ShareOAuthView.vue b/src/views/ShareOAuthView.vue deleted file mode 100644 index d6c7ef35..00000000 --- a/src/views/ShareOAuthView.vue +++ /dev/null @@ -1,111 +0,0 @@ - - - diff --git a/src/views/SummaryEditorView.vue b/src/views/SummaryEditorView.vue deleted file mode 100644 index df759724..00000000 --- a/src/views/SummaryEditorView.vue +++ /dev/null @@ -1,166 +0,0 @@ - - - diff --git a/src/views/__tests__/AddEvidence.spec.js b/src/views/__tests__/AddEvidence.spec.js deleted file mode 100644 index 1964f525..00000000 --- a/src/views/__tests__/AddEvidence.spec.js +++ /dev/null @@ -1,155 +0,0 @@ -import Vuetify from "vuetify"; -import AddEvidence from "../AddEvidence"; -import ReviewWrapper from "../../components/ReviewWrapper"; - -import { mount } from "@vue/test-utils"; - -const vuetify = new Vuetify(); - -describe("AddEvidence.vue", () => { - test("loads editor view", () => { - const wrapper = mount(AddEvidence, { - mocks: { - $t: () => {}, - $tc: () => {}, - }, - data() { - return { - item: { - fileType: "", - comment: { - type: "", - }, - }, - config: {}, - comment: { - type: "", - content: "", - text: "", - }, - }; - }, - stubs: ["router-link"], - vuetify, - }); - - expect( - wrapper - .find(".content-bottom .comment-type .subtitle-2.label-text") - .exists() - ).toBe(true); - expect(wrapper.findComponent(ReviewWrapper).exists()).toBe(true); - expect(wrapper.findAll(".footer button").length).toBe(3); - }); - - test('triggers a click on "Discard" button', async () => { - const wrapper = mount(AddEvidence, { - mocks: { - $t: () => {}, - $tc: () => {}, - }, - data() { - return { - item: { - fileType: "", - comment: { - type: "", - }, - }, - config: {}, - comment: { - type: "", - content: "", - text: "", - }, - processing: false, - }; - }, - stubs: ["router-link"], - vuetify, - }); - - const button = wrapper.find(".footer > div button:nth-child(1)"); - const event = jest.fn(); - - button.vm.$on("click", event); - button.trigger("click"); - - expect(event).toHaveBeenCalled(); - }); - - test('triggers a click on "Save" button', async () => { - const wrapper = mount(AddEvidence, { - mocks: { - $t: () => {}, - $tc: () => {}, - }, - data() { - return { - item: { - fileType: "", - comment: { - type: "", - }, - }, - config: {}, - comment: { - type: "", - content: "", - text: "", - }, - processing: false, - }; - }, - stubs: ["router-link"], - vuetify, - }); - - const button = wrapper.find(".footer > div button:nth-child(2)"); - const event = jest.fn(); - - button.vm.$on("click", event); - button.trigger("click"); - - expect(event).toHaveBeenCalled(); - }); - - it('trigger the click event of "Clear" button', async () => { - const wrapper = mount(AddEvidence, { - mocks: { - $t: () => {}, - $tc: () => {}, - }, - data() { - return { - item: { - fileType: "", - comment: { - type: "", - }, - }, - config: {}, - comment: { - type: "", - content: "", - text: "", - }, - processing: false, - }; - }, - stubs: ["router-link"], - vuetify, - }); - - const button = wrapper.find(".footer button:nth-child(1)"); - const event = jest.fn(); - - button.vm.$on("click", event); - button.trigger("click"); - - expect(event).toHaveBeenCalled(); - - expect(wrapper.vm.comment.text).toBe(""); - expect(wrapper.vm.comment.type).toBe("Comment"); - }); -}); diff --git a/src/views/__tests__/EditEvidence.spec.js b/src/views/__tests__/EditEvidence.spec.js deleted file mode 100644 index b13817fa..00000000 --- a/src/views/__tests__/EditEvidence.spec.js +++ /dev/null @@ -1,128 +0,0 @@ -import Vuetify from "vuetify"; -import EditEvidence from "../EditEvidence"; -import ReviewWrapper from "../../components/ReviewWrapper"; - -import { mount } from "@vue/test-utils"; - -const vuetify = new Vuetify(); - -describe("EditEvidence.vue", () => { - test("loads editor view", () => { - const wrapper = mount(EditEvidence, { - mocks: { - $t: () => {}, - $tc: () => {}, - }, - data() { - return { - item: { - fileType: "", - comment: { - type: "", - }, - }, - }; - }, - stubs: ["router-link"], - vuetify, - }); - - expect( - wrapper - .find(".content-bottom .comment-type .subtitle-2.label-text") - .exists() - ).toBe(true); - expect(wrapper.findComponent(ReviewWrapper).exists()).toBe(true); - expect(wrapper.findAll(".footer button").length).toBe(3); - }); - - test('triggers a click on "Discard" button', async () => { - const wrapper = mount(EditEvidence, { - mocks: { - $t: () => {}, - $tc: () => {}, - }, - data() { - return { - item: { - fileType: "", - comment: { - type: "", - }, - }, - }; - }, - stubs: ["router-link"], - vuetify, - }); - - const button = wrapper.find(".footer > div button:nth-child(1)"); - const event = jest.fn(); - - button.vm.$on("click", event); - button.trigger("click"); - - expect(event).toHaveBeenCalled(); - }); - - test('triggers a click on "Save" button', async () => { - const wrapper = mount(EditEvidence, { - mocks: { - $t: () => {}, - $tc: () => {}, - }, - data() { - return { - item: { - fileType: "", - comment: { - type: "", - }, - }, - }; - }, - stubs: ["router-link"], - vuetify, - }); - - const button = wrapper.find(".footer > div button:nth-child(2)"); - const event = jest.fn(); - - button.vm.$on("click", event); - button.trigger("click"); - - expect(event).toHaveBeenCalled(); - }); - - it('Click on "Clear" button calls "handleClear" method', async () => { - const wrapper = mount(EditEvidence, { - mocks: { - $t: () => {}, - $tc: () => {}, - }, - data() { - return { - item: { - fileType: "", - comment: { - type: "", - }, - }, - }; - }, - stubs: ["router-link"], - vuetify, - }); - - const button = wrapper.find(".footer button:nth-child(1)"); - const event = jest.fn(); - - button.vm.$on("click", event); - button.trigger("click"); - - expect(event).toHaveBeenCalled(); - - expect(wrapper.vm.comment.text).toBe(""); - expect(wrapper.vm.comment.type).toBe("Comment"); - }); -}); diff --git a/src/views/__tests__/EndSessionView.spec.js b/src/views/__tests__/EndSessionView.spec.js deleted file mode 100644 index c367c953..00000000 --- a/src/views/__tests__/EndSessionView.spec.js +++ /dev/null @@ -1,45 +0,0 @@ -import Vuetify from "vuetify"; -import EndSessionView from "../EndSessionView.vue"; -import CheckTaskWrapper from "../../components/CheckTaskWrapper.vue"; - -import { mount } from "@vue/test-utils"; - -const vuetify = new Vuetify(); - -describe("EndSessionView.vue", () => { - let wrapper; - beforeEach(() => { - wrapper = mount(EndSessionView, { - mocks: { - $t: () => {}, - $tc: () => {}, - }, - vuetify, - }); - }); - - test("render a view", () => { - expect(wrapper.findComponent(CheckTaskWrapper).exists()).toBe(true); - expect(wrapper.findAll(".footer button").length).toBe(2); - }); - - test('trigger the click event of "End Session" button', () => { - const event = jest.fn(); - const button = wrapper.find(".footer button:first-child"); - - button.vm.$on("click", event); - button.trigger("click"); - - expect(event).toHaveBeenCalled(); - }); - - test('trigger the click event of "Cancel" button', () => { - const event = jest.fn(); - const button = wrapper.find(".footer button:last-child"); - - button.vm.$on("click", event); - button.trigger("click"); - - expect(event).toHaveBeenCalled(); - }); -}); diff --git a/src/views/__tests__/NoteEditorView.spec.js b/src/views/__tests__/NoteEditorView.spec.js deleted file mode 100644 index 5d6aa117..00000000 --- a/src/views/__tests__/NoteEditorView.spec.js +++ /dev/null @@ -1,71 +0,0 @@ -import Vuetify from "vuetify"; -import NoteEditorView from "../NoteEditorView.vue"; - -import { mount } from "@vue/test-utils"; -import { TEXT_TYPES } from "../../modules/constants"; - -const vuetify = new Vuetify(); - -describe("NoteEditorView.vue", () => { - let wrapper; - beforeEach(() => { - wrapper = mount(NoteEditorView, { - mocks: { - $t: () => {}, - $tc: () => {}, - }, - data() { - return { - config: {}, - comment: { - type: "", - content: "", - tags: [], - }, - tag: "", - tags: [], - commentTypes: Object.keys(TEXT_TYPES).filter( - (item) => item !== "Summary" - ), - }; - }, - vuetify, - }); - }); - - test("render a view", () => { - expect(wrapper.find(".dialog-title").exists()).toBe(true); - - expect(wrapper.findAll(".btn").length).toBe(3); - }); - - test('trigger the click event of "Clear" button', () => { - const button = wrapper.find(".note-wrapper .btn"); - const event = jest.fn(); - - button.vm.$on("click", event); - button.trigger("click"); - - expect(event).toHaveBeenCalled(); - }); - - test('trigger the click event of "Discard" button', () => { - const button = wrapper.find(".action-wrapper > div:first-child > .btn"); - const event = jest.fn(); - - button.vm.$on("click", event); - button.trigger("click"); - - expect(event).toHaveBeenCalled(); - }); - - test('trigger the click event of "Save" button', () => { - const button = wrapper.find(".action-wrapper > div:last-child > .btn"); - const event = jest.fn(); - - button.vm.$on("click", event); - button.trigger("click"); - - expect(event).toHaveBeenCalled(); - }); -}); diff --git a/src/views/__tests__/SummaryEditorView.spec.js b/src/views/__tests__/SummaryEditorView.spec.js deleted file mode 100644 index c5aa7f78..00000000 --- a/src/views/__tests__/SummaryEditorView.spec.js +++ /dev/null @@ -1,58 +0,0 @@ -import Vuetify from "vuetify"; -import SummaryEditorView from "../SummaryEditorView.vue"; - -import { mount } from "@vue/test-utils"; - -const vuetify = new Vuetify(); - -describe("SummaryEditoryView.vue", () => { - let wrapper; - beforeEach(() => { - wrapper = mount(SummaryEditorView, { - mocks: { - $t: () => {}, - $tc: () => {}, - }, - vuetify, - }); - }); - - test("render a view", () => { - expect(wrapper.find(".dialog-title").exists()).toBe(true); - expect(wrapper.find(".container").exists()).toBe(true); - expect(wrapper.find(".container .subtitle-2").exists()).toBe(true); - expect(wrapper.find(".container input").exists()).toBe(true); - expect(wrapper.find(".container button").exists()).toBe(true); - expect(wrapper.findAll(".action-wrapper button").length).toBe(2); - }); - - test('trigger the click event of "dicard" button', () => { - const event = jest.fn(); - const button = wrapper.find(".action-wrapper button:first-child"); - - button.vm.$on("click", event); - button.trigger("click"); - - expect(event).toHaveBeenCalled(); - }); - - test('trigger the click event of "save" button', () => { - const event = jest.fn(); - const button = wrapper.find(".action-wrapper button:last-child"); - - button.vm.$on("click", event); - button.trigger("click"); - - expect(event).toHaveBeenCalled(); - }); - - test('trigger the click event of "clear" button', () => { - const event = jest.fn(); - const button = wrapper.find(".container button"); - - button.vm.$on("click", event); - button.trigger("click"); - - expect(event).toHaveBeenCalled(); - }); -});