-
+
diff --git a/src/Index/reduxer.jsx b/src/Index/reduxer.jsx
index 1dc3c19609..4fb90ba292 100644
--- a/src/Index/reduxer.jsx
+++ b/src/Index/reduxer.jsx
@@ -5,6 +5,7 @@ import { setActive } from '../Layout/reduxer';
import IndexBarChart from '../components/charts/IndexBarChart/.';
import IndexCounts from '../components/cards/IndexCounts/.';
import IndexButtonBar from '../components/IndexButtonBar';
+import Introduction from '../components/Introduction';
import { components } from '../params';
export const ReduxIndexBarChart = (() => {
@@ -61,3 +62,11 @@ export const ReduxIndexButtonBar = (() => {
return connect(mapStateToProps, mapDispatchToProps)(IndexButtonBar);
})();
+
+export const ReduxIntroduction = (() => {
+ const mapStateToProps = state => ({
+ userAuthMapping: state.userAuthMapping,
+ });
+
+ return connect(mapStateToProps)(Introduction);
+})();
diff --git a/src/Layout/reduxer.js b/src/Layout/reduxer.js
index a2a5517a33..a970d71ce1 100644
--- a/src/Layout/reduxer.js
+++ b/src/Layout/reduxer.js
@@ -43,6 +43,7 @@ export const ReduxTopBar = (() => {
topItems: components.topBar.items,
activeTab: state.bar.active,
user: state.user,
+ userAuthMapping: state.userAuthMapping,
isFullWidth: isPageFullScreen(state.bar.active),
});
diff --git a/src/QueryNode/QueryNode.jsx b/src/QueryNode/QueryNode.jsx
index 536f9532ee..90ba155671 100644
--- a/src/QueryNode/QueryNode.jsx
+++ b/src/QueryNode/QueryNode.jsx
@@ -5,8 +5,9 @@ import { jsonToString, getSubmitPath } from '../utils';
import Popup from '../components/Popup';
import QueryForm from './QueryForm';
import './QueryNode.less';
+import { useArboristUI } from '../configs';
-const Entity = ({ value, project, onUpdatePopup, onStoreNodeInfo, tabindexStart }) => {
+const Entity = ({ value, project, onUpdatePopup, onStoreNodeInfo, tabindexStart, showDelete }) => {
const onDelete = () => {
onStoreNodeInfo({ project, id: value.id }).then(
() => onUpdatePopup({ nodedelete_popup: true }),
@@ -20,7 +21,9 @@ const Entity = ({ value, project, onUpdatePopup, onStoreNodeInfo, tabindexStart
{value.submitter_id}
Download
View
-
Delete
+ {
+ showDelete ?
Delete : null
+ }
);
};
@@ -31,6 +34,7 @@ Entity.propTypes = {
tabindexStart: PropTypes.number.isRequired,
onUpdatePopup: PropTypes.func,
onStoreNodeInfo: PropTypes.func,
+ showDelete: PropTypes.bool.isRequired,
};
Entity.defaultProps = {
@@ -40,7 +44,7 @@ Entity.defaultProps = {
onSearchFormSubmit: null,
};
-const Entities = ({ value, project, onUpdatePopup, onStoreNodeInfo }) => (
+const Entities = ({ value, project, onUpdatePopup, onStoreNodeInfo, showDelete }) => (
{
value.map(
@@ -51,6 +55,7 @@ const Entities = ({ value, project, onUpdatePopup, onStoreNodeInfo }) => (
key={v.submitter_id}
value={v}
tabindexStart={i * 3}
+ showDelete={showDelete}
/>),
)
}
@@ -62,6 +67,7 @@ Entities.propTypes = {
project: PropTypes.string.isRequired,
onUpdatePopup: PropTypes.func,
onStoreNodeInfo: PropTypes.func,
+ showDelete: PropTypes.bool.isRequired,
};
Entities.defaultProps = {
@@ -188,6 +194,16 @@ class QueryNode extends React.Component {
return popup;
}
+ userHasDeleteOnProject = () => {
+ var split = this.props.params.project.split('-');
+ var program = split[0]
+ var project = split.slice(1).join('-')
+ var resourcePath = ["/programs", program, "projects", project].join('/')
+ var actions = this.props.userAuthMapping[resourcePath]
+
+ return actions !== undefined && actions.some(x => x["method"] === "delete")
+ }
+
render() {
const queryNodesList = this.props.queryNodes.search_status === 'succeed: 200' ?
Object.entries(this.props.queryNodes.search_result.data)
@@ -226,15 +242,23 @@ class QueryNode extends React.Component {
/>
most recent 20:
{ queryNodesList.map(
- value => (
- ),
+ value => {
+ var showDelete = true
+ if (useArboristUI) {
+ showDelete = this.userHasDeleteOnProject()
+ }
+ return (
+
+ )
+ }
)
}
@@ -253,6 +277,7 @@ QueryNode.propTypes = {
onClearDeleteSession: PropTypes.func.isRequired,
onDeleteNode: PropTypes.func.isRequired,
onStoreNodeInfo: PropTypes.func.isRequired,
+ userAuthMapping: PropTypes.object.isRequired,
};
QueryNode.defaultProps = {
diff --git a/src/QueryNode/ReduxQueryNode.js b/src/QueryNode/ReduxQueryNode.js
index 06ba39f0ba..e5e1441d56 100644
--- a/src/QueryNode/ReduxQueryNode.js
+++ b/src/QueryNode/ReduxQueryNode.js
@@ -117,6 +117,7 @@ const mapStateToProps = (state, ownProps) => {
ownProps,
queryNodes: state.queryNodes,
popups: Object.assign({}, state.popups),
+ userAuthMapping: state.userAuthMapping,
};
return result;
};
diff --git a/src/Submission/ProjectDashboard.jsx b/src/Submission/ProjectDashboard.jsx
index 542a47ca18..d58f50c567 100644
--- a/src/Submission/ProjectDashboard.jsx
+++ b/src/Submission/ProjectDashboard.jsx
@@ -1,6 +1,6 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types';
-import ProjectTable from '../components/tables/ProjectTable';
+import ReduxProjectTable from '../components/tables/reduxer';
import ReduxSubmissionHeader from './ReduxSubmissionHeader';
import './ProjectDashboard.less';
@@ -13,7 +13,11 @@ class ProjectDashboard extends Component {
Data Submission