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

feat: set resource class for a session launcher #3196

Merged
merged 7 commits into from
Jul 1, 2024

Conversation

andre-code
Copy link
Contributor

@andre-code andre-code commented Jun 10, 2024

Description

PR to add a feature for selecting a resource class in a session launcher and prompt users to choose a resource class if they lack access to the default one.

Type of Change

Feat
it requires a new version of renku-data-services

Related Tickets & Documents

Other documents:

Screenshots

resource_class_id in launcher

resource_class_id in launcher no access

UI Accessibility Checklist

For UI changes, ensure the following:

Testing

Cases to test:

  • Select a default resource class when add/update a global session environment launcher
  • Select a default resource class when add/update a custom session environment launcher
  • Find out which resource class is assigned to a session launcher.
  • Display a modal to select a resource class when launching a session and not having access to the default session launcher resource class.
  • Be able to select a resource class other than the default when launching a session.

Added/Updated Unit Tests?

  • Yes
  • No

Added/Updated E2E Tests?

  • Yes
  • No

Renku Acceptance Tests

Does this involve adding or modifying acceptance tests in Renku Repository? No

Storybook

Not included new stories because the components may change due to ongoing app redesigns.

/deploy

@andre-code andre-code changed the title add modal to select resource class feat: add modal to select resource class Jun 10, 2024
@RenkuBot
Copy link
Contributor

You can access the deployment of this PR at https://renku-ci-ui-3196.dev.renku.ch

@andre-code andre-code force-pushed the andrea/resource-pool-when-launch-session branch from e2f4046 to 15e547b Compare June 10, 2024 09:29
@andre-code andre-code changed the title feat: add modal to select resource class WIP feat: add modal to select resource class Jun 10, 2024
@andre-code andre-code temporarily deployed to renku-ci-ui-3196 June 11, 2024 06:41 — with GitHub Actions Inactive
@andre-code andre-code force-pushed the andrea/resource-pool-when-launch-session branch 2 times, most recently from 5516411 to e030808 Compare June 14, 2024 11:45
@andre-code andre-code temporarily deployed to renku-ci-ui-3196 June 14, 2024 11:46 — with GitHub Actions Inactive
@andre-code andre-code temporarily deployed to renku-ci-ui-3196 June 14, 2024 14:34 — with GitHub Actions Inactive
@andre-code andre-code force-pushed the andrea/resource-pool-when-launch-session branch from e030808 to 3b4097a Compare June 14, 2024 18:04
@andre-code andre-code temporarily deployed to renku-ci-ui-3196 June 17, 2024 09:37 — with GitHub Actions Inactive
@andre-code andre-code force-pushed the andrea/resource-pool-when-launch-session branch from 94a8b76 to 004c5d1 Compare June 18, 2024 13:36
@andre-code andre-code force-pushed the andrea/resource-pool-when-launch-session branch from 004c5d1 to 9c95aa6 Compare June 18, 2024 13:38
@andre-code andre-code temporarily deployed to renku-ci-ui-3196 June 25, 2024 19:46 — with GitHub Actions Inactive
@andre-code andre-code changed the title WIP feat: add modal to select resource class feat: set resource class for a session launcher Jun 25, 2024
@andre-code andre-code temporarily deployed to renku-ci-ui-3196 June 25, 2024 20:18 — with GitHub Actions Inactive
@andre-code andre-code marked this pull request as ready for review June 25, 2024 20:18
@andre-code andre-code requested a review from a team as a code owner June 25, 2024 20:18
@andre-code andre-code self-assigned this Jun 25, 2024
Copy link
Member

@leafty leafty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some code comments:

Comment on lines 49 to 59
const onClickCustomLaunch = useCallback(() => {
const customStartUrl = generatePath(
ABSOLUTE_ROUTES.v2.projects.show.sessions.startCustom,
{
launcherId,
namespace,
slug,
}
);
navigate(customStartUrl);
}, [launcherId, namespace, slug, navigate]);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this not a link component? This breaks navigation for keyboard users.

Comment on lines 39 to 40
startCustom:
"/v2/projects/:namespace/:slug/sessions/:launcherId/start?custom",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not needed. Add a constant for the query param you can re-use (e.g. in client/src/features/sessionsV2/SessionStartPage.tsx).

launcher,
project,
});
const { isPendingResourceClass, setResourceClass } = useSessionResourceClass({
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this not part of the useSessionLauncherState hook? It seems more natural to host all state in there.

Comment on lines 277 to 283
const cancelLaunchSession = useCallback(() => {
const url = generatePath(ABSOLUTE_ROUTES.v2.projects.show.root, {
namespace: project.namespace,
slug: project.slug,
});
navigate(url);
}, [navigate, project]);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this not just a Link component?

import { toHumanDuration } from "../../../../utils/helpers/DurationUtils";
import { FetchingResourcePools } from "../../../sessionsV2/components/SessionModals/ResourceClassWarning.tsx";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
import { FetchingResourcePools } from "../../../sessionsV2/components/SessionModals/ResourceClassWarning.tsx";
import { FetchingResourcePools } from "../../../sessionsV2/components/SessionModals/ResourceClassWarning";

resourcePools,
startSessionOptionsV2,
} = useSessionLauncherState({
const hasCustomQuery = new URLSearchParams(location.search).has("custom");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"custom" should probably be defined as a constant. Also, this should use a hook to get the query params:

Suggested change
const hasCustomQuery = new URLSearchParams(location.search).has("custom");
const [searchParams] = useSearchParams(); // from "react-router-dom-v5-compat"
const hasCustomQuery = searchParams.has("custom");

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: this form doesn't seem to let users unset the resource class.

Copy link
Member

@leafty leafty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking: it seems that the project page uses different icons to indicate "edit".

Screenshot 2024-06-27 at 10 27 22
Screenshot 2024-06-27 at 10 27 27

Only one icon should be used for all these cases.

Also the edit button doesn't feel like it's a button at all, there should be some hover and activation styles to communicate to the user that it is an interactive element in the page.

@andre-code
Copy link
Contributor Author

Thanks @leafty for your suggestions. You can find them implemented in the latest commit. Regarding the icon, I share your opinion, but I will create a separate PR for those changes.

@andre-code andre-code requested review from leafty and removed request for lorenzo-cavazzi June 27, 2024 10:53
@andre-code andre-code temporarily deployed to renku-ci-ui-3196 June 27, 2024 11:36 — with GitHub Actions Inactive
components,
} from "react-select";
import { useGetNotebooksVersionQuery } from "../../../versions/versions.api.ts";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
import { useGetNotebooksVersionQuery } from "../../../versions/versions.api.ts";
import { useGetNotebooksVersionQuery } from "../../../versions/versions.api";

@RenkuBot
Copy link
Contributor

RenkuBot commented Jul 1, 2024

Tearing down the temporary RenkuLab deplyoment for this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[ShapeUp] Set resource pool/class for a session launcher 2.0
3 participants