fix: show/hide "new library" button based on separate v1/v2 permissions (backport) (#1549)
This commit is contained in:
@@ -57,6 +57,7 @@ const StudioHome = () => {
|
|||||||
studioShortName,
|
studioShortName,
|
||||||
studioRequestEmail,
|
studioRequestEmail,
|
||||||
showNewLibraryButton,
|
showNewLibraryButton,
|
||||||
|
showNewLibraryV2Button,
|
||||||
} = studioHomeData;
|
} = studioHomeData;
|
||||||
|
|
||||||
const getHeaderButtons = useCallback(() => {
|
const getHeaderButtons = useCallback(() => {
|
||||||
@@ -86,7 +87,7 @@ const StudioHome = () => {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (showNewLibraryButton || showV2LibraryURL) {
|
if ((showNewLibraryButton && !showV2LibraryURL) || (showV2LibraryURL && showNewLibraryV2Button)) {
|
||||||
const newLibraryClick = () => {
|
const newLibraryClick = () => {
|
||||||
if (showV2LibraryURL) {
|
if (showV2LibraryURL) {
|
||||||
navigate('/library/create');
|
navigate('/library/create');
|
||||||
@@ -101,7 +102,6 @@ const StudioHome = () => {
|
|||||||
variant="outline-primary"
|
variant="outline-primary"
|
||||||
iconBefore={AddIcon}
|
iconBefore={AddIcon}
|
||||||
size="sm"
|
size="sm"
|
||||||
disabled={showNewCourseContainer}
|
|
||||||
onClick={newLibraryClick}
|
onClick={newLibraryClick}
|
||||||
data-testid="new-library-button"
|
data-testid="new-library-button"
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -67,6 +67,7 @@ module.exports = {
|
|||||||
requestCourseCreatorUrl: '/request_course_creator',
|
requestCourseCreatorUrl: '/request_course_creator',
|
||||||
rerunCreatorStatus: true,
|
rerunCreatorStatus: true,
|
||||||
showNewLibraryButton: true,
|
showNewLibraryButton: true,
|
||||||
|
showNewLibraryV2Button: true,
|
||||||
splitStudioHome: false,
|
splitStudioHome: false,
|
||||||
studioName: 'Studio',
|
studioName: 'Studio',
|
||||||
studioShortName: 'Studio',
|
studioShortName: 'Studio',
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ export const generateGetStudioHomeDataApiResponse = () => ({
|
|||||||
requestCourseCreatorUrl: '/request_course_creator',
|
requestCourseCreatorUrl: '/request_course_creator',
|
||||||
rerunCreatorStatus: true,
|
rerunCreatorStatus: true,
|
||||||
showNewLibraryButton: true,
|
showNewLibraryButton: true,
|
||||||
|
showNewLibraryV2Button: true,
|
||||||
splitStudioHome: false,
|
splitStudioHome: false,
|
||||||
studioName: 'Studio',
|
studioName: 'Studio',
|
||||||
studioShortName: 'Studio',
|
studioShortName: 'Studio',
|
||||||
|
|||||||
Reference in New Issue
Block a user