Skip to content

Commit

Permalink
Merge branch 'master' of github.com:edx/frontend-app-publisher into a…
Browse files Browse the repository at this point in the history
…bdullahwaheed/renovate-bot-edx-packages-auto-update
  • Loading branch information
abdullahwaheed committed Aug 26, 2022
2 parents 96609f6 + 05afea4 commit 6ce584a
Show file tree
Hide file tree
Showing 33 changed files with 880 additions and 1,699 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ module.config.js
dist/

.idea
.vscode
32 changes: 18 additions & 14 deletions src/components/CollaboratorPage/index.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React from 'react';
import PropTypes from 'prop-types';
import { Helmet } from 'react-helmet';
import { Alert } from '@edx/paragon';

import CollaboratorForm from './CollaboratorForm';
import StatusAlert from '../StatusAlert';
import PageContainer from '../PageContainer';

class CollaboratorPage extends React.Component {
Expand Down Expand Up @@ -51,12 +51,13 @@ class CollaboratorPage extends React.Component {

if (!isCreateForm && (!location.state || !location.state.uuid)) {
return (
<StatusAlert
<Alert
id="error"
alertType="danger"
title="Could not load page: "
message="Direct access to collaborators not supported"
/>
variant="danger"
>
<Alert.Heading>Could not load page: </Alert.Heading>
<p>Direct access to collaborators not supported</p>
</Alert>
);
}

Expand Down Expand Up @@ -87,12 +88,14 @@ class CollaboratorPage extends React.Component {
<PageContainer>
{ referrer
&& (
<StatusAlert
<Alert
id="sent-from-edit-course-info"
alertType="info"
message="The data you entered on the course edit screen is saved. You will return to that page when you have finished updating collaborator information."
variant="info"
dismissible
/>
>
The data you entered on the course edit screen is saved. You will return to that page
when you have finished updating collaborator information.
</Alert>
)}
<div>
<h2>{titleText}</h2>
Expand All @@ -109,11 +112,12 @@ class CollaboratorPage extends React.Component {
{...this.props}
/>
{ errorArray.length > 0 && (
<StatusAlert
<Alert
id="create-collaborator-error"
alertType="danger"
message={errorArray}
/>
variant="danger"
>
{errorArray}
</Alert>
)}
</div>
</PageContainer>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,21 +142,32 @@ exports[`CreateCoursePage renders page correctly with course create error 1`] =
touchOnChange={false}
updateUnregisteredFields={false}
/>
<StatusAlert
alertType="danger"
className=""
<ForwardRef
closeLabel="Dismiss"
dismissible={false}
iconClassNames={Array []}
id="create-error"
message={
Array [
"Fail",
<br />,
]
}
onClose={[Function]}
title={null}
/>
show={true}
stacked={false}
transition={
Object {
"$$typeof": Symbol(react.forward_ref),
"defaultProps": Object {
"appear": false,
"in": false,
"mountOnEnter": false,
"timeout": 300,
"unmountOnExit": false,
},
"displayName": "Fade",
"render": [Function],
}
}
variant="danger"
>
Fail
<br />
</ForwardRef>
</div>
</PageContainer>
</Fragment>
Expand Down Expand Up @@ -293,16 +304,45 @@ exports[`CreateCoursePage renders page correctly with course create success 1`]
`;

exports[`CreateCoursePage renders page correctly with no publisherUserInfo 1`] = `
<StatusAlert
alertType="danger"
className=""
<ForwardRef
closeLabel="Dismiss"
dismissible={false}
iconClassNames={Array []}
id="error"
message="User information unavailable"
onClose={[Function]}
title="Course Create Form failed to load: "
/>
show={true}
stacked={false}
transition={
Object {
"$$typeof": Symbol(react.forward_ref),
"defaultProps": Object {
"appear": false,
"in": false,
"mountOnEnter": false,
"timeout": 300,
"unmountOnExit": false,
},
"displayName": "Fade",
"render": [Function],
}
}
variant="danger"
>
<AlertHeading
as={
Object {
"$$typeof": Symbol(react.forward_ref),
"displayName": "DivStyledAsH4",
"render": [Function],
}
}
bsPrefix="alert-heading"
>
Course Create Form failed to load:
</AlertHeading>
<p>
User information unavailable
</p>
</ForwardRef>
`;

exports[`CreateCoursePage renders page correctly with org error 1`] = `
Expand Down Expand Up @@ -365,21 +405,32 @@ exports[`CreateCoursePage renders page correctly with org error 1`] = `
touchOnChange={false}
updateUnregisteredFields={false}
/>
<StatusAlert
alertType="danger"
className=""
<ForwardRef
closeLabel="Dismiss"
dismissible={false}
iconClassNames={Array []}
id="create-error"
message={
Array [
"Fail",
<br />,
]
}
onClose={[Function]}
title={null}
/>
show={true}
stacked={false}
transition={
Object {
"$$typeof": Symbol(react.forward_ref),
"defaultProps": Object {
"appear": false,
"in": false,
"mountOnEnter": false,
"timeout": 300,
"unmountOnExit": false,
},
"displayName": "Fade",
"render": [Function],
}
}
variant="danger"
>
Fail
<br />
</ForwardRef>
</div>
</PageContainer>
</Fragment>
Expand Down
22 changes: 12 additions & 10 deletions src/components/CreateCoursePage/index.jsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import React from 'react';
import PropTypes from 'prop-types';
import { Helmet } from 'react-helmet';
import { Alert } from '@edx/paragon';

import CreateCourseForm from './CreateCourseForm';
import LoadingSpinner from '../LoadingSpinner';
import PageContainer from '../PageContainer';
import StatusAlert from '../StatusAlert';
import ConfirmationModal from '../ConfirmationModal';

import { formatPriceData } from '../../utils';
Expand Down Expand Up @@ -94,12 +94,13 @@ class CreateCoursePage extends React.Component {
render() {
if (!this.props.publisherUserInfo) {
return (
<StatusAlert
<Alert
id="error"
alertType="danger"
title="Course Create Form failed to load: "
message="User information unavailable"
/>
variant="danger"
>
<Alert.Heading>Course Create Form failed to load: </Alert.Heading>
<p>User information unavailable</p>
</Alert>
);
}

Expand Down Expand Up @@ -174,11 +175,12 @@ class CreateCoursePage extends React.Component {
courseRunOptions={courseRunOptions}
/>
{errorArray.length > 1 && (
<StatusAlert
<Alert
id="create-error"
alertType="danger"
message={errorArray}
/>
variant="danger"
>
{errorArray}
</Alert>
) }
</div>
)}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React from 'react';
import { shallow } from 'enzyme';
import { shallowToJson } from 'enzyme-to-json';
import { Alert } from '@edx/paragon';

import { CreateCourseRunForm } from './CreateCourseRunForm';
import CreateCourseRunPage from './index';
import StatusAlert from '../StatusAlert';
import { courseOptions } from '../../data/constants/testData';

describe('CreateCourseRunPage', () => {
Expand Down Expand Up @@ -91,9 +91,9 @@ describe('CreateCourseRunPage', () => {
/>);

// Confirm message is shown
const reviewAlert = component.find(StatusAlert);
const reviewAlert = component.find(Alert);
const reviewMessage = 'Test Course has been submitted for review. No course runs can be added right now.';
expect(reviewAlert.props().message).toEqual(reviewMessage);
expect(reviewAlert.text()).toEqual(reviewMessage);

// And confirm that we don't show form
const form = component.find(CreateCourseRunForm);
Expand Down
Loading

0 comments on commit 6ce584a

Please sign in to comment.