Skip to content

Commit

Permalink
Merge branch 'master' into development
Browse files Browse the repository at this point in the history
  • Loading branch information
ericenns committed Jun 1, 2022
2 parents c84316d + 8208ca1 commit 4bc7e96
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 783 deletions.
795 changes: 37 additions & 758 deletions CHANGELOG.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<groupId>ca.corefacility.bioinformatics</groupId>
<artifactId>irida</artifactId>
<packaging>war</packaging>
<version>22.09-SNAPSHOT</version>
<version>22.07-SNAPSHOT</version>
<name>irida</name>
<url>http://www.irida.ca</url>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.3.xsd">

<changeSet id="user-account-project-subscription" author="katherine">
<validCheckSum>8:e75125f4b2af1759f21078bafe3b8ed9</validCheckSum>
<createTable tableName="project_subscription">
<column name="id" type="bigint(20)" autoIncrement="true">
<constraints primaryKey="true" nullable="false"/>
Expand Down Expand Up @@ -57,7 +58,7 @@
INSERT INTO project_subscription (project_id, user_id, email_subscription, created_date)
SELECT project_id, user_id, IF(email_subscription=b'1', 1, 0), now() FROM project_user
UNION
SELECT p.project_id, m.user_id, 0, now() from user_group_member m LEFT JOIN user_group_project p ON
SELECT p.project_id, m.user_id, 0, now() from user_group_member m INNER JOIN user_group_project p ON
m.group_id = p.user_group_id;
</sql>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import { Avatar, Button, List, Tooltip } from "antd";
import React from "react";
import { useDispatch } from "react-redux";
import { Avatar, Button, List, Tooltip } from "antd";
import { green6 } from "../../../styles/colors";
import { IconLocked, IconUnlocked } from "../../../components/icons/Icons";
import { SampleDetailViewer } from "../../../components/samples/SampleDetailViewer";
import {
SampleDetailViewer
} from "../../../components/samples/SampleDetailViewer";
import { green6 } from "../../../styles/colors";
import { removeSample } from "./shareSlice";

/**
* Render a list item for the samples to be shared with another project.
Expand Down
21 changes: 8 additions & 13 deletions src/main/webapp/resources/js/pages/projects/share/ShareSamples.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,19 @@ import { updatedLocked, updateMoveSamples } from "./shareSlice";
*/
export function ShareSamples({ samples = [] }) {
const dispatch = useDispatch();
const { associated, originalSamples, locked, remove, currentProject } =
useSelector((state) => state.shareReducer);

const SHOW_SAMPLES = samples.length > 0;
const SHOW_NO_SAMPLES_WARNING = samples.length === 0;
const SHOW_SOME_SAMPLES_WARNING =
SHOW_SAMPLES && samples.length < originalSamples.length;
const SHOW_ASSOCIATED = SHOW_SAMPLES && associated.length > 0;
const { associated, samples: originalSamples, locked, remove } = useSelector(
(state) => state.shareReducer
);

return (
<Space direction="vertical" style={{ width: `100%` }}>
<Typography.Title level={5}>
{i18n("ShareSamplesList.title")}
</Typography.Title>
{SHOW_ASSOCIATED && <ShareAssociated />}
{SHOW_SAMPLES && (
{associated.length > 0 && <ShareAssociated />}
{samples.length > 0 && (
<>
<SharedSamplesList list={samples} currentProject={currentProject} />
<SharedSamplesList list={samples} />
<Checkbox
className="t-move-checkbox"
checked={remove}
Expand All @@ -52,7 +47,7 @@ export function ShareSamples({ samples = [] }) {
</Checkbox>
</>
)}
{SHOW_NO_SAMPLES_WARNING && (
{samples.length === 0 && (
<Alert
type="warning"
className="t-no-sample-warning"
Expand All @@ -61,7 +56,7 @@ export function ShareSamples({ samples = [] }) {
description={i18n("ShareSamples.no-samples.description")}
/>
)}
{SHOW_SOME_SAMPLES_WARNING && (
{originalSamples.length - samples.length > 0 && (
<Alert
className="t-same-samples-warning"
type="info"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { List } from "antd";
import { sample } from "lodash";
import React from "react";
import { FixedSizeList as VList } from "react-window";
import ShareSamplesListItem from "./ShareSampleListItem";
Expand All @@ -10,7 +9,7 @@ import ShareSamplesListItem from "./ShareSampleListItem";
* @returns {JSX.Element}
* @constructor
*/
export function SharedSamplesList({ list = [], currentProject }) {
export function SharedSamplesList({ list = [] }) {
const Row = ({ index, style }) => {
const sample = list[index];

Expand Down
12 changes: 7 additions & 5 deletions src/main/webapp/resources/js/pages/projects/share/shareSlice.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { createAction, createSlice } from "@reduxjs/toolkit";
import { compareRestrictionLevels } from "../../../utilities/restriction-utilities";
import {
compareRestrictionLevels
} from "../../../utilities/restriction-utilities";

/**
* Action to set the target project for the samples
Expand Down Expand Up @@ -83,8 +85,9 @@ const initialState = (() => {
return {};
}

const { samples: allSamples, projectId: currentProject } =
JSON.parse(stringData);
const { samples: allSamples, projectId: currentProject } = JSON.parse(
stringData
);
const samples = [];
const associated = [];
allSamples.forEach((sample) => {
Expand All @@ -96,7 +99,6 @@ const initialState = (() => {
});

return {
originalSamples: samples,
samples,
associated,
currentProject,
Expand All @@ -115,7 +117,7 @@ const shareSlice = createSlice({
});

builder.addCase(removeSample, (state, action) => {
state.originalSamples = state.originalSamples.filter(
state.samples = state.samples.filter(
(sample) => sample.id !== action.payload.sampleId
);
});
Expand Down

0 comments on commit 4bc7e96

Please sign in to comment.