已关闭
优化npm build静态资源过多占用git记录问题 #605
AtomGit-Bot创建于 2024年2月22日关闭于 2024年2月23日
优化npm build静态资源过多占用git记录问题 #605
已关闭
AtomGit-Bot创建于 2024年2月22日关闭于 2024年2月23日
refs/pull/605/head合入到master
12 个文件变更+179-19
M.gitignore+1-0
@@ -344,6 +344,7 @@ docs/_book
344dist/344dist/
345npm-debug.log345npm-debug.log
346yarn-error.log346yarn-error.log
347+**/resources/resources
347 348 
348### WebStorm+all ###349### WebStorm+all ###
349# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider350# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
MopenGauss-datakit/visualtool-api/src/main/java/org/opengauss/admin/web/controller/ops/HostController.java+6-0
@@ -32,6 +32,7 @@ import org.opengauss.admin.common.core.domain.model.ops.HostBody;
32import org.opengauss.admin.common.core.domain.model.ops.host.OpsHostVO;32import org.opengauss.admin.common.core.domain.model.ops.host.OpsHostVO;
33import org.opengauss.admin.common.core.domain.model.ops.host.SSHBody;33import org.opengauss.admin.common.core.domain.model.ops.host.SSHBody;
34import org.opengauss.admin.common.core.page.TableDataInfo;34import org.opengauss.admin.common.core.page.TableDataInfo;
35+import org.opengauss.admin.common.enums.OsSupportMap;
35import org.opengauss.admin.system.service.ops.IHostService;36import org.opengauss.admin.system.service.ops.IHostService;
36import org.springframework.beans.factory.annotation.Autowired;37import org.springframework.beans.factory.annotation.Autowired;
37import org.springframework.validation.annotation.Validated;38import org.springframework.validation.annotation.Validated;
@@ -112,4 +113,9 @@ public class HostController extends BaseController {
112 public AjaxResult monitor(@RequestParam String hostId, @RequestParam String businessId, @RequestParam(value = "rootPassword",required = false) String rootPassword){113 public AjaxResult monitor(@RequestParam String hostId, @RequestParam String businessId, @RequestParam(value = "rootPassword",required = false) String rootPassword){
113 return AjaxResult.success(hostService.monitor(hostId,businessId,rootPassword));114 return AjaxResult.success(hostService.monitor(hostId,businessId,rootPassword));
114 }115 }
116+ 
117+ @GetMapping("/listSupportOsName")
118+ public AjaxResult listSupportOsName(){
119+ return AjaxResult.success(OsSupportMap.getSupportOsNameList());
120+ }
115}121}
AopenGauss-datakit/visualtool-common/src/main/java/org/opengauss/admin/common/enums/OsSet.java+16-0
@@ -0,0 +1,16 @@
1+package org.opengauss.admin.common.enums;
2+ 
3+import java.util.HashSet;
4+ 
5+public class OsSet {
6+ public HashSet<String> centosBasedSet;
7+ public HashSet<String> openEulerBasedSet;
8+ 
9+ public boolean isCentos(String os){
10+ return centosBasedSet.contains(os);
11+ }
12+ 
13+ public boolean isOpenEuler(String os){
14+ return openEulerBasedSet.contains(os);
15+ }
16+}
AopenGauss-datakit/visualtool-common/src/main/java/org/opengauss/admin/common/enums/OsSupportMap.java+94-0
@@ -0,0 +1,94 @@
1+/*
2+ * Copyright (c) 2022 Huawei Technologies Co.,Ltd.
3+ *
4+ * openGauss is licensed under Mulan PSL v2.
5+ * You can use this software according to the terms and conditions of the Mulan PSL v2.
6+ * You may obtain a copy of Mulan PSL v2 at:
7+ *
8+ * http://license.coscl.org.cn/MulanPSL2
9+ *
10+ * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
11+ * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
12+ * MERCHANTABILITY OR FITFOR A PARTICULAR PURPOSE.
13+ * See the Mulan PSL v2 for more details.
14+ * -------------------------------------------------------------------------
15+ *
16+ * OsSupportMap.java
17+ *
18+ * IDENTIFICATION
19+ * openGauss-visualtool/visualtool-common/src/main/java/org/opengauss/admin/common/enums/OsSupportMap.java
20+ *
21+ * -------------------------------------------------------------------------
22+ */
23+ 
24+ 
25+package org.opengauss.admin.common.enums;
26+ 
27+import lombok.AllArgsConstructor;
28+import lombok.Getter;
29+ 
30+import java.util.HashSet;
31+ 
32+/**
33+ * @author chenyuchen2024
34+ * @date 24/02/22 21:12
35+ **/
36+@Getter
37+@AllArgsConstructor
38+public enum OsSupportMap {
39+ CENTOS_7_x86_64("centos","x86_64","7.6"),
40+ OPENEULER_20_x86_64("openEuler","x86_64","20.03"),
41+ OPENEULER_20_AARCH64("openEuler","aarch64","20.03"),
42+ OPENEULER_22_x86_64("openEuler","x86_64","22.03"),
43+ OPENEULER_22_AARCH64("openEuler","aarch64","22.03");
44+ 
45+ private final String osType;
46+ private final String arch;
47+ private final String version;
48+ 
49+ static private OsSet osBasedSet;
50+ 
51+ static {
52+ osBasedSet=new OsSet();
53+ osBasedSet.centosBasedSet=new HashSet<>();
54+ osBasedSet.centosBasedSet.add("centos");
55+ osBasedSet.centosBasedSet.add("红旗");
56+// centosBasedSet.add("bclinux(基于centos)");
57+ osBasedSet.openEulerBasedSet=new HashSet<>();
58+ osBasedSet.openEulerBasedSet.add("openeuler");
59+ osBasedSet.openEulerBasedSet.add("kylin");
60+// openEulerBasedSet.add("uniontech");
61+// openEulerBasedSet.add("统信");
62+// openEulerBasedSet.add("euleros");
63+ }
64+ 
65+ public static OsSupportMap of(String osInfo, String osVersionInfo, String cpuArchInfo) {
66+ if (osBasedSet.isCentos(osInfo) && "x86_64".equalsIgnoreCase(cpuArchInfo)){
67+ return CENTOS_7_x86_64;
68+ }
69+ 
70+ if (osBasedSet.isOpenEuler(osInfo)){
71+ if(osVersionInfo.contains("22")){
72+ if ("x86_64".equalsIgnoreCase(cpuArchInfo)){
73+ return OPENEULER_22_x86_64;
74+ }
75+ if ("aarch64".equalsIgnoreCase(cpuArchInfo)){
76+ return OPENEULER_22_AARCH64;
77+ }
78+ }
79+ // 除了openEuler22,其余openEuler系os默认映射成openEuler20
80+ if ("x86_64".equalsIgnoreCase(cpuArchInfo)){
81+ return OPENEULER_20_x86_64;
82+ }
83+ if ("aarch64".equalsIgnoreCase(cpuArchInfo)){
84+ return OPENEULER_20_AARCH64;
85+ }
86+ }
87+ 
88+ return CENTOS_7_x86_64;
89+ }
90+ 
91+ public static OsSet getSupportOsNameList(){
92+ return osBasedSet;
93+ }
94+}
MopenGauss-datakit/visualtool-service/src/main/java/org/opengauss/admin/system/service/ops/IHostService.java+3-0
@@ -31,6 +31,7 @@ import org.opengauss.admin.common.core.domain.entity.ops.OpsHostEntity;
31import org.opengauss.admin.common.core.domain.model.ops.HostBody;31import org.opengauss.admin.common.core.domain.model.ops.HostBody;
32import org.opengauss.admin.common.core.domain.model.ops.host.OpsHostVO;32import org.opengauss.admin.common.core.domain.model.ops.host.OpsHostVO;
33import org.opengauss.admin.common.core.domain.model.ops.host.SSHBody;33import org.opengauss.admin.common.core.domain.model.ops.host.SSHBody;
34+import org.opengauss.admin.common.enums.OsSet;
34 35 
35import java.util.List;36import java.util.List;
36import java.util.Map;37import java.util.Map;
@@ -95,4 +96,6 @@ public interface IHostService extends IService<OpsHostEntity> {
95 Map<String,Object> monitor(String hostId, String businessId, String rootPassword);96 Map<String,Object> monitor(String hostId, String businessId, String rootPassword);
96 97 
97 void updateHostOsVersion(OpsHostEntity opsHostEntity);98 void updateHostOsVersion(OpsHostEntity opsHostEntity);
99+ 
100+ OpsHostEntity getByIdWrapper(String hostId);
98}101}
MopenGauss-datakit/visualtool-service/src/main/java/org/opengauss/admin/system/service/ops/impl/HostServiceImpl.java+11-0
@@ -49,6 +49,8 @@ import org.opengauss.admin.common.core.handler.ops.cache.SSHChannelManager;
49import org.opengauss.admin.common.core.handler.ops.cache.TaskManager;49import org.opengauss.admin.common.core.handler.ops.cache.TaskManager;
50import org.opengauss.admin.common.core.handler.ops.cache.WsConnectorManager;50import org.opengauss.admin.common.core.handler.ops.cache.WsConnectorManager;
51import org.opengauss.admin.common.core.vo.HostInfoVo;51import org.opengauss.admin.common.core.vo.HostInfoVo;
52+import org.opengauss.admin.common.enums.OsSupportMap;
53+import org.opengauss.admin.common.enums.OsSet;
52import org.opengauss.admin.common.exception.ops.OpsException;54import org.opengauss.admin.common.exception.ops.OpsException;
53import org.opengauss.admin.common.utils.ops.JschUtil;55import org.opengauss.admin.common.utils.ops.JschUtil;
54import org.opengauss.admin.common.utils.ops.WsUtil;56import org.opengauss.admin.common.utils.ops.WsUtil;
@@ -644,4 +646,13 @@ public class HostServiceImpl extends ServiceImpl<OpsHostMapper, OpsHostEntity> i
644 return getOne(queryWrapper, false);646 return getOne(queryWrapper, false);
645 }647 }
646 648 
649+ public OpsHostEntity getByIdWrapper(String hostId){
650+ OpsHostEntity opsHostEntity=getById(hostId);
651+ OsSupportMap osMapEnum=OsSupportMap.of(opsHostEntity.getOs(),opsHostEntity.getOsVersion(),opsHostEntity.getCpuArch());
652+ 
653+ opsHostEntity.setOs(osMapEnum.getOsType());
654+ opsHostEntity.setOsVersion(osMapEnum.getVersion());
655+ 
656+ return opsHostEntity;
657+ }
647}658}
Mplugins/base-ops/src/main/java/org/opengauss/admin/plugin/controller/ops/OpsClusterController.java+9-1
@@ -28,6 +28,7 @@ import org.opengauss.admin.common.core.domain.AjaxResult;
28import org.opengauss.admin.common.core.domain.entity.ops.OpsHostEntity;28import org.opengauss.admin.common.core.domain.entity.ops.OpsHostEntity;
29import org.opengauss.admin.common.core.domain.model.ops.OpsClusterVO;29import org.opengauss.admin.common.core.domain.model.ops.OpsClusterVO;
30import org.opengauss.admin.common.core.domain.model.ops.check.CheckSummaryVO;30import org.opengauss.admin.common.core.domain.model.ops.check.CheckSummaryVO;
31+import org.opengauss.admin.common.enums.OsSupportMap;
31import org.opengauss.admin.plugin.base.BaseController;32import org.opengauss.admin.plugin.base.BaseController;
32import org.opengauss.admin.plugin.domain.model.ops.*;33import org.opengauss.admin.plugin.domain.model.ops.*;
33import org.opengauss.admin.plugin.domain.model.ops.env.HostEnv;34import org.opengauss.admin.plugin.domain.model.ops.env.HostEnv;
@@ -245,8 +246,10 @@ public class OpsClusterController extends BaseController {
245 246 
246 @GetMapping("/env/{hostId}")247 @GetMapping("/env/{hostId}")
247 public AjaxResult env(@PathVariable("hostId") String hostId,248 public AjaxResult env(@PathVariable("hostId") String hostId,
248- @RequestParam(value = "expectedOs", defaultValue = "CENTOS_X86_64") OpenGaussSupportOSEnum expectedOs,249+ @RequestParam(value = "expectedOs", defaultValue = "centos_X86_64") String expectedOsStr,
249 @RequestParam(required = false) String rootPassword) {250 @RequestParam(required = false) String rootPassword) {
251+ int tmpIndex = expectedOsStr.indexOf("_");
252+ OpenGaussSupportOSEnum expectedOs = OpenGaussSupportOSEnum.of(expectedOsStr.substring(0,tmpIndex).toLowerCase(),"",expectedOsStr.substring(tmpIndex+1).toLowerCase());
250 HostEnv hostEnv = opsClusterService.env(hostId, expectedOs, rootPassword);253 HostEnv hostEnv = opsClusterService.env(hostId, expectedOs, rootPassword);
251 return AjaxResult.success(hostEnv);254 return AjaxResult.success(hostEnv);
252 }255 }
@@ -274,4 +277,9 @@ public class OpsClusterController extends BaseController {
274 Map<String, Integer> res = opsClusterService.threadPoolMonitor();277 Map<String, Integer> res = opsClusterService.threadPoolMonitor();
275 return AjaxResult.success(res);278 return AjaxResult.success(res);
276 }279 }
280+ 
281+ @GetMapping("/listSupportOsName")
282+ public AjaxResult listSupportOsName(){
283+ return AjaxResult.success(OsSupportMap.getSupportOsNameList());
284+ }
277}285}
Mplugins/base-ops/src/main/java/org/opengauss/admin/plugin/enums/ops/OpenGaussSupportOSEnum.java+9-7
@@ -25,8 +25,13 @@ package org.opengauss.admin.plugin.enums.ops;
25 25 
26import lombok.AllArgsConstructor;26import lombok.AllArgsConstructor;
27import lombok.Getter;27import lombok.Getter;
28+import org.opengauss.admin.common.enums.OsSupportMap;
28import org.opengauss.admin.plugin.domain.model.ops.SshCommandConstants;29import org.opengauss.admin.plugin.domain.model.ops.SshCommandConstants;
29 30 
31+import java.util.ArrayList;
32+import java.util.HashSet;
33+import java.util.List;
34+ 
30/**35/**
31 * @author lhf36 * @author lhf
32 * @date 2022/12/11 13:3837 * @date 2022/12/11 13:38
@@ -47,18 +52,15 @@ public enum OpenGaussSupportOSEnum {
47 private String omPackagePostfix;52 private String omPackagePostfix;
48 53 
49 public static OpenGaussSupportOSEnum of(String osInfo, String osVersionInfo, String cpuArchInfo) {54 public static OpenGaussSupportOSEnum of(String osInfo, String osVersionInfo, String cpuArchInfo) {
50- if ("centos".equalsIgnoreCase(osInfo) && "x86_64".equalsIgnoreCase(cpuArchInfo)){55+ OsSupportMap osMapEnum= OsSupportMap.of(osInfo,osVersionInfo,cpuArchInfo);
56+ if (osMapEnum==OsSupportMap.CENTOS_7_x86_64){
51 return CENTOS_X86_64;57 return CENTOS_X86_64;
52 }58 }
53 59 
54- if ("openEuler".equalsIgnoreCase(osInfo) && "aarch64".equalsIgnoreCase(cpuArchInfo)){60+ if ("x86_64".equalsIgnoreCase(osMapEnum.getArch())){
55- return OPENEULER_AARCH64;
56- }
57- 
58- if ("openEuler".equalsIgnoreCase(osInfo) && "x86_64".equalsIgnoreCase(cpuArchInfo)){
59 return OPENEULER_X86_64;61 return OPENEULER_X86_64;
60 }62 }
61- return CENTOS_X86_64;63+ return OPENEULER_AARCH64;
62 }64 }
63 65 
64 public boolean match(String os,String cpuArch) {66 public boolean match(String os,String cpuArch) {
Mplugins/base-ops/web-ui/src/api/ops/index.ts+5-1
@@ -429,4 +429,8 @@ export const batchSetGucSetting = (data: KeyValue) => {
429 429 
430export const listEnterpriseCluster = () => {430export const listEnterpriseCluster = () => {
431 return axios.get('/opsCluster/listEnterpriseCluster')431 return axios.get('/opsCluster/listEnterpriseCluster')
432-}432+}
433+ 
434+export const listSupportOsName = () => {
435+ return axios.get('http://192.168.197.131:9494/host/listSupportOsName')
436+}
Mplugins/base-ops/web-ui/src/views/monitor/packageManage/AddPackageDlg.vue+22-8
@@ -175,7 +175,7 @@ import {
175 delPkgTar,175 delPkgTar,
176 editPackage,176 editPackage,
177 getSysUploadPath,177 getSysUploadPath,
178- hasPkgName178+ hasPkgName, listSupportOsName
179} from '@/api/ops'179} from '@/api/ops'
180import { FileItem, Message } from '@arco-design/web-vue'180import { FileItem, Message } from '@arco-design/web-vue'
181import { useI18n } from 'vue-i18n'181import { useI18n } from 'vue-i18n'
@@ -206,6 +206,8 @@ const data = reactive<KeyValue>({
206 },206 },
207 rules: {},207 rules: {},
208 osList: [],208 osList: [],
209+ centosList: [],
210+ openEulerList: [],
209 cpuArchList: [],211 cpuArchList: [],
210 packageVersionList: [],212 packageVersionList: [],
211 typeList: [],213 typeList: [],
@@ -304,10 +306,10 @@ const osChange = () => {
304 if (data.formData.os === OS.All) {306 if (data.formData.os === OS.All) {
305 data.cpuArchList = [{ label: CpuArch.NOARCH, value: CpuArch.NOARCH }]307 data.cpuArchList = [{ label: CpuArch.NOARCH, value: CpuArch.NOARCH }]
306 data.formData.cpuArch = CpuArch.NOARCH308 data.formData.cpuArch = CpuArch.NOARCH
307- } else if (data.formData.os === OS.CENTOS) {309+ } else if (data.centosList.includes(data.formData.os)) {
308 data.cpuArchList = [{ label: CpuArch.X86_64, value: CpuArch.X86_64 }]310 data.cpuArchList = [{ label: CpuArch.X86_64, value: CpuArch.X86_64 }]
309 data.formData.cpuArch = CpuArch.X86_64311 data.formData.cpuArch = CpuArch.X86_64
310- } else if (data.formData.os === OS.OPEN_EULER) {312+ } else if (data.openEulerList.includes(data.formData.os)) {
311 data.cpuArchList = [313 data.cpuArchList = [
312 { label: CpuArch.X86_64, value: CpuArch.X86_64 },314 { label: CpuArch.X86_64, value: CpuArch.X86_64 },
313 { label: CpuArch.AARCH64, value: CpuArch.AARCH64 }315 { label: CpuArch.AARCH64, value: CpuArch.AARCH64 }
@@ -459,10 +461,21 @@ const getSystemSetting = () => {
459}461}
460 462 
461const initData = () => {463const initData = () => {
462- data.osList = [464+ // data.osList = [
463- { label: OS.CENTOS, value: OS.CENTOS },465+ // { label: OS.CENTOS, value: OS.CENTOS },
464- { label: OS.OPEN_EULER, value: OS.OPEN_EULER }466+ // { label: OS.OPEN_EULER, value: OS.OPEN_EULER }
465- ]467+ // ]
468+ data.osList=[]
469+ listSupportOsName().then((res)=>{
470+ data.centosList=res.data.centosBasedSet;
471+ data.openEulerList=res.data.openEulerBasedSet;
472+ for(let os of data.centosList){
473+ data.osList.push({ label: os, value: os });
474+ }
475+ for(let os of data.openEulerList){
476+ data.osList.push({ label: os, value: os });
477+ }
478+ })
466 data.typeList = [479 data.typeList = [
467 { label: 'OpenGauss', value: PackageType.OPENGAUSS },480 { label: 'OpenGauss', value: PackageType.OPENGAUSS },
468 { label: 'Zookeeper', value: PackageType.ZOOKEEPER },481 { label: 'Zookeeper', value: PackageType.ZOOKEEPER },
@@ -612,7 +625,8 @@ const generateName = () => {
612 if (625 if (
613 data.type === 'create' &&626 data.type === 'create' &&
614 !data.isNameDirty &&627 !data.isNameDirty &&
615- data.formData.packageVersionNum628+ data.formData.packageVersionNum &&
629+ (data.formData.os === 'centos' || data.formData.os === 'openEuler')
616 ) {630 ) {
617 let name = `${data.formData.type}-${data.formData.os}-${data.formData.cpuArch}`631 let name = `${data.formData.type}-${data.formData.os}-${data.formData.cpuArch}`
618 if (data.formData.type === PackageType.OPENGAUSS) {632 if (data.formData.type === PackageType.OPENGAUSS) {
Mplugins/base-ops/web-ui/src/views/ops/install/components/OfflineInstall.vue+2-1
@@ -205,7 +205,8 @@ const setPathToStore = () => {
205 cpuArchStr = cpuArchStr.replace('-', '_')205 cpuArchStr = cpuArchStr.replace('-', '_')
206 }206 }
207 const temp =207 const temp =
208- getInstallOs(fileInfo.os) + '_' + cpuArchStr.toLocaleUpperCase()208+ fileInfo.os.toLocaleUpperCase() + '_' + cpuArchStr.toLocaleUpperCase()
209+ console.log(temp)
209 installStore.setInstallContext({210 installStore.setInstallContext({
210 packagePath: data.path,211 packagePath: data.path,
211 packageName: data.fileName,212 packageName: data.fileName,
Mplugins/data-migration/src/main/java/org/opengauss/admin/plugin/service/impl/MigrationToolPortalDownloadInfoServiceImpl.java+1-1
@@ -32,7 +32,7 @@ public class MigrationToolPortalDownloadInfoServiceImpl extends ServiceImpl<Migr
32 32 
33 @Override33 @Override
34 public List<MigrationToolPortalDownloadInfo> getPortalDownloadInfoList(String hostId) {34 public List<MigrationToolPortalDownloadInfo> getPortalDownloadInfoList(String hostId) {
35- OpsHostEntity opsHostEntity = hostService.getById(hostId);35+ OpsHostEntity opsHostEntity = hostService.getByIdWrapper(hostId);
36 if (StringUtils.isEmpty(opsHostEntity.getOsVersion())) {36 if (StringUtils.isEmpty(opsHostEntity.getOsVersion())) {
37 hostService.updateHostOsVersion(opsHostEntity);37 hostService.updateHostOsVersion(opsHostEntity);
38 }38 }