From d53cb7c86d6ac34ebc2f05401f1c80e13f6d0581 Mon Sep 17 00:00:00 2001 From: Eric Date: Thu, 20 Aug 2020 11:56:14 +0800 Subject: [PATCH] perf(tips): modify tips --- cmd/locale/en_US/LC_MESSAGES/koko.po | 24 +++++++++++----------- cmd/locale/zh_CN/LC_MESSAGES/koko.po | 30 +++++++++++++--------------- pkg/handler/app_k8s.go | 2 +- pkg/handler/dispatch.go | 2 +- pkg/handler/session.go | 4 ++-- 5 files changed, 30 insertions(+), 32 deletions(-) diff --git a/cmd/locale/en_US/LC_MESSAGES/koko.po b/cmd/locale/en_US/LC_MESSAGES/koko.po index 5c8d8d9b4..740910add 100644 --- a/cmd/locale/en_US/LC_MESSAGES/koko.po +++ b/cmd/locale/en_US/LC_MESSAGES/koko.po @@ -237,28 +237,28 @@ msgid "Command `%s` is forbidden" msgstr "" #. i18n.T -#: pkg/proxy/dbproxy.go:117 +#: pkg/proxy/dbproxy.go:119 msgid "Connecting to Database %s %.1f" msgstr "" #. i18n.T -#: pkg/proxy/dbproxy.go:136 +#: pkg/proxy/dbproxy.go:138 msgid "System user <%s> and database <%s> protocol are inconsistent." msgstr "" #. i18n.T -#: pkg/proxy/dbproxy.go:144 +#: pkg/proxy/dbproxy.go:146 msgid "Database %s protocol client not installed." msgstr "" #. i18n.T -#: pkg/proxy/dbproxy.go:203 +#: pkg/proxy/dbproxy.go:205 msgid "Create database session failed" msgstr "" #. i18n.T #. i18n.T -#: pkg/proxy/dbproxy.go:241 pkg/proxy/dbswitch.go:183 +#: pkg/proxy/dbproxy.go:243 pkg/proxy/dbswitch.go:183 msgid "Database connect idle more than %d minutes, disconnect" msgstr "" @@ -268,39 +268,39 @@ msgid "Database connection terminated by administrator" msgstr "" #. i18n.T -#: pkg/proxy/k8sproxy.go:69 +#: pkg/proxy/k8sproxy.go:71 msgid "Connecting to Kubernetes %s %.1f" msgstr "" #. i18n.T -#: pkg/proxy/k8sproxy.go:88 +#: pkg/proxy/k8sproxy.go:90 msgid "System user <%s> and kubernetes <%s> protocol are inconsistent." msgstr "" #. i18n.T -#: pkg/proxy/k8sproxy.go:96 +#: pkg/proxy/k8sproxy.go:98 msgid "%s protocol client not installed." msgstr "" #. i18n.T -#: pkg/proxy/k8sproxy.go:104 +#: pkg/proxy/k8sproxy.go:106 msgid "You don't have permission login %s" msgstr "" #. i18n.T -#: pkg/proxy/k8sproxy.go:112 +#: pkg/proxy/k8sproxy.go:114 msgid "You get auth token failed" msgstr "" #. i18n.T -#: pkg/proxy/k8sproxy.go:157 +#: pkg/proxy/k8sproxy.go:159 msgid "Create k8s session failed" msgstr "" #. i18n.T #. i18n.T #. i18n.T -#: pkg/proxy/k8sproxy.go:195 pkg/proxy/parser.go:150 pkg/proxy/proxy.go:184 +#: pkg/proxy/k8sproxy.go:197 pkg/proxy/parser.go:150 pkg/proxy/proxy.go:184 msgid "Reuse SSH connections (%s@%s) [Number of connections: %d]" msgstr "" diff --git a/cmd/locale/zh_CN/LC_MESSAGES/koko.po b/cmd/locale/zh_CN/LC_MESSAGES/koko.po index 3e2248143..58d276c39 100644 --- a/cmd/locale/zh_CN/LC_MESSAGES/koko.po +++ b/cmd/locale/zh_CN/LC_MESSAGES/koko.po @@ -11,7 +11,7 @@ msgstr "" #: pkg/handler/app_database.go:102 #, fuzzy msgid "Search: %s" -msgstr "搜索: %s" +msgstr "搜索:%s" #. i18n.T #: pkg/handler/app_database.go:104 @@ -224,9 +224,7 @@ msgstr "用户名" #: pkg/handler/session.go:196 #, fuzzy msgid "Tips: Enter system user ID and directly login" -msgstr "" -"\n" -"提示:输入系统用户ID,登录资产[ %s(%s) ]\n" +msgstr "提示:输入系统用户ID直接登录" #. i18n.T #: pkg/handler/session.go:197 @@ -254,30 +252,30 @@ msgid "Command `%s` is forbidden" msgstr "命令 `%s` 是被禁止的 ..." #. i18n.T -#: pkg/proxy/dbproxy.go:117 +#: pkg/proxy/dbproxy.go:119 #, fuzzy msgid "Connecting to Database %s %.1f" msgstr "开始连接数据库%s %.1f" #. i18n.T -#: pkg/proxy/dbproxy.go:136 +#: pkg/proxy/dbproxy.go:138 #, fuzzy msgid "System user <%s> and database <%s> protocol are inconsistent." msgstr "系统用户<%s>和资产<%s>协议不一致" #. i18n.T -#: pkg/proxy/dbproxy.go:144 +#: pkg/proxy/dbproxy.go:146 msgid "Database %s protocol client not installed." msgstr "%s 协议的数据库客户端未安装" #. i18n.T -#: pkg/proxy/dbproxy.go:203 +#: pkg/proxy/dbproxy.go:205 msgid "Create database session failed" msgstr "创建数据库会话失败" #. i18n.T #. i18n.T -#: pkg/proxy/dbproxy.go:241 pkg/proxy/dbswitch.go:183 +#: pkg/proxy/dbproxy.go:243 pkg/proxy/dbswitch.go:183 #, fuzzy msgid "Database connect idle more than %d minutes, disconnect" msgstr "数据库连接空闲时间超过 %d 分钟,断开连接" @@ -289,35 +287,35 @@ msgid "Database connection terminated by administrator" msgstr "管理员中断数据库连接" #. i18n.T -#: pkg/proxy/k8sproxy.go:69 +#: pkg/proxy/k8sproxy.go:71 #, fuzzy msgid "Connecting to Kubernetes %s %.1f" msgstr "开始连接Kubernetes %s %.1f" #. i18n.T -#: pkg/proxy/k8sproxy.go:88 +#: pkg/proxy/k8sproxy.go:90 #, fuzzy msgid "System user <%s> and kubernetes <%s> protocol are inconsistent." msgstr "系统用户<%s>和kubernetes<%s>协议不一致" #. i18n.T -#: pkg/proxy/k8sproxy.go:96 +#: pkg/proxy/k8sproxy.go:98 #, fuzzy msgid "%s protocol client not installed." msgstr "%s 协议的数据库客户端未安装" #. i18n.T -#: pkg/proxy/k8sproxy.go:104 +#: pkg/proxy/k8sproxy.go:106 msgid "You don't have permission login %s" msgstr "你无权限登陆%s" #. i18n.T -#: pkg/proxy/k8sproxy.go:112 +#: pkg/proxy/k8sproxy.go:114 msgid "You get auth token failed" msgstr "你获取认证令牌失败" #. i18n.T -#: pkg/proxy/k8sproxy.go:157 +#: pkg/proxy/k8sproxy.go:159 #, fuzzy msgid "Create k8s session failed" msgstr "创建Kubernetes会话失败" @@ -325,7 +323,7 @@ msgstr "创建Kubernetes会话失败" #. i18n.T #. i18n.T #. i18n.T -#: pkg/proxy/k8sproxy.go:195 pkg/proxy/parser.go:150 pkg/proxy/proxy.go:184 +#: pkg/proxy/k8sproxy.go:197 pkg/proxy/parser.go:150 pkg/proxy/proxy.go:184 msgid "Reuse SSH connections (%s@%s) [Number of connections: %d]" msgstr "复用SSH连接(%s@%s)[连接数量: %d]" diff --git a/pkg/handler/app_k8s.go b/pkg/handler/app_k8s.go index 9b6b904ba..c3581d0bc 100644 --- a/pkg/handler/app_k8s.go +++ b/pkg/handler/app_k8s.go @@ -170,7 +170,7 @@ func (k *K8sApplication) DisplayCurrentResult() { func (k *K8sApplication) ProxyK8s(dbSelect model.K8sCluster) { systemUsers := service.GetUserK8sSystemUsers(k.h.user.ID, dbSelect.ID) - defer k.h.term.SetPrompt("[k8s]> ") + defer k.h.term.SetPrompt("[K8S]> ") systemUserSelect, ok := k.h.chooseSystemUser(systemUsers) if !ok { return diff --git a/pkg/handler/dispatch.go b/pkg/handler/dispatch.go index 9847e5941..5523c1ec8 100644 --- a/pkg/handler/dispatch.go +++ b/pkg/handler/dispatch.go @@ -188,7 +188,7 @@ func (h *interactiveHandler) getK8sApp() Application { engine: eng, searchKeys: make([]string, 0), } - h.term.SetPrompt("[k8s]> ") + h.term.SetPrompt("[K8S]> ") return &app } diff --git a/pkg/handler/session.go b/pkg/handler/session.go index 4a5948b6b..01be48ed6 100644 --- a/pkg/handler/session.go +++ b/pkg/handler/session.go @@ -197,9 +197,9 @@ func (h *interactiveHandler) chooseSystemUser(systemUsers []model.SystemUser) (s backTip := i18n.T("Back: B/b") for { utils.IgnoreErrWriteString(h.term, table.Display()) - utils.IgnoreErrWriteString(h.term, selectTip) + utils.IgnoreErrWriteString(h.term, utils.WrapperString(selectTip, utils.Green)) utils.IgnoreErrWriteString(h.term, utils.CharNewLine) - utils.IgnoreErrWriteString(h.term, backTip) + utils.IgnoreErrWriteString(h.term, utils.WrapperString(backTip, utils.Green)) utils.IgnoreErrWriteString(h.term, utils.CharNewLine) line, err := h.term.ReadLine() if err != nil {