Skip to content

Commit

Permalink
add code suggestions
Browse files Browse the repository at this point in the history
- add file comment
- move css import ant the end of the import list
- simplify default_url and description assignment to simplify conditional check
  • Loading branch information
andre-code committed Oct 18, 2024
1 parent be32e65 commit 07165fb
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 4 deletions.
4 changes: 2 additions & 2 deletions client/src/features/admin/UpdateSessionEnvironmentButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ function UpdateSessionEnvironmentModal({
environmentId: environment.id,
container_image: data.container_image,
name: data.name,
default_url: data.default_url?.trim() ? data.default_url : "",
description: data.description?.trim() ? data.description : "",
default_url: data.default_url?.trim() || "",
description: data.description?.trim() || "",
port: data.port ?? undefined,
working_directory: data.working_directory?.trim() || undefined,
mount_directory: data.mount_directory?.trim() || undefined,
Expand Down
22 changes: 21 additions & 1 deletion client/src/features/dashboardV2/DashboardV2Sessions.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,31 @@
/*!
* Copyright 2024 - Swiss Data Science Center (SDSC)
* A partnership between École Polytechnique Fédérale de Lausanne (EPFL) and
* Eidgenössische Technische Hochschule Zürich (ETHZ).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import { SerializedError } from "@reduxjs/toolkit";
import { FetchBaseQueryError, skipToken } from "@reduxjs/toolkit/query";
import cx from "classnames";
import { Link, generatePath } from "react-router-dom-v5-compat";
import { Col, ListGroup, Row } from "reactstrap";

import { Loader } from "../../components/Loader";
import EnvironmentLogsV2 from "../../components/LogsV2";
import { RtkErrorAlert } from "../../components/errors/RtkErrorAlert";
import { useGetSessionsQuery as useGetSessionsQueryV2 } from "../../features/sessionsV2/sessionsV2.api";
import "../../notebooks/Notebooks.css";
import { ABSOLUTE_ROUTES } from "../../routing/routes.constants";
import useAppSelector from "../../utils/customHooks/useAppSelector.hook";
import { useGetProjectsByProjectIdQuery } from "../projectsV2/api/projectV2.enhanced-api";
Expand All @@ -18,6 +36,8 @@ import {
} from "../sessionsV2/components/SessionStatus/SessionStatus";
import { SessionList, SessionV2 } from "../sessionsV2/sessionsV2.types";

import "../../notebooks/Notebooks.css";

export default function DashboardV2Sessions() {
const { data: sessions, error, isLoading } = useGetSessionsQueryV2();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export default function UpdateSessionLauncherModal({
updateSessionLauncher({
launcherId: launcher.id,
name,
description: description.trim() ? description : undefined,
description: description?.trim() || undefined,
environment: environment.data,
});
},
Expand Down

0 comments on commit 07165fb

Please sign in to comment.