This commit is contained in:
fit2-zhao 2020-12-14 16:08:15 +08:00
commit 6672c7756e
5 changed files with 95 additions and 3 deletions

View File

@ -55,11 +55,17 @@
- [x] 测试跟踪:支持对接禅道同步缺陷
- [x] 其他Jenkins 插件支持 pipeline 方式调用
## v1.6 (开发中)
- [ ] 新增接口管理功能
- [ ] 全新接口自动化使用方式
- [ ] 测试跟踪测试计划分类型展示
- [ ] 优化消息通知配置及实现方式
## 规划中
- [ ] 接口测试支持添加 WebSocket 协议请求
- [ ] 接口管理功能
- [ ] 集成云平台动态管理测试资源池
- [ ] 支持 K8s 集群作为测试资源池
- [ ] 测试跟踪测试用例及接口测试增加版本管理
- [ ] 测试跟踪测试用例增加思维导图展示形式
- [ ] 移动端测试支持
- [ ] UI 功能测试支持

View File

@ -5,14 +5,17 @@ import io.metersphere.commons.constants.UserSource;
import io.metersphere.commons.user.SessionUser;
import io.metersphere.commons.utils.SessionUtils;
import io.metersphere.controller.request.LoginRequest;
import io.metersphere.service.BaseDisplayService;
import io.metersphere.service.UserService;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.core.env.Environment;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.io.IOException;
@RestController
@RequestMapping
@ -22,6 +25,8 @@ public class LoginController {
private UserService userService;
@Resource
private Environment env;
@Resource
private BaseDisplayService baseDisplayService;
@GetMapping(value = "/isLogin")
public ResultHolder isLogin() {
@ -66,4 +71,9 @@ public class LoginController {
public String getDefaultLanguage() {
return userService.getDefaultLanguage();
}
@GetMapping("display/file/{imageName}")
public ResponseEntity<byte[]> image(@PathVariable("imageName") String imageName) throws IOException {
return baseDisplayService.getImage(imageName);
}
}

View File

@ -0,0 +1,72 @@
package io.metersphere.service;
import io.metersphere.base.domain.SystemParameter;
import io.metersphere.base.domain.SystemParameterExample;
import io.metersphere.base.mapper.SystemParameterMapper;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.io.IOException;
import java.util.List;
@Service
public class BaseDisplayService {
@Resource
private SystemParameterMapper systemParameterMapper;
@Resource
private FileService fileService;
public List<SystemParameter> getParamList(String type) {
SystemParameterExample example = new SystemParameterExample();
example.createCriteria().andParamKeyLike(type + "%");
return systemParameterMapper.selectByExample(example);
}
public byte[] loadFileAsBytes(String fileId) {
return fileService.loadFileAsBytes(fileId);
}
public ResponseEntity<byte[]> getImage(String imageName) throws IOException {
byte[] bytes = null;
List<SystemParameter> paramList = getParamList("ui." + imageName);
if (!CollectionUtils.isEmpty(paramList)) {
SystemParameter sp = paramList.get(0);
String paramValue = sp.getParamValue();
if (StringUtils.isNotBlank(paramValue)) {
bytes = loadFileAsBytes(paramValue);
}
}
MediaType contentType = MediaType.parseMediaType("application/octet-stream");
if (bytes == null) {
PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver(getClass().getClassLoader());
switch (imageName) {
case "logo":
bytes = IOUtils.toByteArray(resolver.getResources("/static/img/logo-light-MeterSphere.*.svg")[0].getInputStream());
contentType = MediaType.valueOf("image/svg+xml");
break;
case "loginImage":
bytes = IOUtils.toByteArray(resolver.getResources("/static/img/info.*.png")[0].getInputStream());
break;
case "loginLogo":
bytes = IOUtils.toByteArray(resolver.getResources("/static/img/logo-dark-MeterSphere.*.svg")[0].getInputStream());
contentType = MediaType.valueOf("image/svg+xml");
break;
default:
break;
}
}
return ResponseEntity.ok()
.contentType(contentType)
.header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"" + imageName + "\"")
.body(bytes);
}
}

@ -1 +1 @@
Subproject commit 905ca8af61ce966d26109e9c5c8c0aee3ca1324e
Subproject commit f514243111c3acb317e80da23857143857a53566

View File

@ -264,6 +264,10 @@ export default {
.login-logo {
background: url(../assets/logo-dark-MeterSphere.svg);
}
.logo-header {
background: url(../assets/logo-light-MeterSphere.svg);
}
</style>
<style>