mirror of
https://github.com/dataease/dataease.git
synced 2025-02-24 19:42:56 +08:00
refactor: 优化主题切换
This commit is contained in:
parent
b571ef24e7
commit
0a3580ddae
@ -4,12 +4,13 @@ import java.util.List;
|
|||||||
|
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestPart;
|
import org.springframework.web.bind.annotation.RequestPart;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import io.dataease.commons.exception.DEException;
|
||||||
|
import io.dataease.commons.utils.LogUtil;
|
||||||
import io.dataease.plugins.config.SpringContextUtil;
|
import io.dataease.plugins.config.SpringContextUtil;
|
||||||
import io.dataease.plugins.xpack.theme.dto.ThemeDto;
|
import io.dataease.plugins.xpack.theme.dto.ThemeDto;
|
||||||
import io.dataease.plugins.xpack.theme.dto.ThemeItem;
|
import io.dataease.plugins.xpack.theme.dto.ThemeItem;
|
||||||
@ -20,10 +21,8 @@ import io.dataease.plugins.xpack.theme.service.ThemeXpackService;
|
|||||||
@RestController
|
@RestController
|
||||||
public class ThemeServer {
|
public class ThemeServer {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/themes")
|
@PostMapping("/themes")
|
||||||
public List<ThemeDto> themes(){
|
public List<ThemeDto> themes() {
|
||||||
|
|
||||||
ThemeXpackService themeXpackService = SpringContextUtil.getBean(ThemeXpackService.class);
|
ThemeXpackService themeXpackService = SpringContextUtil.getBean(ThemeXpackService.class);
|
||||||
return themeXpackService.themes();
|
return themeXpackService.themes();
|
||||||
@ -36,15 +35,22 @@ public class ThemeServer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/save")
|
@PostMapping("/save")
|
||||||
public void save(@RequestPart("request") ThemeRequest request, @RequestPart(value = "file", required = false) MultipartFile bodyFile) {
|
public void save(@RequestPart("request") ThemeRequest request,
|
||||||
|
@RequestPart(value = "file", required = false) MultipartFile bodyFile) {
|
||||||
ThemeXpackService themeXpackService = SpringContextUtil.getBean(ThemeXpackService.class);
|
ThemeXpackService themeXpackService = SpringContextUtil.getBean(ThemeXpackService.class);
|
||||||
themeXpackService.save(request, bodyFile);
|
try {
|
||||||
|
themeXpackService.save(request, bodyFile);
|
||||||
|
} catch (Exception e) {
|
||||||
|
LogUtil.error(e.getMessage(), e);
|
||||||
|
DEException.throwException(e);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/delete/{themeId}")
|
@PostMapping("/delete/{themeId}")
|
||||||
public void save(@PathVariable("themeId") int themeId) {
|
public void delete(@PathVariable("themeId") int themeId) {
|
||||||
ThemeXpackService themeXpackService = SpringContextUtil.getBean(ThemeXpackService.class);
|
ThemeXpackService themeXpackService = SpringContextUtil.getBean(ThemeXpackService.class);
|
||||||
themeXpackService.deleteTheme(themeId);
|
themeXpackService.deleteTheme(themeId);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -131,6 +131,7 @@ export default {
|
|||||||
default_login: 'Normal'
|
default_login: 'Normal'
|
||||||
},
|
},
|
||||||
commons: {
|
commons: {
|
||||||
|
apply: 'Apply',
|
||||||
search: 'Search',
|
search: 'Search',
|
||||||
folder: 'Folder',
|
folder: 'Folder',
|
||||||
no_target_permission: 'No permission',
|
no_target_permission: 'No permission',
|
||||||
@ -437,7 +438,10 @@ export default {
|
|||||||
background: 'Background color',
|
background: 'Background color',
|
||||||
custom: 'Custom color',
|
custom: 'Custom color',
|
||||||
otherSave: 'Theme Save as',
|
otherSave: 'Theme Save as',
|
||||||
info: 'Theme info'
|
info: 'Theme info',
|
||||||
|
add: 'Add Theme',
|
||||||
|
please_input_name: 'Please enter a name',
|
||||||
|
name_repeat: 'Name already exists'
|
||||||
},
|
},
|
||||||
tagsView: {
|
tagsView: {
|
||||||
refresh: 'Refresh',
|
refresh: 'Refresh',
|
||||||
|
@ -131,6 +131,7 @@ export default {
|
|||||||
default_login: '普通登錄'
|
default_login: '普通登錄'
|
||||||
},
|
},
|
||||||
commons: {
|
commons: {
|
||||||
|
apply: '應用',
|
||||||
search: '搜索',
|
search: '搜索',
|
||||||
folder: '目錄',
|
folder: '目錄',
|
||||||
no_target_permission: '沒有權限',
|
no_target_permission: '沒有權限',
|
||||||
@ -437,7 +438,10 @@ export default {
|
|||||||
background: '背景顏色',
|
background: '背景顏色',
|
||||||
custom: '自定義顏色',
|
custom: '自定義顏色',
|
||||||
otherSave: '主題另存為',
|
otherSave: '主題另存為',
|
||||||
info: '主題信息'
|
info: '主題信息',
|
||||||
|
add: '新增主題',
|
||||||
|
please_input_name: '請輸入名稱',
|
||||||
|
name_repeat: '名稱已存在'
|
||||||
},
|
},
|
||||||
tagsView: {
|
tagsView: {
|
||||||
refresh: '刷新',
|
refresh: '刷新',
|
||||||
|
@ -131,6 +131,7 @@ export default {
|
|||||||
default_login: '普通登录'
|
default_login: '普通登录'
|
||||||
},
|
},
|
||||||
commons: {
|
commons: {
|
||||||
|
apply: '应用',
|
||||||
search: '搜索',
|
search: '搜索',
|
||||||
folder: '目录',
|
folder: '目录',
|
||||||
no_target_permission: '没有权限',
|
no_target_permission: '没有权限',
|
||||||
@ -438,7 +439,10 @@ export default {
|
|||||||
background: '背景颜色',
|
background: '背景颜色',
|
||||||
custom: '自定义颜色',
|
custom: '自定义颜色',
|
||||||
otherSave: '主题另存为',
|
otherSave: '主题另存为',
|
||||||
info: '主题信息'
|
info: '主题信息',
|
||||||
|
add: '新增主题',
|
||||||
|
please_input_name: '请输入名称',
|
||||||
|
name_repeat: '名称已存在'
|
||||||
},
|
},
|
||||||
tagsView: {
|
tagsView: {
|
||||||
refresh: '刷新',
|
refresh: '刷新',
|
||||||
|
Loading…
Reference in New Issue
Block a user