From ab607a73fd1bbab3275acb171bb1748e2836aade Mon Sep 17 00:00:00 2001 From: Maxim Lyubimov Date: Thu, 20 Jun 2024 18:46:56 +0300 Subject: [PATCH 01/11] docs: Edit Readme --- README.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 4e76f3e..60dfffe 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,15 @@ docker build -t test . ``` ``` -docker run --rm -it -p 8080:80 --net test -e POSTGRES_URL=postgresql+asyncpg://user:password@hostname/database test +docker network create --driver bridge test +``` + +``` +docker run --rm -d --name postgres --net=test -e POSTGRES_USER=user -e POSTGRES_PASSWORD=password postgres:15.3-alpine +``` + +``` +docker run --rm -it -p 8080:80 --net test -e POSTGRES_URL=postgresql+asyncpg://user:password@hostname/ test ``` Visit `http://127.0.0.1:8080/admin` From 23e32d3c92ef087c0eebcb1ab399e0a419407ca8 Mon Sep 17 00:00:00 2001 From: Maxim Lyubimov Date: Thu, 20 Jun 2024 18:47:40 +0300 Subject: [PATCH 02/11] fix: Delete env in frontend folder --- frontend/.env | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 frontend/.env diff --git a/frontend/.env b/frontend/.env deleted file mode 100644 index 1ad7f5a..0000000 --- a/frontend/.env +++ /dev/null @@ -1,3 +0,0 @@ -APP_PATH = /admin # relative base path where the frontend is served from, resulting in https://example.com/admin -API_PATH = /api/v0/ # relative base path where the API is served from, resulting in https://example.com/api/v0/ -#SHORTENED_URL_BASE_PATH = https://r.example.com/ # (vanity, only used to display urls) absolute base path for shortened links, resulting in https://r.example.com/abc123, define this env if you wanna overwrite default value `${location.origin}/` From f1d6fd02157d8730e07f842684dea6e91ef2915c Mon Sep 17 00:00:00 2001 From: Maxim Lyubimov Date: Thu, 20 Jun 2024 18:48:00 +0300 Subject: [PATCH 03/11] feat: Add env example in frontend folder and add Environment Variable to gitignore --- .gitignore | 4 ++++ frontend/.env.example | 3 +++ 2 files changed, 7 insertions(+) create mode 100644 frontend/.env.example diff --git a/.gitignore b/.gitignore index 162b4db..a679df0 100644 --- a/.gitignore +++ b/.gitignore @@ -166,3 +166,7 @@ cython_debug/ # Volumes volumes/ + +# Environment Variable +backend/.env +fronted/.env diff --git a/frontend/.env.example b/frontend/.env.example new file mode 100644 index 0000000..35d2603 --- /dev/null +++ b/frontend/.env.example @@ -0,0 +1,3 @@ +APP_PATH = /admin # relative base path where the frontend is served from, resulting in https://example.com/admin +API_PATH = /api/v0/ # relative base path where the API is served from, resulting in https://example.com/api/v0/ +SHORTENED_URL_BASE_PATH = https://r.example.com/ # (vanity, only used to display urls) absolute base path for shortened links, resulting in https://r.example.com/abc123, define this env if you wanna overwrite default value `${location.origin}/` From a603fb782163eb1bf87ca765bfe298023eef420e Mon Sep 17 00:00:00 2001 From: Maxim Lyubimov Date: Thu, 20 Jun 2024 18:48:14 +0300 Subject: [PATCH 04/11] feat: Add nvmrc --- frontend/.nvmrc | 1 + 1 file changed, 1 insertion(+) create mode 100644 frontend/.nvmrc diff --git a/frontend/.nvmrc b/frontend/.nvmrc new file mode 100644 index 0000000..5e0828a --- /dev/null +++ b/frontend/.nvmrc @@ -0,0 +1 @@ +v18.16.1 From 96738e04ac22be42b03aa5c61a442f47ac937ff0 Mon Sep 17 00:00:00 2001 From: Maxim Lyubimov Date: Thu, 20 Jun 2024 18:48:37 +0300 Subject: [PATCH 05/11] perf: Add config prettier and edit eslint config --- frontend/.eslintrc.cjs | 10 +++++++--- frontend/.prettierrc.json | 21 +++++++++++++++++++++ 2 files changed, 28 insertions(+), 3 deletions(-) create mode 100644 frontend/.prettierrc.json diff --git a/frontend/.eslintrc.cjs b/frontend/.eslintrc.cjs index e1c4dd6..348c1b9 100644 --- a/frontend/.eslintrc.cjs +++ b/frontend/.eslintrc.cjs @@ -5,7 +5,7 @@ module.exports = { root: true, parserOptions: { - ecmaVersion: 2021, // Allows for the parsing of modern ECMAScript features + ecmaVersion: 2021 // Allows for the parsing of modern ECMAScript features }, env: { @@ -33,7 +33,7 @@ module.exports = { plugins: [ // https://eslint.vuejs.org/user-guide/#why-doesn-t-it-work-on-vue-files // required to lint *.vue files - 'vue', + 'vue' ], @@ -47,7 +47,11 @@ module.exports = { __QUASAR_SSR_PWA__: 'readonly', process: 'readonly', Capacitor: 'readonly', - chrome: 'readonly' + chrome: 'readonly', + defineProps: 'readonly', + defineEmits: 'readonly', + defineExpose: 'readonly', + withDefaults: 'readonly' }, // add your custom rules here diff --git a/frontend/.prettierrc.json b/frontend/.prettierrc.json new file mode 100644 index 0000000..d1df35f --- /dev/null +++ b/frontend/.prettierrc.json @@ -0,0 +1,21 @@ +{ + "arrowParens": "always", + "bracketSameLine": false, + "bracketSpacing": true, + "embeddedLanguageFormatting": "auto", + "endOfLine": "lf", + "htmlWhitespaceSensitivity": "css", + "insertPragma": false, + "jsxSingleQuote": true, + "printWidth": 80, + "proseWrap": "preserve", + "quoteProps": "as-needed", + "requirePragma": false, + "semi": false, + "singleAttributePerLine": false, + "singleQuote": true, + "tabWidth": 2, + "trailingComma": "none", + "useTabs": false, + "vueIndentScriptAndStyle": false +} From d908087597b1b3938c79cd07a31f6381271618c5 Mon Sep 17 00:00:00 2001 From: Maxim Lyubimov Date: Thu, 20 Jun 2024 18:48:49 +0300 Subject: [PATCH 06/11] feat: Add vscode settings file --- .vscode/settings.json | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..ab31fd5 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,16 @@ +{ + "editor.bracketPairColorization.enabled": true, + "editor.guides.bracketPairs": true, + "editor.formatOnSave": true, + "editor.defaultFormatter": "dbaeumer.vscode-eslint", + "editor.codeActionsOnSave": [ + "source.fixAll.eslint" + ], + "eslint.validate": [ + "javascript", + "javascriptreact", + "typescript", + "vue" + ], + "prettier.configPath": ".prettierrc.json" +} From d516dd70c91cf572fa9c2ec0cbf2fc8a164f0f3a Mon Sep 17 00:00:00 2001 From: Maxim Lyubimov Date: Thu, 20 Jun 2024 18:51:37 +0300 Subject: [PATCH 07/11] feat: Add tags and sorting --- frontend/src/components/URLsList.vue | 637 +++++++++++++++++++++-- frontend/src/components/tags/TagList.vue | 123 +++++ frontend/src/composables/useShowNotif.js | 4 +- 3 files changed, 716 insertions(+), 48 deletions(-) create mode 100644 frontend/src/components/tags/TagList.vue diff --git a/frontend/src/components/URLsList.vue b/frontend/src/components/URLsList.vue index a756dae..35fca01 100644 --- a/frontend/src/components/URLsList.vue +++ b/frontend/src/components/URLsList.vue @@ -8,8 +8,11 @@ :columns="columns" row-key="id" hide-bottom - :pagination="{ rowsPerPage: 0 }" + v-model:pagination="queryParams" no-data-label="No items to show" + :loading="isURLsListLoading" + @request="onURLsRequest" + binary-state-sort > + + + + + + + + +
Add tags
+
+ + + + + + + +
+ +
+
+ + + +
+
+ + + +
Add tags for filtering
+
+ + + + + +
+ +
+
+ + + +
+
diff --git a/frontend/src/components/tags/TagList.vue b/frontend/src/components/tags/TagList.vue new file mode 100644 index 0000000..4dbf88a --- /dev/null +++ b/frontend/src/components/tags/TagList.vue @@ -0,0 +1,123 @@ + + + diff --git a/frontend/src/composables/useShowNotif.js b/frontend/src/composables/useShowNotif.js index 3f1cbe0..dc9a13e 100644 --- a/frontend/src/composables/useShowNotif.js +++ b/frontend/src/composables/useShowNotif.js @@ -1,6 +1,6 @@ import { Notify } from 'quasar' -const showNotif = ({ message, color, reloadBtn }) => { +const showNotif = ({ message, color, reloadBtn, timeout = 0 }) => { const actions = [] if (reloadBtn) { @@ -17,7 +17,7 @@ const showNotif = ({ message, color, reloadBtn }) => { color, textColor: 'white', position: 'bottom-right', - timeout: 0, + timeout, group: true, actions }) From 9396088091e0f9248a92bc627d1402af37d4b4a0 Mon Sep 17 00:00:00 2001 From: Maxim Lyubimov Date: Thu, 20 Jun 2024 19:05:34 +0300 Subject: [PATCH 08/11] feat: Add use of the changeRowsPerPage function --- frontend/src/components/URLsList.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/components/URLsList.vue b/frontend/src/components/URLsList.vue index 35fca01..19b2f30 100644 --- a/frontend/src/components/URLsList.vue +++ b/frontend/src/components/URLsList.vue @@ -37,7 +37,7 @@ dense borderless class="q-ml-sm" - @update:model-value="localStore('queryParams.size', queryParams.size)" + @update:model-value="changeRowsPerPage" > From 39c2e783f0ae9b65e025275c053d3d8c0e169c64 Mon Sep 17 00:00:00 2001 From: Maxim Lyubimov Date: Thu, 20 Jun 2024 19:36:34 +0300 Subject: [PATCH 09/11] feat: Add dialog for deleting tag --- frontend/src/components/URLsList.vue | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/frontend/src/components/URLsList.vue b/frontend/src/components/URLsList.vue index 19b2f30..a9a059f 100644 --- a/frontend/src/components/URLsList.vue +++ b/frontend/src/components/URLsList.vue @@ -349,7 +349,7 @@ @click="(val) => addTag({ tag: val })" - @remove="deleteTag" + @remove="openDeleteTagDialog" />
+ + + + +
+
Delete the tag «{{ deletableTag.name }}»
+
Are you sure you want to delete this tag?
+
+
+ + + + +
+
@@ -695,6 +712,12 @@ const addTag = async ({ tag, isShowNotif = true }) => { } } } +const dialogDeleteTag = ref(false) +const deletableTag = ref(null) +const openDeleteTagDialog = (tag) => { + dialogDeleteTag.value = true + deletableTag.value = tag +} const deleteTag = (tag) => { axios.delete(new URL(`tag/${tag.id}`, API_ENDPOINT)) .then(res => { From 74f6e08985e5d40ad4986dcc69a616b6992d6e1b Mon Sep 17 00:00:00 2001 From: Maxim Lyubimov Date: Thu, 20 Jun 2024 19:37:37 +0300 Subject: [PATCH 10/11] fix: Add tag to utl table --- frontend/src/components/URLsList.vue | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/frontend/src/components/URLsList.vue b/frontend/src/components/URLsList.vue index a9a059f..e5e744d 100644 --- a/frontend/src/components/URLsList.vue +++ b/frontend/src/components/URLsList.vue @@ -777,15 +777,25 @@ const addTagsUrl = async ({ UrlId, tags, isShowNotif = true }) => { tag_ids: tags.map((tag) => tag.id) }) .then(() => { - if (isShowNotif) { - tags.forEach(tag => { + const currentUrl = rows.value.find((url) => url.id === UrlId) + const _tags = currentUrl.tags + + tags.forEach(tag => { + originalUrlTags.value.push(tag) + const tagIndex = _tags.findIndex((i) => i.id === tag.id) + + if (tagIndex === -1) { + currentUrl.tags.push(tag) + } + + if (isShowNotif) { showNotif({ message: `Successfully added «${tag.name}» tag to URL`, color: 'positive', timeout: 1000 }) - }) - } + } + }) }) .catch(error => { console.error(error) From 92b7b77390bb01e05230fbaaefeea576ae2ac774 Mon Sep 17 00:00:00 2001 From: Maxim Lyubimov <52247631+mlyubimov@users.noreply.github.com> Date: Sun, 24 Nov 2024 03:45:21 +0400 Subject: [PATCH 11/11] fix: Frontend env file path in gitignore --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index a679df0..5365bd0 100644 --- a/.gitignore +++ b/.gitignore @@ -169,4 +169,4 @@ volumes/ # Environment Variable backend/.env -fronted/.env +frontend/.env