Skip to content

Commit

Permalink
Merge pull request #582 from psarando/tapis-v3
Browse files Browse the repository at this point in the history
CORE-1889 Tapis v3 Migration
  • Loading branch information
psarando authored Jan 6, 2025
2 parents 9eb9b0d + 9c6a8a2 commit 854c8bc
Show file tree
Hide file tree
Showing 13 changed files with 53 additions and 42 deletions.
2 changes: 2 additions & 0 deletions src/components/analyses/landing/AnalysisSubmissionLanding.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import React from "react";
import { useTranslation } from "i18n";
import { useMutation, useQuery, useQueryClient } from "react-query";
import {
ANALYSIS_HISTORY_QUERY_KEY,
ANALYSES_LISTING_QUERY_KEY,
cancelAnalysis,
extendVICEAnalysisTimeLimit,
Expand Down Expand Up @@ -162,6 +163,7 @@ export default function AnalysisSubmissionLanding(props) {

const refreshAnalysis = () => {
queryClient.invalidateQueries([ANALYSES_LISTING_QUERY_KEY, id]);
queryClient.invalidateQueries([ANALYSIS_HISTORY_QUERY_KEY, id]);
};

const { isFetching, error: analysisFetchError } = useQuery({
Expand Down
29 changes: 14 additions & 15 deletions src/components/analyses/toolbar/Toolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { allowAnalysesCancel } from "../utils";

import { useConfig } from "contexts/config";

import AppsTypeFilter from "components/apps/AppsTypeFilter";
import AppsTypeFilter, { getFilters } from "components/apps/AppsTypeFilter";

import buildID from "components/utils/DebugIDUtil";

Expand Down Expand Up @@ -171,6 +171,17 @@ function AnalysesToolbar(props) {
hasSelection && allowAnalysesCancel(selectedAnalyses, username, config);
const { isSmDown, isMdDown } = useBreakpoints();

const typeFilter = (
<AppsTypeFilter
baseId={analysesNavId}
filter={appTypeFilter}
classes={classes}
handleFilterChange={handleAppTypeFilterChange}
options={getFilters(true)}
disabled={false}
/>
);

return (
<>
<Toolbar variant="dense" id={analysesNavId} style={{ padding: 0 }}>
Expand All @@ -182,13 +193,7 @@ function AnalysesToolbar(props) {
classes={classes}
handleFilterChange={handleOwnershipFilterChange}
/>
<AppsTypeFilter
baseId={analysesNavId}
filter={appTypeFilter}
classes={classes}
handleFilterChange={handleAppTypeFilterChange}
disabled={false}
/>
{typeFilter}
</>
)}
{viewFiltered && (
Expand Down Expand Up @@ -300,13 +305,7 @@ function AnalysesToolbar(props) {
handleFilterChange={handleOwnershipFilterChange}
/>
<br />
<AppsTypeFilter
baseId={analysesNavId}
filter={appTypeFilter}
classes={classes}
handleFilterChange={handleAppTypeFilterChange}
disabled={false}
/>
{typeFilter}
</DialogContent>
<DialogActions>
<Button onClick={() => setOpenFilterDialog(false)}>
Expand Down
17 changes: 13 additions & 4 deletions src/components/apps/AppsTypeFilter.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,29 @@ import buildID from "components/utils/DebugIDUtil";
import Autocomplete from "@mui/material/Autocomplete";
import { TextField } from "@mui/material";

function getFilters() {
return Object.values(appType);
function getFilters(includeDeprecated = false) {
const filters = Object.values(appType);

return includeDeprecated ? filters : filters.filter((f) => !f.deprecated);
}

export default function AppsTypeFilter(props) {
const { baseId, filter, handleFilterChange, classes, disabled } = props;
const {
baseId,
filter,
handleFilterChange,
classes,
disabled,
options = getFilters(),
} = props;
const { t } = useTranslation("apps");

return (
<Autocomplete
id={buildID(baseId, ids.APPS_FILTER)}
disabled={disabled}
value={filter}
options={getFilters()}
options={options}
size="small"
onChange={(event, newValue) => {
handleFilterChange(newValue);
Expand Down
8 changes: 7 additions & 1 deletion src/components/apps/launch/formatters.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,13 @@ const initGroupValues = (groups) =>

if (paramArgs?.length > 0) {
const defaultArg =
paramArgs.find((arg) => defaultValue?.id === arg.id) ||
(defaultValue &&
paramArgs.find((arg) => defaultValue.id === arg.id)) ||
// param arg IDs can change between jobs
(defaultValue &&
paramArgs.find(
(arg) => defaultValue.value === arg.value
)) ||
paramArgs.find((arg) => arg.isDefault);

value = defaultArg || "";
Expand Down
4 changes: 2 additions & 2 deletions src/components/apps/listing/Listing.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import buildID from "components/utils/DebugIDUtil";
import { announce } from "components/announcer/CyVerseAnnouncer";
import { SUCCESS } from "components/announcer/AnnouncerConstants";

import appType from "components/models/AppType";
import SystemIds from "components/models/systemId";

import ConfirmationDialog from "components/utils/ConfirmationDialog";
import DEPagination from "components/utils/DEPagination";
Expand Down Expand Up @@ -485,7 +485,7 @@ function Listing(props) {
let toFilter = filter;
if (
category.system_id?.toLowerCase() ===
appType.agave.value.toLowerCase()
SystemIds.tapis.toLowerCase()
) {
toFilter = null;
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/apps/savedLaunch/SavedLaunchListing.js
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ function ListSavedLaunches(props) {
}

if (!savedLaunches || savedLaunches.length === 0) {
if (systemId !== SystemIds.agave) {
if (systemId !== SystemIds.tapis) {
const href = `/${NavigationConstants.APPS}/[systemId]/[appId]/launch`;
const as = `/${NavigationConstants.APPS}/${systemId}/${appId}/launch`;
return (
Expand Down
2 changes: 1 addition & 1 deletion src/components/apps/toolbar/AppNavigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ function AppNavigation(props) {
(cat) => cat.system_id === systemId.de
);
const hpcCat = data.categories.find(
(cat) => cat.system_id === systemId.agave
(cat) => cat.system_id === systemId.tapis
);

let categoryList = privateCat.categories;
Expand Down
6 changes: 3 additions & 3 deletions src/components/apps/toolbar/Toolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import AppNavigation from "./AppNavigation";
import CreateAppMenuItem from "../menuItems/CreateAppMenuItem";
import CreateWorkflowMenuItem from "../menuItems/CreateWorkflowMenuItem";

import appType from "components/models/AppType";
import SystemIds from "components/models/systemId";
import AppsTypeFilter from "components/apps/AppsTypeFilter";

import NavigationConstants from "common/NavigationConstants";
Expand Down Expand Up @@ -197,7 +197,7 @@ function AppsToolbar(props) {
handleFilterChange={handleFilterChange}
disabled={
selectedCategory?.system_id?.toLowerCase() ===
appType.agave.value.toLowerCase()
SystemIds.tapis.toLowerCase()
}
/>
)}
Expand Down Expand Up @@ -324,7 +324,7 @@ function AppsToolbar(props) {
handleFilterChange={handleFilterChange}
disabled={
selectedCategory?.system_id?.toLowerCase() ===
appType.agave.value.toLowerCase()
SystemIds.tapis.toLowerCase()
}
/>
</DialogContent>
Expand Down
5 changes: 3 additions & 2 deletions src/components/apps/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import ReferenceGenomeSelect from "components/apps/launch/ReferenceGenomeSelect"

import AppParamTypes from "components/models/AppParamTypes";
import AppType from "components/models/AppType";
import SystemIds from "components/models/systemId";
import ToolTypes from "components/models/ToolTypes";
import Permissions, {
permissionHierarchy,
Expand Down Expand Up @@ -292,8 +293,8 @@ export const appUnavailable = (
};

export const getAppTypeDisplay = (app) => {
if (app?.system_id?.toLowerCase() === AppType.agave.value.toLowerCase()) {
return AppType.agave.display;
if (app?.system_id?.toLowerCase() === SystemIds.tapis.toLowerCase()) {
return AppType.tapis.display;
}

if (app?.step_count === 1) {
Expand Down
4 changes: 3 additions & 1 deletion src/components/models/AppType.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
const appType = {
agave: { value: "Agave", display: "HPC" },
de: { value: "DE", display: "DE" },
interactive: { value: "Interactive", display: "VICE" },
tapis: { value: "Tapis", display: "HPC" },
osg: { value: "OSG", display: "OSG" },
agave: { value: "Agave", display: "Agave (deprecated)", deprecated: true },
};

export default appType;
2 changes: 1 addition & 1 deletion src/components/models/systemId.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const systemId = {
agave: "agave",
tapis: "tapis",
de: "de",
};
export default systemId;
2 changes: 1 addition & 1 deletion src/components/oauth/OAuthCodeHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function OAuthCodeHandler(props) {
const determineListingUrl = useCallback(
(data) => {
const hpcCategory = data.categories.find(
(cat) => cat.system_id === systemId.agave
(cat) => cat.system_id === systemId.tapis
);
setListingUrl(
getListingPath(
Expand Down
12 changes: 2 additions & 10 deletions src/serviceFacades/apps.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
*
*/
import callApi from "../common/callApi";
import appType from "../components/models/AppType";
import constants from "../constants";
import {
betaAVU,
Expand Down Expand Up @@ -32,10 +31,7 @@ const ADMIN_APP_DETAILS_QUERY_KEY = "fetchAppDetailsForAdmin";
const ADMIN_APP_AVU_QUERY_KEY = "fetchAppAVUs";

const getAppTypeFilter = (appTypeFilter) => {
const typeFilter =
appTypeFilter && appTypeFilter !== appType.all
? "&app-type=" + appTypeFilter
: "";
const typeFilter = appTypeFilter ? "&app-type=" + appTypeFilter : "";
return typeFilter;
};

Expand Down Expand Up @@ -370,11 +366,7 @@ function getAppsForAdmin({
params["search"] = searchTerm;
}

if (appTypeFilter && appTypeFilter !== appType.all) {
params["app-type"] = appTypeFilter;
} else {
params["app-type"] = "";
}
params["app-type"] = appTypeFilter || "";

if (adminOwnershipFilter) {
params["app-subset"] = adminOwnershipFilter;
Expand Down

0 comments on commit 854c8bc

Please sign in to comment.