ydb-embedded-ui 1.8.4 → 1.8.7

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.8.7](https://github.com/ydb-platform/ydb-embedded-ui/compare/v1.8.6...v1.8.7) (2022-07-18)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * **Preview:** sort numbers as numbers, not string ([6c42a62](https://github.com/ydb-platform/ydb-embedded-ui/commit/6c42a62d077fcb9419ceb680906d4cef78a0134f))
9
+
10
+ ## [1.8.6](https://github.com/ydb-platform/ydb-embedded-ui/compare/v1.8.5...v1.8.6) (2022-07-14)
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * **Tenant:** fix switching between groups and nodes on storage tab ([6923885](https://github.com/ydb-platform/ydb-embedded-ui/commit/6923885336fa21ac985879e41685137adbf8159a))
16
+
17
+ ## [1.8.5](https://github.com/ydb-platform/ydb-embedded-ui/compare/v1.8.4...v1.8.5) (2022-07-11)
18
+
19
+
20
+ ### Bug Fixes
21
+
22
+ * **AsideNavigation:** aside header is compact by default ([aa3ad03](https://github.com/ydb-platform/ydb-embedded-ui/commit/aa3ad033fc6b62e6f2ee595e266343e67e764ec6))
23
+
3
24
  ## [1.8.4](https://github.com/ydb-platform/ydb-embedded-ui/compare/v1.8.3...v1.8.4) (2022-07-11)
4
25
 
5
26
 
@@ -3,7 +3,7 @@ import {connect} from 'react-redux';
3
3
  import PropTypes from 'prop-types';
4
4
 
5
5
  import {configure as configureUiKit} from '@yandex-cloud/uikit';
6
- import {i18n as YDBComponentsI18N} from 'ydb-ui-components';
6
+ import {configure as configureYdbUiComponents} from 'ydb-ui-components';
7
7
  import {i18n, Lang} from '../../utils/i18n';
8
8
 
9
9
  import ContentWrapper, {Content} from './Content';
@@ -27,10 +27,8 @@ class App extends React.Component {
27
27
  constructor(props) {
28
28
  super(props);
29
29
  i18n.setLang(Lang.En);
30
- YDBComponentsI18N.setLang(Lang.En);
31
- configureUiKit({
32
- lang: Lang.En,
33
- });
30
+ configureYdbUiComponents({lang: Lang.En});
31
+ configureUiKit({lang: Lang.En});
34
32
  }
35
33
 
36
34
  componentDidMount() {
@@ -189,6 +189,7 @@ function AsideNavigation(props: AsideNavigationProps) {
189
189
  onLogoIconClick={() => history.push('/')}
190
190
  menuItems={menuItems}
191
191
  settings={<UserSettings />}
192
+ initIsCompact
192
193
  className={b()}
193
194
  renderContent={() => props.children}
194
195
  renderFooter={({isCompact, asideRef}) => (
@@ -115,7 +115,9 @@ class Storage extends React.Component {
115
115
  filter: FILTER_OPTIONS[visibleEntities],
116
116
  type: storageType,
117
117
  });
118
+ };
118
119
 
120
+ const restartAutorefresh = () => {
119
121
  this.autofetcher.stop();
120
122
  this.autofetcher.start();
121
123
  this.autofetcher.fetch(() =>
@@ -131,14 +133,15 @@ class Storage extends React.Component {
131
133
  }
132
134
  if (database && autorefresh && !prevProps.autorefresh) {
133
135
  startFetch();
136
+ restartAutorefresh();
134
137
  }
135
138
 
136
- if (
137
- (storageType !== prevProps.storageType ||
138
- visibleEntities !== prevProps.visibleEntities) &&
139
- (!database || (database && autorefresh))
140
- ) {
139
+ if (storageType !== prevProps.storageType || visibleEntities !== prevProps.visibleEntities) {
141
140
  startFetch();
141
+
142
+ if (!database || (database && autorefresh)) {
143
+ restartAutorefresh();
144
+ }
142
145
  }
143
146
  }
144
147
 
@@ -12,6 +12,7 @@ import Fullscreen from '../../../components/Fullscreen/Fullscreen';
12
12
  import {sendQuery, setQueryOptions} from '../../../store/reducers/preview';
13
13
  import {showTooltip, hideTooltip} from '../../../store/reducers/tooltip';
14
14
  import {prepareQueryError, prepareQueryResponse} from '../../../utils/index';
15
+ import {isNumeric} from '../../../utils/utils';
15
16
 
16
17
  import {isTableType} from '../utils/schema';
17
18
  import {AutoFetcher} from '../../../utils/autofetcher';
@@ -127,6 +128,8 @@ class Preview extends React.Component {
127
128
  if (data && data.length > 0) {
128
129
  columns = Object.keys(data[0]).map((key) => ({
129
130
  name: key,
131
+ align: isNumeric(data[0][key]) ? DataTable.RIGHT : DataTable.LEFT,
132
+ sortAccessor: (row) => isNumeric(row[key]) ? Number(row[key]) : row[key],
130
133
  render: ({value}) => {
131
134
  return (
132
135
  <span
@@ -81,4 +81,11 @@ export function pad9(val) {
81
81
  result = "0" + result;
82
82
  }
83
83
  return result;
84
- }
84
+ }
85
+
86
+ export function isNumeric(value) {
87
+ // need both isNaN and isNaN(parseFloat):
88
+ // - isNaN treats true/false/''/etc. as numbers, parseFloat fixes this
89
+ // - parseFloat treats '123qwe' as number, isNaN fixes this
90
+ return !isNaN(value) && !isNaN(parseFloat(value));
91
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ydb-embedded-ui",
3
- "version": "1.8.4",
3
+ "version": "1.8.7",
4
4
  "files": [
5
5
  "dist"
6
6
  ],
@@ -40,7 +40,7 @@
40
40
  "reselect": "4.0.0",
41
41
  "sass": "1.32.8",
42
42
  "web-vitals": "1.1.2",
43
- "ydb-ui-components": "2.2.0"
43
+ "ydb-ui-components": "2.3.0"
44
44
  },
45
45
  "scripts": {
46
46
  "start": "react-app-rewired start",