Skip to content
This repository has been archived by the owner on Dec 17, 2024. It is now read-only.

Commit

Permalink
feat: start scaled servers
Browse files Browse the repository at this point in the history
  • Loading branch information
Schlauer-Hax committed Dec 23, 2023
1 parent 7dd6731 commit 8f953e5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pages/hosting/views/changeStateButton.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { LoadingSpinner } from "shared/mod.ts";
import { Box, Color, Component, IconButton, isMobile, MIcon, StateHandler } from "webgen/mod.ts";
import { API, LoadingSpinner } from "shared/mod.ts";
import { Box, Color, Component, IconButton, MIcon, StateHandler, isMobile } from "webgen/mod.ts";
import { Server, SidecarResponse } from "../../../spec/music.ts";
import { messageQueueSidecar, startSidecarConnection } from "../loading.ts";
import { StateActions } from "../types.ts";
Expand All @@ -11,6 +11,7 @@ export function ChangeStateButton(server: StateHandler<Server>): Component {
.setColor(Color.Colored)
.onClick((e) => {
e.stopPropagation();
API.hosting.serverId(server._id).start();
startSidecarConnection(server._id);
const promise = Promise.withResolvers<SidecarResponse>();
messageQueueSidecar.push({
Expand Down
5 changes: 5 additions & 0 deletions pages/shared/restSpec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,11 @@ export const API = {
})
.then(none())
.catch(reject),
start: () => fetch(`${API.BASE_URL}hosting/servers/${id}/start`, {
headers: headers(API.getToken())
})
.then(none())
.catch(reject),
}),
store: ({
create: (type: StoreItems) => fetch(`${API.BASE_URL}hosting/store`, {
Expand Down

0 comments on commit 8f953e5

Please sign in to comment.