ydb-embedded-ui 1.2.6 → 1.4.1

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,41 @@
1
1
  # Changelog
2
2
 
3
+ ### [1.4.1](https://github.com/ydb-platform/ydb-embedded-ui/compare/v1.4.0...v1.4.1) (2022-05-17)
4
+
5
+
6
+ ### UI Updates
7
+
8
+ * **Tenant:** add tenant name wrapper ([8176d28](https://github.com/ydb-platform/ydb-embedded-ui/commit/8176d28a5769b2b95d667ed960ad34d7a0d9bb4c))
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * **NodesTable:** align external link icon ([a379796](https://github.com/ydb-platform/ydb-embedded-ui/commit/a379796c6b8087f25f95ce3db4be33f18da71e04))
14
+
15
+ ## [1.4.0](https://github.com/ydb-platform/ydb-embedded-ui/compare/v1.3.0...v1.4.0) (2022-05-16)
16
+
17
+
18
+ ### Features
19
+
20
+ * **Tenant:** save initial tab preference ([7195d0f](https://github.com/ydb-platform/ydb-embedded-ui/commit/7195d0f7f5754c461555211515f80ea96464ca15))
21
+
22
+
23
+ ### UI Updtaes
24
+
25
+ * **NodesTable:** don't reserve space for icons next to node fqdn ([8fcf1b3](https://github.com/ydb-platform/ydb-embedded-ui/commit/8fcf1b3269dee7ada83d7c5abcf44ad004191851))
26
+
27
+
28
+ ### Bug Fixes
29
+
30
+ * **Tenant:** mapDispatchToProps types ([7dcaf56](https://github.com/ydb-platform/ydb-embedded-ui/commit/7dcaf561ec0c361d52d789b2ea3b1aba75339d83))
31
+
32
+ ## [1.3.0](https://www.github.com/ydb-platform/ydb-embedded-ui/compare/v1.2.6...v1.3.0) (2022-05-12)
33
+
34
+
35
+ ### Features
36
+
37
+ * **Storage:** red progress bars for unavailable disks ([17cf94d](https://www.github.com/ydb-platform/ydb-embedded-ui/commit/17cf94defb23681bc62c768d3282eed00c7e974d))
38
+
3
39
  ### [1.2.6](https://www.github.com/ydb-platform/ydb-embedded-ui/compare/v1.2.5...v1.2.6) (2022-05-05)
4
40
 
5
41
 
package/README.md CHANGED
@@ -8,7 +8,7 @@ Local viewer for YDB clusters
8
8
 
9
9
  1) Run on a machine with Docker installed:
10
10
  ```
11
- docker pull cr.yandex/yc/yandex-docker-local-ydb`
11
+ docker pull cr.yandex/yc/yandex-docker-local-ydb
12
12
  docker run --hostname localhost -e YDB_ALLOW_ORIGIN="http://localhost:3000" -dp 2135:2135 -dp 8765:8765 cr.yandex/yc/yandex-docker-local-ydb
13
13
  ```
14
14
  2) Run the frontend app in the development mode, via invoking `npm run dev`
@@ -9,8 +9,7 @@
9
9
  line-height: var(--yc-text-body2-line-height);
10
10
 
11
11
  &__clipboard-button {
12
- display: flex;
13
- visibility: hidden;
12
+ display: none;
14
13
  align-items: center;
15
14
 
16
15
  margin-left: 8px;
@@ -22,7 +21,7 @@
22
21
  }
23
22
 
24
23
  &_visible {
25
- visibility: visible;
24
+ display: flex;
26
25
  }
27
26
  }
28
27
 
@@ -144,7 +144,7 @@ body,
144
144
  }
145
145
 
146
146
  .data-table__row:hover .entity-status__clipboard-button {
147
- visibility: visible;
147
+ display: flex;
148
148
  }
149
149
 
150
150
  .no-problem {
@@ -1,25 +1,26 @@
1
1
  .kv-nodes {
2
+ &__host-name-wrapper {
3
+ display: flex;
4
+ }
5
+
2
6
  &__external-button {
3
- display: inline-flex;
4
- visibility: hidden;
7
+ display: none;
5
8
  align-items: center;
6
9
 
7
10
  margin-left: 4px;
8
11
 
9
- transform: translateY(-1px);
10
-
11
12
  .yc-button__text {
12
13
  margin: 0 4px;
13
14
  }
14
15
  }
15
16
 
16
17
  &__host-name {
17
- width: 90%;
18
+ overflow: hidden;
18
19
  }
19
20
  }
20
21
 
21
22
  .data-table__row:hover {
22
23
  .kv-nodes__external-button {
23
- visibility: visible;
24
+ display: inline-flex;
24
25
  }
25
26
  }
@@ -13,6 +13,8 @@ import DiskStateProgressBar, {
13
13
  } from '../DiskStateProgressBar/DiskStateProgressBar';
14
14
  import {STRUCTURE} from '../../Node/NodePages';
15
15
 
16
+ import {colorSeverity, NOT_AVAILABLE_SEVERITY} from '../utils';
17
+
16
18
  import './Pdisk.scss';
17
19
 
18
20
  const b = cn('pdisk-storage');
@@ -34,14 +36,6 @@ const stateSeverity = {
34
36
  DeviceIoError: 5,
35
37
  };
36
38
 
37
- const colorSeverity = {
38
- Grey: 0,
39
- Green: 1,
40
- Blue: 2,
41
- Yellow: 3,
42
- Orange: 4,
43
- Red: 5,
44
- };
45
39
  type PDiskState = keyof typeof stateSeverity;
46
40
 
47
41
  interface PDiskProps {
@@ -57,7 +51,7 @@ interface PDiskProps {
57
51
  }
58
52
 
59
53
  const getStateSeverity = (pDiskState?: PDiskState) => {
60
- return pDiskState ? stateSeverity[pDiskState] : colorSeverity.Grey;
54
+ return pDiskState ? stateSeverity[pDiskState] : NOT_AVAILABLE_SEVERITY;
61
55
  };
62
56
 
63
57
  function Pdisk(props: PDiskProps) {
@@ -12,6 +12,8 @@ import DiskStateProgressBar, {
12
12
  } from '../DiskStateProgressBar/DiskStateProgressBar';
13
13
  import {STRUCTURE} from '../../Node/NodePages';
14
14
 
15
+ import {colorSeverity, NOT_AVAILABLE_SEVERITY} from '../utils';
16
+
15
17
  import './Vdisk.scss';
16
18
 
17
19
  const b = cn('vdisk-storage');
@@ -34,17 +36,8 @@ const stateSeverity = {
34
36
  OK: 1,
35
37
  };
36
38
 
37
- const colorSeverity = {
38
- Grey: 0,
39
- Green: 1,
40
- Blue: 2,
41
- Yellow: 3,
42
- Orange: 4,
43
- Red: 5,
44
- };
45
-
46
39
  const getStateSeverity = (vDiskState) => {
47
- return stateSeverity[vDiskState] ?? colorSeverity.Grey;
40
+ return stateSeverity[vDiskState] ?? NOT_AVAILABLE_SEVERITY;
48
41
  };
49
42
 
50
43
  const getColorSeverity = (color) => {
@@ -57,15 +50,25 @@ function Vdisk(props) {
57
50
 
58
51
  const anchor = useRef();
59
52
 
53
+ // determine disk status severity
60
54
  useEffect(() => {
61
55
  const {DiskSpace, VDiskState, FrontQueues, Replicated} = props;
56
+
57
+ // if the disk is not available, this determines its status severity regardless of other features
58
+ if (!VDiskState) {
59
+ setSeverity(NOT_AVAILABLE_SEVERITY);
60
+ return;
61
+ }
62
+
62
63
  const DiskSpaceSeverity = getColorSeverity(DiskSpace);
63
64
  const VDiskSpaceSeverity = getStateSeverity(VDiskState);
64
65
  const FrontQueuesSeverity = Math.min(colorSeverity.Orange, getColorSeverity(FrontQueues));
66
+
65
67
  let newSeverity = Math.max(DiskSpaceSeverity, VDiskSpaceSeverity, FrontQueuesSeverity);
66
68
  if (!Replicated && newSeverity === colorSeverity.Green) {
67
69
  newSeverity = colorSeverity.Blue;
68
70
  }
71
+
69
72
  setSeverity(newSeverity);
70
73
  }, [props.VDiskState, props.DiskSpace, props.FrontQueues, props.Replicated]);
71
74
 
@@ -0,0 +1,10 @@
1
+ export const colorSeverity = {
2
+ Grey: 0,
3
+ Green: 1,
4
+ Blue: 2,
5
+ Yellow: 3,
6
+ Orange: 4,
7
+ Red: 5,
8
+ };
9
+
10
+ export const NOT_AVAILABLE_SEVERITY = colorSeverity.Red;
@@ -0,0 +1 @@
1
+ export * from './constants';
@@ -1,3 +1,4 @@
1
+ import {connect} from 'react-redux';
1
2
  import {Link} from 'react-router-dom';
2
3
  import cn from 'bem-cn-lite';
3
4
  import {useLocation} from 'react-router';
@@ -11,6 +12,8 @@ import Diagnostics from '../Diagnostics/Diagnostics';
11
12
 
12
13
  import {TenantGeneralTabsIds, TenantTabsGroups, TENANT_GENERAL_TABS} from '../TenantPages';
13
14
  import routes, {createHref} from '../../../routes';
15
+ import {setSettingValue} from '../../../store/reducers/settings';
16
+ import {TENANT_INITIAL_TAB_KEY} from '../../../utils/constants';
14
17
 
15
18
  import './ObjectGeneral.scss';
16
19
 
@@ -20,6 +23,7 @@ interface ObjectGeneralProps {
20
23
  type: string;
21
24
  additionalTenantInfo?: any;
22
25
  additionalNodesInfo?: any;
26
+ setSettingValue: (name: string, value: string) => void;
23
27
  }
24
28
 
25
29
  function ObjectGeneral(props: ObjectGeneralProps) {
@@ -63,6 +67,7 @@ function ObjectGeneral(props: ObjectGeneralProps) {
63
67
  );
64
68
  }}
65
69
  allowNotSelected
70
+ onSelectTab={(id) => props.setSettingValue(TENANT_INITIAL_TAB_KEY, id)}
66
71
  />
67
72
  </div>
68
73
  );
@@ -101,4 +106,8 @@ function ObjectGeneral(props: ObjectGeneralProps) {
101
106
  return renderContent();
102
107
  }
103
108
 
104
- export default ObjectGeneral;
109
+ const mapDispatchToProps = {
110
+ setSettingValue,
111
+ };
112
+
113
+ export default connect(null, mapDispatchToProps)(ObjectGeneral);
@@ -17,9 +17,9 @@ import routes, {CLUSTER_PAGES, createHref} from '../../routes';
17
17
  import {formatCPU, formatBytesToGigabyte} from '../../utils';
18
18
  import {hideTooltip, showTooltip} from '../../store/reducers/tooltip';
19
19
  import {withSearch} from '../../HOCS';
20
- import {ALL, DEFAULT_TABLE_SETTINGS} from '../../utils/constants';
20
+ import {ALL, DEFAULT_TABLE_SETTINGS, TENANT_INITIAL_TAB_KEY} from '../../utils/constants';
21
21
  import {getTenantsInfo} from '../../store/reducers/tenants';
22
- import {changeFilter} from '../../store/reducers/settings';
22
+ import {changeFilter, getSettingValue} from '../../store/reducers/settings';
23
23
  import {setHeader} from '../../store/reducers/header';
24
24
 
25
25
  import {clusterName} from '../../store';
@@ -119,6 +119,7 @@ class Tenants extends React.Component {
119
119
  filter,
120
120
  handleSearchQuery,
121
121
  additionalTenantsInfo = {},
122
+ savedTenantInitialTab,
122
123
  } = this.props;
123
124
 
124
125
  const filteredTenantsBySearch = tenants.filter(
@@ -129,6 +130,9 @@ class Tenants extends React.Component {
129
130
  );
130
131
  const filteredTenants = Tenants.filterTenants(filteredTenantsBySearch, filter);
131
132
 
133
+ const initialTenantGeneralTab = savedTenantInitialTab || TENANT_GENERAL_TABS[0].id;
134
+ const initialTenantInfoTab = TENANT_INFO_TABS[0].id;
135
+
132
136
  const columns = [
133
137
  {
134
138
  name: 'Name',
@@ -140,7 +144,7 @@ class Tenants extends React.Component {
140
144
  : undefined;
141
145
  const isExternalLink = Boolean(backend);
142
146
  return (
143
- <React.Fragment>
147
+ <div className={b('name-wrapper')}>
144
148
  <EntityStatus
145
149
  externalLink={isExternalLink}
146
150
  className={b('name')}
@@ -150,12 +154,12 @@ class Tenants extends React.Component {
150
154
  path={createHref(routes.tenant, undefined, {
151
155
  name: value,
152
156
  backend: tenantBackend,
153
- [TenantTabsGroups.info]: TENANT_INFO_TABS[0].id,
154
- [TenantTabsGroups.general]: TENANT_GENERAL_TABS[0].id,
157
+ [TenantTabsGroups.info]: initialTenantInfoTab,
158
+ [TenantTabsGroups.general]: initialTenantGeneralTab,
155
159
  })}
156
160
  />
157
161
  {additionalTenantsInfo.name && additionalTenantsInfo.name(value, row)}
158
- </React.Fragment>
162
+ </div>
159
163
  );
160
164
  },
161
165
  width: 440,
@@ -347,6 +351,7 @@ const mapStateToProps = (state) => {
347
351
  loading,
348
352
  error,
349
353
  filter: state.settings.problemFilter,
354
+ savedTenantInitialTab: getSettingValue(state, TENANT_INITIAL_TAB_KEY),
350
355
  };
351
356
  };
352
357
 
@@ -54,7 +54,13 @@
54
54
  .data-table__row:hover &__type-button {
55
55
  visibility: visible;
56
56
  }
57
+
58
+ &__name-wrapper {
59
+ display: flex;
60
+ align-items: center;
61
+ }
62
+
57
63
  &__name {
58
- max-width: 90%;
64
+ overflow: hidden;
59
65
  }
60
66
  }
@@ -1,4 +1,4 @@
1
- import {ALL, defaultUserSettings, SAVED_QUERIES_KEY, THEME_KEY} from '../../utils/constants';
1
+ import {ALL, defaultUserSettings, SAVED_QUERIES_KEY, THEME_KEY, TENANT_INITIAL_TAB_KEY} from '../../utils/constants';
2
2
  import '../../services/api';
3
3
  import {getValueFromLS} from '../../utils/utils';
4
4
 
@@ -13,6 +13,9 @@ const theme = window.web_version
13
13
  const savedQueries = window.web_version
14
14
  ? userSettings[SAVED_QUERIES_KEY]
15
15
  : getValueFromLS(SAVED_QUERIES_KEY, '[]');
16
+ const savedTenantGeneralTab = window.web_version
17
+ ? userSettings[TENANT_INITIAL_TAB_KEY]
18
+ : getValueFromLS(TENANT_INITIAL_TAB_KEY);
16
19
 
17
20
  export const initialState = {
18
21
  problemFilter: ALL,
@@ -21,6 +24,7 @@ export const initialState = {
21
24
  ...userSettings,
22
25
  theme,
23
26
  [SAVED_QUERIES_KEY]: savedQueries,
27
+ [TENANT_INITIAL_TAB_KEY]: savedTenantGeneralTab,
24
28
  },
25
29
  systemSettings,
26
30
  };
@@ -137,3 +137,5 @@ export const DEFAULT_TABLE_SETTINGS = {
137
137
  dynamicRender: true,
138
138
  highlightRows: true,
139
139
  };
140
+
141
+ export const TENANT_INITIAL_TAB_KEY = 'saved_tenant_initial_tab';
@@ -31,7 +31,7 @@ export function getNodesColumns({showTooltip, hideTooltip, tabletsPath, getNodeR
31
31
  return <span>—</span>;
32
32
  }
33
33
  return (
34
- <React.Fragment>
34
+ <div className={b('host-name-wrapper')}>
35
35
  <EntityStatus
36
36
  name={row.Host}
37
37
  status={row.Overall}
@@ -44,7 +44,7 @@ export function getNodesColumns({showTooltip, hideTooltip, tabletsPath, getNodeR
44
44
  <Icon name="external" />
45
45
  </Button>
46
46
  )}
47
- </React.Fragment>
47
+ </div>
48
48
  );
49
49
  },
50
50
  width: '350px',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ydb-embedded-ui",
3
- "version": "1.2.6",
3
+ "version": "1.4.1",
4
4
  "files": [
5
5
  "dist"
6
6
  ],