diff --git a/README.md b/README.md index 3a5fd9f..e7ebe89 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ https://corifeus.com/redis-ui --- -# 💿 The p3x-redis-ui-material web interface that connects to the p3x-redis-ui-server via http and socket.io v2024.4.211 +# 💿 The p3x-redis-ui-material web interface that connects to the p3x-redis-ui-server via http and socket.io v2024.4.212 @@ -77,7 +77,7 @@ All my domains ([patrikx3.com](https://patrikx3.com) and [corifeus.com](https:// --- -[**P3X-REDIS-UI-MATERIAL**](https://corifeus.com/redis-ui-material) Build v2024.4.211 +[**P3X-REDIS-UI-MATERIAL**](https://corifeus.com/redis-ui-material) Build v2024.4.212 [![NPM](https://img.shields.io/npm/v/p3x-redis-ui-material.svg)](https://www.npmjs.com/package/p3x-redis-ui-material) [![Donate for Corifeus / P3X](https://img.shields.io/badge/Donate-Corifeus-003087.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=QZVM4V6HVZJW6) [![Contact Corifeus / P3X](https://img.shields.io/badge/Contact-P3X-ff9900.svg)](https://www.patrikx3.com/en/front/contact) [![Like Corifeus @ Facebook](https://img.shields.io/badge/LIKE-Corifeus-3b5998.svg)](https://www.facebook.com/corifeus.software) diff --git a/package.json b/package.json index 5308079..d8c291f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "p3x-redis-ui-material", - "version": "2024.4.211", + "version": "2024.4.212", "description": "💿 The p3x-redis-ui-material web interface that connects to the p3x-redis-ui-server via http and socket.io", "corifeus": { "icon": "fas fa-database", diff --git a/src/angular/dialog/p3xr-dialog-key-new-or-set.html b/src/angular/dialog/p3xr-dialog-key-new-or-set.html index 7f716b0..df32509 100644 --- a/src/angular/dialog/p3xr-dialog-key-new-or-set.html +++ b/src/angular/dialog/p3xr-dialog-key-new-or-set.html @@ -132,7 +132,7 @@

- {{ $root.p3xr.strings.label.isBuffer }} {{ bufferDisplay(model.value) }} + {{ $root.p3xr.strings.label.isBuffer({ maxValueAsBuffer: $root.p3xr.settings.prettyBytes($root.p3xr.settings.maxValueAsBuffer)}) }} {{ bufferDisplay(model.value) }}
diff --git a/src/angular/dialog/p3xr-dialog-key-new-or-set.js b/src/angular/dialog/p3xr-dialog-key-new-or-set.js index 931b889..bbef0c2 100644 --- a/src/angular/dialog/p3xr-dialog-key-new-or-set.js +++ b/src/angular/dialog/p3xr-dialog-key-new-or-set.js @@ -12,10 +12,8 @@ p3xr.ng.factory('p3xrDialogKeyNewOrSet', function (p3xrCommon, $mdDialog, p3xrSo controller: function ($scope, $mdDialog) { - const prettyBytes = require('pretty-bytes'); - $scope.bufferDisplay = (value) => { - const result = '(' + prettyBytes(value.byteLength) + ')' + const result = '(' + p3xr.settings.prettyBytes(value.byteLength) + ')' //console.log('bufferDisplay', result ) return result } diff --git a/src/angular/dialog/p3xr-dialog-ttl.js b/src/angular/dialog/p3xr-dialog-ttl.js index c6e9b29..16eceac 100644 --- a/src/angular/dialog/p3xr-dialog-ttl.js +++ b/src/angular/dialog/p3xr-dialog-ttl.js @@ -27,10 +27,12 @@ p3xr.ng.factory('p3xrDialogTtl', function (p3xrCommon, $mdDialog) { const humanizeDuration = require("humanize-duration"); + if (typeof $scope.model.ttl === 'number' && $scope.model.ttl > 0) { $scope.convertTextToTime = humanizeDuration($scope.model.ttl * 1000, { delimiter: ' ', + language: p3xr.settings.getHumanizeDurationLanguage(), }) } else { $scope.convertTextToTime = ''; diff --git a/src/angular/pages/main/key/p3xr-main-key-string.html b/src/angular/pages/main/key/p3xr-main-key-string.html index db3ca8c..aab1538 100644 --- a/src/angular/pages/main/key/p3xr-main-key-string.html +++ b/src/angular/pages/main/key/p3xr-main-key-string.html @@ -110,13 +110,13 @@
- {{ $root.p3xr.strings.label.isBuffer }} {{$ctrl.bufferDisplay($ctrl.p3xrValue)}} + {{ $root.p3xr.strings.label.isBuffer({ maxValueAsBuffer: $root.p3xr.settings.prettyBytes($root.p3xr.settings.maxValueAsBuffer)}) }} {{$ctrl.bufferDisplay($ctrl.p3xrValue)}}
- {{ $root.p3xr.strings.label.isBuffer }} {{$ctrl.bufferDisplay($ctrl.p3xrValueBuffer)}} + {{ $root.p3xr.strings.label.isBuffer({ maxValueAsBuffer: $root.p3xr.settings.prettyBytes($root.p3xr.settings.maxValueAsBuffer)}) }} {{$ctrl.bufferDisplay($ctrl.p3xrValueBuffer)}}
diff --git a/src/angular/pages/main/key/p3xr-main-key-string.js b/src/angular/pages/main/key/p3xr-main-key-string.js index e3fd767..42feef5 100644 --- a/src/angular/pages/main/key/p3xr-main-key-string.js +++ b/src/angular/pages/main/key/p3xr-main-key-string.js @@ -15,10 +15,8 @@ p3xr.ng.component('p3xrMainKeyString', { } - const prettyBytes = require('pretty-bytes'); - this.bufferDisplay = (value) => { - const result = '(' + prettyBytes(value.byteLength) + ')' + const result = '(' + p3xr.settings.prettyBytes(value.byteLength) + ')' //console.log('bufferDisplay', result ) return result } diff --git a/src/angular/pages/main/p3xr-main-key.js b/src/angular/pages/main/p3xr-main-key.js index 22625f1..13d167d 100644 --- a/src/angular/pages/main/p3xr-main-key.js +++ b/src/angular/pages/main/p3xr-main-key.js @@ -73,21 +73,10 @@ p3xr.ng.component('p3xrMainKey', { this.ttlParsed = ' ' + duration */ - let language - switch(p3xr.settings.language.current) { - case 'zn': - language = 'zh_CN' - break; - case 'ru': - language = 'ru' - break; - default: - language = 'en' - break; - } + this.ttlParsed = ' ' + humanizeDuration(this.response.ttl * 1000, { - language: language, + language: p3xr.settings.getHumanizeDurationLanguage(), delimiter: ' ', }) const counterEl = document.getElementById('p3xr-main-key-ttl-counter') @@ -240,8 +229,7 @@ p3xr.ng.component('p3xrMainKey', { if (length < 1024 || length === undefined) { return '' } - const prettyBytes = require('pretty-bytes'); - return '(' + prettyBytes(length) + ')' + return '(' + p3xr.settings.prettyBytes(length) + ')' } this.refresh = async (options) => { diff --git a/src/core/settings.js b/src/core/settings.js index 57d8ece..0cfa6ac 100644 --- a/src/core/settings.js +++ b/src/core/settings.js @@ -1,7 +1,29 @@ const cookieExpiry = new Date() cookieExpiry.setFullYear(cookieExpiry.getFullYear() + 5) +const prettyBytes = require('pretty-bytes') + p3xr.settings = { + prettyBytes: (value) => { + return prettyBytes(value, { + locale: p3xr.settings.language.current + }) + }, + getHumanizeDurationLanguage: () => { + let language + switch(p3xr.settings.language.current) { + case 'zn': + language = 'zh_CN' + break; + case 'ru': + language = 'ru' + break; + default: + language = 'en' + break; + } + return language + }, maxLightKeysCount: 110000, // maxLightKeysCount: 1, resizeMinWidth: 350, @@ -59,7 +81,7 @@ p3xr.settings = { }, pageCount: 50, maxValueDisplay: 1024, - maxValueAsBuffer: 512 * 1024, + maxValueAsBuffer: 1000 * 256, maxValueDisplaySetting: { default: 1024, cookieName: 'p3xr-main-treecontrol-max-value-display' diff --git a/src/strings/en/strings.js b/src/strings/en/strings.js index 24f081d..64ac333 100644 --- a/src/strings/en/strings.js +++ b/src/strings/en/strings.js @@ -147,7 +147,7 @@ const strings = { sshPrivateKey: 'SSH private key', }, - isBuffer: "[object ArrayBuffer] means that the value is binary data or the value is bigger than 0.5MB", + isBuffer: (opts) => `[object ArrayBuffer] means that the value is binary data or the value is bigger than ${opts.maxValueAsBuffer}`, streamValue: `Stream field and value is a oneliner. Eg.: field1 value1 "field 2" "value 2"`, streamTimestampId: `'*' means auto generated or the specification as -`, unableToLoadKey: ({ key }) => { diff --git a/src/strings/ru/strings.js b/src/strings/ru/strings.js index 07c69d0..adb7749 100644 --- a/src/strings/ru/strings.js +++ b/src/strings/ru/strings.js @@ -149,7 +149,7 @@ const strings = { sshPassword: 'Пароль SSH', sshPrivateKey: 'Приватный ключ SSH', }, - isBuffer: "[object ArrayBuffer] означает, что значение представляет собой двоичный буфер или значение превышает 0.5 МБ.", + isBuffer: (opts) => `[object ArrayBuffer] означает, что значение представляет собой двоичный буфер или значение превышает ${opts.maxValueAsBuffer}`, streamValue: `Поле и значение потока это однополосник. Например: поле1 значение1 "поле 2" "значение 2"`, streamTimestampId: `'*' означает автогенерацию или определяется как -`, unableToLoadKey: ({ key }) => { diff --git a/src/strings/zn/strings.js b/src/strings/zn/strings.js index 68d588a..e2f6a6f 100644 --- a/src/strings/zn/strings.js +++ b/src/strings/zn/strings.js @@ -139,7 +139,7 @@ const strings = { sshPassword: 'SSH密码', sshPrivateKey: 'SSH 私钥', }, - isBuffer: "[object ArrayBuffer] 表示該值是二進位緩衝區或該值大於 0.5MB", + isBuffer: (opts) => `[object ArrayBuffer] 表示該值是二進位緩衝區或該值大於 ${opts.maxValueAsBuffer}`, streamValue: `流字段和值是唯一的。 例如:field1 value1 "field 2" "value 2"`, streamTimestampId: `'*'表示自动生成或指定为-`, unableToLoadKey: ({ key }) => {