Skip to content

Commit

Permalink
Merge pull request #296 from kthcloud/main
Browse files Browse the repository at this point in the history
Finalize v2 migration
  • Loading branch information
pierrelefevre authored May 31, 2024
2 parents c64d515 + 3dbe00a commit 2064ff4
Show file tree
Hide file tree
Showing 48 changed files with 244 additions and 606 deletions.
4 changes: 1 addition & 3 deletions .env
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
VITE_API_URL="https://api.cloud.cbh.kth.se"
VITE_DEPLOY_API_URL="https://api.cloud.cbh.kth.se/deploy/v1"
VITE_DEPLOY_V2_API_URL="https://api.cloud.cbh.kth.se/deploy/v2"
VITE_DEPLOY_API_URL="https://api.cloud.cbh.kth.se/deploy/v2"
VITE_ALERT_API_URL="https://alert.app.cloud.cbh.kth.se/"
GENERATE_SOURCEMAP=false
3 changes: 2 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ LICENSE
public/_redirects
package.json
package-lock.json
bun.lockb
bun.lockb
*.xcf
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ ENV VITE_RELEASE_DATE=${RELEASE_DATE}
ENV VITE_RELEASE_COMMIT=${RELEASE_COMMIT}

ENV VITE_API_URL="https://api.cloud.cbh.kth.se"
ENV VITE_DEPLOY_API_URL="https://api.cloud.cbh.kth.se/deploy/v1"
ENV VITE_DEPLOY_API_URL="https://api.cloud.cbh.kth.se/deploy/v2"
ENV NODE_ENV="production"

WORKDIR /app
Expand Down
Binary file modified bun.lockb
Binary file not shown.
22 changes: 21 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,29 @@
<body>
<noscript>
<h1>cbhcloud</h1>
To experience this page properly, please enable JavaScript.
Welcome to kthcloud. The console is built in React, meaning you have to enable JavaScript to use it.<br />
If you prefer to use the API or Python SDK, find information in the
<a href="https://docs.cloud.cbh.kth.se/usage/api/">docs</a>.
</noscript>
<div id="root"></div>
<script>
function updateFaviconPaths() {
if (
window.location.hostname === "beta.app.cloud.cbh.kth.se" ||
window.location.hostname === "localhost"
) {
var linkElements = document.querySelectorAll('link[rel*="icon"]');

linkElements.forEach(function (link) {
var href = link.getAttribute("href");
if (href && href.startsWith("/favicon/")) {
link.setAttribute("href", href.replace("/favicon/", "/favicon/beta/"));
}
});
}
}
updateFaviconPaths();
</script>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
Binary file added public/favicon/beta/apple-touch-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/favicon/beta/favicon-16x16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/favicon/beta/favicon-32x32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/favicon/beta/icon.xcf
Binary file not shown.
29 changes: 29 additions & 0 deletions public/favicon/beta/safari-pinned-tab.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/api/deploy/discover.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DiscoverRead } from "@kthcloud/go-deploy-types/types/v1/body";
import { DiscoverRead } from "@kthcloud/go-deploy-types/types/v2/body";

export const discover = async (): Promise<DiscoverRead> => {
const res = await fetch(import.meta.env.VITE_DEPLOY_API_URL + "/discover", {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Jwt } from "../../../types";
import { Jwt } from "../../types";

export const listGpuGroups = async (token: Jwt, vmId?: string) => {
const vmIdQuery = vmId ? `?vmId=${encodeURIComponent(vmId)}` : "";
const url = `${import.meta.env.VITE_DEPLOY_V2_API_URL}/gpuGroups${vmIdQuery}`;
const url = `${import.meta.env.VITE_DEPLOY_API_URL}/gpuGroups${vmIdQuery}`;
const response = await fetch(url, {
method: "GET",
headers: {
Expand All @@ -24,7 +24,7 @@ export const listGpuGroups = async (token: Jwt, vmId?: string) => {
};

export const getGpuGroup = async (token: Jwt, gpuGroupId: string) => {
const url = `${import.meta.env.VITE_DEPLOY_V2_API_URL}/gpuGroups/${gpuGroupId}`;
const url = `${import.meta.env.VITE_DEPLOY_API_URL}/gpuGroups/${gpuGroupId}`;
const response = await fetch(url, {
method: "GET",
headers: {
Expand Down
12 changes: 6 additions & 6 deletions src/api/deploy/v2/gpuLeases.ts → src/api/deploy/gpuLeases.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { GpuLeaseCreate } from "@kthcloud/go-deploy-types/types/v2/body";
import { Jwt, Uuid } from "../../../types";
import { Jwt, Uuid } from "../../types";

export const listGpuLeases = async (token: Jwt, vmId?: Uuid) => {
const vmIdQuery = vmId ? `?vmId=${encodeURIComponent(vmId)}` : "";
const url = `${import.meta.env.VITE_DEPLOY_V2_API_URL}/gpuLeases${vmIdQuery}`;
const url = `${import.meta.env.VITE_DEPLOY_API_URL}/gpuLeases${vmIdQuery}`;
const response = await fetch(url, {
method: "GET",
headers: {
Expand All @@ -18,7 +18,7 @@ export const listGpuLeases = async (token: Jwt, vmId?: Uuid) => {
};

export const createGpuLease = async (token: Jwt, body: GpuLeaseCreate) => {
const url = `${import.meta.env.VITE_DEPLOY_V2_API_URL}/gpuLeases`;
const url = `${import.meta.env.VITE_DEPLOY_API_URL}/gpuLeases`;
const response = await fetch(url, {
method: "POST",
headers: {
Expand All @@ -35,7 +35,7 @@ export const createGpuLease = async (token: Jwt, body: GpuLeaseCreate) => {
};

export const getGpuLease = async (token: Jwt, gpuLeaseId: Uuid) => {
const url = `${import.meta.env.VITE_DEPLOY_V2_API_URL}/gpuLeases/${gpuLeaseId}`;
const url = `${import.meta.env.VITE_DEPLOY_API_URL}/gpuLeases/${gpuLeaseId}`;
const response = await fetch(url, {
method: "GET",
headers: {
Expand All @@ -54,7 +54,7 @@ export const updateGpuLease = async (
gpuLeaseId: Uuid,
body: any
) => {
const url = `${import.meta.env.VITE_DEPLOY_V2_API_URL}/gpuLeases/${gpuLeaseId}`;
const url = `${import.meta.env.VITE_DEPLOY_API_URL}/gpuLeases/${gpuLeaseId}`;
const response = await fetch(url, {
method: "POST",
headers: {
Expand All @@ -71,7 +71,7 @@ export const updateGpuLease = async (
};

export const deleteGpuLease = async (token: Jwt, gpuLeaseId: Uuid) => {
const url = `${import.meta.env.VITE_DEPLOY_V2_API_URL}/gpuLeases/${gpuLeaseId}`;
const url = `${import.meta.env.VITE_DEPLOY_API_URL}/gpuLeases/${gpuLeaseId}`;
const response = await fetch(url, {
method: "DELETE",
headers: {
Expand Down
2 changes: 1 addition & 1 deletion src/api/deploy/resourceMigrations.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ResourceMigrationCreate } from "@kthcloud/go-deploy-types/types/v1/body";
import { ResourceMigrationCreate } from "@kthcloud/go-deploy-types/types/v2/body";
import { Jwt } from "../../types";

export const createResourceMigration = async (
Expand Down
10 changes: 5 additions & 5 deletions src/api/deploy/v2/snapshots.ts → src/api/deploy/snapshots.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Jwt } from "../../../types";
import { Jwt } from "../../types";

export const listVMSnapshots = async (token: Jwt, vmId: string) => {
const url = `${import.meta.env.VITE_DEPLOY_V2_API_URL}/vms/${vmId}/snapshots`;
const url = `${import.meta.env.VITE_DEPLOY_API_URL}/vms/${vmId}/snapshots`;
const response = await fetch(url, {
method: "GET",
headers: {
Expand All @@ -16,7 +16,7 @@ export const listVMSnapshots = async (token: Jwt, vmId: string) => {
};

export const createVMSnapshot = async (token: Jwt, vmId: string) => {
const url = `${import.meta.env.VITE_DEPLOY_V2_API_URL}/vms/${vmId}/snapshots`;
const url = `${import.meta.env.VITE_DEPLOY_API_URL}/vms/${vmId}/snapshots`;
const response = await fetch(url, {
method: "POST",
headers: {
Expand All @@ -35,7 +35,7 @@ export const getVMSnapshot = async (
vmId: string,
snapshotId: string
) => {
const url = `${import.meta.env.VITE_DEPLOY_V2_API_URL}/vms/${vmId}/snapshot/${snapshotId}`;
const url = `${import.meta.env.VITE_DEPLOY_API_URL}/vms/${vmId}/snapshot/${snapshotId}`;
const response = await fetch(url, {
method: "POST",
headers: {
Expand All @@ -54,7 +54,7 @@ export const deleteVMSnapshot = async (
vmId: string,
snapshotId: string
) => {
const url = `${import.meta.env.VITE_DEPLOY_V2_API_URL}/vms/${vmId}/snapshot/${snapshotId}`;
const url = `${import.meta.env.VITE_DEPLOY_API_URL}/vms/${vmId}/snapshot/${snapshotId}`;
const response = await fetch(url, {
method: "DELETE",
headers: {
Expand Down
2 changes: 1 addition & 1 deletion src/api/deploy/users.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {
ApiKeyCreated,
UserRead,
UserUpdate,
} from "@kthcloud/go-deploy-types/types/v1/body";
} from "@kthcloud/go-deploy-types/types/v2/body";
import { Jwt, Uuid } from "../../types";

export const getUser = async (
Expand Down
118 changes: 0 additions & 118 deletions src/api/deploy/v2/vms.ts

This file was deleted.

Loading

0 comments on commit 2064ff4

Please sign in to comment.