Ver Fonte

fix: 一些修改

370774330@qq.com há 5 anos atrás
pai
commit
7566b3ed43

+ 0 - 2
core/src/main/java/seecoder/devcloud/core/pipeline/pipeline/PipelineImpl.java

@@ -26,9 +26,7 @@ public class PipelineImpl implements Pipeline {
 
     @Override
     public void start() throws PipelineException {
-        //todo 流水线开始事件监听
         firstHandler.invoke(context);
-        //todo 流水线开始事件监听
     }
 
     @Override

+ 1 - 1
core/src/main/java/seecoder/devcloud/core/pipeline/template/PipelineTemplateTable.java

@@ -25,7 +25,7 @@ public class PipelineTemplateTable {
 
     /**
      * 需要添加模板类型在这里添加,然后根据需求添加对应的dockerfile、configjson等
-     * todo
+     * todo 静态字段
      */
     static {
         templateNames = new HashSet<String>();

+ 0 - 1
web/src/main/java/seecoder/devcloud/web/controller/pipeline/PipelineController.java

@@ -84,7 +84,6 @@ public class PipelineController {
     public Response savePipelineConfig(@RequestParam("projectId")Integer projectId,
                                        @RequestParam("pipelineId")Integer pipelineId,
                                        @RequestParam("configJson")String configJson) throws AccessDeniedException {
-        //todo 验证configJson有效性
         pipelineService.savePipelineConfig(projectId,pipelineId, configJson);
         return Response.buildSuccess();
     }

+ 3 - 4
web/src/main/java/seecoder/devcloud/web/controller/project/ProjectController.java

@@ -34,10 +34,9 @@ public class ProjectController {
 
 
     @ApiOperation(value = "根据user获取Project列表", httpMethod = "GET")
-    @GetMapping("/listByUser/{userId}")
-    @ApiImplicitParam(value = "userId",dataType ="int", paramType = "path")
-    public Response<List<ProjectVO>> listProjectsByUserId(@PathVariable("userId")int userId) throws ServiceException {
-        return Response.buildSuccess(projectService.listProjectsByUserId(userId));
+    @GetMapping("/listByUser")
+    public Response<List<ProjectVO>> listProjectsByUserId() throws ServiceException {
+        return Response.buildSuccess(projectService.listProjectsByUserId());
     }
 
     @ApiOperation(value = "根据projectId获取Project", httpMethod = "GET")

+ 0 - 17
web/src/main/java/seecoder/devcloud/web/infrastructure/config/WebSecurityConfig.java

@@ -1,37 +1,21 @@
 package seecoder.devcloud.web.infrastructure.config;
 
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.context.annotation.DependsOn;
-import org.springframework.http.HttpMethod;
 import org.springframework.security.authentication.AuthenticationManager;
-import org.springframework.security.authentication.AuthenticationProvider;
-import org.springframework.security.authentication.dao.DaoAuthenticationProvider;
-import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
 import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
 import org.springframework.security.config.annotation.web.builders.HttpSecurity;
-import org.springframework.security.config.annotation.web.builders.WebSecurity;
 import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
 import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
 import org.springframework.security.config.http.SessionCreationPolicy;
-import org.springframework.security.core.userdetails.UserDetailsService;
-import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
-import org.springframework.security.crypto.password.PasswordEncoder;
 import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
 import org.springframework.web.cors.CorsConfiguration;
 import org.springframework.web.cors.CorsConfigurationSource;
 import org.springframework.web.cors.CorsUtils;
 import seecoder.devcloud.web.infrastructure.security.JwtAuthenticationTokenFilter;
 import seecoder.devcloud.web.infrastructure.security.WebSecurityConstants;
-import seecoder.devcloud.web.service.impl.user.UserServiceImpl;
-
-import javax.servlet.http.HttpServletResponse;
-import javax.swing.*;
-import java.io.PrintWriter;
-import java.util.HashMap;
-import java.util.Map;
 
 /**
  * @author PuHong Weng
@@ -69,7 +53,6 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
                 .authorizeRequests()
                 //跨域的Options请求进行放行
                 .requestMatchers(CorsUtils::isPreFlightRequest).permitAll()
-                //todo 具体角色权限配置等开发完成之后再配, 这里先配为默认所有权限
                 .antMatchers("/**").hasAnyRole(WebSecurityConstants.STUDENT_ROLE, WebSecurityConstants.ADMIN_ROLE)
                 //其他所有接口都要在登陆认证状态下请求
                 .anyRequest().authenticated();

+ 0 - 33
web/src/main/java/seecoder/devcloud/web/model/po/pipeline/DeploymentPO.java

@@ -1,33 +0,0 @@
-package seecoder.devcloud.web.model.po.pipeline;
-
-import java.sql.Timestamp;
-
-/**
- * @author PuHong Weng
- * @date 2021/3/11
- * @description: 已部署的软件实例
- */
-public class DeploymentPO {
-
-    Integer id;
-
-    /**
-     * 对应关联的流水线 todo sql外键
-     */
-    Integer pipelineId;
-
-    /**
-     * 部署的项目名称
-     */
-    String name;
-
-    /**
-     * 最新一次部署时间
-     */
-    Timestamp deployedTime;
-
-    /**
-     * 访问的url地址
-     */
-    String accessUrl;
-}

+ 2 - 1
web/src/main/java/seecoder/devcloud/web/service/impl/project/ProjectServiceImpl.java

@@ -44,7 +44,8 @@ public class ProjectServiceImpl implements ProjectService {
 
     @Override
     // TODO:该方法待测试
-    public List<ProjectVO> listProjectsByUserId(int userId) throws ServiceException {
+    public List<ProjectVO> listProjectsByUserId() throws ServiceException {
+        int userId = UserService.loginUser().getId();
         List<com.nju.edu.gitlab.vo.ProjectVO> projects = null;
         try {
             projects = seecoderGitlabApi.getAllProjectsByUserId(userId);

+ 1 - 1
web/src/main/java/seecoder/devcloud/web/service/project/ProjectService.java

@@ -13,7 +13,7 @@ public interface ProjectService {
      * 根据user找Project
      * @return
      */
-    List<ProjectVO> listProjectsByUserId(int userId) throws ServiceException;
+    List<ProjectVO> listProjectsByUserId() throws ServiceException;
 
     /**
      * 获取project

+ 1 - 1
web/src/main/resources/application-wph.yml

@@ -33,7 +33,7 @@ seecoder:
     debugging: true
     ingressHostSuffix: .devcloud.seec.seecoder.cn
   gitlab:
-    host: http://gitlab.192.168.99.105.nip.io
+    host: http://localhost:8082
     webhookProxy: url/hook
     token: wXDeETv2Kmt-JhiApJ9H
   mail:

+ 1 - 1
web/src/test/java/seecoder/devcloud/web/DevcloudWebApplicationTests.java

@@ -17,7 +17,7 @@ public class DevcloudWebApplicationTests {
 
     @Test
     public void testEnum(){
-        
+
         ObjectMapper mapper = new ObjectMapper();
         try {
             String s = mapper.writeValueAsString(PriorityEnum.HIGH);