From aef3d6cbef58734dd072df3bbe7c9d1388ba6283 Mon Sep 17 00:00:00 2001 From: kunw Date: Mon, 18 Apr 2016 18:42:12 +0800 Subject: [PATCH] updates for create time localization of image detail and i18n of index title --- api/repository.go | 1 - models/repo.go | 1 - static/i18n/locale_en-US.ini | 2 +- static/i18n/locale_zh-CN.ini | 1 + static/resources/js/item-detail.js | 20 +++++++++----------- views/index.tpl | 2 +- 6 files changed, 12 insertions(+), 15 deletions(-) diff --git a/api/repository.go b/api/repository.go index 0ce3cf8d1..9c7257351 100644 --- a/api/repository.go +++ b/api/repository.go @@ -169,7 +169,6 @@ func (ra *RepositoryAPI) GetManifests() { ra.RenderError(http.StatusInternalServerError, "Internal Server Error") return } - item.CreatedStr = item.Created.Format("2006-01-02 15:04:05") item.DurationDays = strconv.Itoa(int(time.Since(item.Created).Hours()/24)) + " days" ra.Data["json"] = item diff --git a/models/repo.go b/models/repo.go index 4ddb7afd0..6b8de742b 100644 --- a/models/repo.go +++ b/models/repo.go @@ -29,7 +29,6 @@ type RepoItem struct { ID string `json:"Id"` Parent string `json:"Parent"` Created time.Time `json:"Created"` - CreatedStr string `json:"CreatedStr"` DurationDays string `json:"Duration Days"` Author string `json:"Author"` Architecture string `json:"Architecture"` diff --git a/static/i18n/locale_en-US.ini b/static/i18n/locale_en-US.ini index 7a44eddda..981213cf0 100644 --- a/static/i18n/locale_en-US.ini +++ b/static/i18n/locale_en-US.ini @@ -82,4 +82,4 @@ index_desc_2 = 2. Efficiency: A private registry server is set up within the org index_desc_3 = 3. Access Control: RBAC (Role Based Access Control) is provided. User management can be integrated with existing enterprise identity services like AD/LDAP. index_desc_4 = 4. Audit: All access to the registry are logged and can be used for audit purpose. index_desc_5 = 5. GUI: User friendly single-pane-of-glass management console. - +index_title = An enterprise-class registry server diff --git a/static/i18n/locale_zh-CN.ini b/static/i18n/locale_zh-CN.ini index 9e49c12ae..90ea4fc04 100644 --- a/static/i18n/locale_zh-CN.ini +++ b/static/i18n/locale_zh-CN.ini @@ -82,3 +82,4 @@ index_desc_2 = 2. 效率: 搭建组织内部的私有容器Registry服务,可 index_desc_3 = 3. 访问控制: 提供基于角色的访问控制,可集成企业目前拥有的用户管理系统(如:AD/LDAP)。 index_desc_4 = 4. 审计: 所有访问Registry服务的操作均被记录,便于日后审计。 index_desc_5 = 5. 管理界面: 具有友好易用图形管理界面。 +index_title = 企业级 Registry 服务 \ No newline at end of file diff --git a/static/resources/js/item-detail.js b/static/resources/js/item-detail.js index e13075ecf..991e6abaa 100644 --- a/static/resources/js/item-detail.js +++ b/static/resources/js/item-detail.js @@ -124,17 +124,15 @@ jQuery(function(){ url: "/api/repositories/manifests?repo_name=" + repoName + "&tag=" + imageId, type: "get", success: function(data, status, xhr){ - if(data){ - for(var i in data){ - if(data[i] == ""){ - data[i] = "N/A"; - } - } - data.Created = data.CreatedStr; - delete data.CreatedStr; - - $("#dlgModal").dialogModal({"title": i18n.getMessage("image_details"), "content": data}); - } + if(data){ + for(var i in data){ + if(data[i] == ""){ + data[i] = "N/A"; + } + } + data.Created = moment(new Date(data.Created)).format("YYYY-MM-DD HH:mm:ss"); + $("#dlgModal").dialogModal({"title": i18n.getMessage("image_details"), "content": data}); + } } }).exec(); }); diff --git a/views/index.tpl b/views/index.tpl index e86e813a4..e92eaa5cb 100644 --- a/views/index.tpl +++ b/views/index.tpl @@ -16,7 +16,7 @@
Harbor's Logo -

An enterprise-class registry server

+

{{i18n .Lang "index_title"}}