Skip to content

Commit

Permalink
Merge pull request #19 from qiaolin-li/dev-v1.0.9
Browse files Browse the repository at this point in the history
Dev v1.0.9
  • Loading branch information
qiaolin-li authored Jun 5, 2024
2 parents 5f9c27d + 5e58f3b commit 8255f0d
Show file tree
Hide file tree
Showing 12 changed files with 87 additions and 69 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"email": "[email protected]",
"url": "https://github.com/qiaolin-li/dubbo-desktop-manager"
},
"version": "1.0.8",
"version": "1.0.9",
"private": true,
"scripts": {
"lint": "vue-cli-service lint",
Expand Down
11 changes: 11 additions & 0 deletions src/common/i18n/lang/en-US.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ export default {
baseSettings: {
title: "Base Settings",
language: "Language",
jvmArgs: "JVM Args",
jvmArgsTips: "Enter JVM Args, such as -Xmx512m"
},
apply: "Apply",
invokerSettings : {
Expand Down Expand Up @@ -78,6 +80,15 @@ export default {
namespaceId: "namespaceId",
username: "username",
password: "password",
zookeeper: {
aclTips: "Enter the authentication information, for example, test:test"
},
nacos: {
groupName: 'ServiceGroupName',
groupNameTips: 'Enter the name of the service GROUP. The DEFAULT is DEFAULT GROUP',
group: 'ConfiguringGroupName',
groupTips: 'Please enter the configuration group name. The default is dubbo',
},
validateMessage: {
timeOutNotNull: "The timeout period cannot be empty",
inputNumber: " Please enter the first group now",
Expand Down
11 changes: 11 additions & 0 deletions src/common/i18n/lang/zh-CN.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ export default {
baseSettings: {
title: "基本设置",
language: "语言",
jvmArgs: "JVM参数",
jvmArgsTips: "请输入JVM参数,如:-Xmx512m"
},
apply: "应用",
invokerSettings : {
Expand Down Expand Up @@ -78,6 +80,15 @@ export default {
namespaceId: "命名空间ID",
username: "用户名",
password: "密码",
zookeeper: {
aclTips: "请输入认证信息, 例如:test:test"
},
nacos: {
groupName: '服务分组名称',
groupNameTips: '请输入服务分组名称,默认为 DEFAULT_GROUP',
group: '配置分组名称',
groupTips: '请输入配置分组名称,默认为 dubbo',
},
validateMessage: {
timeOutNotNull: "超时时间不能为空",
inputNumber: "请输入数字",
Expand Down
6 changes: 6 additions & 0 deletions src/main/dubbo/invoker/javaInvoker.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import i18n from '@/main/common/i18n'
import common from "./common.js";
import appConfig from "@/main/common/config/appConfig.js";


let jarPath;
if (process.env.NODE_ENV === 'development') {
jarPath = path.join(__dirname, '../public/jar/java-invoker.jar');
Expand Down Expand Up @@ -71,13 +72,18 @@ function executeJar(outFile) {
elapsedTime : 0
});
}

const jvmArgs = appConfig.getProperty("jvmArgs");
const commandArgs = [
...(jvmArgs ? [jvmArgs] : []),
'-Dfile.encoding=utf-8',
'-jar', jarPath,
outFile
];
const config = {
// maxBuffer: 100 * 1024 * 1024 * 1024, // 1G
cwd: constant.USER_HOME_DIR,
shell: true
}

// eslint-disable-next-line no-unused-vars
Expand Down
78 changes: 24 additions & 54 deletions src/main/registry/nacos-registry.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ async function getServiceList(registryConfig) {
let params = {
pageNo: 1,
pageSize: 100,
namespaceId: registryConfig.namespaceId || ""
namespaceId: registryConfig.namespaceId || "",
groupName: registryConfig.groupName || ""
}
// `http://127.0.0.1:8848/nacos/v1/ns/service/list?pageNo=1&pageSize=20`
let url = `${registryConfig.address}/nacos/v1/ns/service/list`
Expand All @@ -36,7 +37,7 @@ async function getServiceList(registryConfig) {
continue;
}

array.push(new common.ServiceInfo(datas[1], serviceName, datas.length == 4 ? datas[3] : ""));
array.push(new common.ServiceInfo(datas[1], serviceName.substring("providers".length+1), datas.length == 4 ? datas[3] : ""));
}

count = data.doms.length;
Expand All @@ -61,8 +62,9 @@ async function getProviderList(serviceName, registryConfig) {
let url = `${registryConfig.address}/nacos/v1/ns/instance/list`;

let params = {
serviceName: serviceName,
namespaceId: registryConfig.namespaceId || ""
serviceName: `providers:${serviceName}`,
namespaceId: registryConfig.namespaceId || "",
groupName: registryConfig.groupName || ""
}

try {
Expand Down Expand Up @@ -145,8 +147,9 @@ async function getConsumerList(serviceName, registryConfig) {
let url = `${registryConfig.address}/nacos/v1/ns/instance/list`;

let params = {
serviceName: serviceName,
namespaceId: registryConfig.namespaceId || ""
serviceName: `consumers:${serviceName}`,
namespaceId: registryConfig.namespaceId || "",
groupName: registryConfig.groupName || ""
}

try {
Expand All @@ -169,10 +172,6 @@ async function getConsumerList(serviceName, registryConfig) {
}

async function getMetaData(providerInfo, registryConfig) {

// http://127.0.0.1:8848/nacos/v1/cs/configs
let url = `${registryConfig.address}/nacos/v1/cs/configs`;

let {
application,
serviceName,
Expand All @@ -182,70 +181,45 @@ async function getMetaData(providerInfo, registryConfig) {
version = version || "";
let dataId = `${serviceName}:${version}:${group || ''}:provider:${application}`;

let params = {
dataId: dataId,
group: "dubbo",
namespaceId: registryConfig.namespaceId || "",
tenant: registryConfig.namespaceId || ""
}

try {
let response = await axios.get(url, { params });
return response.data || [];
} catch(error){
if(error.response.status === 404){
return null;
}
throw new Error(i18n.t("connect.exportService.nacos.getMetaData.error", { e: error}));
}
return JSON.parse(await getConfig(registryConfig, dataId));
}


// eslint-disable-next-line no-unused-vars
async function getCurrentConfiguration(registryConfig, providerInfo) {

let config = await getConfiguration(registryConfig, providerInfo);


let configData = configuration.yamlToJSON(config);

if(configData){
return configData;
}

return configuration.createDefaultConfiguration(providerInfo.serviceName);
}



// eslint-disable-next-line no-unused-vars
async function getConfiguration(registryConfig, providerInfo) {
return await getConfig(registryConfig, buildDataId(providerInfo));
}

async function getConfig(registryConfig, dataId){
// http://127.0.0.1:8848/nacos/v1/cs/configs
let url = `${registryConfig.address}/nacos/v1/cs/configs`;

let {
serviceName,
version,
group
} = providerInfo;
version = version || "";
let dataId = `${serviceName}:${version}:${group || ''}.configurators`;
const url = `${registryConfig.address}/nacos/v1/cs/configs`;

let params = {
const params = {
dataId: dataId,
group: "dubbo",
group: registryConfig.group || 'dubbo',
namespaceId: registryConfig.namespaceId || "",
tenant: registryConfig.namespaceId || ""
tenant: registryConfig.namespaceId || "",
show: 'all'
}

try {
let response = await axios.get(url, { params })
return response.data || null;
} catch(error) {
if (error.response.status == 404) {
return null;
const response = await axios.get(url, { params })
if(response.data && response.data.content){
return response.data.content;
}
return null;
} catch(error) {
throw new Error(i18n.t("connect.exportService.nacos.getMetaData.error", { e: error}));
}
}
Expand All @@ -257,7 +231,7 @@ async function saveConfiguration(registryConfig, providerInfo, doc) {

let params = {
dataId: buildDataId(providerInfo),
group: "dubbo",
group: registryConfig.group || 'dubbo',
namespaceId: registryConfig.namespaceId || "",
tenant: registryConfig.namespaceId || "",
}
Expand All @@ -275,8 +249,6 @@ async function saveConfiguration(registryConfig, providerInfo, doc) {
}
}



/**
*
* @param {string} serviceName
Expand Down Expand Up @@ -305,8 +277,6 @@ async function saveConfiguration(registryConfig, providerInfo, doc) {
return addressList;
}



function buildDataId(providerInfo) {
let {
serviceName,
Expand Down
4 changes: 3 additions & 1 deletion src/main/registry/zookeeper/zkClientUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ function createConncetion(registryConfig) {
let zkClient = new Promise((resolve, reject) => {
let zk = zookeeperClient.createClient(address, OPTIONS);
zk.on("connected", function () {
if(registryConfig.scheme && registryConfig.auth){
zk.addAuthInfo(registryConfig.scheme, Buffer.from(registryConfig.auth));
}
resolve(zk);
});

Expand All @@ -23,7 +26,6 @@ function createConncetion(registryConfig) {
zk.connect();
});


return zkClient;
}

Expand Down
14 changes: 4 additions & 10 deletions src/main/repository/connectRepository.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
import dbUtils from "@/main/common/utils/DBUtils.js";
let dbOperator = dbUtils("zkConnectInfo");

function ZkConnectInfo({_id, name ,type, address, namespaceId, username, password,sessionTimeout, createTime = new Date().getTime()}){
this._id = _id,
this.name = name;
this.type = type;
this.address = address;
this.namespaceId = namespaceId;
this.username = username;
this.password = password;
this.sessionTimeout = sessionTimeout;
this.createTime = createTime;

function ZkConnectInfo(obj){
Object.assign(this, obj)
this.createTime = new Date().getTime();
}

function save(zkConnectInfo){
Expand Down
10 changes: 9 additions & 1 deletion src/renderer/views/connect/add/nacos-add.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<el-form ref="form" :rules="rules" :model="form" label-width="100px">
<el-form ref="form" :rules="rules" :model="form" label-width="160px">
<el-form-item :label="$t('connect.name')" prop="name">
<el-input v-model="form.name"></el-input>
</el-form-item>
Expand All @@ -12,6 +12,12 @@
<el-form-item :label="$t('connect.sessionTimeout')" prop="sessionTimeout">
<el-input v-model="form.sessionTimeout"></el-input>
</el-form-item>
<el-form-item :label="$t('connect.nacos.groupName')" prop="groupName">
<el-input v-model="form.groupName" :placeholder="$t('connect.nacos.groupNameTips')" ></el-input>
</el-form-item>
<el-form-item :label="$t('connect.nacos.group')" prop="group">
<el-input v-model="form.group" :placeholder="$t('connect.nacos.groupTips')" ></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="saveZkConnectInfo">{{$t('connect.save')}}</el-button>
</el-form-item>
Expand All @@ -32,6 +38,8 @@ export default {
address: "http://127.0.0.1:8848",
namespaceId: "",
sessionTimeout: 5000,
groupName: '',
group: ''
},
};
Expand Down
10 changes: 10 additions & 0 deletions src/renderer/views/connect/add/zookeeper-add.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@
<el-form-item :label="$t('connect.sessionTimeout')" prop="sessionTimeout">
<el-input v-model="form.sessionTimeout"></el-input>
</el-form-item>
<el-form-item label="ACL" prop="auth">
<el-input :placeholder="$t('connect.zookeeper.aclTips')" v-model="form.auth" class="input-with-select">
<el-select v-model="form.scheme" slot="prepend" style="width:120px">
<el-option label="digest" value="digest"></el-option>
<el-option label="auth" value="auth"></el-option>
</el-select>
</el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="saveZkConnectInfo">{{$t('connect.save')}}</el-button>
</el-form-item>
Expand All @@ -27,6 +35,7 @@ export default {
name: "",
address: "127.0.0.1:2181",
sessionTimeout: 5000,
scheme: 'digest'
},
};
Expand Down Expand Up @@ -93,6 +102,7 @@ export default {
this.form.name = "";
this.form.address = "127.0.0.1:2181";
this.form.sessionTimeout = 5000;
this.form.scheme = 'digest';
}
},
async saveZkConnectInfo() {
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/views/connect/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<el-divider class="my-divider"></el-divider>
<connectList ref="connectList" :mainPanel="mainPanel" @editConnect="openAddConnectDialog"></connectList>

<el-dialog :title="currentConnectId ? $t('connect.modifyConnect') : $t('connect.addConnect')" width="40%" :visible.sync="dialogVisible" :close-on-click-modal="false">
<el-dialog :title="currentConnectId ? $t('connect.modifyConnect') : $t('connect.addConnect')" width="70%" :visible.sync="dialogVisible" :close-on-click-modal="false">
<addConnect @saveSuccess="saveConnectSuccess" :id="currentConnectId" :key="addConnectKey" />
</el-dialog>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/views/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ export default {
.menu-aside {
height: 100%;
align-items: center;
background-color: #ececec;
background-color: #f0f0f0;
}
.ddm-menu-list {
Expand Down
Loading

0 comments on commit 8255f0d

Please sign in to comment.