zlSun 1 рік тому
батько
коміт
a9cf4fae7e
2 змінених файлів з 41 додано та 5 видалено
  1. 11 4
      atlas/js/utils/CommonViewFunction.js
  2. 30 1
      atlas/js/utils/Utils.js

+ 11 - 4
atlas/js/utils/CommonViewFunction.js

@@ -44,8 +44,14 @@ define([ "require", "utils/Utils", "modules/Modal", "utils/Messages", "utils/Enu
                 return resultStr;
             }
         }, getEmptyString = function(key) {
-            return options.getEmptyString ? options.getEmptyString(key) : "N/A";
+            return options.getEmptyString ? options.getEmptyString(key) : "";
         }, getValue = function(val, key) {
+            if("false"===val||false===val){
+                return "否";
+            }
+            else if ("true"===val||true===val){
+                return "是";
+            }
             if (options && options.getValue && (val = options.getValue(val, key)), _.isUndefined(val) || _.isNull(val)) return getEmptyString(key);
             if (!_.isNumber(val) && _.isNaN(parseInt(val)) || !formatIntVal) {
                 var newVal = val;
@@ -115,6 +121,7 @@ define([ "require", "utils/Utils", "modules/Modal", "utils/Messages", "utils/Enu
         return (_.isUndefined(sortBy) || 1 == sortBy) && (valueObjectKeysList = _.sortBy(valueObjectKeysList)),
         valueObjectKeysList.map(function(key) {
             if ("profileData" != key) {
+                console.log("key",key)
                 var keyValue = valueObject[key], listCount = showListCount && _.isArray(keyValue) && keyValue.length > 0 ? " (" + numberFormat(keyValue.length) + ")" : "", defEntity = _.find(attributeDefs, {
                     name: key
                 });
@@ -134,7 +141,7 @@ define([ "require", "utils/Utils", "modules/Modal", "utils/Messages", "utils/Enu
                 var val = "";
                 if (val = _.isObject(valueObject[key]) ? keyValue : "guid" === key || "__guid" === key ? options.guidHyperLink === !1 ? getValue(keyValue, key) : '<a title="' + key + '" href="#!/detailPage/' + _.escape(keyValue) + '">' + getValue(keyValue, key) + "</a>" : getValue(keyValue, key),
                 isTable) {
-                    var value = val, appendClass = "N/A" == value ? "hide-row" : "", htmlTag = '<div class="scroll-y">' + value + "</div>";
+                    var value = val, appendClass = "" == value ? "hide-row" : "", htmlTag = '<div class="scroll-y">' + value + "</div>";
                     if (_.isObject(valueObject[key]) && !_.isEmpty(valueObject[key])) {
                         var matchedLinkString = val.match(/href|value-loader\w*/g), matchedJson = val.match(/json-value|json-string\w*/g), isMatchJSONStringIsSingle = (val.match(/json-key\w*/g),
                         matchedLinkString && matchedLinkString.length <= 5, matchedJson && 1 == matchedJson.length), expandCollapseButton = "";
@@ -144,10 +151,10 @@ define([ "require", "utils/Utils", "modules/Modal", "utils/Messages", "utils/Enu
                             htmlTag = '<pre class="' + className + '">' + expandCollapseButton + "<code>" + val + "</code></pre>";
                         }
                     }
-                    table += '<tr class="' + appendClass + '"><td>' + (_.escape(key) + listCount) + "</td><td>" + htmlTag + "</td></tr>";
+                    table += '<tr class="' + appendClass + '"><td>' + (Utils.toChinese(_.escape(key))+ listCount) + "</td><td>" + htmlTag + "</td></tr>";
                 } else table += "<span>" + val + "</span>";
             }
-        }), table && table.length > 0 ? table : '<tr class="empty"><td colspan="22"><span>No Record found!</span></td></tr>';
+        }), table && table.length > 0 ? table : '<tr class="empty"><td colspan="22"><span>没有记录!</span></td></tr>';
     }, CommonViewFunction.tagForTable = function(obj) {
         var traits = obj.classifications, tagHtml = "", addTag = "", popTag = "", count = 0, entityName = Utils.getName(obj);
         return traits && traits.map(function(tag) {

+ 30 - 1
atlas/js/utils/Utils.js

@@ -513,5 +513,34 @@ define([ "require", "utils/Globals", "pnotify", "utils/Messages", "utils/Enums",
         "-" !== dateValue && (isValidDate === !1 && options && options.defaultDate !== !1 && (dateValue = moment().format(dateFormat)), 
         Globals.isTimezoneFormatEnabled && (!options || options && options.zone !== !1) && (dateValue += " (" + moment.tz(moment.tz.guess()).zoneAbbr() + ")")), 
         dateValue;
-    }, Utils;
+    },Utils.toChinese=function (name){
+        switch (name){
+            case "columns": return "列";
+            case "aliases": return "别名";
+            case "comment": return "备注";
+            case "createTime": return "创建时间";
+            case "db": return "数据库";
+            case "displayName": return "展示名称";
+            case "isIncomplete": return "是否为未完成";
+            case "lastAccessTime": return "上次访问时间";
+            case "name": return "名称";
+            case "owner":return "所有者";
+            case "parameters": return "参数";
+            case "partitionKeys": return "分区键";
+            case "qualifiedName": return "限定符";
+            case "replicatedFrom": return "复制自";
+            case "replicatedTo": return "复制到";
+            case "retention": return "留存";
+            case "sd": return "物理存储";
+            case "tableType": return "表类型";
+            case "temporary": return "临时";
+            case "typeName": return "类型名称";
+            case "userDescription": return "用户描述";
+            case "viewExpandedText": return "视图拓展文本";
+            case "viewOriginalText": return "视图原始文本";
+            default: return name;
+        }
+
+    },
+        Utils;
 });