This is an automated email from the ASF dual-hosted git repository. benjobs pushed a commit to branch git_clone in repository https://gitbox.apache.org/repos/asf/incubator-streampark.git
commit 79c3027397c39d8e2d4d062ac735570198d24594 Author: benjobs <[email protected]> AuthorDate: Wed Jan 3 00:30:31 2024 +0800 [Improve] clone project connect type improvement --- .../src/main/assembly/script/data/mysql-data.sql | 2 +- .../src/main/assembly/script/data/pgsql-data.sql | 2 +- .../main/assembly/script/schema/mysql-schema.sql | 1 - .../main/assembly/script/schema/pgsql-schema.sql | 1 - .../main/assembly/script/upgrade/mysql/2.1.3.sql | 2 + .../main/assembly/script/upgrade/pgsql/2.1.3.sql | 19 +++++ .../streampark/console/base/util/GitUtils.java | 87 ++++++++++------------ .../streampark/console/core/entity/Project.java | 10 ++- .../console/core/enums/GitCredential.java | 43 ----------- .../core/service/impl/ProjectServiceImpl.java | 4 +- .../console/core/task/ProjectBuildTask.java | 5 +- .../src/main/resources/db/data-h2.sql | 2 +- .../src/main/resources/db/schema-h2.sql | 1 - .../main/resources/mapper/core/ProjectMapper.xml | 1 - .../console/core/entity/ProjectTest.java | 2 - .../Application/src/AppDarkModeToggle.vue | 4 +- .../src/components/ContextMenu/src/ContextMenu.vue | 4 +- .../src/components/Form/src/BasicForm.vue | 2 +- .../src/components/Page/src/PageFooter.vue | 4 +- .../components/Table/src/components/HeaderCell.vue | 2 +- .../src/enums/projectEnum.ts | 5 -- .../src/hooks/web/useLockPage.ts | 9 ++- .../src/locales/lang/en/flink/project.ts | 6 +- .../src/locales/lang/zh-CN/flink/project.ts | 3 - .../streampark-console-webapp/src/utils/props.ts | 2 +- .../src/views/flink/project/Add.vue | 1 - .../src/views/flink/project/Edit.vue | 1 - .../flink/project/components/RepositoryGroup.tsx | 78 +++++++------------ .../src/views/flink/project/useProject.tsx | 37 ++------- 29 files changed, 129 insertions(+), 211 deletions(-) diff --git a/streampark-console/streampark-console-service/src/main/assembly/script/data/mysql-data.sql b/streampark-console/streampark-console-service/src/main/assembly/script/data/mysql-data.sql index c5ad94555..95e8eb357 100644 --- a/streampark-console/streampark-console-service/src/main/assembly/script/data/mysql-data.sql +++ b/streampark-console/streampark-console-service/src/main/assembly/script/data/mysql-data.sql @@ -40,7 +40,7 @@ insert into `t_flink_effective` values (100000, 100000, 2, 100000, now()); -- ---------------------------- -- Records of t_flink_project -- ---------------------------- -insert into `t_flink_project` values (100000, 100000, 'streampark-quickstart', '1', 'https://github.com/apache/incubator-streampark-quickstart', 'release-2.0.0', null, null, null, null, null, 1, 1, null, 'streampark-quickstart', -1, now(), now()); +insert into `t_flink_project` values (100000, 100000, 'streampark-quickstart', 'https://github.com/apache/incubator-streampark-quickstart', 'release-2.0.0', null, null, null, null, null, 1, 1, null, 'streampark-quickstart', -1, now(), now()); -- ---------------------------- -- Records of t_flink_sql diff --git a/streampark-console/streampark-console-service/src/main/assembly/script/data/pgsql-data.sql b/streampark-console/streampark-console-service/src/main/assembly/script/data/pgsql-data.sql index dc88b6e6d..0becb366a 100644 --- a/streampark-console/streampark-console-service/src/main/assembly/script/data/pgsql-data.sql +++ b/streampark-console/streampark-console-service/src/main/assembly/script/data/pgsql-data.sql @@ -35,7 +35,7 @@ insert into "public"."t_flink_effective" values (100000, 100000, 2, 100000, now( -- ---------------------------- -- Records of t_flink_project -- ---------------------------- -insert into "public"."t_flink_project" values (100000, 100000, 'streampark-quickstart', '1', 'https://github.com/apache/incubator-streampark-quickstart', 'release-2.0.0', null, null, null, null, null, 1, 1, null, 'streampark-quickstart', -1, now(), now()); +insert into "public"."t_flink_project" values (100000, 100000, 'streampark-quickstart', 'https://github.com/apache/incubator-streampark-quickstart', 'release-2.0.0', null, null, null, null, null, 1, 1, null, 'streampark-quickstart', -1, now(), now()); -- ---------------------------- diff --git a/streampark-console/streampark-console-service/src/main/assembly/script/schema/mysql-schema.sql b/streampark-console/streampark-console-service/src/main/assembly/script/schema/mysql-schema.sql index c1a390400..ac63175c2 100644 --- a/streampark-console/streampark-console-service/src/main/assembly/script/schema/mysql-schema.sql +++ b/streampark-console/streampark-console-service/src/main/assembly/script/schema/mysql-schema.sql @@ -184,7 +184,6 @@ create table `t_flink_project` ( `id` bigint not null auto_increment, `team_id` bigint not null, `name` varchar(255) collate utf8mb4_general_ci default null, - `git_credential` tinyint not null, `url` varchar(255) collate utf8mb4_general_ci default null, `branches` varchar(64) collate utf8mb4_general_ci default null, `user_name` varchar(64) collate utf8mb4_general_ci default null, diff --git a/streampark-console/streampark-console-service/src/main/assembly/script/schema/pgsql-schema.sql b/streampark-console/streampark-console-service/src/main/assembly/script/schema/pgsql-schema.sql index 76c4c6e8f..2d91ffe3c 100644 --- a/streampark-console/streampark-console-service/src/main/assembly/script/schema/pgsql-schema.sql +++ b/streampark-console/streampark-console-service/src/main/assembly/script/schema/pgsql-schema.sql @@ -421,7 +421,6 @@ create table "public"."t_flink_project" ( "id" int8 not null default nextval('streampark_t_flink_project_id_seq'::regclass), "team_id" int8, "name" varchar(255) collate "pg_catalog"."default", - "git_credential" int2, "url" varchar(255) collate "pg_catalog"."default", "branches" varchar(64) collate "pg_catalog"."default", "user_name" varchar(64) collate "pg_catalog"."default", diff --git a/streampark-console/streampark-console-service/src/main/assembly/script/upgrade/mysql/2.1.3.sql b/streampark-console/streampark-console-service/src/main/assembly/script/upgrade/mysql/2.1.3.sql index 958364181..eeb022f92 100644 --- a/streampark-console/streampark-console-service/src/main/assembly/script/upgrade/mysql/2.1.3.sql +++ b/streampark-console/streampark-console-service/src/main/assembly/script/upgrade/mysql/2.1.3.sql @@ -36,4 +36,6 @@ alter table `t_flink_cluster` alter table `t_message` modify column `context` longtext; +alter table `t_flink_project` drop column `git_credential`; + set foreign_key_checks = 1; diff --git a/streampark-console/streampark-console-service/src/main/assembly/script/upgrade/pgsql/2.1.3.sql b/streampark-console/streampark-console-service/src/main/assembly/script/upgrade/pgsql/2.1.3.sql new file mode 100644 index 000000000..af18a13d2 --- /dev/null +++ b/streampark-console/streampark-console-service/src/main/assembly/script/upgrade/pgsql/2.1.3.sql @@ -0,0 +1,19 @@ +/* +* Licensed to the Apache Software Foundation (ASF) under one or more +* contributor license agreements. See the NOTICE file distributed with +* this work for additional information regarding copyright ownership. +* The ASF licenses this file to You under the Apache License, Version 2.0 +* (the "License"); you may not use this file except in compliance with +* the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +alter table "public"."t_flink_project" + drop column "git_credential"; diff --git a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/base/util/GitUtils.java b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/base/util/GitUtils.java index bd61a4d1b..02a17de35 100644 --- a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/base/util/GitUtils.java +++ b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/base/util/GitUtils.java @@ -18,7 +18,6 @@ package org.apache.streampark.console.base.util; import org.apache.streampark.console.core.entity.Project; -import org.apache.streampark.console.core.enums.GitCredential; import org.apache.commons.lang3.StringUtils; @@ -78,56 +77,52 @@ public class GitUtils { } private static void setCredentials(TransportCommand<?, ?> transportCommand, Project project) { - GitCredential gitCredential = GitCredential.of(project.getGitCredential()); - switch (gitCredential) { - case HTTPS: - if (!StringUtils.isAllEmpty(project.getUserName(), project.getPassword())) { - UsernamePasswordCredentialsProvider credentialsProvider = - new UsernamePasswordCredentialsProvider(project.getUserName(), project.getPassword()); - transportCommand.setCredentialsProvider(credentialsProvider); - } - break; - case SSH: - transportCommand.setTransportConfigCallback( - transport -> { - SshTransport sshTransport = (SshTransport) transport; - sshTransport.setSshSessionFactory( - new JschConfigSessionFactory() { - @Override - protected void configure(OpenSshConfig.Host hc, Session session) { - session.setConfig("StrictHostKeyChecking", "no"); - } + if (project.isHttpRepositoryUrl()) { + if (!StringUtils.isAllEmpty(project.getUserName(), project.getPassword())) { + UsernamePasswordCredentialsProvider credentialsProvider = + new UsernamePasswordCredentialsProvider(project.getUserName(), project.getPassword()); + transportCommand.setCredentialsProvider(credentialsProvider); + } + } else if (project.isSshRepositoryUrl()) { + transportCommand.setTransportConfigCallback( + transport -> { + SshTransport sshTransport = (SshTransport) transport; + sshTransport.setSshSessionFactory( + new JschConfigSessionFactory() { + @Override + protected void configure(OpenSshConfig.Host hc, Session session) { + session.setConfig("StrictHostKeyChecking", "no"); + } - @Override - protected JSch createDefaultJSch(FS fs) throws JSchException { - JSch jSch = super.createDefaultJSch(fs); - String prvkeyPath = project.getPrvkeyPath(); - if (StringUtils.isBlank(prvkeyPath)) { - String userHome = System.getProperty("user.home"); - if (userHome != null) { - String rsaPath = userHome.concat("/.ssh/id_rsa"); - File resFile = new File(rsaPath); - if (resFile.exists()) { - prvkeyPath = rsaPath; - } + @Override + protected JSch createDefaultJSch(FS fs) throws JSchException { + JSch jSch = super.createDefaultJSch(fs); + String prvkeyPath = project.getPrvkeyPath(); + if (StringUtils.isBlank(prvkeyPath)) { + String userHome = System.getProperty("user.home"); + if (userHome != null) { + String rsaPath = userHome.concat("/.ssh/id_rsa"); + File resFile = new File(rsaPath); + if (resFile.exists()) { + prvkeyPath = rsaPath; } } - if (prvkeyPath == null) { - return jSch; - } - if (StringUtils.isEmpty(project.getPassword())) { - jSch.addIdentity(prvkeyPath); - } else { - jSch.addIdentity(prvkeyPath, project.getPassword()); - } + } + if (prvkeyPath == null) { return jSch; } - }); - }); - break; - default: - throw new IllegalStateException( - "[StreamPark] git setCredentials: unsupported protocol type"); + if (StringUtils.isEmpty(project.getPassword())) { + jSch.addIdentity(prvkeyPath); + } else { + jSch.addIdentity(prvkeyPath, project.getPassword()); + } + return jSch; + } + }); + }); + } else { + throw new IllegalStateException( + "[StreamPark] repository URL is invalid, must be ssh or http(s)"); } } } diff --git a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/entity/Project.java b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/entity/Project.java index 99498eae8..6feb8b275 100644 --- a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/entity/Project.java +++ b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/entity/Project.java @@ -68,8 +68,6 @@ public class Project implements Serializable { private Date lastBuild; - private Integer gitCredential; - @TableField(updateStrategy = FieldStrategy.IGNORED) private String userName; @@ -306,4 +304,12 @@ public class Project implements Serializable { private String getLogHeader(String header) { return "---------------------------------[ " + header + " ]---------------------------------\n"; } + + public boolean isHttpRepositoryUrl() { + return url != null && (url.trim().startsWith("https://") || url.trim().startsWith("http://")); + } + + public boolean isSshRepositoryUrl() { + return url != null && url.trim().startsWith("git@"); + } } diff --git a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/enums/GitCredential.java b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/enums/GitCredential.java deleted file mode 100644 index 36a19a90f..000000000 --- a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/enums/GitCredential.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.streampark.console.core.enums; - -import java.util.Arrays; - -public enum GitCredential { - HTTPS(1), - SSH(2); - - private final int value; - - GitCredential(int value) { - this.value = value; - } - - public static GitCredential of(Integer value) { - return Arrays.stream(values()).filter(x -> x.value == value).findFirst().orElse(null); - } - - public static boolean isSSH(Integer gitCredential) { - return GitCredential.SSH.equals(GitCredential.of(gitCredential)); - } - - public Integer getValue() { - return this.value; - } -} diff --git a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/impl/ProjectServiceImpl.java b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/impl/ProjectServiceImpl.java index cc8745903..7ce20d25a 100644 --- a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/impl/ProjectServiceImpl.java +++ b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/impl/ProjectServiceImpl.java @@ -34,7 +34,6 @@ import org.apache.streampark.console.base.util.GZipUtils; import org.apache.streampark.console.core.entity.Application; import org.apache.streampark.console.core.entity.Project; import org.apache.streampark.console.core.enums.BuildState; -import org.apache.streampark.console.core.enums.GitCredential; import org.apache.streampark.console.core.enums.ReleaseState; import org.apache.streampark.console.core.mapper.ProjectMapper; import org.apache.streampark.console.core.service.ApplicationService; @@ -126,14 +125,13 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> project.setName(projectParam.getName()); project.setUrl(projectParam.getUrl()); project.setBranches(projectParam.getBranches()); - project.setGitCredential(projectParam.getGitCredential()); project.setPrvkeyPath(projectParam.getPrvkeyPath()); project.setUserName(projectParam.getUserName()); project.setPassword(projectParam.getPassword()); project.setPom(projectParam.getPom()); project.setDescription(projectParam.getDescription()); project.setBuildArgs(projectParam.getBuildArgs()); - if (GitCredential.isSSH(project.getGitCredential())) { + if (project.isSshRepositoryUrl()) { project.setUserName(null); } else { project.setPrvkeyPath(null); diff --git a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/task/ProjectBuildTask.java b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/task/ProjectBuildTask.java index 5a5fcbffd..bfe06c444 100644 --- a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/task/ProjectBuildTask.java +++ b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/task/ProjectBuildTask.java @@ -22,7 +22,6 @@ import org.apache.streampark.common.util.Utils; import org.apache.streampark.console.base.util.GitUtils; import org.apache.streampark.console.core.entity.Project; import org.apache.streampark.console.core.enums.BuildState; -import org.apache.streampark.console.core.enums.GitCredential; import ch.qos.logback.classic.Logger; import lombok.extern.slf4j.Slf4j; @@ -106,9 +105,7 @@ public class ProjectBuildTask extends AbstractLogFileTask { return true; } catch (Exception e) { if (e instanceof InvalidRemoteException) { - GitCredential gitCredential = GitCredential.of(project.getGitCredential()); - if (gitCredential == GitCredential.HTTPS) { - project.setGitCredential(GitCredential.SSH.getValue()); + if (project.isHttpRepositoryUrl()) { String url = project .getUrl() diff --git a/streampark-console/streampark-console-service/src/main/resources/db/data-h2.sql b/streampark-console/streampark-console-service/src/main/resources/db/data-h2.sql index 7a450f129..e691ee3f2 100644 --- a/streampark-console/streampark-console-service/src/main/resources/db/data-h2.sql +++ b/streampark-console/streampark-console-service/src/main/resources/db/data-h2.sql @@ -35,7 +35,7 @@ insert into `t_flink_effective` values (100000, 100000, 2, 100000, now()); -- ---------------------------- -- Records of t_flink_project -- ---------------------------- -insert into `t_flink_project` values (100000, 100000, 'streampark-quickstart', '1', 'https://github.com/apache/incubator-streampark-quickstart', 'release-2.0.0', null, null, null, null, null, 1, 1, null, 'streampark-quickstart', -1, now(), now()); +insert into `t_flink_project` values (100000, 100000, 'streampark-quickstart', 'https://github.com/apache/incubator-streampark-quickstart', 'release-2.0.0', null, null, null, null, null, 1, 1, null, 'streampark-quickstart', -1, now(), now()); -- ---------------------------- -- Records of t_flink_sql diff --git a/streampark-console/streampark-console-service/src/main/resources/db/schema-h2.sql b/streampark-console/streampark-console-service/src/main/resources/db/schema-h2.sql index 74b000e0a..2e27d73ea 100644 --- a/streampark-console/streampark-console-service/src/main/resources/db/schema-h2.sql +++ b/streampark-console/streampark-console-service/src/main/resources/db/schema-h2.sql @@ -165,7 +165,6 @@ create table if not exists `t_flink_project` ( `id` bigint generated by default as identity not null, `team_id` bigint not null, `name` varchar(255) default null, - `git_credential` tinyint not null, `url` varchar(255) default null, `branches` varchar(64) default null, `user_name` varchar(64) default null, diff --git a/streampark-console/streampark-console-service/src/main/resources/mapper/core/ProjectMapper.xml b/streampark-console/streampark-console-service/src/main/resources/mapper/core/ProjectMapper.xml index e8a472956..0402ba7c8 100644 --- a/streampark-console/streampark-console-service/src/main/resources/mapper/core/ProjectMapper.xml +++ b/streampark-console/streampark-console-service/src/main/resources/mapper/core/ProjectMapper.xml @@ -22,7 +22,6 @@ <id column="id" jdbcType="INTEGER" property="id"/> <result column="team_id" jdbcType="BIGINT" property="teamId"/> <result column="name" jdbcType="VARCHAR" property="name"/> - <result column="git_credential" jdbcType="INTEGER" property="gitCredential"/> <result column="url" jdbcType="VARCHAR" property="url"/> <result column="repository" jdbcType="INTEGER" property="repository"/> <result column="branches" jdbcType="VARCHAR" property="branches"/> diff --git a/streampark-console/streampark-console-service/src/test/java/org/apache/streampark/console/core/entity/ProjectTest.java b/streampark-console/streampark-console-service/src/test/java/org/apache/streampark/console/core/entity/ProjectTest.java index f2d060d76..ed506667a 100644 --- a/streampark-console/streampark-console-service/src/test/java/org/apache/streampark/console/core/entity/ProjectTest.java +++ b/streampark-console/streampark-console-service/src/test/java/org/apache/streampark/console/core/entity/ProjectTest.java @@ -18,7 +18,6 @@ package org.apache.streampark.console.core.entity; import org.apache.streampark.console.core.enums.GitAuthorizedError; -import org.apache.streampark.console.core.enums.GitCredential; import lombok.extern.slf4j.Slf4j; import org.junit.jupiter.api.BeforeEach; @@ -35,7 +34,6 @@ class ProjectTest { @BeforeEach void before() { project.setUrl("https://github.com/apache/incubator-streampark.git"); - project.setGitCredential(GitCredential.HTTPS.getValue()); } @Disabled("This test case can't be runnable due to external service is not available.") diff --git a/streampark-console/streampark-console-webapp/src/components/Application/src/AppDarkModeToggle.vue b/streampark-console/streampark-console-webapp/src/components/Application/src/AppDarkModeToggle.vue index 19ba3b151..d4e0ce164 100644 --- a/streampark-console/streampark-console-webapp/src/components/Application/src/AppDarkModeToggle.vue +++ b/streampark-console/streampark-console-webapp/src/components/Application/src/AppDarkModeToggle.vue @@ -63,7 +63,9 @@ height: 18px; background-color: #fff; border-radius: 50%; - transition: transform 0.5s, background-color 0.5s; + transition: + transform 0.5s, + background-color 0.5s; will-change: transform; } diff --git a/streampark-console/streampark-console-webapp/src/components/ContextMenu/src/ContextMenu.vue b/streampark-console/streampark-console-webapp/src/components/ContextMenu/src/ContextMenu.vue index e08c25f36..78cac5c5b 100644 --- a/streampark-console/streampark-console-webapp/src/components/ContextMenu/src/ContextMenu.vue +++ b/streampark-console/streampark-console-webapp/src/components/ContextMenu/src/ContextMenu.vue @@ -179,7 +179,9 @@ background-color: @component-background; border: 1px solid rgb(0 0 0 / 8%); border-radius: 0.25rem; - box-shadow: 0 2px 2px 0 rgb(0 0 0 / 14%), 0 3px 1px -2px rgb(0 0 0 / 10%), + box-shadow: + 0 2px 2px 0 rgb(0 0 0 / 14%), + 0 3px 1px -2px rgb(0 0 0 / 10%), 0 1px 5px 0 rgb(0 0 0 / 6%); background-clip: padding-box; user-select: none; diff --git a/streampark-console/streampark-console-webapp/src/components/Form/src/BasicForm.vue b/streampark-console/streampark-console-webapp/src/components/Form/src/BasicForm.vue index 1cd7e3809..e5a9dacf6 100644 --- a/streampark-console/streampark-console-webapp/src/components/Form/src/BasicForm.vue +++ b/streampark-console/streampark-console-webapp/src/components/Form/src/BasicForm.vue @@ -113,7 +113,7 @@ }); const getBindValue = computed( - () => ({ ...attrs, ...props, ...unref(getProps) } as Recordable), + () => ({ ...attrs, ...props, ...unref(getProps) }) as Recordable, ); const getSchema = computed((): FormSchema[] => { diff --git a/streampark-console/streampark-console-webapp/src/components/Page/src/PageFooter.vue b/streampark-console/streampark-console-webapp/src/components/Page/src/PageFooter.vue index e89a6ce97..8fdbc8f41 100644 --- a/streampark-console/streampark-console-webapp/src/components/Page/src/PageFooter.vue +++ b/streampark-console/streampark-console-webapp/src/components/Page/src/PageFooter.vue @@ -39,7 +39,9 @@ line-height: 44px; background-color: @component-background; border-top: 1px solid @border-color-base; - box-shadow: 0 -6px 16px -8px rgb(0 0 0 / 8%), 0 -9px 28px 0 rgb(0 0 0 / 5%), + box-shadow: + 0 -6px 16px -8px rgb(0 0 0 / 8%), + 0 -9px 28px 0 rgb(0 0 0 / 5%), 0 -12px 48px 16px rgb(0 0 0 / 3%); transition: width 0.2s; diff --git a/streampark-console/streampark-console-webapp/src/components/Table/src/components/HeaderCell.vue b/streampark-console/streampark-console-webapp/src/components/Table/src/components/HeaderCell.vue index 35c080269..36ab854c5 100644 --- a/streampark-console/streampark-console-webapp/src/components/Table/src/components/HeaderCell.vue +++ b/streampark-console/streampark-console-webapp/src/components/Table/src/components/HeaderCell.vue @@ -22,7 +22,7 @@ props: { column: { type: Object as PropType<BasicColumn>, - default: () => ({} as BasicColumn), + default: () => ({}) as BasicColumn, }, }, setup(props) { diff --git a/streampark-console/streampark-console-webapp/src/enums/projectEnum.ts b/streampark-console/streampark-console-webapp/src/enums/projectEnum.ts index 3be6455ad..e5b5454cf 100644 --- a/streampark-console/streampark-console-webapp/src/enums/projectEnum.ts +++ b/streampark-console/streampark-console-webapp/src/enums/projectEnum.ts @@ -3,11 +3,6 @@ export enum ProjectTypeEnum { SPARK = 2, } -export enum GitCredentialEnum { - HTTPS = 1, - SSH = 2, -} - export enum CVSTypeEnum { GIT = 1, SVN = 2, diff --git a/streampark-console/streampark-console-webapp/src/hooks/web/useLockPage.ts b/streampark-console/streampark-console-webapp/src/hooks/web/useLockPage.ts index c543be954..9a6607421 100644 --- a/streampark-console/streampark-console-webapp/src/hooks/web/useLockPage.ts +++ b/streampark-console/streampark-console-webapp/src/hooks/web/useLockPage.ts @@ -32,9 +32,12 @@ export function useLockPage() { } clear(); - timeId = setTimeout(() => { - lockPage(); - }, lockTime * 60 * 1000); + timeId = setTimeout( + () => { + lockPage(); + }, + lockTime * 60 * 1000, + ); } function lockPage(): void { diff --git a/streampark-console/streampark-console-webapp/src/locales/lang/en/flink/project.ts b/streampark-console/streampark-console-webapp/src/locales/lang/en/flink/project.ts index 4f569def3..245f717a1 100644 --- a/streampark-console/streampark-console-webapp/src/locales/lang/en/flink/project.ts +++ b/streampark-console/streampark-console-webapp/src/locales/lang/en/flink/project.ts @@ -34,14 +34,11 @@ export default { cvs: 'CVS', prvkeyPath: 'Private Key Path', prvkeyPathPlaceholder: 'private key path, e.g: ~/.ssh/id_rsa', - gitCredential: 'Connect Type', - gitCredentialPlaceholder: 'Git connection type, http/ssh', cvsPlaceholder: 'CVS', repositoryURL: 'Repository URL', repositoryURLPlaceholder: 'The Repository URL for this project', repositoryURLRequired: 'The repository URL is required', - httpChecked: 'The repository address must be a valid http(s) address', - gitChecked: 'The repository address must be a valid ssh address', + credentialError: 'The repository address must be a valid ssh or http(s) address', userName: 'UserName', userNamePlaceholder: 'UserName for this project', password: 'Password', @@ -62,7 +59,6 @@ export default { projectNameIsRequiredMessage: 'Project Name is required', projectNameIsUniqueMessage: 'The Project Name is already exists. Please check', projectTypeIsRequiredMessage: 'Project Type is required', - gitCredentialIsRequiredMessage: 'Connect Type is required', cvsIsRequiredMessage: 'CVS is required', repositoryURLIsRequiredMessage: 'Repository URL is required', pomSpecifiesModuleMessage: diff --git a/streampark-console/streampark-console-webapp/src/locales/lang/zh-CN/flink/project.ts b/streampark-console/streampark-console-webapp/src/locales/lang/zh-CN/flink/project.ts index 572e153d3..7d077a5d6 100644 --- a/streampark-console/streampark-console-webapp/src/locales/lang/zh-CN/flink/project.ts +++ b/streampark-console/streampark-console-webapp/src/locales/lang/zh-CN/flink/project.ts @@ -34,8 +34,6 @@ export default { cvs: 'CVS', prvkeyPath: '私钥路径', prvkeyPathPlaceholder: '私钥文件路径, 如: ~/.ssh/id_rsa', - gitCredential: '连接方式', - gitCredentialPlaceholder: 'Git连接方式, http/ssh', cvsPlaceholder: 'CVS类型: git/svn', repositoryURL: '仓库地址', repositoryURLPlaceholder: '请输入该项目的仓库地址', @@ -61,7 +59,6 @@ export default { projectNameIsRequiredMessage: '项目名称必填', projectNameIsUniqueMessage: '项目名称已存在,请再次输入', projectTypeIsRequiredMessage: '项目类型必选', - gitCredentialIsRequiredMessage: 'Git连接方式为必填项', cvsIsRequiredMessage: '资源来源必选', repositoryURLIsRequiredMessage: '(项目)仓库地址必填', pomSpecifiesModuleMessage: '指定编译pom.xml的模块 如未指定,则在根路径pom.xml下找到', diff --git a/streampark-console/streampark-console-webapp/src/utils/props.ts b/streampark-console/streampark-console-webapp/src/utils/props.ts index ebbe33a1a..5d1d35150 100644 --- a/streampark-console/streampark-console-webapp/src/utils/props.ts +++ b/streampark-console/streampark-console-webapp/src/utils/props.ts @@ -175,7 +175,7 @@ export const buildProps = < : never; }; -export const definePropType = <T>(val: any) => ({ [wrapperKey]: val } as PropWrapper<T>); +export const definePropType = <T>(val: any) => ({ [wrapperKey]: val }) as PropWrapper<T>; export const keyOf = <T extends Object>(arr: T) => Object.keys(arr) as Array<keyof T>; export const mutable = <T extends readonly any[] | Record<string, unknown>>(val: T) => diff --git a/streampark-console/streampark-console-webapp/src/views/flink/project/Add.vue b/streampark-console/streampark-console-webapp/src/views/flink/project/Add.vue index 41c6215d9..e7eea570e 100644 --- a/streampark-console/streampark-console-webapp/src/views/flink/project/Add.vue +++ b/streampark-console/streampark-console-webapp/src/views/flink/project/Add.vue @@ -40,7 +40,6 @@ try { const res = await createProject({ name: values.name, - gitCredential: values.gitCredential, url: values.url, repository: values.repository, type: values.type, diff --git a/streampark-console/streampark-console-webapp/src/views/flink/project/Edit.vue b/streampark-console/streampark-console-webapp/src/views/flink/project/Edit.vue index 99748c59f..0d31eda5f 100644 --- a/streampark-console/streampark-console-webapp/src/views/flink/project/Edit.vue +++ b/streampark-console/streampark-console-webapp/src/views/flink/project/Edit.vue @@ -60,7 +60,6 @@ const { data } = await updateProject({ id: route.query.id, name: values.name, - gitCredential: values.gitCredential, url: values.url, repository: values.repository, type: values.type, diff --git a/streampark-console/streampark-console-webapp/src/views/flink/project/components/RepositoryGroup.tsx b/streampark-console/streampark-console-webapp/src/views/flink/project/components/RepositoryGroup.tsx index 5f317752f..449d6eb33 100644 --- a/streampark-console/streampark-console-webapp/src/views/flink/project/components/RepositoryGroup.tsx +++ b/streampark-console/streampark-console-webapp/src/views/flink/project/components/RepositoryGroup.tsx @@ -1,4 +1,4 @@ -/* +/* Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. @@ -12,18 +12,14 @@ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and - limitations under the License. + limitations under the License. */ -import { defineComponent, h } from 'vue'; -import type { PropType } from 'vue'; -import { Form, Input, Select, Tag } from 'ant-design-vue'; +import { defineComponent } from 'vue'; +import { Form, Input, Tag } from 'ant-design-vue'; export interface RepositoryProps { - gitCredential: string | number; url: string; } import { useI18n } from '/@/hooks/web/useI18n'; -import { GitCredentialEnum } from '/@/enums/projectEnum'; -import { SvgIcon } from '/@/components/Icon'; export default defineComponent({ name: 'RepositoryUrl', props: { @@ -32,63 +28,43 @@ export default defineComponent({ required: true, }, }, - emits: ['updateProtocol', 'updateUrl'], + emits: ['updateUrl'], setup(props, { emit }) { const { t } = useI18n(); const formItemContext = Form.useInjectFormItemContext(); - const handleProtocolChange = (value: any) => { - emit('updateProtocol', value); - formItemContext.onFieldChange(); - }; const handleUrlChange = (value: any) => { emit('updateUrl', value); formItemContext.onFieldChange(); }; - const options = [ - { - label: h('div', {}, [h(SvgIcon, { name: 'http', color: '#108ee9', size: '30' }, '')]), - value: GitCredentialEnum.HTTPS, - }, - { - label: h('div', {}, [h(SvgIcon, { name: 'ssh', color: '#108ee9', size: '30' }, '')]), - value: GitCredentialEnum.SSH, - }, - ]; - return () => { return ( <div> - <Input.Group compact class="!flex custom-input-group"> - <Select - name="gitCredential" - style="width: 80px" - placeholder={t('flink.project.form.gitCredentialPlaceholder')} - value={props.value?.gitCredential} - onChange={(e: any) => handleProtocolChange(e)} - options={options} - /> - <Input - name="url" - placeholder={t('flink.project.form.repositoryURLPlaceholder')} - allow-clear - class="flex-1" - value={props.value?.url} - onInput={(e: any) => handleUrlChange(e.target.value)} - /> - </Input.Group> + <Input + name="url" + placeholder={t('flink.project.form.repositoryURLPlaceholder')} + allow-clear + class="flex-1" + value={props.value?.url} + onInput={(e: any) => handleUrlChange(e.target.value)} + /> <p class="conf-desc mt-10px"> - <span class="note-info"> - <Tag color="#2db7f5" class="tag-note"> - {t('flink.app.noteInfo.note')} - </Tag> - {props.value?.gitCredential === 1 && ( + {/^http(s)?:\/\//.test(props.value?.url) && ( + <span class="note-info"> + <Tag color="#2db7f5" class="tag-note"> + {t('flink.app.noteInfo.note')} + </Tag> <span>{t('flink.project.operationTips.httpsCredential')}</span> - )} - {props.value?.gitCredential === 2 && ( + </span> + )} + {/^git@(.*)/.test(props.value?.url) && ( + <span class="note-info"> + <Tag color="#2db7f5" class="tag-note"> + {t('flink.app.noteInfo.note')} + </Tag> <span>{t('flink.project.operationTips.sshCredential')}</span> - )} - </span> + </span> + )} </p> </div> ); diff --git a/streampark-console/streampark-console-webapp/src/views/flink/project/useProject.tsx b/streampark-console/streampark-console-webapp/src/views/flink/project/useProject.tsx index 61d319282..09873176c 100644 --- a/streampark-console/streampark-console-webapp/src/views/flink/project/useProject.tsx +++ b/streampark-console/streampark-console-webapp/src/views/flink/project/useProject.tsx @@ -24,7 +24,7 @@ import { useRoute } from 'vue-router'; import { ProjectRecord } from '/@/api/flink/project/model/projectModel'; import { filterOption } from '../app/utils'; import { useI18n } from '/@/hooks/web/useI18n'; -import { GitCredentialEnum, ProjectTypeEnum, CVSTypeEnum } from '/@/enums/projectEnum'; +import { ProjectTypeEnum, CVSTypeEnum } from '/@/enums/projectEnum'; import RepositoryGroup from './components/RepositoryGroup'; import { Form } from 'ant-design-vue'; @@ -43,19 +43,10 @@ export const useProject = () => { if (!values.url) { return Promise.reject(t('flink.project.form.repositoryURLRequired')); } - switch (values.gitCredential) { - case GitCredentialEnum.SSH: - if (/^git@(.*)/.test(values.url)) { - return Promise.resolve(); - } else { - return Promise.reject(t('flink.project.form.gitChecked')); - } - default: - if (/^http(s)?:\/\//.test(values.url)) { - return Promise.resolve(); - } else { - return Promise.reject(t('flink.project.form.httpChecked')); - } + if (/^git@(.*)/.test(values.url) || /^http(s)?:\/\//.test(values.url)) { + return Promise.resolve(); + } else { + return Promise.reject(t('flink.project.form.credentialError')); } }; const projectFormSchema = computed((): FormSchema[] => { @@ -110,13 +101,6 @@ export const useProject = () => { }, ], }, - { - field: 'gitCredential', - label: '', - component: 'Input', - show: false, - defaultValue: GitCredentialEnum.HTTPS, - }, { field: 'url', label: '', component: 'Input', show: false }, { field: 'repositoryUrl', @@ -131,10 +115,8 @@ export const useProject = () => { > <RepositoryGroup value={{ - gitCredential: Number(model.gitCredential) || GitCredentialEnum.HTTPS, url: model.url || '', }} - onUpdateProtocol={(value) => (model.gitCredential = value)} onUpdateUrl={(value) => (model.url = value)} /> </Form.Item> @@ -145,7 +127,7 @@ export const useProject = () => { field: 'prvkeyPath', label: t('flink.project.form.prvkeyPath'), component: 'Input', - ifShow: ({ values }) => values.gitCredential == GitCredentialEnum.SSH, + ifShow: ({ values }) => /^git@(.*)/.test(values.url || ''), componentProps: { placeholder: t('flink.project.form.prvkeyPathPlaceholder'), }, @@ -154,7 +136,7 @@ export const useProject = () => { field: 'userName', label: t('flink.project.form.userName'), component: 'Input', - ifShow: ({ values }) => values.gitCredential == GitCredentialEnum.HTTPS, + ifShow: ({ values }) => /^http(s)?:\/\//.test(values.url || ''), componentProps: { placeholder: t('flink.project.form.userNamePlaceholder'), autocomplete: 'new-password', @@ -255,7 +237,6 @@ export const useProject = () => { const res = await gitCheck({ url: values.url, branches: values.branches, - gitCredential: values.gitCredential, userName: values.userName || null, password: values.password || null, prvkeyPath: values.prvkeyPath || null, @@ -292,14 +273,13 @@ export const useProject = () => { try { const url = values.url; if (url) { - const gitCredential = values.gitCredential; const userName = values.userName || null; const password = values.password || null; const prvkeyPath = values.prvkeyPath || null; const userNull = userName === null || userName === undefined || userName === ''; const passNull = password === null || password === undefined || password === ''; if ((userNull && passNull) || (!userNull && !passNull)) { - const res = await fetchBranches({ gitCredential, url, userName, password, prvkeyPath }); + const res = await fetchBranches({ url, userName, password, prvkeyPath }); if (res) branchList.value = res.map((i) => ({ label: i, value: i })); } } @@ -318,7 +298,6 @@ export const useProject = () => { name: res.name, type: res.type, repository: res.repository, - gitCredential: res.gitCredential || GitCredentialEnum.HTTPS, url: res.url, userName: res.userName, password: res.password,
