ydb-embedded-ui 1.2.1 → 1.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ### [1.2.2](https://www.github.com/ydb-platform/ydb-embedded-ui/compare/v1.2.1...v1.2.2) (2022-05-04)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * code-review ([288fda3](https://www.github.com/ydb-platform/ydb-embedded-ui/commit/288fda3cd207908e9b5c0486c4d486c6f2e17dd4))
9
+ * reducer clusterInfo should not be used ([1cafcbf](https://www.github.com/ydb-platform/ydb-embedded-ui/commit/1cafcbfb15f668b100cf6628b540b7cd234f6024))
10
+
3
11
  ### [1.2.1](https://www.github.com/ydb-platform/ydb-embedded-ui/compare/v1.2.0...v1.2.1) (2022-04-27)
4
12
 
5
13
 
@@ -17,6 +17,8 @@ registerLanguages();
17
17
  class App extends React.Component {
18
18
  static propTypes = {
19
19
  isAuthenticated: PropTypes.bool,
20
+ singleClusterMode: PropTypes.bool,
21
+ clusterName: PropTypes.string,
20
22
  children: PropTypes.node,
21
23
  };
22
24
 
@@ -40,9 +42,10 @@ class App extends React.Component {
40
42
  }
41
43
 
42
44
  renderContentWithNavigation() {
45
+ const {singleClusterMode, clusterName} = this.props;
43
46
  return (
44
47
  <AsideNavigation>
45
- <Content singleClusterMode={this.props.singleClusterMode} />
48
+ <Content singleClusterMode={singleClusterMode} clusterName={clusterName} />
46
49
  <div id="fullscreen-root"></div>
47
50
  </AsideNavigation>
48
51
  );
@@ -58,6 +61,7 @@ function mapStateToProps(state) {
58
61
  isAuthenticated: state.authentication.isAuthenticated,
59
62
  internalUser: state.authentication.user,
60
63
  singleClusterMode: state.singleClusterMode,
64
+ clusterName: state.cluster.data?.Name,
61
65
  };
62
66
  }
63
67
 
@@ -59,7 +59,7 @@ export function Content(props) {
59
59
  };
60
60
  return (
61
61
  <React.Fragment>
62
- {!isClustersPage && <Header />}
62
+ {!isClustersPage && <Header clusterName={props.clusterName} />}
63
63
  <main className={b('main')}>{renderRoute()}</main>
64
64
  <ReduxTooltip />
65
65
  <AppIcons />
@@ -70,6 +70,7 @@ export function Content(props) {
70
70
  Content.propTypes = {
71
71
  singleClusterMode: PropTypes.bool,
72
72
  children: PropTypes.node,
73
+ clusterName: PropTypes.string,
73
74
  };
74
75
 
75
76
  function ContentWrapper(props) {
@@ -26,16 +26,16 @@ function ClusterName({name}: {name: string}) {
26
26
  );
27
27
  }
28
28
 
29
- function Header() {
29
+ interface HeaderProps {
30
+ clusterName: string
31
+ }
32
+
33
+ function Header({clusterName}: HeaderProps) {
30
34
  const dispatch = useDispatch();
31
35
  const {data: host}: {data: {ClusterName?: string}} = useSelector((state: any) => state.host);
32
36
  const {singleClusterMode, header}: {singleClusterMode: boolean; header: HeaderItemType[]} =
33
37
  useSelector((state: any) => state);
34
38
 
35
- const clusterName: string = useSelector(
36
- (state: any) => state.cluster.data?.Name || state.clusterInfo.title,
37
- );
38
-
39
39
  const location = useLocation();
40
40
  const history = useHistory();
41
41
 
@@ -20,7 +20,6 @@ import tablet from './tablet';
20
20
  import executeQuery from './executeQuery';
21
21
  import explainQuery from './explainQuery';
22
22
  import tabletsFilters from './tabletsFilters';
23
- import clusterInfo from './clusterInfo';
24
23
  import settings from './settings';
25
24
  import preview from './preview';
26
25
  import nodesList from './clusterNodes';
@@ -63,7 +62,6 @@ export const rootReducer = {
63
62
  explainQuery,
64
63
  tabletsFilters,
65
64
  heatmap,
66
- clusterInfo,
67
65
  settings,
68
66
  preview,
69
67
  nodesList,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ydb-embedded-ui",
3
- "version": "1.2.1",
3
+ "version": "1.2.2",
4
4
  "files": [
5
5
  "dist"
6
6
  ],
@@ -1,48 +0,0 @@
1
- import {createRequestActionTypes, createApiRequest} from '../utils';
2
- import '../../services/api';
3
-
4
- const FETCH_CLUSTER = createRequestActionTypes('cluster', 'FETCH_CLUSTER');
5
-
6
- const initialState = {loading: false};
7
-
8
- const clusterInfo = function (state = initialState, action) {
9
- switch (action.type) {
10
- case FETCH_CLUSTER.REQUEST: {
11
- return {
12
- ...state,
13
- loading: true,
14
- };
15
- }
16
- case FETCH_CLUSTER.SUCCESS: {
17
- const {data = {}} = action;
18
-
19
- return {
20
- ...state,
21
- ...data,
22
- loading: false,
23
- error: undefined,
24
- };
25
- }
26
- case FETCH_CLUSTER.FAILURE: {
27
- return {
28
- ...state,
29
- error: action.error,
30
- loading: false,
31
- };
32
- }
33
- default:
34
- return state;
35
- }
36
- };
37
-
38
- export function getCluster(name) {
39
- return createApiRequest({
40
- request: window.api.getClustersList(),
41
- actions: FETCH_CLUSTER,
42
- dataHandler: ({clusters = []}) => {
43
- return clusters.filter((item) => item.name === name)[0];
44
- },
45
- });
46
- }
47
-
48
- export default clusterInfo;