Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 配置示例bug修复和其他调整 #3319

Merged
merged 3 commits into from
Jun 28, 2024
Merged
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
2 changes: 1 addition & 1 deletion bcs-services/bcs-bscp/ui/src/api/credentials.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const createCredential = (biz_id: string, params: { memo: string }) =>
*/
export const getCredentialList = (
biz_id: string,
query: { limit: number; start: number; searchKey?: string; enable?: boolean; all?: boolean },
query: { limit?: number; start: number; searchKey?: string; enable?: boolean; all?: boolean },
) => http.get(`/config/biz_id/${biz_id}/credentials`, { params: query }).then((res) => res.data);

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
### Pull

```c++
### Get

#include <iostream>
#include <string>
#include <vector>
Expand All @@ -12,13 +12,12 @@ int main(int argc, char** argv)
// set client options.
bscp::core::ClientOptions options;

options.m_feedAddrs.push_back({{ .Bk_Bscp_Variable_FEED_ADDR }});
options.m_feedAddrs.push_back("{{ .Bk_Bscp_Variable_FEED_ADDR }}");
options.m_token = {{ .Bk_Bscp_Variable_ClientKey }};
options.m_bizID = {{ .Bk_Bscp_Variable_BkBizId }};
options.m_sideRid = "xx";

// labels.
std::map<std::string, std::string> labels{{{ .Bk_Bscp_Variable_Leabels }}};
std::map<std::string, std::string> labels{{ .Bk_Bscp_Variable_Leabels }};
options.m_labels = labels;

// instantiate client.
Expand Down Expand Up @@ -66,7 +65,7 @@ int main(int argc, char** argv)
std::cout << kv.m_key << "=" << value << std::endl;
}

std::cout << "call pull kvs success" << std::endl;
std::cout << "call get kvs success" << std::endl;

return 0;
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

### Watch

```c++
#include <ctime>
#include <iostream>
#include <string>
Expand All @@ -16,13 +16,12 @@ int main(int argc, char** argv)
// set client options.
bscp::core::ClientOptions options;

options.m_feedAddrs.push_back({{ .Bk_Bscp_Variable_FEED_ADDR }});
options.m_feedAddrs.push_back("{{ .Bk_Bscp_Variable_FEED_ADDR }}");
options.m_token = {{ .Bk_Bscp_Variable_ClientKey }};
options.m_bizID = {{ .Bk_Bscp_Variable_BkBizId }};
options.m_sideRid = "xx";

// labels.
std::map<std::string, std::string> labels{{{ .Bk_Bscp_Variable_Leabels }}};
std::map<std::string, std::string> labels{{ .Bk_Bscp_Variable_Leabels }};
options.m_labels = labels;

// instantiate client.
Expand Down Expand Up @@ -104,4 +103,4 @@ int main(int argc, char** argv)
}

return 0;
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@

### Pull
### Get

```golang
// pull kv example for bscp sdk
// get kv example for bscp sdk
package main

import (
Expand All @@ -27,9 +26,7 @@ func main() {
var token string = {{ .Bk_Bscp_Variable_ClientKey }}
var app string = "{{ .Bk_Bscp_Variable_ServiceName }}"

labels := map[string]string{
{{ .Bk_Bscp_Variable_Leabels }}
}
labels := map[string]string{{ .Bk_Bscp_Variable_Leabels }}

bscp, err := client.New(
client.WithFeedAddr(feedAddr),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

### Watch

```golang
// watch kv example for bscp sdk
package main

Expand All @@ -26,9 +26,7 @@ func main() {
var token string = {{ .Bk_Bscp_Variable_ClientKey }}
var app string = "{{ .Bk_Bscp_Variable_ServiceName }}"

labels := map[string]string{
{{ .Bk_Bscp_Variable_Leabels }}
}
labels := map[string]string{{ .Bk_Bscp_Variable_Leabels }}

bscp, err := client.New(
client.WithFeedAddr(feedAddr),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
### Pull

```java
package com.example.pull;
### Get

package com.example.get;

import com.tencent.bscp.helper.OptionHelper;
import com.tencent.bscp.pojo.AppOption;
Expand All @@ -26,7 +26,7 @@ public class Main {
String feedAddr = "{{ .Bk_Bscp_Variable_FEED_ADDR }}";
Integer biz = {{ .Bk_Bscp_Variable_BkBizId }};
String token = {{ .Bk_Bscp_Variable_ClientKey }};
String app = {{ .Bk_Bscp_Variable_ServiceName }};
String app = "{{ .Bk_Bscp_Variable_ServiceName }}";

Map<String, String> labels = new HashMap<>();
{{ .Bk_Bscp_Variable_Leabels }}
Expand All @@ -50,10 +50,10 @@ public class Main {

bscp.close();

System.out.println("pull success");
System.out.println("get success");

} catch (Exception e) {
LOGGER.error("pull bscp kv failed", e);
LOGGER.error("get bscp kv failed", e);
System.exit(1);
return;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

### Watch

```java
package com.example.watch;

import com.tencent.bscp.helper.OptionHelper;
Expand All @@ -25,7 +25,7 @@ public class Main {
String feedAddr = "{{ .Bk_Bscp_Variable_FEED_ADDR }}";
Integer biz = {{ .Bk_Bscp_Variable_BkBizId }};
String token = {{ .Bk_Bscp_Variable_ClientKey }};
String app = {{ .Bk_Bscp_Variable_ServiceName }};
String app = "{{ .Bk_Bscp_Variable_ServiceName }}";

Map<String, String> labels = new HashMap<>();
{{ .Bk_Bscp_Variable_Leabels }}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
### Pull

### Get

from bk_bscp.client import BscpClient

Expand All @@ -8,11 +9,13 @@ BIZ_ID = {{ .Bk_Bscp_Variable_BkBizId }}
APP = "{{ .Bk_Bscp_Variable_ServiceName }}"
LABELS = {{ .Bk_Bscp_Variable_Leabels }}



def main():
with BscpClient(SERVER_ADDRS, TOKEN, BIZ_ID) as client:
pair = client.get(APP, "key1", LABELS)
print(pair.value)


if __name__ == "__main__":
main()

Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

### Watch

import logging
Expand All @@ -10,6 +11,7 @@ BIZ_ID = {{ .Bk_Bscp_Variable_BkBizId }}
APP = "{{ .Bk_Bscp_Variable_ServiceName }}"
LABELS = {{ .Bk_Bscp_Variable_Leabels }}


def main():
"""Watch a single app."""
with BscpClient(SERVER_ADDRS, TOKEN, BIZ_ID) as client:
Expand All @@ -19,6 +21,9 @@ def main():
value = client.get(ev.app, key.key)
print(f"{key.key}={value}")




def setup_logger():
"""Set up the logger to print logs."""
logger = logging.getLogger("bk_bscp")
Expand All @@ -29,8 +34,9 @@ def setup_logger():
handler.setFormatter(formatter)
logger.addHandler(handler)


setup_logger()


if __name__ == "__main__":
main()
```
13 changes: 7 additions & 6 deletions bcs-services/bcs-bscp/ui/src/i18n/en-us.ts
Original file line number Diff line number Diff line change
Expand Up @@ -713,12 +713,12 @@ export default {
示例参数: 'Example Params',
示例预览: 'Example Preview',
复制示例: 'Example Copy',
'与分组结合使用,实现服务实例的灰度发布场景,支持多个标签;若不需要灰度发布功能,此参数可不配置': 'It can be used in combination with grouping to realize grayscale publishing scenario of service instances and support multiple labels. If the gray scale publishing function is not required, this parameter can not be configured',
用于客户端拉取配置时身份验证: 'Used for authentication when the client pulls the configuration',
// Get方法: 'Get',
// Watch方法: 'Watch',
'Pull:用于一次性拉取最新的配置信息,适用于需要获取并更新配置的场景。': 'Method: Pull the latest configuration information at one time. This method is applicable to the scenario where the configuration needs to be obtained and updated.',
'Watch:通过建立长连接,实时监听配置版本的变更,当新版本的配置发布时,将自动调用回调方法处理新的配置信息,适用于需要实时响应配置变更的场景。': 'Watch method: Establish a long connection to monitor changes in the configuration version in real time. When the new configuration version is released, the callback method is automatically invoked to process the new configuration information. This method is applicable to scenarios that require real-time response to configuration changes.',
'与分组结合使用,实现服务实例的灰度发布场景,支持多个标签;若不需要灰度发布功能,此参数可不配置': 'It can be used in combination with grouping to realize grayscale publishing scenario of \n service instances and support multiple labels. \n If the gray scale publishing function is not required, this parameter can not be configured',
'用于客户端拉取配置时身份验证,下拉列表只会展示关联过此服务且状态为启用的密钥': 'Used for client-side authentication when fetching configurations, \n the dropdown list will only display keys that have been associated \n with this service and are in the enabled state',
Get方法: 'Get',
Watch方法: 'Watch',
'Get方法:用于一次性拉取最新的配置信息,适用于需要获取并更新配置的场景。': 'Get method: Used for fetching the latest configuration information in a single request, suitable for scenarios requiring both retrieval and update of configurations',
'Watch方法:通过建立长连接,实时监听配置版本的变更,当新版本的配置发布时,将自动调用回调方法处理新的配置信息,适用于需要实时响应配置变更的场景。': 'Watch method: Establish a long connection to monitor changes in the configuration version in real time. When the new configuration version is released, the callback method is automatically invoked to process the new configuration information. This method is applicable to scenarios that require real-time response to configuration changes.',
节点管理插件客户端需要在: 'Node management plug-in client needs to be in',
节点管理平台: 'Node management platform',
'部署“bkbscp (bscp服务配置分发和热更新)”插件,部署详情请参考产品白皮书:': 'Deploy the bkbscp (bscp Service Configuration Distribution and Hot Update) plug-in. For details, see the product white paper:',
Expand Down Expand Up @@ -748,6 +748,7 @@ export default {
'获取指定服务下指定配置项元数据,支持多个配置项元数据获取,没有指定配置项,获取服务下所有配置项的元数据': 'Obtain the metadata of the specified configuration item of the specified service. You can obtain the metadata of multiple configuration items. Obtain the metadata of all configuration items of the service if no configuration item is specified',
'暂无可用密钥,可前往密钥管理新建/启用密钥,或将已有密钥关联至此服务': 'No available keys found. You can go to key management to create/enable a key or associate an existing key with this service',
'搜索结果为空,可前往密钥管理新建/启用密钥,或将已有密钥关联至此服务': 'Search result is empty. You can go to key management to create/enable a key or associate an existing key with this service',
禁止使用系统目录: 'Prohibited from using system directories',

// 公共组件
页面不存在: 'Page does not exist',
Expand Down
13 changes: 7 additions & 6 deletions bcs-services/bcs-bscp/ui/src/i18n/zh-cn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -719,12 +719,12 @@ export default {
示例参数: '示例参数',
示例预览: '示例预览',
复制示例: '复制示例',
'与分组结合使用,实现服务实例的灰度发布场景,支持多个标签;若不需要灰度发布功能,此参数可不配置': 'It can be used in combination with grouping to realize grayscale publishing scenario of service instances and support multiple labels. If the gray scale publishing function is not required, this parameter can not be configured',
用于客户端拉取配置时身份验证: '用于客户端拉取配置时身份验证',
// Get方法: 'Get方法',
// Watch方法: 'Watch方法',
'Pull:用于一次性拉取最新的配置信息,适用于需要获取并更新配置的场景。': 'Get 方法:用于一次性拉取最新的配置信息,适用于需要获取并更新配置的场景。',
'Watch:通过建立长连接,实时监听配置版本的变更,当新版本的配置发布时,将自动调用回调方法处理新的配置信息,适用于需要实时响应配置变更的场景。': 'Watch 方法:通过建立长连接,实时监听配置版本的变更,当新版本的配置发布时,将自动调用回调方法处理新的配置信息,适用于需要实时响应配置变更的场景。',
'与分组结合使用,实现服务实例的灰度发布场景,支持多个标签;若不需要灰度发布功能,此参数可不配置': '与分组结合使用,实现服务实例的灰度发布场景,支持多个标签;若不需要灰度发布功能,此参数可不配置',
'用于客户端拉取配置时身份验证,下拉列表只会展示关联过此服务且状态为启用的密钥': '用于客户端拉取配置时身份验证,下拉列表只会展示关联过此服务且状态为启用的密钥',
Get方法: 'Get方法',
Watch方法: 'Watch方法',
'Get方法:用于一次性拉取最新的配置信息,适用于需要获取并更新配置的场景。': 'Get 方法:用于一次性拉取最新的配置信息,适用于需要获取并更新配置的场景。',
'Watch方法:通过建立长连接,实时监听配置版本的变更,当新版本的配置发布时,将自动调用回调方法处理新的配置信息,适用于需要实时响应配置变更的场景。': 'Watch 方法:通过建立长连接,实时监听配置版本的变更,当新版本的配置发布时,将自动调用回调方法处理新的配置信息,适用于需要实时响应配置变更的场景。',
节点管理插件客户端需要在: '节点管理插件客户端需要在',
节点管理平台: '节点管理平台',
'部署“bkbscp (bscp服务配置分发和热更新)”插件,部署详情请参考产品白皮书:': '部署“bkbscp (bscp服务配置分发和热更新)”插件,部署详情请参考产品白皮书:',
Expand Down Expand Up @@ -754,6 +754,7 @@ export default {
'获取指定服务下指定配置项元数据,支持多个配置项元数据获取,没有指定配置项,获取服务下所有配置项的元数据': '获取指定服务下指定配置项元数据,支持多个配置项元数据获取,没有指定配置项,获取服务下所有配置项的元数据',
'暂无可用密钥,可前往密钥管理新建/启用密钥,或将已有密钥关联至此服务': '暂无可用密钥,可前往密钥管理新建/启用密钥,或将已有密钥关联至此服务',
'搜索结果为空,可前往密钥管理新建/启用密钥,或将已有密钥关联至此服务': '搜索结果为空,可前往密钥管理新建/启用密钥,或将已有密钥关联至此服务',
禁止使用系统目录: '禁止使用系统目录',

// 公共组件
页面不存在: '页面不存在',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
}
.icon-info {
margin-left: 9px;
color: #63656e;
color: #979ba5;
cursor: pointer;
}
.add-label-button {
Expand Down Expand Up @@ -126,6 +126,12 @@
border: 1px solid #979ba5;
border-radius: 50%;
cursor: pointer;
&:hover {
border-color: #3a84ff;
&::after {
border-color: #3a84ff;
}
}
&::after {
content: '';
position: absolute;
Expand Down
Loading
Loading