From 0c69ace08aa3660cd4de56bcb54e0565d8644d27 Mon Sep 17 00:00:00 2001 From: belljun3395 <195850@jnu.ac.kr> Date: Fri, 10 Jan 2025 18:45:56 +0900 Subject: [PATCH 1/4] =?UTF-8?q?refactor:=20vaadin=20=EC=84=A4=EC=A0=95=20w?= =?UTF-8?q?eb=20=EB=AA=A8=EB=93=88=EB=A1=9C=20=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- domain/crm/build.gradle.kts | 3 --- .../kotlin/com/few/crm/config/CrmVaadinConfig.kt | 8 -------- .../few/crm/view/email/CrmEmailSendHistoryView.kt | 2 +- .../com/few/crm/view/email/CrmEmailSendView.kt | 2 +- .../com/few/crm/view/email/CrmEmailTemplateView.kt | 2 +- .../kotlin/com/few/crm/view/user/CrmUserView.kt | 2 +- .../src/main/resources/application-crm-local.yml | 2 -- .../crm/src/main/resources/application-crm-prd.yml | 2 -- library/web/build.gradle.kts | 4 ++++ .../web/src/main/kotlin/web/config/VaadinConfig.kt | 14 ++++++++++++++ .../main/kotlin/web}/view/CommonVerticalLayout.kt | 6 +++--- .../web/src/main/kotlin/web/view/LoginView.kt | 6 +++--- .../src/main/resources/application-web-local.yml | 3 +++ .../web/src/main/resources/application-web-prd.yml | 3 +++ 14 files changed, 34 insertions(+), 25 deletions(-) delete mode 100644 domain/crm/src/main/kotlin/com/few/crm/config/CrmVaadinConfig.kt create mode 100644 library/web/src/main/kotlin/web/config/VaadinConfig.kt rename {domain/crm/src/main/kotlin/com/few/crm => library/web/src/main/kotlin/web}/view/CommonVerticalLayout.kt (94%) rename domain/crm/src/main/kotlin/com/few/crm/view/CrmLoginView.kt => library/web/src/main/kotlin/web/view/LoginView.kt (97%) diff --git a/domain/crm/build.gradle.kts b/domain/crm/build.gradle.kts index 62c209704..5d1b52606 100644 --- a/domain/crm/build.gradle.kts +++ b/domain/crm/build.gradle.kts @@ -26,9 +26,6 @@ dependencies { implementation("io.awspring.cloud:spring-cloud-aws-starter-sqs:${DependencyVersion.AWS_SQS}") implementation("software.amazon.awssdk:scheduler:2.29.45") - - /** vaadin */ - implementation("com.vaadin:vaadin-spring-boot-starter") } vaadin { diff --git a/domain/crm/src/main/kotlin/com/few/crm/config/CrmVaadinConfig.kt b/domain/crm/src/main/kotlin/com/few/crm/config/CrmVaadinConfig.kt deleted file mode 100644 index cb977f5d4..000000000 --- a/domain/crm/src/main/kotlin/com/few/crm/config/CrmVaadinConfig.kt +++ /dev/null @@ -1,8 +0,0 @@ -package com.few.crm.config - -import com.vaadin.flow.spring.annotation.EnableVaadin -import org.springframework.context.annotation.Configuration - -@Configuration -@EnableVaadin(value = [CrmConfig.BASE_PACKAGE]) -class CrmVaadinConfig \ No newline at end of file diff --git a/domain/crm/src/main/kotlin/com/few/crm/view/email/CrmEmailSendHistoryView.kt b/domain/crm/src/main/kotlin/com/few/crm/view/email/CrmEmailSendHistoryView.kt index 7454439cd..bc5aefece 100644 --- a/domain/crm/src/main/kotlin/com/few/crm/view/email/CrmEmailSendHistoryView.kt +++ b/domain/crm/src/main/kotlin/com/few/crm/view/email/CrmEmailSendHistoryView.kt @@ -2,7 +2,7 @@ package com.few.crm.view.email import com.few.crm.email.domain.EmailSendHistory import com.few.crm.email.repository.EmailSendHistoryRepository -import com.few.crm.view.CommonVerticalLayout +import web.view.CommonVerticalLayout import com.vaadin.flow.component.grid.Grid import com.vaadin.flow.component.orderedlayout.HorizontalLayout import com.vaadin.flow.component.textfield.TextArea diff --git a/domain/crm/src/main/kotlin/com/few/crm/view/email/CrmEmailSendView.kt b/domain/crm/src/main/kotlin/com/few/crm/view/email/CrmEmailSendView.kt index 8231a84bc..52860440c 100644 --- a/domain/crm/src/main/kotlin/com/few/crm/view/email/CrmEmailSendView.kt +++ b/domain/crm/src/main/kotlin/com/few/crm/view/email/CrmEmailSendView.kt @@ -10,7 +10,7 @@ import com.few.crm.support.schedule.TaskView import com.few.crm.support.schedule.TimeOutEventTaskManager import com.few.crm.user.domain.User import com.few.crm.user.repository.UserRepository -import com.few.crm.view.CommonVerticalLayout +import web.view.CommonVerticalLayout import com.vaadin.flow.component.button.Button import com.vaadin.flow.component.checkbox.Checkbox import com.vaadin.flow.component.datepicker.DatePicker diff --git a/domain/crm/src/main/kotlin/com/few/crm/view/email/CrmEmailTemplateView.kt b/domain/crm/src/main/kotlin/com/few/crm/view/email/CrmEmailTemplateView.kt index e305668b6..f089d3808 100644 --- a/domain/crm/src/main/kotlin/com/few/crm/view/email/CrmEmailTemplateView.kt +++ b/domain/crm/src/main/kotlin/com/few/crm/view/email/CrmEmailTemplateView.kt @@ -6,7 +6,7 @@ import com.few.crm.email.repository.EmailTemplateHistoryRepository import com.few.crm.email.repository.EmailTemplateRepository import com.few.crm.email.usecase.PostTemplateUseCase import com.few.crm.email.usecase.dto.PostTemplateUseCaseIn -import com.few.crm.view.CommonVerticalLayout +import web.view.CommonVerticalLayout import com.vaadin.flow.component.button.Button import com.vaadin.flow.component.dialog.Dialog import com.vaadin.flow.component.formlayout.FormLayout diff --git a/domain/crm/src/main/kotlin/com/few/crm/view/user/CrmUserView.kt b/domain/crm/src/main/kotlin/com/few/crm/view/user/CrmUserView.kt index b18ee4c76..13f8c86b8 100644 --- a/domain/crm/src/main/kotlin/com/few/crm/view/user/CrmUserView.kt +++ b/domain/crm/src/main/kotlin/com/few/crm/view/user/CrmUserView.kt @@ -5,7 +5,7 @@ import com.few.crm.user.domain.User import com.few.crm.user.repository.UserRepository import com.few.crm.user.usecase.EnrollUserUseCase import com.few.crm.user.usecase.dto.EnrollUserUseCaseIn -import com.few.crm.view.CommonVerticalLayout +import web.view.CommonVerticalLayout import com.vaadin.flow.component.button.Button import com.vaadin.flow.component.dialog.Dialog import com.vaadin.flow.component.formlayout.FormLayout diff --git a/domain/crm/src/main/resources/application-crm-local.yml b/domain/crm/src/main/resources/application-crm-local.yml index dda3825d9..55e120aa0 100644 --- a/domain/crm/src/main/resources/application-crm-local.yml +++ b/domain/crm/src/main/resources/application-crm-local.yml @@ -24,5 +24,3 @@ spring: properties: hibernate: format_sql: true -vaadin: - urlMapping: /view/* diff --git a/domain/crm/src/main/resources/application-crm-prd.yml b/domain/crm/src/main/resources/application-crm-prd.yml index cc787f081..c2dcbe81e 100644 --- a/domain/crm/src/main/resources/application-crm-prd.yml +++ b/domain/crm/src/main/resources/application-crm-prd.yml @@ -24,5 +24,3 @@ spring: properties: hibernate: format_sql: true -vaadin: - urlMapping: /view/* diff --git a/library/web/build.gradle.kts b/library/web/build.gradle.kts index e9f5abf56..a67908df9 100644 --- a/library/web/build.gradle.kts +++ b/library/web/build.gradle.kts @@ -22,4 +22,8 @@ dependencies { api("org.springframework.restdocs:spring-restdocs-mockmvc") api("org.springdoc:springdoc-openapi-ui:${DependencyVersion.SPRINGDOC}") api("com.epages:restdocs-api-spec-mockmvc:${DependencyVersion.EPAGES_REST_DOCS_API_SPEC}") + + + /** vaadin */ + api("com.vaadin:vaadin-spring-boot-starter") } \ No newline at end of file diff --git a/library/web/src/main/kotlin/web/config/VaadinConfig.kt b/library/web/src/main/kotlin/web/config/VaadinConfig.kt new file mode 100644 index 000000000..13a619561 --- /dev/null +++ b/library/web/src/main/kotlin/web/config/VaadinConfig.kt @@ -0,0 +1,14 @@ +package web.config +import com.vaadin.flow.spring.annotation.EnableVaadin +import com.vaadin.hilla.crud.CrudConfiguration +import org.springframework.boot.autoconfigure.EnableAutoConfiguration +import org.springframework.context.annotation.Configuration + +@Configuration +@EnableVaadin(value = ["com.few"]) +@EnableAutoConfiguration( + exclude = [ + CrudConfiguration::class, + ] +) +class VaadinConfig \ No newline at end of file diff --git a/domain/crm/src/main/kotlin/com/few/crm/view/CommonVerticalLayout.kt b/library/web/src/main/kotlin/web/view/CommonVerticalLayout.kt similarity index 94% rename from domain/crm/src/main/kotlin/com/few/crm/view/CommonVerticalLayout.kt rename to library/web/src/main/kotlin/web/view/CommonVerticalLayout.kt index 94ac8ad06..1de8f48aa 100644 --- a/domain/crm/src/main/kotlin/com/few/crm/view/CommonVerticalLayout.kt +++ b/library/web/src/main/kotlin/web/view/CommonVerticalLayout.kt @@ -1,4 +1,4 @@ -package com.few.crm.view +package web.view import com.vaadin.flow.component.UI import com.vaadin.flow.component.button.Button @@ -19,11 +19,11 @@ abstract class CommonVerticalLayout : VerticalLayout() { val user = VaadinService.getCurrentRequest().wrappedSession.getAttribute("user") if (user == null || user == "") { UI.getCurrent().access { - UI.getCurrent().navigate("crm/login") + UI.getCurrent().navigate("login") } } - val logo = H1("FEW CRM") + val logo = H1("FEW") logo.addClassName("logo") val logout = Button("Logout") { diff --git a/domain/crm/src/main/kotlin/com/few/crm/view/CrmLoginView.kt b/library/web/src/main/kotlin/web/view/LoginView.kt similarity index 97% rename from domain/crm/src/main/kotlin/com/few/crm/view/CrmLoginView.kt rename to library/web/src/main/kotlin/web/view/LoginView.kt index 6aacbf40b..434fb15e6 100644 --- a/domain/crm/src/main/kotlin/com/few/crm/view/CrmLoginView.kt +++ b/library/web/src/main/kotlin/web/view/LoginView.kt @@ -1,4 +1,4 @@ -package com.few.crm.view +package web.view import com.vaadin.flow.component.UI import com.vaadin.flow.component.html.H1 @@ -13,10 +13,10 @@ import com.vaadin.flow.server.VaadinService import com.vaadin.flow.server.auth.AnonymousAllowed import org.springframework.web.client.RestTemplate -@Route("/crm/login") +@Route("/login") @PageTitle("Login") @AnonymousAllowed -class CrmLoginView : +class LoginView : VerticalLayout(), BeforeEnterObserver { private val loginOverlay = LoginOverlay() diff --git a/library/web/src/main/resources/application-web-local.yml b/library/web/src/main/resources/application-web-local.yml index 508343580..4a416081d 100644 --- a/library/web/src/main/resources/application-web-local.yml +++ b/library/web/src/main/resources/application-web-local.yml @@ -21,3 +21,6 @@ web: webhook: discord: "localhost:8080/webhook/discord/unused" + +vaadin: + urlMapping: /view/* diff --git a/library/web/src/main/resources/application-web-prd.yml b/library/web/src/main/resources/application-web-prd.yml index 08e8a0905..36f2b1aa9 100644 --- a/library/web/src/main/resources/application-web-prd.yml +++ b/library/web/src/main/resources/application-web-prd.yml @@ -21,3 +21,6 @@ web: webhook: discord: ${WEBHOOK_DISCORD} + +vaadin: + urlMapping: /view/* From 1c9daa8402aa57f694d4a3896a4c0eaf5325d6ff Mon Sep 17 00:00:00 2001 From: belljun3395 <195850@jnu.ac.kr> Date: Fri, 10 Jan 2025 18:59:46 +0900 Subject: [PATCH 2/4] =?UTF-8?q?chore:=20lint=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/few/crm/view/email/CrmEmailSendHistoryView.kt | 2 +- .../kotlin/com/few/crm/view/email/CrmEmailSendView.kt | 2 +- .../com/few/crm/view/email/CrmEmailTemplateView.kt | 2 +- .../main/kotlin/com/few/crm/view/user/CrmUserView.kt | 2 +- library/web/build.gradle.kts | 1 - library/web/src/main/kotlin/web/config/VaadinConfig.kt | 10 +++++++--- 6 files changed, 11 insertions(+), 8 deletions(-) diff --git a/domain/crm/src/main/kotlin/com/few/crm/view/email/CrmEmailSendHistoryView.kt b/domain/crm/src/main/kotlin/com/few/crm/view/email/CrmEmailSendHistoryView.kt index bc5aefece..c4d88d4ee 100644 --- a/domain/crm/src/main/kotlin/com/few/crm/view/email/CrmEmailSendHistoryView.kt +++ b/domain/crm/src/main/kotlin/com/few/crm/view/email/CrmEmailSendHistoryView.kt @@ -2,13 +2,13 @@ package com.few.crm.view.email import com.few.crm.email.domain.EmailSendHistory import com.few.crm.email.repository.EmailSendHistoryRepository -import web.view.CommonVerticalLayout import com.vaadin.flow.component.grid.Grid import com.vaadin.flow.component.orderedlayout.HorizontalLayout import com.vaadin.flow.component.textfield.TextArea import com.vaadin.flow.component.textfield.TextField import com.vaadin.flow.router.Route import org.springframework.data.domain.Sort +import web.view.CommonVerticalLayout @Route("/crm/email/send/histories") class CrmEmailSendHistoryView( diff --git a/domain/crm/src/main/kotlin/com/few/crm/view/email/CrmEmailSendView.kt b/domain/crm/src/main/kotlin/com/few/crm/view/email/CrmEmailSendView.kt index 52860440c..371df5e01 100644 --- a/domain/crm/src/main/kotlin/com/few/crm/view/email/CrmEmailSendView.kt +++ b/domain/crm/src/main/kotlin/com/few/crm/view/email/CrmEmailSendView.kt @@ -10,7 +10,6 @@ import com.few.crm.support.schedule.TaskView import com.few.crm.support.schedule.TimeOutEventTaskManager import com.few.crm.user.domain.User import com.few.crm.user.repository.UserRepository -import web.view.CommonVerticalLayout import com.vaadin.flow.component.button.Button import com.vaadin.flow.component.checkbox.Checkbox import com.vaadin.flow.component.datepicker.DatePicker @@ -26,6 +25,7 @@ import com.vaadin.flow.component.timepicker.TimePicker import com.vaadin.flow.router.Route import org.springframework.context.ApplicationEventPublisher import org.springframework.data.domain.Sort +import web.view.CommonVerticalLayout import java.time.* @Route("/crm/email/send") diff --git a/domain/crm/src/main/kotlin/com/few/crm/view/email/CrmEmailTemplateView.kt b/domain/crm/src/main/kotlin/com/few/crm/view/email/CrmEmailTemplateView.kt index f089d3808..edd48c790 100644 --- a/domain/crm/src/main/kotlin/com/few/crm/view/email/CrmEmailTemplateView.kt +++ b/domain/crm/src/main/kotlin/com/few/crm/view/email/CrmEmailTemplateView.kt @@ -6,7 +6,6 @@ import com.few.crm.email.repository.EmailTemplateHistoryRepository import com.few.crm.email.repository.EmailTemplateRepository import com.few.crm.email.usecase.PostTemplateUseCase import com.few.crm.email.usecase.dto.PostTemplateUseCaseIn -import web.view.CommonVerticalLayout import com.vaadin.flow.component.button.Button import com.vaadin.flow.component.dialog.Dialog import com.vaadin.flow.component.formlayout.FormLayout @@ -17,6 +16,7 @@ import com.vaadin.flow.component.textfield.TextArea import com.vaadin.flow.component.textfield.TextField import com.vaadin.flow.router.Route import org.springframework.data.domain.Sort +import web.view.CommonVerticalLayout @Route("/crm/email/templates") class CrmEmailTemplateView( diff --git a/domain/crm/src/main/kotlin/com/few/crm/view/user/CrmUserView.kt b/domain/crm/src/main/kotlin/com/few/crm/view/user/CrmUserView.kt index 13f8c86b8..74d75db26 100644 --- a/domain/crm/src/main/kotlin/com/few/crm/view/user/CrmUserView.kt +++ b/domain/crm/src/main/kotlin/com/few/crm/view/user/CrmUserView.kt @@ -5,7 +5,6 @@ import com.few.crm.user.domain.User import com.few.crm.user.repository.UserRepository import com.few.crm.user.usecase.EnrollUserUseCase import com.few.crm.user.usecase.dto.EnrollUserUseCaseIn -import web.view.CommonVerticalLayout import com.vaadin.flow.component.button.Button import com.vaadin.flow.component.dialog.Dialog import com.vaadin.flow.component.formlayout.FormLayout @@ -13,6 +12,7 @@ import com.vaadin.flow.component.grid.Grid import com.vaadin.flow.component.textfield.TextField import com.vaadin.flow.router.Route import org.springframework.web.client.RestTemplate +import web.view.CommonVerticalLayout @Route("/crm/users") class CrmUserView( diff --git a/library/web/build.gradle.kts b/library/web/build.gradle.kts index a67908df9..efaa55ce5 100644 --- a/library/web/build.gradle.kts +++ b/library/web/build.gradle.kts @@ -23,7 +23,6 @@ dependencies { api("org.springdoc:springdoc-openapi-ui:${DependencyVersion.SPRINGDOC}") api("com.epages:restdocs-api-spec-mockmvc:${DependencyVersion.EPAGES_REST_DOCS_API_SPEC}") - /** vaadin */ api("com.vaadin:vaadin-spring-boot-starter") } \ No newline at end of file diff --git a/library/web/src/main/kotlin/web/config/VaadinConfig.kt b/library/web/src/main/kotlin/web/config/VaadinConfig.kt index 13a619561..5650edd14 100644 --- a/library/web/src/main/kotlin/web/config/VaadinConfig.kt +++ b/library/web/src/main/kotlin/web/config/VaadinConfig.kt @@ -5,10 +5,14 @@ import org.springframework.boot.autoconfigure.EnableAutoConfiguration import org.springframework.context.annotation.Configuration @Configuration -@EnableVaadin(value = ["com.few"]) +@EnableVaadin( + value = [ + "com.few", + ], +) @EnableAutoConfiguration( - exclude = [ + exclude = [ CrudConfiguration::class, - ] + ], ) class VaadinConfig \ No newline at end of file From c5fdb515776d9ca24a0981a3e92d61d8da56cecd Mon Sep 17 00:00:00 2001 From: belljun3395 <195850@jnu.ac.kr> Date: Fri, 10 Jan 2025 19:00:07 +0900 Subject: [PATCH 3/4] =?UTF-8?q?fix:=20LoginView=20=ED=8F=AC=ED=95=A8=20?= =?UTF-8?q?=EB=90=98=EB=8F=84=EB=A1=9D=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/web/src/main/kotlin/web/config/VaadinConfig.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/library/web/src/main/kotlin/web/config/VaadinConfig.kt b/library/web/src/main/kotlin/web/config/VaadinConfig.kt index 5650edd14..2bc60ff6b 100644 --- a/library/web/src/main/kotlin/web/config/VaadinConfig.kt +++ b/library/web/src/main/kotlin/web/config/VaadinConfig.kt @@ -8,6 +8,7 @@ import org.springframework.context.annotation.Configuration @EnableVaadin( value = [ "com.few", + "web.view", ], ) @EnableAutoConfiguration( From f4c4ceb6382aa91fb68759577c656a34d265eae6 Mon Sep 17 00:00:00 2001 From: belljun3395 <195850@jnu.ac.kr> Date: Fri, 10 Jan 2025 19:00:07 +0900 Subject: [PATCH 4/4] =?UTF-8?q?fix:=20LoginView=20=ED=8F=AC=ED=95=A8=20?= =?UTF-8?q?=EB=90=98=EB=8F=84=EB=A1=9D=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/web/src/main/kotlin/web/config/VaadinConfig.kt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/library/web/src/main/kotlin/web/config/VaadinConfig.kt b/library/web/src/main/kotlin/web/config/VaadinConfig.kt index 11a356211..2bc60ff6b 100644 --- a/library/web/src/main/kotlin/web/config/VaadinConfig.kt +++ b/library/web/src/main/kotlin/web/config/VaadinConfig.kt @@ -5,7 +5,12 @@ import org.springframework.boot.autoconfigure.EnableAutoConfiguration import org.springframework.context.annotation.Configuration @Configuration -@EnableVaadin(value = ["com.few"]) +@EnableVaadin( + value = [ + "com.few", + "web.view", + ], +) @EnableAutoConfiguration( exclude = [ CrudConfiguration::class,