Skip to content

Commit

Permalink
#328: fixed project filter toolbar issue
Browse files Browse the repository at this point in the history
  • Loading branch information
yaxue1123 committed Jul 15, 2024
1 parent 03f43bd commit 53eca0d
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 12 deletions.
7 changes: 5 additions & 2 deletions src/components/Experiment/Projects.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@ class Projects extends React.Component {
const communities = [];
for (const s of selectedList) {
communities.push(s.name);
communities.push(`${s.name}:${portalData.communityMapping[s.name]}`);
if (portalData.communityMapping[s.name]) {
communities.push(`${s.name}:${portalData.communityMapping[s.name]}`);
}
}
return communities.toString();
}
Expand Down Expand Up @@ -161,7 +163,8 @@ class Projects extends React.Component {
? { ...el, isActive: true }
: { ...el, isActive: false }
),
currentPage: 1
currentPage: 1,
selectedList: []
}), () => {
this.reloadProjectsData();
});
Expand Down
1 change: 0 additions & 1 deletion src/components/Resource/SiteDetailPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ class SiteDetailPage extends React.Component {
const parsedObj1 = sitesParser(res1.data[0], sitesNameMapping.acronymToShortName);
const siteName = this.props.location.pathname.split("s/")[1];
const parsedObj2 = siteParserLevel2(res2.data[0], siteName, sitesNameMapping.acronymToShortName);
console.log(parsedObj2.hosts)
this.setState({
hosts: parsedObj2.hosts.filter(host => host.Site === siteName),
data: parsedObj1.parsedSites.filter(s => s.name === siteName)[0],
Expand Down
15 changes: 9 additions & 6 deletions src/pages/ProjectForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ const ToastMessageWithLink = ({projectId, message}) => (

class ProjectForm extends Form {
state = {
originalProject: { name: "", profile: { references: [] }},
data: {
uuid: "",
name: "",
Expand Down Expand Up @@ -166,7 +167,7 @@ class ProjectForm extends Form {
if(project.memberships && !project.memberships.is_creator &&
!project.memberships.is_member && !project.memberships.is_owner &&
!this.state.globalRoles.isFacilityOperator) {
this.setState({
this.setState({
data: project,
fabricMatrix: project.profile.references.length > 0 ? project.profile.references["fabric_matrix"] : "",
showSpinner: false,
Expand All @@ -178,7 +179,8 @@ class ProjectForm extends Form {
});
} else {
// user is po/pm/pc or Facility Operator.
this.setState({
this.setState({
originalProject: project,
data: this.mapToViewModel(project),
fabricMatrix: project.profile.references.length > 0 ? project.profile.references[0].url : "",
projectFunding: project.project_funding,
Expand Down Expand Up @@ -295,8 +297,8 @@ class ProjectForm extends Form {
}
});

const { data: project, projectFunding, communities, fabricMatrix } = this.state;
const originalMatrix = project.profile.references.length > 0 ? project.profile.references[0].url : "";
const { data: project, projectFunding, communities, fabricMatrix, originalProject } = this.state;
const originalMatrix = originalProject.profile.references.length > 0 ? originalProject.profile.references[0].url : "";
try {
await updateProject(project, this.parsePreferences());
await updateProjectFunding(project.uuid, projectFunding);
Expand Down Expand Up @@ -574,7 +576,8 @@ class ProjectForm extends Form {
volumes,
projectFunding,
communities,
fabricMatrix
fabricMatrix,
originalProject
} = this.state;

let canUpdate = !this.checkProjectExpiration(data.expired) &&
Expand Down Expand Up @@ -629,7 +632,7 @@ class ProjectForm extends Form {
return (
<div className="container">
<div className="d-flex flex-row justify-content-between">
<h1>{data.name}</h1>
<h1>{originalProject.name}</h1>
{
canUpdate ?
<div className="d-flex flex-row justify-content-end">
Expand Down
2 changes: 1 addition & 1 deletion src/services/projectService.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export function getProjects(type, offset, limit, searchQuery, searchSet) {
if (!searchQuery) {
return http.get(`${apiEndpoint}?offset=${offset}&limit=${limit}&sort_by=created_time&order_by=desc&person_uuid=${userID}`);
} else {
return http.get(`${apiEndpoint}?search=${searchQuery}&offset=${offset}&limit=${limit}&sort_by=created_time&order_by=desc&person_uuid=${userID}`);
return http.get(`${apiEndpoint}?search=${searchQuery}&offset=${offset}&limit=${limit}&sort_by=created_time&order_by=desc&person_uuid=${userID}&search_set=${searchSet}`);
}
} else if (type === "allProjects") {
if (!searchQuery) {
Expand Down
4 changes: 2 additions & 2 deletions src/styles/App.scss
Original file line number Diff line number Diff line change
Expand Up @@ -1244,11 +1244,11 @@ ul,
}

div:has(> #multiselectContainerReact) {
width: 95%;
width: 94%;
}

.project-search-toolbar .input-group-prepend {
width: 5% !important;
width: 6% !important;
}

.project-search-toolbar .input-group-prepend .dropdown-toggle {
Expand Down

0 comments on commit 53eca0d

Please sign in to comment.