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

CORE-1936 MUI v5 fixes #557

Merged
merged 6 commits into from
Nov 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion src/components/analyses/AnalysisCommentDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ function AnalysisCommentDialog(props) {
</Button>
<Button
id={buildID(baseId, UtilIds.DIALOG.CONFIRM)}
color="primary"
variant="contained"
type="submit"
onClick={handleSubmit}
>
Expand Down
2 changes: 1 addition & 1 deletion src/components/analyses/RenameAnalysisDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ function RenameAnalysisDialog(props) {
</Button>
<Button
id={buildID(baseId, UtilIds.DIALOG.CONFIRM)}
color="primary"
variant="contained"
type="submit"
onClick={handleSubmit}
>
Expand Down
2 changes: 1 addition & 1 deletion src/components/analyses/details/InfoPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ function InfoPanel(props) {
return <GridLoading rows={2} baseId={baseId} />;
}

if (!info && !isInfoFetching && !infoFetchError) {
if (!(info?.steps || isInfoFetching || infoFetchError)) {
return null;
}

Expand Down
2 changes: 1 addition & 1 deletion src/components/apps/AgaveAuthPromptDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ function AgaveAuthPromptDialog(props) {
</Button>
<Button
onClick={redirectUser}
color="primary"
variant="contained"
id={buildID(
baseId,
ids.AGAVE_AUTH_PROMPT_DIALOG,
Expand Down
2 changes: 1 addition & 1 deletion src/components/apps/PublishAppDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ export default function PublishAppDialog(props) {
<Button
id={buildID(parentId, ids.SUBMIT_BTN)}
type="submit"
color="primary"
variant="contained"
onClick={handleSubmit}
>
{i18nCommon("submit")}
Expand Down
2 changes: 1 addition & 1 deletion src/components/apps/admin/details/AdminAppDetails.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ function AdminAppDetailsForm(props) {
<Button
id={buildID(parentId, ids.SAVE_BTN)}
type="submit"
color="primary"
variant="contained"
onClick={handleSubmit}
>
{i18nCommon("save")}
Expand Down
2 changes: 1 addition & 1 deletion src/components/apps/admin/referenceGenomes/Edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ function Edit(props) {
<Button
id={buildID(baseId, ids.OK_BUTTON)}
className={classes.actionButton}
color="primary"
variant="contained"
type="submit"
>
{t("ok")}
Expand Down
10 changes: 6 additions & 4 deletions src/components/dashboard/DashboardSection.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
import React, { useState } from "react";
import clsx from "clsx";

import { Typography, Collapse, Button, useTheme, Divider } from "@mui/material";
import { Typography, Collapse, Button, Divider } from "@mui/material";

import getItem from "./dashboardItem";

import useStyles from "./styles";
import * as fns from "./functions";
import * as constants from "./constants";
import ids from "./ids";
import { useTranslation } from "i18n";

const DashboardSection = ({
t,
theme,
name,
kind,
items,
Expand All @@ -29,9 +30,7 @@ const DashboardSection = ({
computeLimitExceeded,
}) => {
const classes = useStyles();
const { t } = useTranslation("dashboard");
const [expanded, setExpanded] = useState(false);
const theme = useTheme();

const isNewsSection = section === constants.SECTION_NEWS;
const isEventsSection = section === constants.SECTION_EVENTS;
Expand Down Expand Up @@ -115,6 +114,7 @@ class SectionBase {

getComponent({
t,
theme,
cardWidth,
cardHeight,
data,
Expand Down Expand Up @@ -169,6 +169,8 @@ class SectionBase {
setPendingAnalysis={setPendingAnalysis}
setTerminateAnalysis={setTerminateAnalysis}
computeLimitExceeded={computeLimitExceeded}
t={t}
theme={theme}
/>
);
}
Expand Down
14 changes: 8 additions & 6 deletions src/components/dashboard/dashboardItem/AnalysisItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
Cancel,
Launch,
} from "@mui/icons-material";
import { IconButton, useTheme } from "@mui/material";
import { IconButton } from "@mui/material";

import { formatDate } from "components/utils/DateFormatter";

Expand All @@ -20,7 +20,6 @@ import { getFolderPage } from "../../data/utils";

import NavConstants from "../../../common/NavigationConstants";
import { isTerminated } from "components/analyses/utils";
import { useTranslation } from "i18n";
import { isInteractive, openInteractiveUrl } from "components/analyses/utils";

class AnalysisItem extends ItemBase {
Expand All @@ -36,11 +35,14 @@ class AnalysisItem extends ItemBase {

static create(props) {
const analysis = props.content;
const { setDetailsAnalysis, setPendingAnalysis, setTerminateAnalysis } =
props;
const {
setDetailsAnalysis,
setPendingAnalysis,
setTerminateAnalysis,
t,
theme,
} = props;
const item = new AnalysisItem(props);
const { t } = useTranslation("dashboard");
const theme = useTheme();
const isTerminatedAnalysis = isTerminated(analysis);
const isVICE = isInteractive(analysis);
const interactiveUrls = analysis?.interactive_urls;
Expand Down
6 changes: 1 addition & 5 deletions src/components/dashboard/dashboardItem/AppItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,8 @@ import { appFavorite, APP_BY_ID_QUERY_KEY } from "serviceFacades/apps";

import * as constants from "../constants";
import ItemBase, { ItemAction } from "./ItemBase";
import { useTranslation } from "i18n";
import AppFavorite from "components/apps/AppFavorite";
import { useAppLaunchLink } from "components/apps/utils";
import { useTheme } from "@mui/material";

class AppItem extends ItemBase {
constructor(props) {
Expand All @@ -30,9 +28,7 @@ class AppItem extends ItemBase {

static create(props) {
const item = new AppItem(props);
const { showErrorAnnouncer, setDetailsApp } = props;
const { t } = useTranslation("dashboard");
const theme = useTheme();
const { showErrorAnnouncer, setDetailsApp, t, theme } = props;

// Extract app details. Note: dashboard-aggregator only queries the DE database.
const app = props.content;
Expand Down
3 changes: 1 addition & 2 deletions src/components/dashboard/dashboardItem/EventItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import * as fns from "../functions";
import * as constants from "../constants";

import ItemBase, { ItemAction, DashboardFeedItem } from "./ItemBase";
import { useTranslation } from "i18n";

class EventItem extends ItemBase {
constructor({ section, content, height, width }) {
Expand All @@ -28,7 +27,7 @@ class EventItem extends ItemBase {

static create(props) {
const item = new EventItem(props);
const { t } = useTranslation("dashboard");
const { t } = props;
return item.addActions([
<ItemAction
ariaLabel={t("tweetAria")}
Expand Down
4 changes: 4 additions & 0 deletions src/components/dashboard/dashboardItem/InstantLaunchItems.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ class InstantLaunchItem extends ItemBase {
instantLaunch={instantLaunch}
showErrorAnnouncer={showErrorAnnouncer}
computeLimitExceeded={computeLimitExceeded}
style={{
margin: theme.spacing(1),
}}
size="small"
/>
</ItemAction>,

Expand Down
3 changes: 1 addition & 2 deletions src/components/dashboard/dashboardItem/NewsItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import * as fns from "../functions";
import * as constants from "../constants";

import ItemBase, { ItemAction, DashboardFeedItem } from "./ItemBase";
import { useTranslation } from "i18n";

class NewsItem extends ItemBase {
constructor({ section, content, height, width }) {
Expand All @@ -27,7 +26,7 @@ class NewsItem extends ItemBase {

static create(props) {
const item = new NewsItem(props);
const { t } = useTranslation("dashboard");
const { t } = props;

return item.addActions([
<ItemAction
Expand Down
2 changes: 1 addition & 1 deletion src/components/dashboard/dashboardItem/Tour.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export default function Tour(props) {
<Button
id={buildID(baseId, ids.TOUR_BTN)}
size="small"
color="primary"
variant="contained"
onClick={() => setRunTour(true)}
>
{t("startTour")}
Expand Down
4 changes: 3 additions & 1 deletion src/components/dashboard/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import clsx from "clsx";
import { useQueryClient, useQuery, useMutation } from "react-query";
import { useTranslation } from "i18n";

import { Typography } from "@mui/material";
import { Typography, useTheme } from "@mui/material";

import { Skeleton } from "@mui/material";

Expand Down Expand Up @@ -118,6 +118,7 @@ const Dashboard = (props) => {
const [userProfile] = useUserProfile();
const [config] = useConfig();
const queryClient = useQueryClient();
const theme = useTheme();

const [resourceUsageSummary, setResourceUsageSummary] = useState(null);
const [resourceUsageError, setResourceUsageError] = useState(null);
Expand Down Expand Up @@ -261,6 +262,7 @@ const Dashboard = (props) => {
.map((section) =>
section.getComponent({
t,
theme,
data,
cardWidth,
cardHeight,
Expand Down
2 changes: 1 addition & 1 deletion src/components/data/CreateFolderDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ function CreateFolderDialog(props) {
</Button>
<Button
id={buildID(baseId, ids.CREATE_BTN)}
color="primary"
variant="contained"
type="submit"
onClick={handleSubmit}
>
Expand Down
2 changes: 1 addition & 1 deletion src/components/data/MoveDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ function MoveDialog(props) {
</Button>
<Button
id={buildID(baseId, ids.MOVE_BTN)}
color="primary"
variant="contained"
type="submit"
onClick={handleSubmit}
>
Expand Down
2 changes: 1 addition & 1 deletion src/components/data/PathListAutomation.js
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ export default function PathListAutomation(props) {
baseId,
ids.PATH_LIST_AUTO_DONE_BTN
)}
color="primary"
variant="contained"
type="submit"
onClick={handleSubmit}
>
Expand Down
2 changes: 1 addition & 1 deletion src/components/data/RenameDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ function RenameDialog(props) {
</Button>
<Button
id={buildID(baseId, ids.RENAME_BTN)}
color="primary"
variant="contained"
type="submit"
onClick={handleSubmit}
>
Expand Down
2 changes: 1 addition & 1 deletion src/components/data/SaveAsDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ function SaveAsDialog(props) {
</Button>
<Button
id={buildID(baseId, ids.CREATE_BTN)}
color="primary"
variant="contained"
type="submit"
onClick={handleSubmit}
>
Expand Down
2 changes: 2 additions & 0 deletions src/components/data/SelectionDrawer.js
Original file line number Diff line number Diff line change
Expand Up @@ -337,10 +337,12 @@ function SelectionDrawer(props) {
onClose={onClose}
open={open}
anchor="right"
elevation={0}
PaperProps={{
variant: "outlined",
classes: { root: classes.selectionDrawer },
}}
sx={{ zIndex: "modal" }}
>
<div
style={{
Expand Down
2 changes: 1 addition & 1 deletion src/components/data/listing/Listing.js
Original file line number Diff line number Diff line change
Expand Up @@ -773,7 +773,7 @@ function Listing(props) {
{t("cancel")}
</Button>
<Button
color="primary"
variant="contained"
onClick={() => {
setConfirmDOIRequestDialogOpen(false);
requestDOI({
Expand Down
8 changes: 7 additions & 1 deletion src/components/data/listing/TableView.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import {
TableBody,
TableCell,
TableContainer,
useTheme,
} from "@mui/material";

import makeStyles from "@mui/styles/makeStyles";
Expand Down Expand Up @@ -154,11 +155,13 @@ function TableView(props) {
instantLaunchDefaultsMapping,
computeLimitExceeded,
} = props;

const invalidRowClass = invalidRowStyles();
const { t } = useTranslation("data");
const dataRecordFields = dataFields(t);
const tableId = buildID(baseId, ids.LISTING_TABLE);
const trashPath = useBaseTrashPath();
const theme = useTheme();

const [displayColumns, setDisplayColumns] = useState(
getLocalStorageCols(rowDotMenuVisibility, dataRecordFields) ||
Expand Down Expand Up @@ -403,7 +406,10 @@ function TableView(props) {
resource={resource}
size="small"
color="default"
themeSpacing={3}
style={{
marginLeft:
theme.spacing(3),
}}
computeLimitExceeded={
computeLimitExceeded
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/data/viewers/FileTypeSelectionDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export default function FileTypeSelectionDialog(props) {
</Button>
<Button
id={buildID(baseId, ids.CREATE_BTN)}
color="primary"
variant="contained"
onClick={() => onFileTypeSelected(type)}
>
{i18nCommon("create")}
Expand Down
5 changes: 5 additions & 0 deletions src/components/data/viewers/PathListViewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import Toolbar from "./Toolbar";
import { getColumns, LINE_NUMBER_ACCESSOR } from "./utils";

import DataSelectionDrawer from "components/data/SelectionDrawer";
import { useSelectorDefaultFolderPath } from "components/data/utils";
import PageWrapper from "components/layout/PageWrapper";

import withErrorAnnouncer from "components/error/withErrorAnnouncer";
Expand Down Expand Up @@ -67,6 +68,7 @@ function PathListViewer(props) {
fileName,
data,
editable,
startingPath,
} = props;

const { t } = useTranslation("data");
Expand All @@ -76,6 +78,8 @@ function PathListViewer(props) {
const [editorData, setEditorData] = useState([]);
const [fileSaveStatus, setFileSaveStatus] = useState();

const defaultStartingPath = useSelectorDefaultFolderPath();

const columns = useMemo(
() => getColumns(data, false, t("path")),
[data, t]
Expand Down Expand Up @@ -266,6 +270,7 @@ function PathListViewer(props) {
}
}}
multiSelect={true}
startingPath={startingPath || defaultStartingPath}
/>
</UploadTrackingProvider>
</PageWrapper>
Expand Down
2 changes: 1 addition & 1 deletion src/components/help/Feedback.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export default function Feedback(props) {
</Button>
<Button
type="submit"
color="primary"
variant="contained"
onClick={handleSubmit}
>
{i18nHelp("submit_feedback")}
Expand Down
Loading
Loading