From 470de49d26f28c5c53edc5fe2ff4f54470556837 Mon Sep 17 00:00:00 2001 From: Evgenii Sopov Date: Tue, 9 Jun 2020 23:22:40 +0700 Subject: [PATCH 01/23] Removed hardcoded useful links --- .../useful-links/useful-links.component.ts | 668 +----------------- 1 file changed, 1 insertion(+), 667 deletions(-) diff --git a/fhq-web-user/src/app/pages/useful-links/useful-links.component.ts b/fhq-web-user/src/app/pages/useful-links/useful-links.component.ts index da416776..ed27a3f3 100644 --- a/fhq-web-user/src/app/pages/useful-links/useful-links.component.ts +++ b/fhq-web-user/src/app/pages/useful-links/useful-links.component.ts @@ -21,673 +21,7 @@ export interface UsefulLinkElement { styleUrls: ['./useful-links.component.css'] }) export class UsefulLinksComponent implements OnInit { - public usefullLinksData: UsefulLinkElement[] = [{ - "id": 1, - "link": "https://freehackquest.com/", - "description": "CTF training: Online aрхив тасков, платформа для проведения CTF игр", - "rating": 0, - "tags": ["ctf", "training", "archive"] - }, { - "id": 2, - "link" : "http://training.hackerdom.ru/", - "description" : "CTF training: by from RuCTF organizotrs", - "rating": 0, - "tags": ["ctf"] - }, { - "id": 3, - "link": "https://ctfnews.ru/news/", - "description": "CTF in Russia", - "rating": 0, - "tags": ["ctf"] - }, { - "id": 4, - "link": "https://kmb.cybber.ru/", - "description": "КМБ (Курс молодого бойца) CTF - ресурс, посвященный соревнованиям в области информационной безопасности", - "rating": 0, - "tags": ["ctf", "courses"] - }, { - "id": 5, - "link": "https://ctftime.org ", - "description": "all about ctf (capture the flag) capture the flag, ctf teams, ctf ratings, ctf archive, ctf writeups", - "rating": 0, - "tags": ["ctf", "timetable", "rating"] - }, { - "id": 6, - "link": "https://ulearn.me/", - "description": "Интерактивные онлайн-курсы по программированию", - "rating": 0, - "tags": ["courses"] - }, { - "id": 7, - "link": "https://securitylab.ru/", - "description": "информационный портал по безопасности securitylab.ru, новости, статьи, обзор уязвимостей, вирусов и мнения аналитиков.", - "rating": 0, - "tags": ["news", "security"] - }, { - "id": 8, - "link": "http://itsecwiki.org/", - "description": "informationsecurity wiki", - "rating": 0, - "tags": [""] - }, { - "id": 9, - "link": "http://ringzer0team.com/", - "description": "CTF training/wargames", - "rating": 0, - "tags": [""] - }, { - "id": 10, - "link": "https://30.ctf.su", - "description": "Платформа с тасками task-based/jeopardy", - "rating": 0, - "tags": [""] - }, { - "id": 11, - "link": "https://re.mipt.ru", - "description": "курс 'защита информации'. кафедра радиотехники. мфти.", - "rating": 0, - "tags": [""] - }, { - "id": 12, - "link": "https://iso27000.ru ", - "description": "защита информации, управление информационной безопасностью и рисками", - "rating": 0, - "tags": [""] - }, { - "id": 13, - "link": "https://kmb.ufoctf.ru", - "description": "курс молодого ctf бойца v 1.5", - "rating": 0, - "tags": [""] - }, { - "id": 14, - "link": "https://md5hashing.net", - "description": "ultimate hashing and anonymity toolkit", - "rating": 0, - "tags": [""] - }, { - "id": 15, - "link": "https://forum.antichat.ru", - "description": "antichat - security online community", - "rating": 0, - "tags": [""] - }, { - "id": 16, - "link": "https://security.stackexchange", - "description": "information security stack exchange", - "rating": 0, - "tags": [""] - }, { - "id": 17, - "link": "http://hackware.ru", - "description": "hackware.ru - этичный хакинг и тестирование на проникновение, информационна", - "rating": 0, - "tags": [""] - }, { - "id": 18, - "link": "http://yztm.ru", - "description": "защита информации и эпо", - "rating": 0, - "tags": [""] - }, { - "id": 19, - "link": "http://overthewire.org", - "description": "overthewire: wargames", - "rating": 0, - "tags": [""] - }, { - "id": 20, - "link": "http://owasp.org", - "description": "owasp", - "rating": 0, - "tags": [""] - }, { - "id": 30, - "link": "http://root-me.org", - "description": "CTF training/wargames", - "rating": 0, - "tags": [""] - }, { - "id": 31, - "link": "http://canyouhack.it/", - "description": "CTF training/wargames", - "rating": 0, - "tags": [""] - }, { - "id": 32, - "link": "http://www.hackthis.co.uk", - "description": "CTF training/wargames", - "rating": 0, - "tags": [""] - }, { - "id": 33, - "link": "https://hack.me/", - "description": "THE HOUSE OF THE RISING SANDBOX", - "rating": 0, - "tags": [""] - }, { - "id": 34, - "link": "https://xss-game.appspot.com/", - "description": "Google's XSS vulnerability search game", - "rating": 0, - "tags": [""] - }, { - "id": 35, - "link": "https://pwnable.tw/", - "description": "A newer set of high quality pwnable challenges", - "rating": 0, - "tags": [""] - }, { - "id": 36, - "link": "https://www.vulnhub.com/", - "description": "the essence of the tasks on this resource is to find the vulnerabilities in the issued virtual machine", - "rating": 0, - "tags": [""] - }, { - "id": 37, - "link": "https://hackthebox.eu", - "description": "platform for training and solving problems of hacking services and raising privileges in the OS", - "rating": 0, - "tags": [""] - }, { - "id": 38, - "link": "https://ctf365.com/", - "description": "CTF training/wargames", - "rating": 0, - "tags": [""] - }, { - "id": 39, - "link" : "http://smashthestack.org/wargames.html", - "description" : "Wargames", - "rating": 0, - "tags": [""] - }, { - "id": 40, - "link": "http://overthewire.org/wargames/", - "description": "CTF training/wargames", - "rating": 0, - "tags": [""] - }, { - "id": 41, - "link": "https://exploit-exercises.com/", - "description": "CTF training/wargames", - "rating": 0, - "tags": [""] - }, { - "id": 42, - "link": "https://microcorruption.com/login", - "description": "CTF training/wargames", - "rating": 0, - "tags": [""] - }, { - "id": 43, - "link": "http://cryptopals.com/", - "description": "Matasano Crypto Challenges", - "rating": 0, - "tags": [""] - }, { - "id": 44, - "link": "https://legacy.gitbook.com/book/isislab/hack-night/details", - "description": "Classbook", - "rating": 0, - "tags": [""] - }, { - "id": 45, - "link": "http://webcache.googleusercontent.com/search?q=cache:gOdFvGbs7R8J:delimitry.blogspot.com/2014/10/useful-tools-for-ctf.html+&cd=1&hl=ru&ct=clnk", - "description": "Useful Utilites", - "rating": 0, - "tags": [""] - }, { - "id": 46, - "link": "https://trailofbits.github.io/ctf/", - "description": "CTF Field Guide", - "rating": 0, - "tags": [""] - }, { - "id": 47, - "link": "http://pwntools.com", - "description": "CTF framework used by Gallopsled in every CTF", - "rating": 0, - "tags": [""] - }, { - "id": 48, - "link": "https://github.com/Gallopsled/pwntools", - "description": "CTF framework used by Gallopsled in every CTF", - "rating": 0, - "tags": [""] - }, { - "id": 49, - "link" : "https://github.com/zardus/ctf-tools", - "description" : "Some setup scripts for security research tools.", - "rating": 0, - "tags": [""] - }, { - "id": 50, - "link" : "https://apsdehal.in/awesome-ctf/", - "description" : "A curated list of CTF frameworks, libraries, resources and softwares", - "rating": 0, - "tags": [""] - }, { - "id": 51, - "link" : "https://github.com/apsdehal/awesome-ctf", - "description" : "A curated list of CTF frameworks, libraries, resources and softwares", - "rating": 0, - "tags": [""] - }, { - "id": 52, - "link" : "https://github.com/ctfs/resources", - "description" : "A general collection of information, tools, and tips regarding CTFs and similar security competitions", - "rating": 0, - "tags": [""] - }, { - "id": 53, - "link" : "http://ctfs.github.io/resources", - "description" : "A general collection of information, tools, and tips regarding CTFs and similar security competitions", - "rating": 0, - "tags": [""] - }, { - "id": 54, - "link" : "https://github.com/kablaa/CTF-Workshop", - "description" : "Challenges for Binary Exploitation Workshop", - "rating": 0, - "tags": [""] - }, { - "id": 55, - "link" : "https://github.com/bt3gl/My-Gray-Hacker-Resources", - "description" : "Useful for CTFs, wargames, pentesting. Educational purposes.", - "rating": 0, - "tags": [""] - }, { - "id": 56, - "link" : "https://github.com/enddo/awesome-windows-exploitation", - "description" : "A curated list of awesome Windows Exploitation resources, and shiny things. Inspired by awesom", - "rating": 0, - "tags": [""] - }, { - "id": 57, - "link": "https://www.youtube.com/channel/UCS0nOltkP5YXxWggoNVE3Gw/videos?view_as=subscriber", - "description": "FreeHackQuests write-up's", - "rating": 0, - "tags": [""] - }, { - "id": 58, - "link": "https://github.com/ctfs/write-ups-2014", - "description": "CTF write-up's", - "rating": 0, - "tags": [""] - }, { - "id": 59, - "link" : "https://github.com/ctfs/write-ups-2015", - "description" : "CTF write-up's", - "rating": 0, - "tags": [""] - }, { - "id": 60, - "link" : "https://github.com/ctfs/write-ups-2016", - "description" : "CTF write-up's", - "rating": 0, - "tags": [""] - }, { - "id": 61, - "link" : "http://www.pentesteracademy.com/", - "description" : "Education portal", - "rating": 0, - "tags": [""] - }, { - "id": 62, - "link" : "http://www.infosecinstitute.com/", - "description" : "Education portal", - "rating": 0, - "tags": [""] - }, { - "id": 63, - "link" : "http://opensecuritytraining.info/", - "description" : "Education portal", - "rating": 0, - "tags": [""] - }, { - "id": 64, - "link" : "http://securitytrainings.net/", - "description" : "Education portal", - "rating": 0, - "tags": [""] - }, { - "id": 65, - "link" : "http://www.best-masters.com/ranking-master-business-intelligence-knowledge-and-security-management.html", - "description" : "University", - "rating": 0, - "tags": [""] - }, { - "id": 66, - "link" : "http://www.cyberdegrees.org/listings/top-schools", - "description" : "University", - "rating": 0, - "tags": [""] - }, { - "id": 67, - "link" : "https://digitalguardian.com/blog/cybersecurity-higher-education-top-cybersecurity-colleges-and-degrees", - "description" : "University", - "rating": 0, - "tags": [""] - }, { - "id": 68, - "link" : "https://academy.yandex.ru/events/system_administration/kit_2014/", - "description" : "Courses", - "rating": 0, - "tags": [""] - }, { - "id": 69, - "link" : "http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/", - "description" : "Courses", - "rating": 0, - "tags": [""] - }, { - "id": 70, - "link" : "https://expdev-kiuhnm.rhcloud.com/", - "description" : "Exploit Development Community", - "rating": 0, - "tags": [""] - }, { - "id": 71, - "link" : "https://backdoor.sdslabs.co/", - "description" : "Other", - "rating": 0, - "tags": [""] - }, { - "id": 72, - "link" : "http://www.mod-x.co.uk/main.php", - "description" : "Other", - "rating": 0, - "tags": [""] - }, { - "id": 73, - "link" : "http://scanme.nmap.org/", - "description" : "Other", - "rating": 0, - "tags": [""] - }, { - "id": 74, - "link" : "http://www.hackertest.net/", - "description" : "Other", - "rating": 0, - "tags": [""] - }, { - "id": 75, - "link" : "http://net-force.nl/", - "description" : "Other", - "rating": 0, - "tags": [""] - }, { - "id": 76, - "link" : "http://pwnable.kr/", - "description" : "one of the more popular recent wargamming sets of challenges", - "rating": 0, - "tags": [""] - }, { - "id": 77, - "link" : "https://picoctf.com/", - "description" : "Designed for high school students while the event is usually new every year, it's left online and has a great difficulty progression", - "rating": 0, - "tags": [""] - }, { - "id": 78, - "link" : "https://microcorruption.com/login", - "description" : "one of the best interfaces, a good difficulty curve and introduction to low-level reverse engineering, specifically on an MSP430", - "rating": 0, - "tags": [""] - }, { - "id": 79, - "link" : "http://ctflearn.com/", - "description" : "a new CTF based learning platform with user-contributed challenges", - "rating": 0, - "tags": [""] - }, { - "id": 80, - "link" : "https://cherryblog.in/", - "description" : "", - "rating": 0, - "tags": [""] - }, { - "id": 81, - "link" : "http://reversing.kr/", - "description" : "", - "rating": 0, - "tags": [""] - }, { - "id": 82, - "link" : "http://hax.tor.hu/", - "description" : "", - "rating": 0, - "tags": [""] - }, { - "id": 83, - "link" : "https://w3challs.com/", - "description" : "", - "rating": 0, - "tags": [""] - }, { - "id": 84, - "link" : "https://pwn0.com/", - "description" : "", - "rating": 0, - "tags": [""] - }, { - "id": 85, - "link" : "https://io.netgarage.org/", - "description" : "", - "rating": 0, - "tags": [""] - }, { - "id": 86, - "link" : "http://ringzer0team.com/", - "description" : "", - "rating": 0, - "tags": [""] - }, { - "id": 87, - "link" : "http://www.hellboundhackers.org/", - "description" : "", - "rating": 0, - "tags": [""] - }, { - "id": 88, - "link" : "http://www.overthewire.org/wargames/", - "description" : "", - "rating": 0, - "tags": [""] - }, { - "id": 89, - "link" : "http://counterhack.net/Counter_Hack/Challenges.html", - "description" : "", - "rating": 0, - "tags": [""] - }, { - "id": 90, - "link" : "http://www.hackthissite.org/", - "description" : "", - "rating": 0, - "tags": [""] - }, { - "id": 91, - "link" : "http://ctf.komodosec.com", - "description" : "", - "rating": 0, - "tags": [""] - }, { - "id": 92, - "link" : "http://www.wechall.net/sites.php", - "description" : "excellent list of challenge sites", - "rating": 0, - "tags": [""] - }, { - "id": 93, - "link" : "http://ctf.forgottensec.com/wiki/", - "description" : "good CTF wiki, though focused on CCDC", - "rating": 0, - "tags": [""] - }, { - "id": 94, - "link" : "http://repo.shell-storm.org/CTF/", - "description" : "great archive of CTFs", - "rating": 0, - "tags": [""] - }, { - "id": 95, - "link" : "http://demo.testfire.net/", - "description" : "Webapp Specific", - "rating": 0, - "tags": [""] - }, { - "id": 96, - "link" : "http://wocares.com/xsstester.php", - "description" : "Webapp Specific", - "rating": 0, - "tags": [""] - }, { - "id": 97, - "link" : "http://crackme.cenzic.com/", - "description" : "Webapp Specific", - "rating": 0, - "tags": [""] - }, { - "id": 98, - "link" : "http://test.acunetix.com/", - "description" : "Webapp Specific", - "rating": 0, - "tags": [""] - }, { - "id": 99, - "link" : "http://zero.webappsecurity.com/", - "description" : "Webapp Specific", - "rating": 0, - "tags": [""] - }, { - "id": 100, - "link" : "http://computer-forensics.sans.org/community/challenges", - "description" : "Forensics Specific", - "rating": 0, - "tags": [""] - }, { - "id": 101, - "link" : "http://computer-forensics.sans.org/community/challenges", - "description" : "Forensics Specific", - "rating": 0, - "tags": [""] - }, { - "id": 102, - "link" : "http://forensicscontest.com/", - "description" : "Forensics Specific", - "rating": 0, - "tags": [""] - }, { - "id": 103, - "link" : "https://www.praetorian.com/challenges/pwnable/", - "description" : "Recruiting", - "rating": 0, - "tags": [""] - }, { - "id": 104, - "link" : "https://www.root-me.org/", - "description" : "well done set of challenges free for public use with optional paid commercial versions", - "rating": 0, - "tags": [""] - }, { - "id": 105, - "link" : "https://avatao.com", - "description" : "paid commercial training platform from a CTF team, though with a strong focus on secure app development", - "rating": 0, - "tags": [""] - }, { - "id": 106, - "link" : "http://heorot.net/", - "description" : "", - "rating": 0, - "tags": [""] - }, { - "id": 107, - "link" : "http://www.badstore.net/", - "description" : "Downloadable Offline Games", - "rating": 0, - "tags": [""] - }, { - "id": 108, - "link" : "http://www.owasp.org/index.php/Category:OWASP_WebGoat_Project", - "description" : "Downloadable Offline Games", - "rating": 0, - "tags": [""] - }, { - "id": 109, - "link" : "http://www.owasp.org/index.php/Owasp_SiteGenerator", - "description" : "Downloadable Offline Games", - "rating": 0, - "tags": [""] - }, { - "id": 110, - "link" : "http://www.ethicalhack3r.co.uk/damn-vulnerable-web-app/", - "description" : "Damn Vulnerable Web App", - "rating": 0, - "tags": [""] - }, { - "id": 111, - "link" : "http://suif.stanford.edu/~livshits/securibench/", - "description" : "Stanford SecureBench", - "rating": 0, - "tags": [""] - }, { - "id": 112, - "link" : "http://suif.stanford.edu/~livshits/work/securibench-micro/", - "description" : "Stanford SecureBench Micro", - "rating": 0, - "tags": [""] - }, { - "id": 113, - "link" : "http://www.irongeek.com/i.php?page=security/mutillidae-deliberately-vulnerable-php-owasp-top-10", - "description" : "Downloadable Offline Games", - "rating": 0, - "tags": [""] - }, { - "id": 114, - "link" : "https://pentesterlab.com/exercises/", - "description" : "Virtual Machines", - "rating": 0, - "tags": [""] - }, { - "id": 115, - "link" : "http://sourceforge.net/projects/metasploitable/files/Metasploitable2/", - "description" : "Virtual Machines", - "rating": 0, - "tags": [""] - }, { - "id": 116, - "link" : "http://intruded.net/", - "description" : "Inactive or Gone. Just around for historical sake, or on the off-chance they come back.", - "rating": 0, - "tags": [""] - }, { - "id": 117, - "link" : "http://www.foundstone.com/", - "description" : "Inactive or Gone. Just around for historical sake, or on the off-chance they come back.", - "rating": 0, - "tags": [""] - }, { - "id": 118, - "link" : "http://roothack.org/", - "description" : "Wargames", - "rating": 0, - "tags": [""] - }, { - "id": 119, - "link" : "https://ctf.saarland/", - "description" : "SaarCTF is a classical attack-defense CTF.", - "rating": 0, - "tags": [""] - }, { - "id": 120, - "link" : "https://course.ugractf.ru/", - "description" : "Информационные технологии и их безопасность. Курс для школьников, студентов и всех сочувствующих", - "rating": 0, - "tags": ["ctf", "course"] - }]; + public usefullLinksData: UsefulLinkElement[] = []; pageEvent: PageEvent; pageIndex: number = 0; From e9d59dc91fe3fe2c4c8895188b319ddefaedbdf7 Mon Sep 17 00:00:00 2001 From: Evgenii Sopov Date: Tue, 9 Jun 2020 23:47:40 +0700 Subject: [PATCH 02/23] Useful links - prepare button favorite / unfavorite / commets --- .../useful-links/useful-links.component.css | 8 ++++++++ .../useful-links/useful-links.component.html | 18 ++++++++++++++++-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/fhq-web-user/src/app/pages/useful-links/useful-links.component.css b/fhq-web-user/src/app/pages/useful-links/useful-links.component.css index 74185012..ba791f4c 100644 --- a/fhq-web-user/src/app/pages/useful-links/useful-links.component.css +++ b/fhq-web-user/src/app/pages/useful-links/useful-links.component.css @@ -19,4 +19,12 @@ .usefulLinks-tag { margin-right: 10px; +} + +.useful-links-table { + width: 100%; +} + +.useful-links-favorite-btn { + margin-left: 10px; } \ No newline at end of file diff --git a/fhq-web-user/src/app/pages/useful-links/useful-links.component.html b/fhq-web-user/src/app/pages/useful-links/useful-links.component.html index 8e44c4a9..772b400b 100644 --- a/fhq-web-user/src/app/pages/useful-links/useful-links.component.html +++ b/fhq-web-user/src/app/pages/useful-links/useful-links.component.html @@ -45,7 +45,7 @@

usefulLinks

- +
@@ -57,12 +57,26 @@

usefulLinks

From b9917a66c987bf96795c65fcc28277df1ef81a5f Mon Sep 17 00:00:00 2001 From: Evgenii Sopov Date: Wed, 10 Jun 2020 00:35:27 +0700 Subject: [PATCH 03/23] Updated version to 0.2.29 --- fhq-server/src.wsjcpp/CMakeLists.txt | 2 +- fhq-server/unit-tests.wsjcpp/CMakeLists.txt | 4 ++-- fhq-server/wsjcpp.yml | 2 +- fhq-web-user/package.json | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/fhq-server/src.wsjcpp/CMakeLists.txt b/fhq-server/src.wsjcpp/CMakeLists.txt index 66a31e27..ae1977b4 100644 --- a/fhq-server/src.wsjcpp/CMakeLists.txt +++ b/fhq-server/src.wsjcpp/CMakeLists.txt @@ -1,7 +1,7 @@ # Automaticly generated by wsjcpp@v0.1.5 cmake_minimum_required(VERSION 3.0) -add_definitions(-DWSJCPP_APP_VERSION="v0.2.27") +add_definitions(-DWSJCPP_APP_VERSION="v0.2.29") add_definitions(-DWSJCPP_APP_NAME="fhq-server") if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") diff --git a/fhq-server/unit-tests.wsjcpp/CMakeLists.txt b/fhq-server/unit-tests.wsjcpp/CMakeLists.txt index 56830ebe..9a4c8e65 100644 --- a/fhq-server/unit-tests.wsjcpp/CMakeLists.txt +++ b/fhq-server/unit-tests.wsjcpp/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.0) project(unit-tests C CXX) -add_definitions(-DWSJCPP_APP_VERSION="ut-v0.2.27") +add_definitions(-DWSJCPP_APP_VERSION="ut-v0.2.29") add_definitions(-DWSJCPP_APP_NAME="unit-tests-fhq-server") if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") @@ -95,7 +95,7 @@ list (APPEND WSJCPP_INCLUDE_DIRS "../src.wsjcpp/wsjcpp_parse_conf/") list (APPEND WSJCPP_SOURCES "../src.wsjcpp/wsjcpp_parse_conf/wsjcpp_parse_conf.cpp") list (APPEND WSJCPP_SOURCES "../src.wsjcpp/wsjcpp_parse_conf/wsjcpp_parse_conf.h") -# fhq-server:v0.2.27 +# fhq-server:v0.2.29 list (APPEND WSJCPP_INCLUDE_DIRS "../src") list (APPEND WSJCPP_SOURCES "../src/core/fallen.cpp") list (APPEND WSJCPP_SOURCES "../src/core/fallen.h") diff --git a/fhq-server/wsjcpp.yml b/fhq-server/wsjcpp.yml index ffa82324..46d7a0d7 100644 --- a/fhq-server/wsjcpp.yml +++ b/fhq-server/wsjcpp.yml @@ -3,7 +3,7 @@ cmake_minimum_required: 3.0 cmake_cxx_standard: 11 name: "fhq-server" -version: "v0.2.27" +version: "v0.2.29" description: "This is an open source platform for competitions of computer security." issues: "https://github.com/freehackquest/fhq-server/issues" diff --git a/fhq-web-user/package.json b/fhq-web-user/package.json index 6ca6dd41..b8b7acdf 100644 --- a/fhq-web-user/package.json +++ b/fhq-web-user/package.json @@ -1,6 +1,6 @@ { "name": "fhq-web-user", - "version": "0.2.28", + "version": "0.2.29", "scripts": { "ng": "ng", "start": "ng serve", From 270f8f4ad7acf8d67899a6a7def7edb6effb5ebe Mon Sep 17 00:00:00 2001 From: Evgenii Sopov Date: Wed, 10 Jun 2020 00:35:47 +0700 Subject: [PATCH 04/23] Updated 'thanks for' --- fhq-web-user/src/app/pages/welcome/welcome.component.html | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/fhq-web-user/src/app/pages/welcome/welcome.component.html b/fhq-web-user/src/app/pages/welcome/welcome.component.html index db7a225d..c5f91541 100644 --- a/fhq-web-user/src/app/pages/welcome/welcome.component.html +++ b/fhq-web-user/src/app/pages/welcome/welcome.component.html @@ -109,6 +109,14 @@ Extrim Code + + + Sergey Ushev + + + + Danil Dudkin + From e833c056bbc91e95a4fafcaab87ff1c93f2e4515 Mon Sep 17 00:00:00 2001 From: Evgenii Sopov Date: Wed, 10 Jun 2020 00:36:46 +0700 Subject: [PATCH 05/23] Added new api for useful links --- .../src/cmd/cmd_handlers_useful_links.cpp | 260 ++++++++++++++++-- .../src/cmd/cmd_handlers_useful_links.h | 108 +++++++- 2 files changed, 346 insertions(+), 22 deletions(-) diff --git a/fhq-server/src/cmd/cmd_handlers_useful_links.cpp b/fhq-server/src/cmd/cmd_handlers_useful_links.cpp index b9ccf65d..cbe52317 100644 --- a/fhq-server/src/cmd/cmd_handlers_useful_links.cpp +++ b/fhq-server/src/cmd/cmd_handlers_useful_links.cpp @@ -78,7 +78,7 @@ CmdHandlerUsefulLinksRetrieve::CmdHandlerUsefulLinksRetrieve() setActivatedFromVersion("0.2.28"); setAccessUnauthorized(false); - setAccessUser(false); + setAccessUser(true); setAccessAdmin(true); // validation and description input fields @@ -262,19 +262,18 @@ void CmdHandlerUsefulLinksUpdate::handle(ModelRequest *pRequest) { pRequest->sendMessageSuccess(cmd(), jsonResponse); } -/********************************************* - * Useful Links Star -**********************************************/ +// --------------------------------------------------------------------- +// Useful Links list of favorite -REGISTRY_CMD(CmdHandlerUsefulLinksStar) +REGISTRY_CMD(CmdHandlerUsefulLinksUserFavoriteList) -CmdHandlerUsefulLinksStar::CmdHandlerUsefulLinksStar() - : CmdHandlerBase("useful_links_star", "Method set star") { +CmdHandlerUsefulLinksUserFavoriteList::CmdHandlerUsefulLinksUserFavoriteList() + : CmdHandlerBase("useful_links_user_favorite_list", "Useful Links list of favorite") { - setActivatedFromVersion("0.2.21"); + setActivatedFromVersion("0.2.29"); setAccessUnauthorized(false); - setAccessUser(false); + setAccessUser(true); setAccessAdmin(true); // validation and description input fields @@ -282,30 +281,255 @@ CmdHandlerUsefulLinksStar::CmdHandlerUsefulLinksStar() // --------------------------------------------------------------------- -void CmdHandlerUsefulLinksStar::handle(ModelRequest *pRequest) { +void CmdHandlerUsefulLinksUserFavoriteList::handle(ModelRequest *pRequest) { pRequest->sendMessageError(cmd(), WsjcppError(501, "Not Implemented Yet")); } -/********************************************* - * Useful Links Unstar -**********************************************/ +// --------------------------------------------------------------------- +// Useful Links add to favorite -REGISTRY_CMD(CmdHandlerUsefulLinksUnstar) +REGISTRY_CMD(CmdHandlerUsefulLinksUserFavorite) -CmdHandlerUsefulLinksUnstar::CmdHandlerUsefulLinksUnstar() - : CmdHandlerBase("useful_links_unstar", "Method set unstar") { +CmdHandlerUsefulLinksUserFavorite::CmdHandlerUsefulLinksUserFavorite() + : CmdHandlerBase("useful_links_user_favorite", "Useful Links add to favorite") { - setActivatedFromVersion("0.2.21"); + setActivatedFromVersion("0.2.29"); setAccessUnauthorized(false); setAccessUser(true); setAccessAdmin(true); // validation and description input fields + requireIntegerParam("useful_link_id", "Id of useful link"); } // --------------------------------------------------------------------- -void CmdHandlerUsefulLinksUnstar::handle(ModelRequest *pRequest) { +void CmdHandlerUsefulLinksUserFavorite::handle(ModelRequest *pRequest) { pRequest->sendMessageError(cmd(), WsjcppError(501, "Not Implemented Yet")); } + +// --------------------------------------------------------------------- +// Useful Links removed from favorite + +REGISTRY_CMD(CmdHandlerUsefulLinksUserUnfavorite) + +CmdHandlerUsefulLinksUserUnfavorite::CmdHandlerUsefulLinksUserUnfavorite() + : CmdHandlerBase("useful_links_user_unfavorite", "Useful Links removed from favorite") { + + setActivatedFromVersion("0.2.29"); + + setAccessUnauthorized(false); + setAccessUser(true); + setAccessAdmin(true); + + // validation and description input fields + requireIntegerParam("useful_link_id", "Id of useful link"); +} + +// --------------------------------------------------------------------- + +void CmdHandlerUsefulLinksUserUnfavorite::handle(ModelRequest *pRequest) { + pRequest->sendMessageError(cmd(), WsjcppError(501, "Not Implemented Yet")); +} + +// --------------------------------------------------------------------- +// Useful Links counter clicker + +REGISTRY_CMD(CmdHandlerUsefulLinksClicked) + +CmdHandlerUsefulLinksClicked::CmdHandlerUsefulLinksClicked() + : CmdHandlerBase("useful_links_clicked", "Useful Links removed from favorite") { + + setActivatedFromVersion("0.2.29"); + + setAccessUnauthorized(false); + setAccessUser(true); + setAccessAdmin(true); + + // validation and description input fields + requireIntegerParam("useful_link_id", "Id of useful link"); +} + +// --------------------------------------------------------------------- + +void CmdHandlerUsefulLinksClicked::handle(ModelRequest *pRequest) { + pRequest->sendMessageError(cmd(), WsjcppError(501, "Not Implemented Yet")); +} + +// --------------------------------------------------------------------- +// Useful Links list of comments + +REGISTRY_CMD(CmdHandlerUsefulLinksCommentList) + +CmdHandlerUsefulLinksCommentList::CmdHandlerUsefulLinksCommentList() + : CmdHandlerBase("useful_links_comment_list", "Useful Links list of comments") { + + setActivatedFromVersion("0.2.29"); + + setAccessUnauthorized(false); + setAccessUser(true); + setAccessAdmin(true); + + // validation and description input fields + requireIntegerParam("useful_link_id", "Id of useful link"); +} + +// --------------------------------------------------------------------- + +void CmdHandlerUsefulLinksCommentList::handle(ModelRequest *pRequest) { + pRequest->sendMessageError(cmd(), WsjcppError(501, "Not Implemented Yet")); +} + +// --------------------------------------------------------------------- +// Useful Links add comment + +CmdHandlerUsefulLinksCommentAdd::CmdHandlerUsefulLinksCommentAdd() + : CmdHandlerBase("useful_links_comment_add", "Useful Links add comment") { + + setActivatedFromVersion("0.2.29"); + + setAccessUnauthorized(false); + setAccessUser(true); + setAccessAdmin(true); + + // validation and description input fields + requireIntegerParam("useful_link_id", "Id of useful link"); + requireStringParam("comment", "Comment"); +} + +// --------------------------------------------------------------------- + +void CmdHandlerUsefulLinksCommentAdd::handle(ModelRequest *pRequest) { + pRequest->sendMessageError(cmd(), WsjcppError(501, "Not Implemented Yet")); +} + +// --------------------------------------------------------------------- +// Useful Links remove comment + +CmdHandlerUsefulLinksCommentDelete::CmdHandlerUsefulLinksCommentDelete() + : CmdHandlerBase("useful_links_comment_delete", "Useful Links remove comment") { + + setActivatedFromVersion("0.2.29"); + + setAccessUnauthorized(false); + setAccessUser(true); + setAccessAdmin(true); + + // validation and description input fields + requireIntegerParam("useful_link_comment_id", "Comment Id for useful link"); +} + +// --------------------------------------------------------------------- + +void CmdHandlerUsefulLinksCommentDelete::handle(ModelRequest *pRequest) { + pRequest->sendMessageError(cmd(), WsjcppError(501, "Not Implemented Yet")); +} + + +// --------------------------------------------------------------------- +// Useful Links List of tags + +CmdHandlerUsefulLinksTagList::CmdHandlerUsefulLinksTagList() + : CmdHandlerBase("useful_links_tag_list", "Useful Links - List of tags") { + + setActivatedFromVersion("0.2.29"); + + setAccessUnauthorized(true); + setAccessUser(true); + setAccessAdmin(true); + +} + +// --------------------------------------------------------------------- + +void CmdHandlerUsefulLinksTagList::handle(ModelRequest *pRequest) { + pRequest->sendMessageError(cmd(), WsjcppError(501, "Not Implemented Yet")); +} + +// --------------------------------------------------------------------- +// Useful Links add tag + +CmdHandlerUsefulLinksTagAdd::CmdHandlerUsefulLinksTagAdd() + : CmdHandlerBase("useful_links_tag_add", "Useful Links add tag") { + + setActivatedFromVersion("0.2.29"); + + setAccessUnauthorized(false); + setAccessUser(false); + setAccessAdmin(true); + + requireIntegerParam("useful_link_id", "Id of useful link"); + requireStringParam("tagname", "tag name"); +} + +// --------------------------------------------------------------------- + +void CmdHandlerUsefulLinksTagAdd::handle(ModelRequest *pRequest) { + pRequest->sendMessageError(cmd(), WsjcppError(501, "Not Implemented Yet")); +} + +// --------------------------------------------------------------------- +// Useful Links remove tag + +CmdHandlerUsefulLinksTagDelete::CmdHandlerUsefulLinksTagDelete() + : CmdHandlerBase("useful_links_tag_delete", "Useful Links remove tag") { + + setActivatedFromVersion("0.2.29"); + + setAccessUnauthorized(false); + setAccessUser(false); + setAccessAdmin(true); + + requireIntegerParam("useful_link_tag_id", "Tag Id for useful link"); +} + +// --------------------------------------------------------------------- + +void CmdHandlerUsefulLinksTagDelete::handle(ModelRequest *pRequest) { + pRequest->sendMessageError(cmd(), WsjcppError(501, "Not Implemented Yet")); +} + +// --------------------------------------------------------------------- +// Useful Links propose link by user + +CmdHandlerUsefulLinksUserPropose::CmdHandlerUsefulLinksUserPropose() + : CmdHandlerBase("useful_links_user_propose", "Useful Links propose link by user") { + + setActivatedFromVersion("0.2.29"); + + setAccessUnauthorized(false); + setAccessUser(true); + setAccessAdmin(true); + + requireStringParam("url", "Url"); + requireStringParam("description", "Description"); + requireStringParam("tags", "tags"); +} + +// --------------------------------------------------------------------- + +void CmdHandlerUsefulLinksUserPropose::handle(ModelRequest *pRequest) { + pRequest->sendMessageError(cmd(), WsjcppError(501, "Not Implemented Yet")); +} + +// --------------------------------------------------------------------- +// Useful Links propose link by user + +CmdHandlerUsefulLinksUserProposeApprove::CmdHandlerUsefulLinksUserProposeApprove() + : CmdHandlerBase("useful_links_user_propose_approve", "Useful Links Approve propose link by admin") { + + setActivatedFromVersion("0.2.29"); + + setAccessUnauthorized(false); + setAccessUser(false); + setAccessAdmin(true); + + requireIntegerParam("useful_links_propose_id", "Id of propose for useful_links"); +} + +// --------------------------------------------------------------------- + +void CmdHandlerUsefulLinksUserProposeApprove::handle(ModelRequest *pRequest) { + pRequest->sendMessageError(cmd(), WsjcppError(501, "Not Implemented Yet")); +} \ No newline at end of file diff --git a/fhq-server/src/cmd/cmd_handlers_useful_links.h b/fhq-server/src/cmd/cmd_handlers_useful_links.h index ae03a841..65ec75b4 100644 --- a/fhq-server/src/cmd/cmd_handlers_useful_links.h +++ b/fhq-server/src/cmd/cmd_handlers_useful_links.h @@ -31,21 +31,121 @@ class CmdHandlerUsefulLinksDelete : public CmdHandlerBase { virtual void handle(ModelRequest *pRequest); }; +// --------------------------------------------------------------------- +// Update useful link + class CmdHandlerUsefulLinksUpdate : public CmdHandlerBase { public: CmdHandlerUsefulLinksUpdate(); virtual void handle(ModelRequest *pRequest); }; -class CmdHandlerUsefulLinksStar : public CmdHandlerBase { +// --------------------------------------------------------------------- +// Useful Links list of favorite + +class CmdHandlerUsefulLinksUserFavoriteList : public CmdHandlerBase { + public: + CmdHandlerUsefulLinksUserFavoriteList(); + virtual void handle(ModelRequest *pRequest); +}; + +// --------------------------------------------------------------------- +// Useful Links add to favorite + +class CmdHandlerUsefulLinksUserFavorite : public CmdHandlerBase { + public: + CmdHandlerUsefulLinksUserFavorite(); + virtual void handle(ModelRequest *pRequest); +}; + +// --------------------------------------------------------------------- +// Useful Links removed from favorite + +class CmdHandlerUsefulLinksUserUnfavorite : public CmdHandlerBase { + public: + CmdHandlerUsefulLinksUserUnfavorite(); + virtual void handle(ModelRequest *pRequest); +}; + +// --------------------------------------------------------------------- +// Useful Links counter clicker + +class CmdHandlerUsefulLinksClicked : public CmdHandlerBase { + public: + CmdHandlerUsefulLinksClicked(); + virtual void handle(ModelRequest *pRequest); +}; + + +// --------------------------------------------------------------------- +// Useful Links list of comments + +class CmdHandlerUsefulLinksCommentList : public CmdHandlerBase { + public: + CmdHandlerUsefulLinksCommentList(); + virtual void handle(ModelRequest *pRequest); +}; + +// --------------------------------------------------------------------- +// Useful Links add comment + +class CmdHandlerUsefulLinksCommentAdd : public CmdHandlerBase { + public: + CmdHandlerUsefulLinksCommentAdd(); + virtual void handle(ModelRequest *pRequest); +}; + +// --------------------------------------------------------------------- +// Useful Links remove comment + +class CmdHandlerUsefulLinksCommentDelete : public CmdHandlerBase { + public: + CmdHandlerUsefulLinksCommentDelete(); + virtual void handle(ModelRequest *pRequest); +}; + +// --------------------------------------------------------------------- +// Useful Links List of tags + +class CmdHandlerUsefulLinksTagList : public CmdHandlerBase { public: - CmdHandlerUsefulLinksStar(); + CmdHandlerUsefulLinksTagList(); virtual void handle(ModelRequest *pRequest); }; -class CmdHandlerUsefulLinksUnstar : public CmdHandlerBase { +// --------------------------------------------------------------------- +// Useful Links add tag + +class CmdHandlerUsefulLinksTagAdd : public CmdHandlerBase { + public: + CmdHandlerUsefulLinksTagAdd(); + virtual void handle(ModelRequest *pRequest); +}; + +// --------------------------------------------------------------------- +// Useful Links remove tag + +class CmdHandlerUsefulLinksTagDelete : public CmdHandlerBase { + public: + CmdHandlerUsefulLinksTagDelete(); + virtual void handle(ModelRequest *pRequest); +}; + +// --------------------------------------------------------------------- +// Useful Links propose link by user + +class CmdHandlerUsefulLinksUserPropose : public CmdHandlerBase { + public: + CmdHandlerUsefulLinksUserPropose(); + virtual void handle(ModelRequest *pRequest); +}; + +// --------------------------------------------------------------------- +// Useful Links Approve propose link by admin + +class CmdHandlerUsefulLinksUserProposeApprove : public CmdHandlerBase { public: - CmdHandlerUsefulLinksUnstar(); + CmdHandlerUsefulLinksUserProposeApprove(); virtual void handle(ModelRequest *pRequest); }; From 0494b18a706b82a5fff530e59d42f4f8269c26a7 Mon Sep 17 00:00:00 2001 From: Evgenii Sopov Date: Wed, 10 Jun 2020 00:53:32 +0700 Subject: [PATCH 06/23] Updated libfhqcli-web-js to 0.2.29 --- fhq-web-user/package-lock.json | 8 ++++---- fhq-web-user/package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/fhq-web-user/package-lock.json b/fhq-web-user/package-lock.json index fbe6349c..cbc92452 100644 --- a/fhq-web-user/package-lock.json +++ b/fhq-web-user/package-lock.json @@ -1,6 +1,6 @@ { "name": "fhq-web-user", - "version": "0.2.27", + "version": "0.2.29", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -6249,9 +6249,9 @@ } }, "libfhqcli-web-js": { - "version": "0.2.27", - "resolved": "https://registry.npmjs.org/libfhqcli-web-js/-/libfhqcli-web-js-0.2.27.tgz", - "integrity": "sha512-WrBdGvqObmoGubgMvxa2niJyEhQC4pwtf7DsWI6+Ff5dS0mpLO4HWzcJgcUjz7sQtda/7yMGbv2WlM/zghftFA==" + "version": "0.2.29", + "resolved": "https://registry.npmjs.org/libfhqcli-web-js/-/libfhqcli-web-js-0.2.29.tgz", + "integrity": "sha512-VO26NbmVgvAqD4MUkbEJ/JgMd4ftaV3WImKLy0fX9VdPezB4/xEOX1ha3b1U/QNOuynz8Q60RG6BpCLX8hOtgQ==" }, "license-webpack-plugin": { "version": "2.1.1", diff --git a/fhq-web-user/package.json b/fhq-web-user/package.json index b8b7acdf..2379678e 100644 --- a/fhq-web-user/package.json +++ b/fhq-web-user/package.json @@ -32,7 +32,7 @@ "hammerjs": "^2.0.8", "highlight.js": "^9.16.2", "jquery": "^3.5.0", - "libfhqcli-web-js": "^0.2.27", + "libfhqcli-web-js": "^0.2.29", "marked": "^0.7.0", "ng2-simplemde": "^2.1.0", "ngx-ace-wrapper": "^8.0.0", From 9a7d62d86b2d9621cb5de919615f58b4412a7b48 Mon Sep 17 00:00:00 2001 From: Evgenii Sopov Date: Wed, 10 Jun 2020 00:53:45 +0700 Subject: [PATCH 07/23] Added comment word --- .../src/app/pages/useful-links/useful-links.component.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fhq-web-user/src/app/pages/useful-links/useful-links.component.html b/fhq-web-user/src/app/pages/useful-links/useful-links.component.html index 772b400b..763804b9 100644 --- a/fhq-web-user/src/app/pages/useful-links/useful-links.component.html +++ b/fhq-web-user/src/app/pages/useful-links/useful-links.component.html @@ -75,7 +75,7 @@

usefulLinks


From 7005446fc390a10ac7e2fec1701e9b4e8f2240c5 Mon Sep 17 00:00:00 2001 From: Evgenii Sopov Date: Wed, 10 Jun 2020 14:21:35 +0700 Subject: [PATCH 08/23] Fixed useful_links list --- fhq-server/src/cmd/cmd_handlers_useful_links.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fhq-server/src/cmd/cmd_handlers_useful_links.cpp b/fhq-server/src/cmd/cmd_handlers_useful_links.cpp index cbe52317..52d22c40 100644 --- a/fhq-server/src/cmd/cmd_handlers_useful_links.cpp +++ b/fhq-server/src/cmd/cmd_handlers_useful_links.cpp @@ -35,7 +35,7 @@ void CmdHandlerUsefulLinksList::handle(ModelRequest *pRequest) { nlohmann::json jsonData = nlohmann::json::array(); QString sWhere = ""; if (!bIsAdmin) { - sWhere = " WHERE status = 'ok' "; + // sWhere = " WHERE status = 'ok' "; } EmployDatabase *pDatabase = findWsjcppEmploy(); From dee62868bb65435962ab9f8c8a49e819d525e653 Mon Sep 17 00:00:00 2001 From: Evgenii Sopov Date: Wed, 10 Jun 2020 14:25:58 +0700 Subject: [PATCH 09/23] Prepare requests for favorite / unfavorite --- .../useful-links/useful-links.component.html | 6 +-- .../useful-links/useful-links.component.ts | 44 +++++++++++++++++++ 2 files changed, 47 insertions(+), 3 deletions(-) diff --git a/fhq-web-user/src/app/pages/useful-links/useful-links.component.html b/fhq-web-user/src/app/pages/useful-links/useful-links.component.html index 763804b9..67f64d96 100644 --- a/fhq-web-user/src/app/pages/useful-links/useful-links.component.html +++ b/fhq-web-user/src/app/pages/useful-links/useful-links.component.html @@ -58,11 +58,11 @@

usefulLinks

diff --git a/fhq-web-user/src/app/pages/user-favorites-useful-links/user-favorites-useful-links.component.css b/fhq-web-user/src/app/pages/user-favorites-useful-links/user-favorites-useful-links.component.css new file mode 100644 index 00000000..4f4475d8 --- /dev/null +++ b/fhq-web-user/src/app/pages/user-favorites-useful-links/user-favorites-useful-links.component.css @@ -0,0 +1,16 @@ +.mat-column-name { + width: 170px; +} + +table { + width: calc(100% - 40px); + margin: 20px; +} + +.useful-links-favorite-btn { + margin-left: 10px; +} + +.mat-column-listOfFavoriteLinks { + padding: 20px; +} \ No newline at end of file diff --git a/fhq-web-user/src/app/pages/user-favorites-useful-links/user-favorites-useful-links.component.html b/fhq-web-user/src/app/pages/user-favorites-useful-links/user-favorites-useful-links.component.html new file mode 100644 index 00000000..054f4784 --- /dev/null +++ b/fhq-web-user/src/app/pages/user-favorites-useful-links/user-favorites-useful-links.component.html @@ -0,0 +1,43 @@ +
+ Please authorize +
signin
+
+ + + + + + + + + + + + + + + + +
# + {{element.id}} + listOfFavoriteLinks + {{element.link}} + +

+ {{element.description}}
+
+ Tags({{ element.tags.length }}): + +
+
+
+ + \ No newline at end of file diff --git a/fhq-web-user/src/app/pages/user-favorites-useful-links/user-favorites-useful-links.component.spec.ts b/fhq-web-user/src/app/pages/user-favorites-useful-links/user-favorites-useful-links.component.spec.ts new file mode 100644 index 00000000..be72d885 --- /dev/null +++ b/fhq-web-user/src/app/pages/user-favorites-useful-links/user-favorites-useful-links.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { UserFavoritesUsefulLinksComponent } from './user-favorites-useful-links.component'; + +describe('UserFavoritesUsefulLinksComponent', () => { + let component: UserFavoritesUsefulLinksComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ UserFavoritesUsefulLinksComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(UserFavoritesUsefulLinksComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/fhq-web-user/src/app/pages/user-favorites-useful-links/user-favorites-useful-links.component.ts b/fhq-web-user/src/app/pages/user-favorites-useful-links/user-favorites-useful-links.component.ts new file mode 100644 index 00000000..b46dc6ed --- /dev/null +++ b/fhq-web-user/src/app/pages/user-favorites-useful-links/user-favorites-useful-links.component.ts @@ -0,0 +1,107 @@ +import { Component, OnInit, ChangeDetectorRef, ViewChild, ElementRef } from '@angular/core'; +import { FhqService } from '../../services/fhq.service'; +import { SpinnerService } from '../../services/spinner.service'; +import { MatDrawer } from '@angular/material/sidenav'; +import { MatTableDataSource } from '@angular/material'; + +export interface UserFavoriteLinkElement { + id: number; + link: string; + description: string; + userFavorites: number; + favorite: boolean; + tags: Array; +} + +@Component({ + selector: 'app-user-favorites-useful-links', + templateUrl: './user-favorites-useful-links.component.html', + styleUrls: ['./user-favorites-useful-links.component.css'] +}) +export class UserFavoritesUsefulLinksComponent implements OnInit { + userId: number = -1; + resultOfUserSkills: string = null; + subscription: any; + dataSource = new MatTableDataSource(); + + userFavoriteLinks: UserFavoriteLinkElement[] = []; + displayedColumns: string[] = ['idFavoriteLinks', 'listOfFavoriteLinks']; + + @ViewChild('drawer', { static: true }) drawer: MatDrawer; + + constructor( + private _cdr: ChangeDetectorRef, + private _fhq: FhqService, + private _spinnerService: SpinnerService, + ) { + + } + + ngOnInit() { + this.updatePage(); + this.subscription = this._fhq.changedState + .subscribe(() => this.updatePage()); + this.drawer.open(); + } + + updatePage() { + if (this._fhq.isAuthorized) { + this.userId = parseInt(this._fhq.userdata.id, 10); + this.loadUserFavorites(); + } else { + this.userId = 0; + this.userFavoriteLinks = []; + } + this._spinnerService.hide(); + } + + loadUserFavorites() { + this._fhq.api().useful_links_user_favorite_list({}) + .done((r: any) => this.successUserFavorites(r)) + .fail((err: any) => this.errorUserFavorites(err)); + } + + successUserFavorites(r: any) { + console.log(r) + this.userFavoriteLinks = []; + for (let ul in r.data) { + console.log(ul) + this.userFavoriteLinks.push({ + id: r.data[ul]['id'], + link: r.data[ul]['url'], + description: r.data[ul]['description'], + userFavorites: r.data[ul]['user_favorites'], + favorite: r.data[ul]['favorite'], + tags: [], + }) + } + this.dataSource = new MatTableDataSource(this.userFavoriteLinks); + this._cdr.detectChanges(); + this._spinnerService.hide(); + } + + errorUserFavorites(err: any) { + console.error("errorUserFavorites: ", err); + } + + successUsefulLinksUserUnfavorite(r: any) { + this.updatePage() + } + + errorUsefulLinksUserUnfavorite(err: any) { + console.error("errorResponse: ", err); + this._spinnerService.hide(); + // this.resultOfChangePassword = err.error; + // this._cdr.detectChanges(); + } + + removeFromFavorite(id: number) { + console.log("removeFromFavorite", id ); + this._spinnerService.show(); + this._fhq.api().useful_links_user_unfavorite({ + "useful_link_id": id + }) + .done((r: any) => this.successUsefulLinksUserUnfavorite(r)) + .fail((err: any) => this.errorUsefulLinksUserUnfavorite(err)); + } +} diff --git a/fhq-web-user/src/app/pages/user-profile-menu/user-profile-menu.component.css b/fhq-web-user/src/app/pages/user-profile-menu/user-profile-menu.component.css index 1befa52d..1084e6fb 100644 --- a/fhq-web-user/src/app/pages/user-profile-menu/user-profile-menu.component.css +++ b/fhq-web-user/src/app/pages/user-profile-menu/user-profile-menu.component.css @@ -1,6 +1,6 @@ .user-profile-menu-sidenav { padding: 20px; - height: 300px; - min-height: 300px; + height: 450px; + min-height: 450px; width: 250px; } \ No newline at end of file diff --git a/fhq-web-user/src/app/pages/user-profile-menu/user-profile-menu.component.html b/fhq-web-user/src/app/pages/user-profile-menu/user-profile-menu.component.html index c3a43442..35b1522b 100644 --- a/fhq-web-user/src/app/pages/user-profile-menu/user-profile-menu.component.html +++ b/fhq-web-user/src/app/pages/user-profile-menu/user-profile-menu.component.html @@ -27,6 +27,13 @@ skills

+ +

diff --git a/fhq-web-user/src/app/pages/user-skills/user-skills.component.ts b/fhq-web-user/src/app/pages/user-skills/user-skills.component.ts index aae6a109..5f3c5b19 100644 --- a/fhq-web-user/src/app/pages/user-skills/user-skills.component.ts +++ b/fhq-web-user/src/app/pages/user-skills/user-skills.component.ts @@ -1,10 +1,11 @@ import { Component, OnInit, ChangeDetectorRef, ViewChild, ElementRef } from '@angular/core'; import { FhqService } from '../../services/fhq.service'; import { SpinnerService } from '../../services/spinner.service'; +import { NgbModal } from '@ng-bootstrap/ng-bootstrap'; +import { ModalDialogSignInComponent } from '../../dialogs/modal-dialog-sign-in/modal-dialog-sign-in.component'; import { MatDrawer } from '@angular/material/sidenav'; import { MatTableDataSource } from '@angular/material'; - export interface UserSkillsElement { skillName: string; userPoints: number; @@ -33,6 +34,7 @@ export class UserSkillsComponent implements OnInit { private _cdr: ChangeDetectorRef, private _fhq: FhqService, private _spinnerService: SpinnerService, + private _modalService: NgbModal, ) { } @@ -56,6 +58,7 @@ export class UserSkillsComponent implements OnInit { this.userId = 0; this.userSkills = []; } + this._spinnerService.hide(); } loadUserSkills() { @@ -92,4 +95,9 @@ export class UserSkillsComponent implements OnInit { errorUserSkills(err: any) { console.error("errorUserSkills: ", err); } + + openDialogSignIn() { + const modalRef = this._modalService.open(ModalDialogSignInComponent); + modalRef.componentInstance.name = 'SignIn'; + } } diff --git a/fhq-web-user/src/app/pages/user-tokens/user-tokens.component.css b/fhq-web-user/src/app/pages/user-tokens/user-tokens.component.css index 7640a115..ab7c8496 100644 --- a/fhq-web-user/src/app/pages/user-tokens/user-tokens.component.css +++ b/fhq-web-user/src/app/pages/user-tokens/user-tokens.component.css @@ -1,3 +1,7 @@ +.mat-column-name { + width: 170px; +} + table { width: calc(100% - 40px); margin: 20px; diff --git a/fhq-web-user/src/app/pages/user-tokens/user-tokens.component.ts b/fhq-web-user/src/app/pages/user-tokens/user-tokens.component.ts index 13c97d42..90d58457 100644 --- a/fhq-web-user/src/app/pages/user-tokens/user-tokens.component.ts +++ b/fhq-web-user/src/app/pages/user-tokens/user-tokens.component.ts @@ -117,4 +117,9 @@ export class UserTokensComponent implements OnInit { .done((r: any) => this.successUserTokensDelete(r)) .fail((err: any) => this.errorUserTokensDelete(err)); } + + openDialogSignIn() { + const modalRef = this._modalService.open(ModalDialogSignInComponent); + modalRef.componentInstance.name = 'SignIn'; + } } From 8e46e3713807a58d9ce2912f2bc1a9656a3b0269 Mon Sep 17 00:00:00 2001 From: Evgenii Sopov Date: Mon, 15 Jun 2020 14:14:22 +0700 Subject: [PATCH 16/23] Try fix sidenav in user-profile --- .../user-favorites-useful-links.component.css | 5 ----- .../user-favorites-useful-links.component.html | 4 ++-- .../src/app/pages/user-skills/user-skills.component.css | 5 ----- .../src/app/pages/user-skills/user-skills.component.html | 4 ++-- .../src/app/pages/user-tokens/user-tokens.component.css | 5 ----- .../src/app/pages/user-tokens/user-tokens.component.html | 4 ++-- .../src/app/pages/user-tokens/user-tokens.component.ts | 4 ++-- fhq-web-user/src/styles.scss | 5 +++++ 8 files changed, 13 insertions(+), 23 deletions(-) diff --git a/fhq-web-user/src/app/pages/user-favorites-useful-links/user-favorites-useful-links.component.css b/fhq-web-user/src/app/pages/user-favorites-useful-links/user-favorites-useful-links.component.css index 4f4475d8..324d1df9 100644 --- a/fhq-web-user/src/app/pages/user-favorites-useful-links/user-favorites-useful-links.component.css +++ b/fhq-web-user/src/app/pages/user-favorites-useful-links/user-favorites-useful-links.component.css @@ -2,11 +2,6 @@ width: 170px; } -table { - width: calc(100% - 40px); - margin: 20px; -} - .useful-links-favorite-btn { margin-left: 10px; } diff --git a/fhq-web-user/src/app/pages/user-favorites-useful-links/user-favorites-useful-links.component.html b/fhq-web-user/src/app/pages/user-favorites-useful-links/user-favorites-useful-links.component.html index 054f4784..8b2594a3 100644 --- a/fhq-web-user/src/app/pages/user-favorites-useful-links/user-favorites-useful-links.component.html +++ b/fhq-web-user/src/app/pages/user-favorites-useful-links/user-favorites-useful-links.component.html @@ -3,11 +3,11 @@
signin