-
Notifications
You must be signed in to change notification settings - Fork 285
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ability to kill function executions
Commit description in progress... Signed-off-by: Nick Gerace <[email protected]> Co-authored-by: Victor Bustamante <[email protected]>
- Loading branch information
1 parent
ac4ff1e
commit fdde7ef
Showing
35 changed files
with
885 additions
and
226 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
59 changes: 59 additions & 0 deletions
59
app/web/src/components/Workspace/WorkspaceAdminDashboard.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<template> | ||
<div | ||
class="w-full h-full flex flex-col items-center relative overflow-hidden dark:bg-neutral-800 dark:text-shade-0 bg-neutral-50 text-neutral-900" | ||
> | ||
<Stack spacing="lg"> | ||
<span class="flex flex-row mt-10 font-bold text-3xl" | ||
>Admin Dashboard</span | ||
> | ||
<Stack> | ||
<h2 class="font-bold text-lg">KILL FUNCTION EXECUTION</h2> | ||
<VormInput | ||
v-model="funcRunId" | ||
label="FuncRunId for function execution" | ||
/> | ||
<div class="flex flex-row-reverse gap-sm"> | ||
<VButton | ||
:disabled="!funcRunId" | ||
:requestStatus="cancelExecutionReqStatus" | ||
class="flex-grow" | ||
icon="plus-circle" | ||
label="Kill function execution" | ||
loadingText="Killing function execution" | ||
tone="success" | ||
@click="cancelExecution" | ||
/> | ||
</div> | ||
</Stack> | ||
</Stack> | ||
</div> | ||
</template> | ||
|
||
<script lang="ts" setup> | ||
import { onBeforeMount, ref } from "vue"; | ||
import { Stack, VormInput, VButton } from "@si/vue-lib/design-system"; | ||
import { useRouter } from "vue-router"; | ||
import { useAdminStore } from "@/store/admin.store"; | ||
import { useFeatureFlagsStore } from "@/store/feature_flags.store"; | ||
const adminStore = useAdminStore(); | ||
const featureFlagStore = useFeatureFlagsStore(); | ||
const router = useRouter(); | ||
onBeforeMount(async () => { | ||
if (!featureFlagStore.ADMIN_PANEL_ACCESS) { | ||
await router.push({ name: "workspace-single" }); | ||
} | ||
}); | ||
const cancelExecutionReqStatus = | ||
adminStore.getRequestStatus("CANCEL_EXECUTION"); | ||
const funcRunId = ref<string | null>(null); | ||
const cancelExecution = () => { | ||
if (funcRunId.value) { | ||
adminStore.CANCEL_EXECUTION(funcRunId.value); | ||
} | ||
}; | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { addStoreHooks, ApiRequest } from "@si/vue-lib/pinia"; | ||
import { defineStore } from "pinia"; | ||
import { FuncRunId } from "@/store/func_runs.store"; | ||
import { useWorkspacesStore } from "./workspaces.store"; | ||
|
||
export const useAdminStore = () => { | ||
const workspacesStore = useWorkspacesStore(); | ||
const workspaceId = workspacesStore.selectedWorkspacePk; | ||
|
||
const API_PREFIX = `v2/workspaces/${workspaceId}/admin`; | ||
|
||
return addStoreHooks( | ||
workspaceId, | ||
null, | ||
defineStore(`ws${workspaceId || "NONE"}/admin`, { | ||
state: () => ({}), | ||
actions: { | ||
async CANCEL_EXECUTION(funcRunId: FuncRunId) { | ||
return new ApiRequest<null>({ | ||
method: "put", | ||
url: `${API_PREFIX}/runs/${funcRunId}/cancel_execution`, | ||
}); | ||
}, | ||
}, | ||
onActivated() { | ||
return () => {}; | ||
}, | ||
}), | ||
)(); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
node_modules | ||
dist | ||
coverage | ||
examples |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,8 +10,8 @@ module.exports = { | |
{ | ||
files: ["**/*.ts"], | ||
rules: { | ||
"no-console": "off", | ||
"no-console": "off" | ||
} | ||
} | ||
], | ||
] | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
use serde::{Deserialize, Serialize}; | ||
|
||
#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] | ||
#[serde(rename_all = "camelCase")] | ||
pub struct CancelExecutionRequest { | ||
pub execution_id: String, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.