Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ configTemplates:
- key: servicecomb.routeRule.*
value: "- kind: routematcher.sermant.io/flow\n description: test\n rules:\n - precedence: 1\n match:\n attachments:\n id:\n exact: '1'\n route:\n - weight: 20\n tags:\n version: 1.0.0\n - weight: 80\n tags:\n version: 1.0.1\n- kind: routematcher.sermant.io/tag\n description: sameTag\n rules:\n - precedence: 1\n match:\n tags:\n zone:\n exact: 'hangzhou'\n policy:\n triggerThreshold: 20\n minAllInstances: 3\n- kind: route.sermant.io/lane\n description: lane\n rules:\n - precedence: 1\n match:\n method: getFoo\n path: 'io.sermant.bar'\n protocol: dubbo\n attachments:\n id:\n exact: '1'\n args:\n args0:\n type: .name\n exact: 'foo'\n route:\n - tag-inject:\n x-sermant-flag2: gray2\n weight: 100"
- key: servicecomb.globalRouteRule
- value: "- kind: routematcher.sermant.io/flow\n description: test\n rules:\n - precedence: 1\n match:\n attachments:\n id:\n exact: '1'\n route:\n - weight: 20\n tags:\n version: 1.0.0\n - weight: 80\n tags:\n version: 1.0.1\n- kind: routematcher.sermant.io/tag\n description: sameTag\n rules:\n - precedence: 1\n match:\n tags:\n zone:\n exact: 'hangzhou'\n policy:\n triggerThreshold: 20\n minAllInstances: 3\n- kind: route.sermant.io/lane\n description: lane\n rules:\n - precedence: 1\n match:\n method: getFoo\n path: 'io.sermant.bar'\n protocol: dubbo\n attachments:\n id:\n exact: '1'\n args:\n args0:\n type: .name\n exact: 'foo'\n route:\n - tag-inject:\n x-sermant-flag2: gray2\n weight: 100"
value: "- kind: routematcher.sermant.io/flow\n description: test\n rules:\n - precedence: 1\n match:\n attachments:\n id:\n exact: '1'\n route:\n - weight: 20\n tags:\n version: 1.0.0\n - weight: 80\n tags:\n version: 1.0.1\n- kind: routematcher.sermant.io/tag\n description: sameTag\n rules:\n - precedence: 1\n match:\n tags:\n zone:\n exact: 'hangzhou'\n policy:\n triggerThreshold: 20\n minAllInstances: 3\n- kind: route.sermant.io/lane\n description: lane\n rules:\n - precedence: 1\n match:\n method: getFoo\n path: 'io.sermant.bar'\n protocol: dubbo\n attachments:\n id:\n exact: '1'\n args:\n args0:\n type: .name\n exact: 'foo'\n route:\n - tag-inject:\n x-sermant-flag2: gray2\n weight: 100"
32 changes: 15 additions & 17 deletions sermant-backend/src/main/webapp/frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion sermant-backend/src/main/webapp/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
},
"dependencies": {
"@element-plus/icons-vue": "^2.1.0",
"axios": "^1.3.4",
"axios": "^1.8.2",
Comment thread
hanbingleixue marked this conversation as resolved.
"element-plus": "^2.2.36",
"moment": "^2.29.4",
"qs": "^6.11.1",
Expand Down
15 changes: 11 additions & 4 deletions sermant-backend/src/main/webapp/frontend/src/views/ConfigInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,8 @@ const configInfo = ref<stringMap>({
configType: ''
});

let currentTemplateKey='';

const options = ref<option[]>([]);

interface pluginTemplate {
Expand Down Expand Up @@ -296,15 +298,15 @@ getTemplate();

function initPageTemplate() {
const param: LocationQuery = router.currentRoute.value.query;
configInfo.value.configType = <string>param.configType;
configInfo.value.namespace = <string>param.namespace;
if (<string>param.type != "modify") {
return;
}
modifyFlag.value = true
configInfo.value.pluginType = <string>param.pluginType;
configInfo.value.group = <string>param.group;
configInfo.value.key = <string>param.key;
configInfo.value.namespace = <string>param.namespace;
configInfo.value.configType = <string>param.configType;
configInfo.value.keyRule = <string>param.keyRule;
configInfo.value.groupRule = <string>param.groupRule;
console.log(param)
Expand Down Expand Up @@ -352,9 +354,11 @@ function changeElement(template: pluginTemplate) {
}
configInfo.value.group = replaceTemplate(configInfo.value.groupRule, configInfo.value);
configInfo.value.key = replaceTemplate(configInfo.value.keyRule, configInfo.value);
console.log(template.configTemplates)
template.configTemplates.forEach(configTemplate => {
const pattern = new RegExp(configTemplate.key.replace("*", ".*"));
if (pattern.test(configInfo.value.key)) {
if (pattern.test(configInfo.value.key) && currentTemplateKey != configTemplate.key) {
currentTemplateKey=configTemplate.key
configInfo.value.content = configTemplate.value
}
})
Expand All @@ -376,7 +380,8 @@ function changePluginType() {
namespace: configInfo.value.namespace,
pluginType: configInfo.value.pluginType,
keyRule: template.keyRule[0],
groupRule: template.groupRule[0]
groupRule: template.groupRule[0],
configType: configInfo.value.configType
};
changeRule(template);
changeElement(template);
Expand All @@ -388,6 +393,8 @@ function initCheckRule(template: pluginTemplate) {
if ((containsPlaceholder(element.name, configInfo.value.keyRule)
|| containsPlaceholder(element.name, configInfo.value.groupRule)) && element.required) {
checkRule.value[element.name] = [{required: true, message: message, trigger: 'change'}];
} else {
checkRule.value[element.name] = [{required: false, message: message, trigger: 'change'}];
}
})
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -298,8 +298,8 @@ const configCenterInfo = reactive({
});

onBeforeMount(async () => {
await getTemplate();
getConfigurationCenter();
await getConfigurationCenter();
getTemplate();
});
// 路由
const router = useRouter();
Expand Down Expand Up @@ -358,10 +358,10 @@ const getConfigList = () => {
namespace: requestParam.value.namespace
}
if (params.groupRule && exactMatchFlag) {
params.group = replaceTemplate(params.groupRule, requestParam.value)
params.groupRule = replaceTemplate(params.groupRule, requestParam.value)
}
if (params.keyRule && exactMatchFlag) {
params.key = replaceTemplate(params.keyRule, requestParam.value)
params.keyRule = replaceTemplate(params.keyRule, requestParam.value)
}
if (pluginType == 'common') {
params.groupRule = params.group
Expand Down Expand Up @@ -458,8 +458,10 @@ const getConfigurationCenter = () => {
};

const handlerChangePluginType = (value: string) => {
const namespace = requestParam.value.namespace;
requestParam.value = {};
requestParam.value.pluginType = value
requestParam.value.namespace = namespace;
currentTemplate.value = getCurrentTemplate(requestParam.value.pluginType);
}

Expand Down Expand Up @@ -512,7 +514,8 @@ const deleteConfig = (row: stringMap, index: number) => {
const toAddConfig = () => {
const params = {
type: "add",
configType: configCenterInfo.dynamicConfigType
configType: configCenterInfo.dynamicConfigType,
namespace: configCenterInfo.namespace,
};
router.push({name: "configInfo", query: params});
};
Expand Down