From 7b2ef4ccdc6243b01188920c3f166567800b1560 Mon Sep 17 00:00:00 2001 From: belljun3395 <195850@jnu.ac.kr> Date: Fri, 10 Jan 2025 18:46:42 +0900 Subject: [PATCH] =?UTF-8?q?[Refactor/#517]=20vaadin=20=EC=84=A4=EC=A0=95?= =?UTF-8?q?=20web=20=EB=AA=A8=EB=93=88=EB=A1=9C=20=EB=B6=84=EB=A6=AC=20(#5?= =?UTF-8?q?18)?= 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/*