From 62d6abe68eb950a753b08bdfd571483ce3beabff Mon Sep 17 00:00:00 2001 From: Jayasanka Date: Mon, 10 Jun 2019 13:39:10 +0530 Subject: [PATCH 1/5] Fix delete category issue --- .../manage/categories/ManageCategories.js | 24 ++++++++++--------- .../src/pages/dashboard/Dashboard.js | 18 +++++++------- .../src/pages/dashboard/manage/Manage.js | 2 +- 3 files changed, 24 insertions(+), 20 deletions(-) diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/manage/categories/ManageCategories.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/manage/categories/ManageCategories.js index d1d7ef41574..f4fa06b6c5e 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/manage/categories/ManageCategories.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/manage/categories/ManageCategories.js @@ -65,17 +65,19 @@ class ManageCategories extends React.Component { "Category Removed Successfully!", }); + + console.log("g"); + const {categories} = this.state; + const remainingElements = categories.filter(function (value) { + return value.categoryName !== id; + + }); + + this.setState({ - loading: false + loading: false, + categories: remainingElements }); - // this.setState({ - // categories: [...categories, ...tempElements], - // tempElements: [], - // inputVisible: false, - // inputValue: '', - // loading: false, - // isAddNewVisible: false - // }); } }).catch((error) => { @@ -135,12 +137,12 @@ class ManageCategories extends React.Component { }; renderTempElement = (category) => { - const {tempElements} = this.state; const tagElem = ( { + onClose={e=>{ e.preventDefault(); + const {tempElements} = this.state; const remainingElements = tempElements.filter(function (value) { return value.categoryName !== category.categoryName; diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/pages/dashboard/Dashboard.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/pages/dashboard/Dashboard.js index e32d5fff1b2..58f562f14e8 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/pages/dashboard/Dashboard.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/pages/dashboard/Dashboard.js @@ -4,9 +4,9 @@ import {Layout, Menu, Icon} from 'antd'; const {Header, Content, Footer} = Layout; import Logo from "../../../public/images/logo.svg"; -import {Link, NavLink} from "react-router-dom"; +import {BrowserRouter,Switch,Link, NavLink} from "react-router-dom"; import RouteWithSubRoutes from "../../components/RouteWithSubRoutes" -import {Switch, Redirect} from 'react-router' +import {Redirect} from 'react-router' import "../../App.css"; class Dashboard extends React.Component { @@ -41,13 +41,15 @@ class Dashboard extends React.Component { - - - {this.state.routes.map((route) => ( - - ))} + + + + {this.state.routes.map((route) => ( + + ))} - + +