Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deploy v9.3.5 to production #3946

Merged
merged 38 commits into from
May 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
b4d0ee8
Bump version to 9.3.5
github-actions[bot] May 3, 2024
ed16d10
Bump @apollo/client from 3.10.1 to 3.10.2 in /app/assets
dependabot[bot] May 6, 2024
827412f
Bump @samvera/clover-iiif from 2.8.0 to 2.8.3 in /app/assets
dependabot[bot] May 6, 2024
dc23efa
Bump @testing-library/react from 15.0.6 to 15.0.7 in /app/assets
dependabot[bot] May 7, 2024
356742a
Bump react-icons from 5.1.0 to 5.2.1 in /app/assets
dependabot[bot] May 7, 2024
93e50ed
Bump sass from 1.75.0 to 1.77.0 in /app/assets
dependabot[bot] May 7, 2024
dd3ce60
Merge dependabot/npm_and_yarn/app/assets/deploy/staging/sass-1.77.0 i…
github-actions[bot] May 7, 2024
a2efbdc
Merge dependabot/npm_and_yarn/app/assets/deploy/staging/react-icons-5…
github-actions[bot] May 7, 2024
84fb958
Merge dependabot/npm_and_yarn/app/assets/deploy/staging/testing-libra…
github-actions[bot] May 7, 2024
c3dcb3d
Merge dependabot/npm_and_yarn/app/assets/deploy/staging/samvera/clove…
github-actions[bot] May 7, 2024
77d5516
Merge dependabot/npm_and_yarn/app/assets/deploy/staging/apollo/client…
github-actions[bot] May 7, 2024
42d22b0
Merge pull request #3954 from nulib/combined-dependencies
mbklein May 7, 2024
2fde5e0
Bump @testing-library/jest-dom from 6.4.2 to 6.4.5 in /app/assets
dependabot[bot] May 7, 2024
b36353f
Adds versioning to the pyramid and streaming buckets, with lifecycle …
bmquinn May 7, 2024
08358bb
Bump recharts from 2.12.6 to 2.12.7 in /app/assets
dependabot[bot] May 8, 2024
b6d2d7f
Bump glob from 10.3.12 to 10.3.15 in /app/assets
dependabot[bot] May 13, 2024
6b14ea2
Display work image toggle button for Video Filesets which have a post…
adamjarling May 10, 2024
d60488b
Merge pull request #3959 from nulib/4710-work-video-poster-fix
adamjarling May 13, 2024
fc745a4
Batch update of Terms of Use supported in the UI
adamjarling Feb 24, 2022
eee576d
Merge pull request #3962 from nulib/2074-terms-of-use-batch
adamjarling May 14, 2024
fb58936
Bump @apollo/client from 3.10.2 to 3.10.4 in /app/assets
dependabot[bot] May 15, 2024
02112a5
Bump phoenix_ecto from 4.5.1 to 4.6.1 in /app
dependabot[bot] May 17, 2024
4e2be46
Bump downshift from 9.0.4 to 9.0.6 in /app/assets
dependabot[bot] May 17, 2024
8d24778
Bump @graphql-codegen/client-preset from 4.2.5 to 4.2.6 in /app/assets
dependabot[bot] May 17, 2024
03f37e9
Bump sass from 1.77.0 to 1.77.2 in /app/assets
dependabot[bot] May 17, 2024
f1cc41b
Bump @nulib/dcapi-types from 2.1.0 to 2.3.1 in /app/assets
dependabot[bot] May 17, 2024
73391eb
Bump ecto_sql from 3.11.1 to 3.11.2 in /app
dependabot[bot] May 20, 2024
7b9ec2f
Merge dependabot/hex/app/deploy/staging/ecto_sql-3.11.2 into combined…
github-actions[bot] May 20, 2024
770b024
Merge dependabot/npm_and_yarn/app/assets/deploy/staging/nulib/dcapi-t…
github-actions[bot] May 20, 2024
5951aab
Merge dependabot/npm_and_yarn/app/assets/deploy/staging/sass-1.77.2 i…
github-actions[bot] May 20, 2024
e9600d2
Merge dependabot/npm_and_yarn/app/assets/deploy/staging/graphql-codeg…
github-actions[bot] May 20, 2024
06d695c
Merge dependabot/npm_and_yarn/app/assets/deploy/staging/downshift-9.0…
github-actions[bot] May 20, 2024
9b2e8de
Merge dependabot/hex/app/deploy/staging/phoenix_ecto-4.6.1 into combi…
github-actions[bot] May 20, 2024
70aba05
Merge dependabot/npm_and_yarn/app/assets/deploy/staging/apollo/client…
github-actions[bot] May 20, 2024
35b4eda
Merge dependabot/npm_and_yarn/app/assets/deploy/staging/glob-10.3.15 …
github-actions[bot] May 20, 2024
f220b0e
Merge dependabot/npm_and_yarn/app/assets/deploy/staging/recharts-2.12…
github-actions[bot] May 20, 2024
216ebde
Merge dependabot/npm_and_yarn/app/assets/deploy/staging/testing-libra…
github-actions[bot] May 20, 2024
f93301e
Merge pull request #3972 from nulib/combined-dependencies
mbklein May 20, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 22 additions & 11 deletions app/assets/js/components/BatchEdit/About/RightsMetadata.jsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import React from "react";
import PropTypes from "prop-types";
import UIFormBatchFieldArray from "@js/components/UI/Form/BatchFieldArray";
import UIFormSelect from "@js/components/UI/Form/Select";
import {
RIGHTS_METADATA,
getCodedTermSelectOptions,
} from "@js/services/metadata";

import PropTypes from "prop-types";
import React from "react";
import UIFormBatchFieldArray from "@js/components/UI/Form/BatchFieldArray";
import UIFormField from "@js/components/UI/Form/Field";
import UIFormSelect from "@js/components/UI/Form/Select";
import UIFormTextarea from "@js/components/UI/Form/Textarea";
import { useCodeLists } from "@js/context/code-list-context";

const BatchEditAboutRightsMetadata = ({ ...restProps }) => {
Expand All @@ -20,16 +22,15 @@ const BatchEditAboutRightsMetadata = ({ ...restProps }) => {
>
{RIGHTS_METADATA.map((item) => (
<div key={item.name} className="column is-half" data-testid={item.name}>
<UIFormBatchFieldArray
required
name={item.name}
label={item.label}
isTextarea={item.inputEl && item.inputEl === 'textarea'}
<UIFormBatchFieldArray
required
name={item.name}
label={item.label}
isTextarea={item.inputEl && item.inputEl === "textarea"}
/>
</div>
))}
<div className="column is-three-quarters">
{/* License */}
<UIFormField label="License">
<UIFormSelect
isReactHookForm
Expand All @@ -39,7 +40,7 @@ const BatchEditAboutRightsMetadata = ({ ...restProps }) => {
codeLists.licenseData
? getCodedTermSelectOptions(
codeLists.licenseData.codeList,
"LICENSE"
"LICENSE",
)
: []
}
Expand All @@ -48,6 +49,16 @@ const BatchEditAboutRightsMetadata = ({ ...restProps }) => {
/>
</UIFormField>
</div>

<div className="column is-half" data-testid="terms-of-use">
<UIFormField label="Terms of Use">
<UIFormTextarea
isReactHookForm
label="Terms of Use"
name="termsOfUse"
/>
</UIFormField>
</div>
</div>
);
};
Expand Down
15 changes: 10 additions & 5 deletions app/assets/js/components/BatchEdit/About/RightsMetadata.test.jsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import React from "react";
import { screen } from "@testing-library/react";
import {
renderWithRouterApollo,
withReactHookForm,
} from "../../../services/testing-helpers";
} from "@js/services/testing-helpers";

import BatchEditAboutRightsMetadata from "./RightsMetadata";
import { RIGHTS_METADATA } from "../../../services/metadata";
import { CodeListProvider } from "@js/context/code-list-context";
import { RIGHTS_METADATA } from "@js/services/metadata";
import React from "react";
import { allCodeListMocks } from "@js/components/Work/controlledVocabulary.gql.mock";
import { screen } from "@testing-library/react";

describe("BatchEditAboutRightsMetadata component", () => {
beforeEach(() => {
Expand All @@ -18,7 +19,7 @@ describe("BatchEditAboutRightsMetadata component", () => {
</CodeListProvider>,
{
mocks: allCodeListMocks,
}
},
);
});

Expand All @@ -32,4 +33,8 @@ describe("BatchEditAboutRightsMetadata component", () => {
}
expect(screen.getByTestId("license-select"));
});

it("renders Terms of Use field", async () => {
expect(screen.getByTestId("terms-of-use"));
});
});
9 changes: 5 additions & 4 deletions app/assets/js/components/BatchEdit/Tabs.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ export default function BatchEditTabs() {
}
});

["title"].forEach((item) => {
/** Single value fields */
["title", "termsOfUse"].forEach((item) => {
if (currentFormValues[item]) {
replaceItems.descriptive[item] = currentFormValues[item];
}
Expand Down Expand Up @@ -146,14 +147,14 @@ export default function BatchEditTabs() {
addItems.descriptive[term.name] = prepControlledTermInput(
term,
currentFormValues[term.name],
true
true,
);
}
// Include only active removals
if (batchState.removeItems && batchState.removeItems[term.name]) {
deleteReadyItems[term.name] = prepFacetKey(
term,
batchState.removeItems[term.name]
batchState.removeItems[term.name],
);
}
}
Expand All @@ -164,7 +165,7 @@ export default function BatchEditTabs() {
// Now we need to split this up between Descriptive and Administrative
let administrativeMultiValues = parseMultiValues(
multiValues,
"administrative"
"administrative",
);
let descriptiveMultiValues = parseMultiValues(multiValues, "descriptive");

Expand Down
19 changes: 10 additions & 9 deletions app/assets/js/components/Work/Fileset/List.test.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import React from "react";
import WorkFilesetList from "@js/components/Work/Fileset/List";
import { screen, waitFor } from "@testing-library/react";
import { mockFileSets } from "@js/mock-data/filesets";
import {
renderWithRouterApollo,
withReactBeautifulDND,
} from "@js/services/testing-helpers";
import { screen, waitFor } from "@testing-library/react";

import React from "react";
import WorkFilesetList from "@js/components/Work/Fileset/List";
import { WorkProvider } from "@js/context/work-context";
import { mockFileSets } from "@js/mock-data/filesets";
import { mockUser } from "@js/components/Auth/auth.gql.mock";
import useIsAuthorized from "@js/hooks/useIsAuthorized";
import { WorkProvider } from "@js/context/work-context";

jest.mock("@js/hooks/useIsAuthorized");
useIsAuthorized.mockReturnValue({
Expand All @@ -25,7 +26,7 @@ describe("WorkFilesetList component", () => {
isReordering: true,
})}
</WorkProvider>,
{}
{},
);
await waitFor(() => {
expect(screen.getByTestId("fileset-draggable-list"));
Expand All @@ -39,7 +40,7 @@ describe("WorkFilesetList component", () => {
fileSets: { access: mockFileSets, auxiliary: [] },
})}
</WorkProvider>,
{}
{},
);
await waitFor(() => {
expect(screen.getByTestId("fileset-list"));
Expand All @@ -53,10 +54,10 @@ describe("WorkFilesetList component", () => {
fileSets: { access: mockFileSets, auxiliary: [] },
})}
</WorkProvider>,
{}
{},
);
await waitFor(() => {
expect(screen.getAllByTestId("fileset-item")).toHaveLength(3);
expect(screen.getAllByTestId("fileset-item")).toHaveLength(4);
});
});
});
30 changes: 11 additions & 19 deletions app/assets/js/components/Work/Fileset/ListItem.jsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import { Button, Tag } from "@nulib/design-system";
import React, { useContext } from "react";
import { useWorkDispatch, useWorkState } from "@js/context/work-context";

import AuthDisplayAuthorized from "@js/components/Auth/DisplayAuthorized";
import { IIIFContext } from "@js/components/IIIF/IIIFProvider";
import { IconPlay } from "@js/components/Icon";
import PropTypes from "prop-types";
import React from "react";
import { Tag } from "@nulib/design-system";
import UIFormField from "@js/components/UI/Form/Field";
import UIFormInput from "@js/components/UI/Form/Input";
import UIFormTextarea from "@js/components/UI/Form/Textarea";
Expand All @@ -19,10 +17,9 @@ function WorkFilesetListItem({
isEditing,
workImageFilesetId,
}) {
const iiifServerUrl = useContext(IIIFContext);
const { id, coreMetadata } = fileSet;
const dispatch = useWorkDispatch();
const {isImage, isMedia, isPDF, isZip } = useFileSet();
const { hasRepresentativeImage, isImage, isMedia, isPDF, isZip } =
useFileSet();
const workContextState = useWorkState();

// Helper for media type file sets
Expand All @@ -46,25 +43,25 @@ function WorkFilesetListItem({
}
};

const placeholderImage = (fileSet) => {
const placeholderImage = (fileSet) => {
if (isMedia(fileSet)) {
return "/images/video-placeholder2.png";
} else if (isPDF(fileSet)) {
} else if (isPDF(fileSet)) {
return "/images/placeholder-pdf.png";
} else if (isZip(fileSet)) {
} else if (isZip(fileSet)) {
return "/images/placeholder-zip.png";
} else {
return "/images/placeholder.png";
}
}
};

const showWorkImageToggle = () => {
if (fileSet.role.id === "A" && workContextState.workTypeId === "AUDIO") {
return false;
} else {
return isImage(fileSet);
return isImage(fileSet) || hasRepresentativeImage(fileSet);
}
}
};

return (
<article className="box" data-testid="fileset-item">
Expand Down Expand Up @@ -120,9 +117,7 @@ function WorkFilesetListItem({
<div className="column is-5 has-text-right is-clearfix">
{!isEditing && (
<>
{(
showWorkImageToggle()
) && (
{showWorkImageToggle() && (
<AuthDisplayAuthorized>
<div className="field">
<input
Expand All @@ -147,9 +142,6 @@ function WorkFilesetListItem({
{fileSet.role.id === "X" && (
<WorkFilesetActionButtonsAuxillary fileSet={fileSet} />
)}
{fileSet.role.id === "S" && (
<WorkFilesetActionButtonsSupplemental fileSet={fileSet} />
)}
</>
)}
</div>
Expand Down
72 changes: 62 additions & 10 deletions app/assets/js/components/Work/Fileset/ListItem.test.js
Original file line number Diff line number Diff line change
@@ -1,31 +1,50 @@
import React from "react";
import { render, screen, waitFor } from "@testing-library/react";
import WorkFilesetListItemImage from "./ListItem";
import { mockFileSets } from "@js/mock-data/filesets";
import {
renderWithReactHookForm,
withReactBeautifulDND,
} from "@js/services/testing-helpers";

import React from "react";
import WorkFilesetList from "./ListItem";
import { WorkProvider } from "@js/context/work-context";
import { mockFileSets } from "@js/mock-data/filesets";
import { mockUser } from "@js/components/Auth/auth.gql.mock";
import useIsAuthorized from "@js/hooks/useIsAuthorized";
import { WorkProvider } from "@js/context/work-context";

jest.mock("@js/hooks/useIsAuthorized");
useIsAuthorized.mockReturnValue({
user: mockUser,
isAuthorized: () => true,
});

// Mock child components
jest.mock("@js/components/Work/Fileset/ActionButtons/Access", () => {
return {
__esModule: true,
default: () => {
return <div>Mocked Access</div>;
},
};
});
jest.mock("@js/components/Work/Fileset/ActionButtons/Auxillary", () => {
return {
__esModule: true,
default: () => {
return <div>Mocked Auxillary</div>;
},
};
});

describe("Fileset component", () => {
describe("when not editing", () => {
function setUpTests(workImageFilesetId) {
return render(
<WorkProvider>
<WorkFilesetListItemImage
<WorkFilesetList
fileSet={mockFileSets[0]}
workImageFilesetId={workImageFilesetId}
/>
</WorkProvider>
</WorkProvider>,
);
}
it("renders the image preview, label and description", async () => {
Expand Down Expand Up @@ -54,6 +73,39 @@ describe("Fileset component", () => {
expect(toggleEl).not.toBeChecked();
});
});

it("renders the Work image toggle if the fileset is a video and has a representative image", async () => {
render(
<WorkProvider>
<WorkFilesetList
fileSet={mockFileSets[3]}
workImageFilesetId={mockFileSets[3].id}
/>
</WorkProvider>,
);

const toggleEl = await screen.findByTestId("work-image-selector");
expect(toggleEl).toBeInTheDocument();
});

it("does not render the image toggle if the fileset is a video and does not have a representative image", async () => {
const fileSet = {
...mockFileSets[3],
representativeImageUrl: null,
};

render(
<WorkProvider>
<WorkFilesetList
fileSet={fileSet}
workImageFilesetId={mockFileSets[3].id}
/>
</WorkProvider>,
);

const toggleEl = screen.queryByTestId("work-image-selector");
expect(toggleEl).not.toBeInTheDocument();
});
});

describe("Audio work type", () => {
Expand All @@ -70,22 +122,22 @@ describe("Fileset component", () => {
it("doesn't render the Work image toggle", () => {
render(
<WorkProvider initialState={initialState}>
<WorkFilesetListItemImage
<WorkFilesetList
fileSet={mockFileSets[0]}
workImageFilesetId={undefined}
/>
</WorkProvider>
</WorkProvider>,
);
expect(
screen.queryByTestId("work-image-selector")
screen.queryByTestId("work-image-selector"),
).not.toBeInTheDocument();
});
});
});

describe("when editing", () => {
beforeEach(() => {
const Wrapped = withReactBeautifulDND(WorkFilesetListItemImage, {
const Wrapped = withReactBeautifulDND(WorkFilesetList, {
fileSet: mockFileSets[0],
index: 0,
isEditing: true,
Expand Down
Loading
Loading