From 0192dc6d1c0d224c8f20020fede1c0b1b52e0443 Mon Sep 17 00:00:00 2001 From: Valeri Date: Wed, 27 Sep 2023 13:53:37 +0300 Subject: [PATCH 01/30] 1. Add new page WhatsNewPage.vue with styling 2. Add page to the router --- frontend/src/router/index.ts | 5 ++ frontend/src/views/WhatsNewPage.vue | 94 +++++++++++++++++++++++++++++ 2 files changed, 99 insertions(+) create mode 100644 frontend/src/views/WhatsNewPage.vue diff --git a/frontend/src/router/index.ts b/frontend/src/router/index.ts index aab4a9e91..1d68a8dbf 100644 --- a/frontend/src/router/index.ts +++ b/frontend/src/router/index.ts @@ -53,6 +53,11 @@ const routes: Array = [ name: "AboutPage", component: () => import(/* webpackChunkName: "about" */ "../views/AboutPage.vue"), }, + { + path: "/whats-new", + name: "WhatsNewPage", + component: () => import("../views/WhatsNewPage.vue") + }, { path: "*", component: LandingPage, diff --git a/frontend/src/views/WhatsNewPage.vue b/frontend/src/views/WhatsNewPage.vue new file mode 100644 index 000000000..668e35234 --- /dev/null +++ b/frontend/src/views/WhatsNewPage.vue @@ -0,0 +1,94 @@ + + + + + + + From 0af004d6c11da8abe4c5d46753fab450f81a32ed Mon Sep 17 00:00:00 2001 From: Valeri Date: Wed, 27 Sep 2023 14:16:29 +0300 Subject: [PATCH 02/30] 1. Add pagination and improvements --- frontend/src/views/WhatsNewPage.vue | 131 +++++++++++++++------------- 1 file changed, 71 insertions(+), 60 deletions(-) diff --git a/frontend/src/views/WhatsNewPage.vue b/frontend/src/views/WhatsNewPage.vue index 668e35234..c08ba4475 100644 --- a/frontend/src/views/WhatsNewPage.vue +++ b/frontend/src/views/WhatsNewPage.vue @@ -6,66 +6,77 @@ - - -
- - - Lorem ipsum dolor sit amet, consectetur adipiscing elit. - - - - Lorem ipsum dolor sit amet, consectetur adipiscing elit. - - - - Lorem ipsum dolor sit amet, consectetur adipiscing elit. - - - - -
-
- - - - Lorem ipsum dolor sit amet, consectetur adipiscing elit. - - - Lorem ipsum dolor sit amet, consectetur adipiscing elit. - - - Lorem ipsum dolor sit amet, consectetur adipiscing elit. - - - -
- - + +
+ +
+
+ + + Title... + LINK + + + + Title... + LINK + + + + Title... + LINK + + + + +
+
+ + + + Title... + LINK + + + Title... + LINK + + + Title... + LINK + + + +
From 015d4f981fc1c6faf49c1c3efb23316389f002fa Mon Sep 17 00:00:00 2001 From: Valeri Date: Wed, 27 Sep 2023 14:49:23 +0300 Subject: [PATCH 03/30] Add localization --- .../src/components/navigation/TopNavigationBar.vue | 13 ++++++++++++- frontend/src/locales/de.json | 7 +++++++ frontend/src/locales/en.json | 7 +++++++ frontend/src/locales/es.json | 7 +++++++ frontend/src/locales/fr.json | 7 +++++++ frontend/src/locales/it.json | 7 +++++++ frontend/src/locales/pl.json | 7 +++++++ frontend/src/locales/pt.json | 7 +++++++ frontend/src/locales/uk.json | 7 +++++++ frontend/src/views/WhatsNewPage.vue | 6 +++++- 10 files changed, 73 insertions(+), 2 deletions(-) diff --git a/frontend/src/components/navigation/TopNavigationBar.vue b/frontend/src/components/navigation/TopNavigationBar.vue index fc29447fc..202641000 100644 --- a/frontend/src/components/navigation/TopNavigationBar.vue +++ b/frontend/src/components/navigation/TopNavigationBar.vue @@ -13,8 +13,13 @@ New Session + + + {{ $t("page.landing.news.buttons.info.label") }} + + - @@ -27,9 +32,15 @@ diff --git a/frontend/src/locales/de.json b/frontend/src/locales/de.json index 99071f07a..43ebbad7d 100644 --- a/frontend/src/locales/de.json +++ b/frontend/src/locales/de.json @@ -116,6 +116,13 @@ } } } + }, + "news": { + "buttons": { + "info": { + "label": "Was ist neu" + } + } } }, "join": { diff --git a/frontend/src/locales/en.json b/frontend/src/locales/en.json index 5ed4da228..e6c639f77 100644 --- a/frontend/src/locales/en.json +++ b/frontend/src/locales/en.json @@ -116,6 +116,13 @@ } } } + }, + "news": { + "buttons": { + "info": { + "label": "What's new" + } + } } }, "join": { diff --git a/frontend/src/locales/es.json b/frontend/src/locales/es.json index f2d91c38b..87be1e3ac 100644 --- a/frontend/src/locales/es.json +++ b/frontend/src/locales/es.json @@ -115,6 +115,13 @@ "label": "Reunirse" } } + }, + "news": { + "buttons": { + "info": { + "label": "Qué hay de nuevo" + } + } } } }, diff --git a/frontend/src/locales/fr.json b/frontend/src/locales/fr.json index 338a35252..91ffde1a2 100644 --- a/frontend/src/locales/fr.json +++ b/frontend/src/locales/fr.json @@ -116,6 +116,13 @@ } } } + }, + "news": { + "buttons": { + "info": { + "label": "Quoi de neuf" + } + } } }, "join": { diff --git a/frontend/src/locales/it.json b/frontend/src/locales/it.json index eaafe713e..6ebf7f982 100644 --- a/frontend/src/locales/it.json +++ b/frontend/src/locales/it.json @@ -116,6 +116,13 @@ } } } + }, + "news": { + "buttons": { + "info": { + "label": "Cosa c'è di nuovo" + } + } } }, "join": { diff --git a/frontend/src/locales/pl.json b/frontend/src/locales/pl.json index 05b6fcda2..500d2023a 100644 --- a/frontend/src/locales/pl.json +++ b/frontend/src/locales/pl.json @@ -116,6 +116,13 @@ } } } + }, + "news": { + "buttons": { + "info": { + "label": "Co nowego" + } + } } }, "join": { diff --git a/frontend/src/locales/pt.json b/frontend/src/locales/pt.json index 78a67b226..02cd022d1 100644 --- a/frontend/src/locales/pt.json +++ b/frontend/src/locales/pt.json @@ -116,6 +116,13 @@ } } } + }, + "news": { + "buttons": { + "info": { + "label": "O que há de novo" + } + } } }, "join": { diff --git a/frontend/src/locales/uk.json b/frontend/src/locales/uk.json index 48733474a..22f1e9ed4 100644 --- a/frontend/src/locales/uk.json +++ b/frontend/src/locales/uk.json @@ -116,6 +116,13 @@ } } } + }, + "news": { + "buttons": { + "info": { + "label": "Що нового" + } + } } }, "join": { diff --git a/frontend/src/views/WhatsNewPage.vue b/frontend/src/views/WhatsNewPage.vue index c08ba4475..5a8029496 100644 --- a/frontend/src/views/WhatsNewPage.vue +++ b/frontend/src/views/WhatsNewPage.vue @@ -2,7 +2,11 @@
- + + + From ab613ba2c5ad43ac83d92b314243e19f649f4783 Mon Sep 17 00:00:00 2001 From: Valeri Date: Thu, 28 Sep 2023 11:50:59 +0300 Subject: [PATCH 04/30] Added pagination and sample data within the cards --- .../navigation/TopNavigationBar.vue | 2 +- frontend/src/views/WhatsNewPage.vue | 105 ++++++++---------- 2 files changed, 45 insertions(+), 62 deletions(-) diff --git a/frontend/src/components/navigation/TopNavigationBar.vue b/frontend/src/components/navigation/TopNavigationBar.vue index 202641000..854508a1f 100644 --- a/frontend/src/components/navigation/TopNavigationBar.vue +++ b/frontend/src/components/navigation/TopNavigationBar.vue @@ -14,7 +14,7 @@ New Session - {{ $t("page.landing.news.buttons.info.label") }} diff --git a/frontend/src/views/WhatsNewPage.vue b/frontend/src/views/WhatsNewPage.vue index 5a8029496..6cb25b9bd 100644 --- a/frontend/src/views/WhatsNewPage.vue +++ b/frontend/src/views/WhatsNewPage.vue @@ -14,84 +14,67 @@
-
- - + + - Title... - LINK + {{card.title}} + {{card.link}} - - - Title... - LINK - - - - Title... - LINK - - - - -
-
- - - - Title... - LINK - - - Title... - LINK - - - Title... - LINK - -
- - From 78cf9c35416fc259c7ba2b8c04831ddd87460e72 Mon Sep 17 00:00:00 2001 From: Valeri Date: Thu, 28 Sep 2023 11:58:36 +0300 Subject: [PATCH 05/30] Add row feature (2rows x 3 elements) to the what's new page --- frontend/src/views/WhatsNewPage.vue | 68 +++++++++++++++-------------- 1 file changed, 35 insertions(+), 33 deletions(-) diff --git a/frontend/src/views/WhatsNewPage.vue b/frontend/src/views/WhatsNewPage.vue index 6cb25b9bd..b89cad039 100644 --- a/frontend/src/views/WhatsNewPage.vue +++ b/frontend/src/views/WhatsNewPage.vue @@ -14,21 +14,23 @@
-
- - - {{card.title}} - {{card.link}} - - +
+
+ + + {{ card.title }} + {{ card.link }} + + +
@@ -42,33 +44,33 @@ export default Vue.extend({ data() { return { - perPage: 4, + perPage: 6, currentPage: 1, items: [ - { id: 1, title: 'Fred', link: 'Flintstone' }, - { id: 2, title: 'Wilma', link: 'Flintstone' }, - { id: 3, title: 'Barney', link: 'Rubble' }, - { id: 4, title: 'Betty', link: 'Rubble' }, - { id: 5, title: 'Pebbles', link: 'Flintstone' }, - { id: 6, title: 'Bamm Bamm', link: 'Rubble' }, - { id: 7, title: 'The Great', link: 'Gazzoo' }, - { id: 8, title: 'Rockhead', link: 'Slate' }, - { id: 9, title: 'Pearl', link: 'Slaghoople' }, - { id: 10, title: 'Petko', link: 'Slaghoople' }, - { id: 11, title: 'Ivan', link: 'Slaghoople' }, - { id: 12, title: 'Gosho', link: 'Slaghoople' }, - { id: 13, title: 'C', link: 'Slaghoople' }, + {id: 1, title: 'Fred', link: 'Flintstone'}, + {id: 2, title: 'Wilma', link: 'Flintstone'}, + {id: 3, title: 'Barney', link: 'Rubble'}, + {id: 4, title: 'Betty', link: 'Rubble'}, + {id: 5, title: 'Pebbles', link: 'Flintstone'}, + {id: 6, title: 'Bamm Bamm', link: 'Rubble'}, + {id: 7, title: 'The Great', link: 'Gazzoo'}, + {id: 8, title: 'Rockhead', link: 'Slate'}, + {id: 9, title: 'Pearl', link: 'Slaghoople'}, + {id: 10, title: 'Petko', link: 'Slaghoople'}, + {id: 11, title: 'Ivan', link: 'Slaghoople'}, + {id: 12, title: 'Gosho', link: 'Slaghoople'}, + {id: 13, title: 'C', link: 'Slaghoople'}, ] } }, - computed:{ - totalRows(){ + computed: { + totalRows() { return this.items.length; }, - currentElements(){ - let end = this.currentPage * this.perPage; - let start = end - this.perPage; - return this.items.slice(start, end); + currentElements() { + let end = this.currentPage * this.perPage; + let start = end - this.perPage; + return this.items.slice(start, end); }, } From bc7d0387f3ea8db2c7a5373497cbdbef6792cf0e Mon Sep 17 00:00:00 2001 From: Valeri Date: Thu, 28 Sep 2023 14:55:16 +0300 Subject: [PATCH 06/30] 1. Add RestTemplate client 2. Build logic for fetching, filtering and sorting pull requests from GitHub api --- .../backend/config/RestTemplateConfig.java | 15 ++++++ .../backend/controller/NewsController.java | 48 +++++++++++++++++++ .../backend/model/news/PullRequest.java | 25 ++++++++++ .../src/main/resources/application.properties | 5 ++ 4 files changed, 93 insertions(+) create mode 100644 backend/src/main/java/io/diveni/backend/config/RestTemplateConfig.java create mode 100644 backend/src/main/java/io/diveni/backend/controller/NewsController.java create mode 100644 backend/src/main/java/io/diveni/backend/model/news/PullRequest.java diff --git a/backend/src/main/java/io/diveni/backend/config/RestTemplateConfig.java b/backend/src/main/java/io/diveni/backend/config/RestTemplateConfig.java new file mode 100644 index 000000000..c91b46481 --- /dev/null +++ b/backend/src/main/java/io/diveni/backend/config/RestTemplateConfig.java @@ -0,0 +1,15 @@ +package io.diveni.backend.config; + +import org.springframework.boot.web.client.RestTemplateBuilder; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.client.RestTemplate; + +@Configuration +public class RestTemplateConfig { + + @Bean + public RestTemplate restTemplate(RestTemplateBuilder builder){ + return builder.build(); + } +} diff --git a/backend/src/main/java/io/diveni/backend/controller/NewsController.java b/backend/src/main/java/io/diveni/backend/controller/NewsController.java new file mode 100644 index 000000000..0f3a86221 --- /dev/null +++ b/backend/src/main/java/io/diveni/backend/controller/NewsController.java @@ -0,0 +1,48 @@ +package io.diveni.backend.controller; + + +import io.diveni.backend.model.news.PullRequest; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.client.RestTemplate; +import org.springframework.web.util.UriComponentsBuilder; + +import java.util.Arrays; + +import java.util.List; +import java.util.stream.Collectors; + +@RestController +@RequestMapping("/news") +public class NewsController { + + private RestTemplate client; + + @Value("${vsc.github.api.pr.get}") + private String url; + + public NewsController(RestTemplate client) { + this.client = client; + } + + @GetMapping("/pull-requests") + public ResponseEntity> getPullRequests(@RequestParam(name = "state", defaultValue = "closed") String state, + @RequestParam(name = "per_page", defaultValue = "6") Integer perPage, + @RequestParam(name = "page", defaultValue = "1") Integer page) { + UriComponentsBuilder builder = UriComponentsBuilder.fromUriString(url); + + builder.queryParam("state", state); + builder.queryParam("page", page); + builder.queryParam("per_page", perPage); + + ResponseEntity data = this.client.getForEntity(builder.toUriString(), PullRequest[].class); + List result = Arrays.stream(data.getBody()) + .filter(e -> e.getMergedAt() != null) + .sorted((o1, o2) -> Integer.compare(o2.getNumber(), o1.getNumber())).collect(Collectors.toList()); + return ResponseEntity.ok(result); + } +} diff --git a/backend/src/main/java/io/diveni/backend/model/news/PullRequest.java b/backend/src/main/java/io/diveni/backend/model/news/PullRequest.java new file mode 100644 index 000000000..684a007d4 --- /dev/null +++ b/backend/src/main/java/io/diveni/backend/model/news/PullRequest.java @@ -0,0 +1,25 @@ +package io.diveni.backend.model.news; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.time.LocalDateTime; + +@Data +@AllArgsConstructor +@NoArgsConstructor +public class PullRequest { + + private int number; + + @JsonProperty("html_url") + private String htmlUrl; + + private String title; + + @JsonProperty("merged_at") + private LocalDateTime mergedAt; + +} diff --git a/backend/src/main/resources/application.properties b/backend/src/main/resources/application.properties index 183a75769..d9afafa4c 100644 --- a/backend/src/main/resources/application.properties +++ b/backend/src/main/resources/application.properties @@ -1,3 +1,8 @@ spring.profiles.active=dev server.error.include-message=always spring.config.import=optional:file:./.env[.properties] + +vsc.github.owner=Sybit-Education +vsc.github.repository = Diveni +vsc.github.api=https://api.github.com +vsc.github.api.pr.get = ${vsc.github.api}/repos/${vsc.github.owner}/${vsc.github.repository}/pulls From 008b8bdac4fda8202cc45d5e13d028005592d467 Mon Sep 17 00:00:00 2001 From: Valeri Date: Tue, 3 Oct 2023 12:07:23 +0300 Subject: [PATCH 07/30] Build pull request fetch logic --- .../backend/controller/NewsController.java | 44 ++++--- .../backend/model/news/PullRequest.java | 13 +- .../src/main/resources/application.properties | 1 + frontend/src/constants.ts | 4 + frontend/src/services/api.service.ts | 21 +++- frontend/src/types.ts | 8 ++ frontend/src/views/WhatsNewPage.vue | 114 ++++++++++-------- 7 files changed, 140 insertions(+), 65 deletions(-) diff --git a/backend/src/main/java/io/diveni/backend/controller/NewsController.java b/backend/src/main/java/io/diveni/backend/controller/NewsController.java index 0f3a86221..d623dd167 100644 --- a/backend/src/main/java/io/diveni/backend/controller/NewsController.java +++ b/backend/src/main/java/io/diveni/backend/controller/NewsController.java @@ -3,6 +3,9 @@ import io.diveni.backend.model.news.PullRequest; import org.springframework.beans.factory.annotation.Value; +import org.springframework.http.HttpEntity; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpMethod; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; @@ -20,29 +23,42 @@ @RequestMapping("/news") public class NewsController { + private static final String STATE_PARAM = "state"; + private static final String PAGE_PARAM = "page"; + private static final String PER_PAGE_PARAM = "per_page"; + private static final String BOT_USER_TYPE = "Bot"; + private RestTemplate client; @Value("${vsc.github.api.pr.get}") private String url; + @Value("${vsc.github.access-token}") + private String authToken; + public NewsController(RestTemplate client) { this.client = client; } @GetMapping("/pull-requests") - public ResponseEntity> getPullRequests(@RequestParam(name = "state", defaultValue = "closed") String state, - @RequestParam(name = "per_page", defaultValue = "6") Integer perPage, - @RequestParam(name = "page", defaultValue = "1") Integer page) { - UriComponentsBuilder builder = UriComponentsBuilder.fromUriString(url); - - builder.queryParam("state", state); - builder.queryParam("page", page); - builder.queryParam("per_page", perPage); - - ResponseEntity data = this.client.getForEntity(builder.toUriString(), PullRequest[].class); - List result = Arrays.stream(data.getBody()) - .filter(e -> e.getMergedAt() != null) - .sorted((o1, o2) -> Integer.compare(o2.getNumber(), o1.getNumber())).collect(Collectors.toList()); - return ResponseEntity.ok(result); + public ResponseEntity getPullRequests(@RequestParam(name = STATE_PARAM, defaultValue = "closed") String state, + @RequestParam(name = PER_PAGE_PARAM, defaultValue = "50") Integer perPage, + @RequestParam(name = PAGE_PARAM, defaultValue = "1") Integer page) { + + HttpHeaders headers = new HttpHeaders(); + if (authToken != null) { + headers.setBearerAuth(authToken); + } + HttpEntity entity = new HttpEntity<>(null, headers); + + UriComponentsBuilder builder = UriComponentsBuilder.fromUriString(url) + .queryParam(STATE_PARAM, state) + .queryParam(PAGE_PARAM, page) + .queryParam(PER_PAGE_PARAM, perPage); + + ResponseEntity data = client.exchange(builder.toUriString(), HttpMethod.GET, entity, PullRequest[].class); + + Arrays.sort(data.getBody(), (o1, o2) -> Integer.compare(o2.getNumber(), o1.getNumber())); + return ResponseEntity.ok(data.getBody()); } } diff --git a/backend/src/main/java/io/diveni/backend/model/news/PullRequest.java b/backend/src/main/java/io/diveni/backend/model/news/PullRequest.java index 684a007d4..dc01af8ea 100644 --- a/backend/src/main/java/io/diveni/backend/model/news/PullRequest.java +++ b/backend/src/main/java/io/diveni/backend/model/news/PullRequest.java @@ -5,7 +5,8 @@ import lombok.Data; import lombok.NoArgsConstructor; -import java.time.LocalDateTime; +import java.time.LocalDate; +import java.util.Map; @Data @AllArgsConstructor @@ -20,6 +21,14 @@ public class PullRequest { private String title; @JsonProperty("merged_at") - private LocalDateTime mergedAt; + private LocalDate mergedAt; + + @JsonProperty("user_type") + private String userType; + + @JsonProperty("user") + private void unpackNestedProperty(Map map) { + userType = map.get("type"); + } } diff --git a/backend/src/main/resources/application.properties b/backend/src/main/resources/application.properties index d9afafa4c..77e9fa6d7 100644 --- a/backend/src/main/resources/application.properties +++ b/backend/src/main/resources/application.properties @@ -2,6 +2,7 @@ spring.profiles.active=dev server.error.include-message=always spring.config.import=optional:file:./.env[.properties] +vsc.github.access-token = ${GITHUB_ACCESS_TOKEN} vsc.github.owner=Sybit-Education vsc.github.repository = Diveni vsc.github.api=https://api.github.com diff --git a/frontend/src/constants.ts b/frontend/src/constants.ts index d401ee7b7..93a96c47f 100644 --- a/frontend/src/constants.ts +++ b/frontend/src/constants.ts @@ -48,6 +48,10 @@ class Constants { memberUpdateCloseSession = "SESSION_CLOSED"; + newsPageSize = 20; + + botUserType = "Bot"; + // eslint-disable-next-line class-methods-use-this public joinSessionRoute(sessionID: string) { return `/sessions/${sessionID}/join`; diff --git a/frontend/src/services/api.service.ts b/frontend/src/services/api.service.ts index c5b34af3a..84571bf69 100644 --- a/frontend/src/services/api.service.ts +++ b/frontend/src/services/api.service.ts @@ -1,6 +1,6 @@ import constants from "@/constants"; -import { JiraRequestTokenDto, JiraResponseCodeDto } from "@/types"; -import axios, { AxiosResponse } from "axios"; +import {JiraRequestTokenDto, JiraResponseCodeDto, PullRequestDto} from "@/types"; +import axios, {AxiosResponse} from "axios"; class ApiService { public async getIssueTrackerConfig(): Promise> { @@ -95,6 +95,23 @@ class ApiService { }); return response; } + + public async getPullRequests(state, page, pageSize): Promise { + const queryParams = { + state: state, + per_page: pageSize, + page: page + } + const response = await axios.get(`${constants.backendURL}/news/pull-requests`, + { + headers: { + "Content-Type": "application/json" + }, + params: queryParams + } + ) + return response.data; + } } export default new ApiService(); diff --git a/frontend/src/types.ts b/frontend/src/types.ts index d0afd6acf..f0818978a 100644 --- a/frontend/src/types.ts +++ b/frontend/src/types.ts @@ -39,3 +39,11 @@ export interface JiraRequestTokenDto { token: string; url: string; } + +export interface PullRequestDto{ + number:number; + html_url: string; + title: string; + merged_at: string + user_type: string +} diff --git a/frontend/src/views/WhatsNewPage.vue b/frontend/src/views/WhatsNewPage.vue index b89cad039..b6846b014 100644 --- a/frontend/src/views/WhatsNewPage.vue +++ b/frontend/src/views/WhatsNewPage.vue @@ -9,70 +9,90 @@
- -
- +
+ + + {{ card.title }} + + +
-
-
- - - {{ card.title }} - {{ card.link }} - - -
+
+
+
From ba6235d51c5eeb60121810b470deebd8028e8572 Mon Sep 17 00:00:00 2001 From: Valeri Date: Wed, 1 Nov 2023 13:45:07 +0200 Subject: [PATCH 28/30] lint fix --- .../navigation/TopNavigationBar.vue | 2 +- frontend/src/router/index.ts | 2 +- frontend/src/services/api.service.ts | 33 ++++---- frontend/src/types.ts | 10 +-- frontend/src/utils/dateUtil.ts | 14 ++-- frontend/src/views/WhatsNewPage.vue | 79 ++++++++++--------- 6 files changed, 74 insertions(+), 66 deletions(-) diff --git a/frontend/src/components/navigation/TopNavigationBar.vue b/frontend/src/components/navigation/TopNavigationBar.vue index 6ac845e18..2d0e0fe12 100644 --- a/frontend/src/components/navigation/TopNavigationBar.vue +++ b/frontend/src/components/navigation/TopNavigationBar.vue @@ -34,7 +34,7 @@ import ThemeToggleComponent from "@/components/ThemeToggleComponent.vue"; export default Vue.extend({ name: "TopNavigationBar", - components: { LocaleDropdown, BIconGithub, ThemeToggleComponent } + components: { LocaleDropdown, BIconGithub, ThemeToggleComponent }, }); diff --git a/frontend/src/router/index.ts b/frontend/src/router/index.ts index 1d68a8dbf..b9344055f 100644 --- a/frontend/src/router/index.ts +++ b/frontend/src/router/index.ts @@ -56,7 +56,7 @@ const routes: Array = [ { path: "/whats-new", name: "WhatsNewPage", - component: () => import("../views/WhatsNewPage.vue") + component: () => import("../views/WhatsNewPage.vue"), }, { path: "*", diff --git a/frontend/src/services/api.service.ts b/frontend/src/services/api.service.ts index af1527751..39de14532 100644 --- a/frontend/src/services/api.service.ts +++ b/frontend/src/services/api.service.ts @@ -1,5 +1,5 @@ import constants from "@/constants"; -import {JiraRequestTokenDto, JiraResponseCodeDto, PullRequestDto} from "@/types"; +import { JiraRequestTokenDto, JiraResponseCodeDto, PullRequestDto } from "@/types"; import axios, { AxiosResponse } from "axios"; class ApiService { @@ -111,23 +111,28 @@ class ApiService { return response; } - public async getPullRequests(state,sort,direction,isMerged, page, pageSize): Promise { + public async getPullRequests( + state, + sort, + direction, + isMerged, + page, + pageSize + ): Promise { const queryParams = { state: state, - is_merged:isMerged, + is_merged: isMerged, per_page: pageSize, page: page, - sort:sort, - direction:direction - } - const response = await axios.get(`${constants.backendURL}/news/pull-requests`, - { - headers: { - "Content-Type": "application/json" - }, - params: queryParams - } - ) + sort: sort, + direction: direction, + }; + const response = await axios.get(`${constants.backendURL}/news/pull-requests`, { + headers: { + "Content-Type": "application/json", + }, + params: queryParams, + }); return response.data; } } diff --git a/frontend/src/types.ts b/frontend/src/types.ts index 362dd7da6..ead369910 100644 --- a/frontend/src/types.ts +++ b/frontend/src/types.ts @@ -42,11 +42,11 @@ export interface JiraRequestTokenDto { url: string; } -export interface PullRequestDto{ - number:number; +export interface PullRequestDto { + number: number; html_url: string; title: string; - merged_at: string - user_type: string - updated_at: string + merged_at: string; + user_type: string; + updated_at: string; } diff --git a/frontend/src/utils/dateUtil.ts b/frontend/src/utils/dateUtil.ts index a993e50bd..cf0886211 100644 --- a/frontend/src/utils/dateUtil.ts +++ b/frontend/src/utils/dateUtil.ts @@ -1,14 +1,14 @@ import i18n from "@/i18n"; -class DateUtil{ - public convertDate(dateTime:string):string{ - const date = dateTime.slice(0,dateTime.indexOf("T")) - const dateParts = date.split('-').map(Number); +class DateUtil { + public convertDate(dateTime: string): string { + const date = dateTime.slice(0, dateTime.indexOf("T")); + const dateParts = date.split("-").map(Number); const [year, month, day] = dateParts; - const options = { + const options = { year: "numeric", - month: 'long', - day: 'numeric' + month: "long", + day: "numeric", } as const; return new Intl.DateTimeFormat(i18n.locale, options).format(new Date(year, month - 1, day)); } diff --git a/frontend/src/views/WhatsNewPage.vue b/frontend/src/views/WhatsNewPage.vue index a1d1de717..247cce49c 100644 --- a/frontend/src/views/WhatsNewPage.vue +++ b/frontend/src/views/WhatsNewPage.vue @@ -11,12 +11,13 @@
-
@@ -24,13 +25,15 @@
- - + + {{ card.title }} - From 20ea66460aebb4d73b21799038e710738614f37f Mon Sep 17 00:00:00 2001 From: SponsoredByPuma Date: Wed, 8 Nov 2023 10:19:03 +0100 Subject: [PATCH 29/30] remove translations, remove imports & adapt to project pattern --- .../java/io/diveni/backend/controller/NewsController.java | 2 +- .../java/io/diveni/backend/model/news/PullRequest.java | 1 - .../io/diveni/backend/service/news/GithubApiService.java | 1 - .../io/diveni/backend/controller/NewsControllerTest.java | 2 -- frontend/src/locales/de.json | 7 ------- frontend/src/locales/es.json | 8 -------- frontend/src/locales/fr.json | 7 ------- frontend/src/locales/it.json | 7 ------- frontend/src/locales/pl.json | 7 ------- frontend/src/locales/pt.json | 7 ------- frontend/src/locales/uk.json | 7 ------- 11 files changed, 1 insertion(+), 55 deletions(-) diff --git a/backend/src/main/java/io/diveni/backend/controller/NewsController.java b/backend/src/main/java/io/diveni/backend/controller/NewsController.java index 625ae5888..10694ef36 100644 --- a/backend/src/main/java/io/diveni/backend/controller/NewsController.java +++ b/backend/src/main/java/io/diveni/backend/controller/NewsController.java @@ -36,6 +36,6 @@ public ResponseEntity getPullRequests(@RequestParam(name = STATE_ @RequestParam(name = PER_PAGE_PARAM, defaultValue = "50") Integer perPage, @RequestParam(name = PAGE_PARAM, defaultValue = "1") Integer page) { - return ResponseEntity.ok(service.getPullRequests(state,sort,direction, isMerged, perPage, page)); + return new ResponseEntity<>(service.getPullRequests(state,sort,direction, isMerged, perPage, page), HttpStatus.OK); } } diff --git a/backend/src/main/java/io/diveni/backend/model/news/PullRequest.java b/backend/src/main/java/io/diveni/backend/model/news/PullRequest.java index 66576a6f5..f64bbdc32 100644 --- a/backend/src/main/java/io/diveni/backend/model/news/PullRequest.java +++ b/backend/src/main/java/io/diveni/backend/model/news/PullRequest.java @@ -5,7 +5,6 @@ import lombok.Data; import lombok.NoArgsConstructor; -import java.time.LocalDate; import java.time.LocalDateTime; import java.util.Map; diff --git a/backend/src/main/java/io/diveni/backend/service/news/GithubApiService.java b/backend/src/main/java/io/diveni/backend/service/news/GithubApiService.java index 6e347ffdf..d461c8fe6 100644 --- a/backend/src/main/java/io/diveni/backend/service/news/GithubApiService.java +++ b/backend/src/main/java/io/diveni/backend/service/news/GithubApiService.java @@ -13,7 +13,6 @@ import org.springframework.web.util.UriComponentsBuilder; import java.util.Arrays; -import java.util.Comparator; import java.util.List; import static io.diveni.backend.controller.NewsController.*; diff --git a/backend/src/test/java/io/diveni/backend/controller/NewsControllerTest.java b/backend/src/test/java/io/diveni/backend/controller/NewsControllerTest.java index 2d82b085d..915433a70 100644 --- a/backend/src/test/java/io/diveni/backend/controller/NewsControllerTest.java +++ b/backend/src/test/java/io/diveni/backend/controller/NewsControllerTest.java @@ -1,7 +1,6 @@ package io.diveni.backend.controller; import io.diveni.backend.model.news.PullRequest; -import io.diveni.backend.service.news.GithubApiService; import org.hamcrest.Matchers; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; @@ -13,7 +12,6 @@ import org.springframework.http.ResponseEntity; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder; -import org.springframework.test.web.servlet.result.MockMvcResultMatchers; import org.springframework.web.client.RestClientException; import org.springframework.web.client.RestTemplate; diff --git a/frontend/src/locales/de.json b/frontend/src/locales/de.json index 519567fab..398d2552a 100644 --- a/frontend/src/locales/de.json +++ b/frontend/src/locales/de.json @@ -123,13 +123,6 @@ "lastMonthTitle": "Letzter Monat", "activeTitle": "Momentan" } - }, - "news": { - "buttons": { - "info": { - "label": "Was ist neu" - } - } } }, "join": { diff --git a/frontend/src/locales/es.json b/frontend/src/locales/es.json index a65d8f861..d665faf76 100644 --- a/frontend/src/locales/es.json +++ b/frontend/src/locales/es.json @@ -122,15 +122,7 @@ "attendeesText": "Colaboradores", "lastMonthTitle": "Last Month", "activeTitle": "Currently" - }, - "news": { - "buttons": { - "info": { - "label": "Qué hay de nuevo" - } - } } - } }, "join": { "title": "Unirse a la sesión", diff --git a/frontend/src/locales/fr.json b/frontend/src/locales/fr.json index 4e2f3a92c..fd82a6002 100644 --- a/frontend/src/locales/fr.json +++ b/frontend/src/locales/fr.json @@ -123,13 +123,6 @@ "lastMonthTitle": "Last Month", "activeTitle": "Currently" } - }, - "news": { - "buttons": { - "info": { - "label": "Quoi de neuf" - } - } } }, "join": { diff --git a/frontend/src/locales/it.json b/frontend/src/locales/it.json index f30f8a018..1bf5d48ac 100644 --- a/frontend/src/locales/it.json +++ b/frontend/src/locales/it.json @@ -123,13 +123,6 @@ "lastMonthTitle": "Last Month", "activeTitle": "Currently" } - }, - "news": { - "buttons": { - "info": { - "label": "Cosa c'è di nuovo" - } - } } }, "join": { diff --git a/frontend/src/locales/pl.json b/frontend/src/locales/pl.json index 77b9b5a61..1f5e9f13e 100644 --- a/frontend/src/locales/pl.json +++ b/frontend/src/locales/pl.json @@ -123,13 +123,6 @@ "lastMonthTitle": "W zeszłym miesiącu", "activeTitle": "Obecnie" } - }, - "news": { - "buttons": { - "info": { - "label": "Co nowego" - } - } } }, "join": { diff --git a/frontend/src/locales/pt.json b/frontend/src/locales/pt.json index 8d681d8d6..205135c80 100644 --- a/frontend/src/locales/pt.json +++ b/frontend/src/locales/pt.json @@ -123,13 +123,6 @@ "lastMonthTitle": "Last Month", "activeTitle": "Currently" } - }, - "news": { - "buttons": { - "info": { - "label": "O que há de novo" - } - } } }, "join": { diff --git a/frontend/src/locales/uk.json b/frontend/src/locales/uk.json index d988aec91..1483b0a96 100644 --- a/frontend/src/locales/uk.json +++ b/frontend/src/locales/uk.json @@ -123,13 +123,6 @@ "lastMonthTitle": "Last Month", "activeTitle": "Currently" } - }, - "news": { - "buttons": { - "info": { - "label": "Що нового" - } - } } }, "join": { From a93b599e5557447b777792be96e27b6533b8878f Mon Sep 17 00:00:00 2001 From: SponsoredByPuma Date: Wed, 8 Nov 2023 10:21:49 +0100 Subject: [PATCH 30/30] fix frontend build error --- frontend/src/locales/es.json | 1 + 1 file changed, 1 insertion(+) diff --git a/frontend/src/locales/es.json b/frontend/src/locales/es.json index d665faf76..6981bb120 100644 --- a/frontend/src/locales/es.json +++ b/frontend/src/locales/es.json @@ -123,6 +123,7 @@ "lastMonthTitle": "Last Month", "activeTitle": "Currently" } + } }, "join": { "title": "Unirse a la sesión",