From fe4790bd37c2833d0ea2679363258964d34ebdb2 Mon Sep 17 00:00:00 2001 From: mirko Date: Sat, 4 Jan 2025 21:15:30 +0100 Subject: [PATCH 1/3] chore: port importDialog to vue --- scripts/build-vue-comp.ps1 | 1 + scripts/build-vue-comp.sh | 3 +- src/js/app/components/ImportButton.vue | 2 +- src/js/app/components/ImportDialog.vue | 53 +++++++++++++++++++ src/js/app/components/apps/DialogsApp.vue | 8 +++ .../app/components/bookmarks/bookmarksVm.js | 25 +-------- .../components/bookmarks/bookmarks_view.html | 25 --------- 7 files changed, 67 insertions(+), 50 deletions(-) create mode 100644 src/js/app/components/ImportDialog.vue diff --git a/scripts/build-vue-comp.ps1 b/scripts/build-vue-comp.ps1 index cf6fd2f..99a981e 100644 --- a/scripts/build-vue-comp.ps1 +++ b/scripts/build-vue-comp.ps1 @@ -12,3 +12,4 @@ $CLI_PATH="node_modules/.bin" & "$CLI_PATH/vue-cli-service.ps1" build --target lib --formats umd --dest $DIST_FOLDER --no-clean --name bookmarks-menu "$COMPONENTS_FOLDER/BookmarksMenu.vue" & "$CLI_PATH/vue-cli-service.ps1" build --target lib --formats umd --dest $DIST_FOLDER --no-clean --name response-menu "$COMPONENTS_FOLDER/ResponseMenu.vue" & "$CLI_PATH/vue-cli-service.ps1" build --target lib --formats umd --dest $DIST_FOLDER --no-clean --name response-viewer "$COMPONENTS_FOLDER/ResponseViewer.vue" +& "$CLI_PATH/vue-cli-service.ps1" build --target lib --formats umd --dest $DIST_FOLDER --no-clean --name import-dialog "$COMPONENTS_FOLDER/ImportDialog.vue" diff --git a/scripts/build-vue-comp.sh b/scripts/build-vue-comp.sh index bb59121..e83b897 100755 --- a/scripts/build-vue-comp.sh +++ b/scripts/build-vue-comp.sh @@ -12,4 +12,5 @@ ${CLI_PATH}/vue-cli-service build --target lib --formats umd --dest ${DIST_FOLDE ${CLI_PATH}/vue-cli-service build --target lib --formats umd --dest ${DIST_FOLDER} --no-clean --name add-folder-button ${COMPONENTS_FOLDER}/AddFolderButton.vue ${CLI_PATH}/vue-cli-service build --target lib --formats umd --dest ${DIST_FOLDER} --no-clean --name bookmarks-menu ${COMPONENTS_FOLDER}/BookmarksMenu.vue ${CLI_PATH}/vue-cli-service build --target lib --formats umd --dest ${DIST_FOLDER} --no-clean --name response-menu ${COMPONENTS_FOLDER}/ResponseMenu.vue -${CLI_PATH}/vue-cli-service build --target lib --formats umd --dest ${DIST_FOLDER} --no-clean --name response-viewer ${COMPONENTS_FOLDER}/ResponseViewer.vue \ No newline at end of file +${CLI_PATH}/vue-cli-service build --target lib --formats umd --dest ${DIST_FOLDER} --no-clean --name response-viewer ${COMPONENTS_FOLDER}/ResponseViewer.vue +${CLI_PATH}/vue-cli-service build --target lib --formats umd --dest ${DIST_FOLDER} --no-clean --name import-dialog ${COMPONENTS_FOLDER}/ImportDialog.vue \ No newline at end of file diff --git a/src/js/app/components/ImportButton.vue b/src/js/app/components/ImportButton.vue index 83ec332..1b8912d 100644 --- a/src/js/app/components/ImportButton.vue +++ b/src/js/app/components/ImportButton.vue @@ -13,7 +13,7 @@ import bacheca from 'Services/bacheca' export default { methods: { action() { - bacheca.publish('importDialog') + bacheca.publish('showImportDialog') }, }, } diff --git a/src/js/app/components/ImportDialog.vue b/src/js/app/components/ImportDialog.vue new file mode 100644 index 0000000..6a338ca --- /dev/null +++ b/src/js/app/components/ImportDialog.vue @@ -0,0 +1,53 @@ + + + diff --git a/src/js/app/components/apps/DialogsApp.vue b/src/js/app/components/apps/DialogsApp.vue index fc6d35b..e797e40 100644 --- a/src/js/app/components/apps/DialogsApp.vue +++ b/src/js/app/components/apps/DialogsApp.vue @@ -13,6 +13,10 @@ v-show="showFolderDialog" :selected-folder="selectedFolder" @dismiss-dialog="showFolderDialog = false"> + @@ -22,6 +26,7 @@ import AboutDialog from 'Components/AboutDialog.vue' import CreditsDialog from 'Components/CreditsDialog.vue' import DonateDialog from 'Components/DonateDialog.vue' import FolderDialog from 'Components/FolderDialog.vue' +import ImportDialog from 'Components/ImportDialog.vue' export default { name: 'DialogsApp', @@ -36,6 +41,7 @@ export default { this.showFolderDialog = true this.selectedFolder = selectedFolder }) + bacheca.subscribe('showImportDialog', () => (this.showImportDialog = true)) }, data() { return { @@ -43,6 +49,7 @@ export default { showCreditsDialog: false, showDonateDialog: false, showFolderDialog: false, + showImportDialog: false, selectedFolder: false, } }, @@ -51,6 +58,7 @@ export default { CreditsDialog, DonateDialog, FolderDialog, + ImportDialog }, } diff --git a/src/js/app/components/bookmarks/bookmarksVm.js b/src/js/app/components/bookmarks/bookmarksVm.js index fee6bf4..02c76de 100644 --- a/src/js/app/components/bookmarks/bookmarksVm.js +++ b/src/js/app/components/bookmarks/bookmarksVm.js @@ -26,7 +26,7 @@ define([ 'app/contextVm', 'component/bookmarks/bookmarkVm', 'component/entry-list/entryItemVm', - 'vuecomp/bookmarks-menu.umd', + 'vuecomp/bookmarks-menu.umd' ], function ( Vue, ko, @@ -46,9 +46,7 @@ define([ const bookmarkToDeleteName = ko.observable() const tryToDeleteFolder = ko.observable(false) const showBookmarkDeleteDialog = ko.observable(false) - const showImportDialog = ko.observable(false) const showExportDialog = ko.observable(false) - const importSrc = ko.observable('har') const exportSrc = ko.observable('har') // contextual menu @@ -115,11 +113,6 @@ define([ deleteChildrenBookmarks(false) } - const dismissImportDialog = () => { - showImportDialog(false) - document.getElementById('import-file').value = '' - } - const dismissExportDialog = () => { showExportDialog(false) } @@ -158,20 +151,11 @@ define([ } } - const importBookmarks = () => { - _handleImport() - dismissImportDialog() - } - const exportBookmarks = () => { _handleExport() dismissExportDialog() } - const _importDialog = () => { - showImportDialog(true) - } - const _exportDialog = () => { showExportDialog(true) } @@ -180,7 +164,6 @@ define([ const excape = 27 if (event.keyCode === excape) { showBookmarkDeleteDialog(false) - showImportDialog(false) showExportDialog(false) showBookmarkContextMenu(false) showFolderContextMenu(false) @@ -409,15 +392,12 @@ define([ bacheca.subscribe('newFolder', _addFolder) bacheca.subscribe('sortBookmarks', _sortBookmarks) bacheca.subscribe('exportDialog', _exportDialog) - bacheca.subscribe('importDialog', _importDialog) + bacheca.subscribe('importBookmarks', _handleImport) return { closeDialogOnExcape, - showImportDialog, showExportDialog, - dismissImportDialog, dismissExportDialog, - importSrc, exportSrc, bookmarks, showBookmarkDeleteDialog, @@ -431,7 +411,6 @@ define([ deleteBookmarkFromView, loadBookmarkObj, expandFolder, - importBookmarks, exportBookmarks, exportSelectedBookmarks, // context menu diff --git a/src/js/app/components/bookmarks/bookmarks_view.html b/src/js/app/components/bookmarks/bookmarks_view.html index be09555..3103989 100644 --- a/src/js/app/components/bookmarks/bookmarks_view.html +++ b/src/js/app/components/bookmarks/bookmarks_view.html @@ -160,31 +160,6 @@ -
-
Import bookmarks
-
-
- From: - - -
-
- -
-
- -
-
Date: Sun, 5 Jan 2025 20:46:16 +0100 Subject: [PATCH 2/3] chore: port exportDialog to vue --- scripts/build-vue-comp.ps1 | 1 + scripts/build-vue-comp.sh | 3 +- src/js/app/components/ExportButton.vue | 2 +- src/js/app/components/ExportDialog.vue | 49 +++++++++++++++++++ src/js/app/components/apps/DialogsApp.vue | 10 +++- .../app/components/bookmarks/bookmarksVm.js | 22 +-------- .../components/bookmarks/bookmarks_view.html | 22 --------- 7 files changed, 63 insertions(+), 46 deletions(-) create mode 100644 src/js/app/components/ExportDialog.vue diff --git a/scripts/build-vue-comp.ps1 b/scripts/build-vue-comp.ps1 index 99a981e..78ba315 100644 --- a/scripts/build-vue-comp.ps1 +++ b/scripts/build-vue-comp.ps1 @@ -13,3 +13,4 @@ $CLI_PATH="node_modules/.bin" & "$CLI_PATH/vue-cli-service.ps1" build --target lib --formats umd --dest $DIST_FOLDER --no-clean --name response-menu "$COMPONENTS_FOLDER/ResponseMenu.vue" & "$CLI_PATH/vue-cli-service.ps1" build --target lib --formats umd --dest $DIST_FOLDER --no-clean --name response-viewer "$COMPONENTS_FOLDER/ResponseViewer.vue" & "$CLI_PATH/vue-cli-service.ps1" build --target lib --formats umd --dest $DIST_FOLDER --no-clean --name import-dialog "$COMPONENTS_FOLDER/ImportDialog.vue" +& "$CLI_PATH/vue-cli-service.ps1" build --target lib --formats umd --dest $DIST_FOLDER --no-clean --name export-dialog "$COMPONENTS_FOLDER/ExportDialog.vue" diff --git a/scripts/build-vue-comp.sh b/scripts/build-vue-comp.sh index e83b897..7e8b070 100755 --- a/scripts/build-vue-comp.sh +++ b/scripts/build-vue-comp.sh @@ -13,4 +13,5 @@ ${CLI_PATH}/vue-cli-service build --target lib --formats umd --dest ${DIST_FOLDE ${CLI_PATH}/vue-cli-service build --target lib --formats umd --dest ${DIST_FOLDER} --no-clean --name bookmarks-menu ${COMPONENTS_FOLDER}/BookmarksMenu.vue ${CLI_PATH}/vue-cli-service build --target lib --formats umd --dest ${DIST_FOLDER} --no-clean --name response-menu ${COMPONENTS_FOLDER}/ResponseMenu.vue ${CLI_PATH}/vue-cli-service build --target lib --formats umd --dest ${DIST_FOLDER} --no-clean --name response-viewer ${COMPONENTS_FOLDER}/ResponseViewer.vue -${CLI_PATH}/vue-cli-service build --target lib --formats umd --dest ${DIST_FOLDER} --no-clean --name import-dialog ${COMPONENTS_FOLDER}/ImportDialog.vue \ No newline at end of file +${CLI_PATH}/vue-cli-service build --target lib --formats umd --dest ${DIST_FOLDER} --no-clean --name import-dialog ${COMPONENTS_FOLDER}/ImportDialog.vue +${CLI_PATH}/vue-cli-service build --target lib --formats umd --dest ${DIST_FOLDER} --no-clean --name export-dialog ${COMPONENTS_FOLDER}/ExportDialog.vue \ No newline at end of file diff --git a/src/js/app/components/ExportButton.vue b/src/js/app/components/ExportButton.vue index d0ba368..de86d58 100644 --- a/src/js/app/components/ExportButton.vue +++ b/src/js/app/components/ExportButton.vue @@ -13,7 +13,7 @@ import bacheca from 'Services/bacheca' export default { methods: { action() { - bacheca.publish('exportDialog') + bacheca.publish('showExportDialog') }, }, } diff --git a/src/js/app/components/ExportDialog.vue b/src/js/app/components/ExportDialog.vue new file mode 100644 index 0000000..42f0809 --- /dev/null +++ b/src/js/app/components/ExportDialog.vue @@ -0,0 +1,49 @@ + + + diff --git a/src/js/app/components/apps/DialogsApp.vue b/src/js/app/components/apps/DialogsApp.vue index e797e40..1a7e07e 100644 --- a/src/js/app/components/apps/DialogsApp.vue +++ b/src/js/app/components/apps/DialogsApp.vue @@ -17,6 +17,10 @@ v-show="showImportDialog" @dismiss-dialog="showImportDialog = false" > +
@@ -27,6 +31,7 @@ import CreditsDialog from 'Components/CreditsDialog.vue' import DonateDialog from 'Components/DonateDialog.vue' import FolderDialog from 'Components/FolderDialog.vue' import ImportDialog from 'Components/ImportDialog.vue' +import ExportDialog from 'Components/ExportDialog.vue' export default { name: 'DialogsApp', @@ -42,6 +47,7 @@ export default { this.selectedFolder = selectedFolder }) bacheca.subscribe('showImportDialog', () => (this.showImportDialog = true)) + bacheca.subscribe('showExportDialog', () => (this.showExportDialog = true)) }, data() { return { @@ -50,6 +56,7 @@ export default { showDonateDialog: false, showFolderDialog: false, showImportDialog: false, + showExportDialog: false, selectedFolder: false, } }, @@ -58,7 +65,8 @@ export default { CreditsDialog, DonateDialog, FolderDialog, - ImportDialog + ImportDialog, + ExportDialog }, } diff --git a/src/js/app/components/bookmarks/bookmarksVm.js b/src/js/app/components/bookmarks/bookmarksVm.js index 02c76de..cf89f37 100644 --- a/src/js/app/components/bookmarks/bookmarksVm.js +++ b/src/js/app/components/bookmarks/bookmarksVm.js @@ -46,8 +46,6 @@ define([ const bookmarkToDeleteName = ko.observable() const tryToDeleteFolder = ko.observable(false) const showBookmarkDeleteDialog = ko.observable(false) - const showExportDialog = ko.observable(false) - const exportSrc = ko.observable('har') // contextual menu const showBookmarkContextMenu = ko.observable(false) @@ -113,10 +111,6 @@ define([ deleteChildrenBookmarks(false) } - const dismissExportDialog = () => { - showExportDialog(false) - } - const deleteBookmark = (bookmark, deleteChildrenBookmarks) => { if (bookmark.folder) { const containerFolder = bookmarks().find( @@ -151,20 +145,10 @@ define([ } } - const exportBookmarks = () => { - _handleExport() - dismissExportDialog() - } - - const _exportDialog = () => { - showExportDialog(true) - } - const closeDialogOnExcape = (data, event) => { const excape = 27 if (event.keyCode === excape) { showBookmarkDeleteDialog(false) - showExportDialog(false) showBookmarkContextMenu(false) showFolderContextMenu(false) } @@ -391,14 +375,11 @@ define([ */ bacheca.subscribe('newFolder', _addFolder) bacheca.subscribe('sortBookmarks', _sortBookmarks) - bacheca.subscribe('exportDialog', _exportDialog) bacheca.subscribe('importBookmarks', _handleImport) + bacheca.subscribe('exportBookmarks', _handleExport) return { closeDialogOnExcape, - showExportDialog, - dismissExportDialog, - exportSrc, bookmarks, showBookmarkDeleteDialog, bookmarkToDeleteName, @@ -411,7 +392,6 @@ define([ deleteBookmarkFromView, loadBookmarkObj, expandFolder, - exportBookmarks, exportSelectedBookmarks, // context menu contextMenu, diff --git a/src/js/app/components/bookmarks/bookmarks_view.html b/src/js/app/components/bookmarks/bookmarks_view.html index 3103989..77d2156 100644 --- a/src/js/app/components/bookmarks/bookmarks_view.html +++ b/src/js/app/components/bookmarks/bookmarks_view.html @@ -159,26 +159,4 @@ - -
-
Export bookmarks
-
-
- To: - - -
-
- -
From 2b1c0af516db7e91a484af3be609a5181fe67679 Mon Sep 17 00:00:00 2001 From: mirko Date: Tue, 11 Feb 2025 20:36:12 +0100 Subject: [PATCH 3/3] chore: fix formatting --- src/js/app/components/ExportDialog.vue | 19 ++++++------------- src/js/app/components/ImportDialog.vue | 17 +++++------------ src/js/app/components/apps/DialogsApp.vue | 8 +++----- .../app/components/bookmarks/bookmarksVm.js | 2 +- 4 files changed, 15 insertions(+), 31 deletions(-) diff --git a/src/js/app/components/ExportDialog.vue b/src/js/app/components/ExportDialog.vue index 42f0809..76b3079 100644 --- a/src/js/app/components/ExportDialog.vue +++ b/src/js/app/components/ExportDialog.vue @@ -3,21 +3,14 @@ title="Export bookmarks" :show-footer="true" @dismiss-dialog="$emit('dismiss-dialog')"> -
+
To:
@@ -30,7 +23,7 @@ export default { name: 'ExportDialog', data() { return { - exportSrc: 'har' + exportSrc: 'har', } }, methods: { @@ -42,8 +35,8 @@ export default { this.$emit('dismiss-dialog') }, }, - components: { + components: { RDialog, - } + }, } diff --git a/src/js/app/components/ImportDialog.vue b/src/js/app/components/ImportDialog.vue index 6a338ca..0cea046 100644 --- a/src/js/app/components/ImportDialog.vue +++ b/src/js/app/components/ImportDialog.vue @@ -12,15 +12,8 @@
@@ -33,7 +26,7 @@ export default { name: 'ImportDialog', data() { return { - importSrc: 'har' + importSrc: 'har', } }, methods: { @@ -46,8 +39,8 @@ export default { this.$emit('dismiss-dialog') }, }, - components: { + components: { RDialog, - } + }, } diff --git a/src/js/app/components/apps/DialogsApp.vue b/src/js/app/components/apps/DialogsApp.vue index 1a7e07e..214d0b0 100644 --- a/src/js/app/components/apps/DialogsApp.vue +++ b/src/js/app/components/apps/DialogsApp.vue @@ -15,12 +15,10 @@ @dismiss-dialog="showFolderDialog = false"> + @dismiss-dialog="showImportDialog = false"> + @dismiss-dialog="showExportDialog = false"> @@ -66,7 +64,7 @@ export default { DonateDialog, FolderDialog, ImportDialog, - ExportDialog + ExportDialog, }, } diff --git a/src/js/app/components/bookmarks/bookmarksVm.js b/src/js/app/components/bookmarks/bookmarksVm.js index cf89f37..0b11c79 100644 --- a/src/js/app/components/bookmarks/bookmarksVm.js +++ b/src/js/app/components/bookmarks/bookmarksVm.js @@ -26,7 +26,7 @@ define([ 'app/contextVm', 'component/bookmarks/bookmarkVm', 'component/entry-list/entryItemVm', - 'vuecomp/bookmarks-menu.umd' + 'vuecomp/bookmarks-menu.umd', ], function ( Vue, ko,