From 0f914097db792900366f78213debf8125dfd7a8c Mon Sep 17 00:00:00 2001 From: dhiraj0911 Date: Sun, 10 Sep 2023 02:24:35 +0530 Subject: [PATCH 1/2] Refactor /management/index.js to functional component Signed-off-by: dhiraj0911 --- ui/package-lock.json | 4 ++-- ui/pages/index.js | 30 ++++++++++++++---------------- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/ui/package-lock.json b/ui/package-lock.json index 5e374f9702f..71753de70bb 100644 --- a/ui/package-lock.json +++ b/ui/package-lock.json @@ -50,7 +50,7 @@ "isomorphic-unfetch": "^4.0.2", "js-yaml": "^4.1.0", "jsonlint-mod": "^1.7.6", - "jss": "*", + "jss": "latest", "lodash": "^4.17.21", "minimist": ">=1.2.2", "mochawesome": "^7.1.3", @@ -63,7 +63,7 @@ "path-parse": "^1.0.7", "pluralize": "^8.0.0", "postcss": "^8.4.21", - "prop-types": "*", + "prop-types": "latest", "react": "^17.0.2", "react-big-calendar": "^0.35.0", "react-codemirror2": "^7.2.1", diff --git a/ui/pages/index.js b/ui/pages/index.js index fa81a07ce37..16d7b0bf24b 100644 --- a/ui/pages/index.js +++ b/ui/pages/index.js @@ -1,28 +1,26 @@ import { NoSsr } from "@material-ui/core"; import Head from 'next/head'; -import React from "react"; +import React, { useEffect } from "react"; import { connect } from "react-redux"; import { bindActionCreators } from 'redux'; import DashboardComponent from "../components/DashboardComponent"; import { getPath } from "../lib/path"; import { updatepagepath } from "../lib/store"; -class Index extends React.Component { - componentDidMount () { +function Index(props) { + useEffect(() => { console.log(`path: ${getPath()}`); - this.props.updatepagepath({ path : getPath() }); - } + props.updatepagepath({ path : getPath() }); + }, []); - render () { - return ( - - - Dashboard | Meshery - - - - ); - } + return ( + + + Dashboard | Meshery + + + + ); } const mapDispatchToProps = dispatch => ({ updatepagepath : bindActionCreators(updatepagepath, dispatch) }) @@ -30,4 +28,4 @@ const mapDispatchToProps = dispatch => ({ updatepagepath : bindActionCreators(up export default connect( null, mapDispatchToProps -)(Index); \ No newline at end of file +)(Index); From 4a3186b7228cc78e9d6dd9c3ceec8443de51c78a Mon Sep 17 00:00:00 2001 From: Dhiraj Bari <82199369+dhiraj0911@users.noreply.github.com> Date: Sun, 10 Sep 2023 20:08:40 +0530 Subject: [PATCH 2/2] Updated package-lock.json Signed-off-by: Dhiraj Bari <82199369+dhiraj0911@users.noreply.github.com> --- ui/package-lock.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ui/package-lock.json b/ui/package-lock.json index 71753de70bb..5e374f9702f 100644 --- a/ui/package-lock.json +++ b/ui/package-lock.json @@ -50,7 +50,7 @@ "isomorphic-unfetch": "^4.0.2", "js-yaml": "^4.1.0", "jsonlint-mod": "^1.7.6", - "jss": "latest", + "jss": "*", "lodash": "^4.17.21", "minimist": ">=1.2.2", "mochawesome": "^7.1.3", @@ -63,7 +63,7 @@ "path-parse": "^1.0.7", "pluralize": "^8.0.0", "postcss": "^8.4.21", - "prop-types": "latest", + "prop-types": "*", "react": "^17.0.2", "react-big-calendar": "^0.35.0", "react-codemirror2": "^7.2.1",