-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
686 additions
and
6 deletions.
There are no files selected for viewing
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,4 @@ | ||
import { type components } from "@/api/schema"; | ||
|
||
export type ClaimLandingPayload = components["schemas"]["ClaimLandingPayload"]; | ||
export type WorkflowLandingRequest = components["schemas"]["WorkflowLandingRequest"]; |
72 changes: 72 additions & 0 deletions
72
client/src/components/Form/Elements/FormData/FormDataUri.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,72 @@ | ||
<template> | ||
<b-row align-v="center"> | ||
<b-col> | ||
<b-form-input | ||
:id="id" | ||
v-model="displayValue" | ||
:class="['ui-input', cls]" | ||
:readonly="true" /> | ||
</b-col> | ||
</b-row> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
props: { | ||
value: { | ||
type: Object, | ||
}, | ||
id: { | ||
type: String, | ||
default: "", | ||
}, | ||
multiple: { | ||
type: Boolean, | ||
default: false, | ||
}, | ||
cls: { | ||
// Refers to an optional custom css class name | ||
type: String, | ||
default: null, | ||
}, | ||
}, | ||
computed: { | ||
displayValue: { | ||
get() { | ||
console.log(this.value); | ||
return this.value.url; | ||
}, | ||
set(newVal, oldValue) { | ||
if (newVal !== this.value.url) { | ||
this.value.url = newValue; | ||
this.$emit("input", this.value); | ||
} | ||
}, | ||
}, | ||
currentValue: { | ||
get() { | ||
const v = this.value ?? ""; | ||
if (Array.isArray(v)) { | ||
if (v.length === 0) { | ||
return ""; | ||
} | ||
return this.multiple | ||
? this.value.reduce((str_value, v) => str_value + String(v) + "\n", "") | ||
: String(this.value[0]); | ||
} | ||
return String(v); | ||
}, | ||
set(newVal, oldVal) { | ||
if (newVal !== oldVal) { | ||
this.$emit("input", newVal); | ||
} | ||
}, | ||
}, | ||
}, | ||
}; | ||
</script> | ||
<style scoped> | ||
.ui-input-linked { | ||
border-left-width: 0.5rem; | ||
} | ||
</style> |
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,8 @@ | ||
<script setup lang="ts"> | ||
</script> | ||
|
||
<template> | ||
<div> | ||
This a place holder for a feature that is not currently implemented. | ||
</div> | ||
</template> |
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,62 @@ | ||
<script setup lang="ts"> | ||
import { BAlert } from "bootstrap-vue"; | ||
import { onMounted, ref } from 'vue' | ||
import { type components, GalaxyApi } from "@/api"; | ||
import { type ClaimLandingPayload } from "@/api/landings"; | ||
import { errorMessageAsString } from "@/utils/simple-error"; | ||
import LoadingSpan from "@/components/LoadingSpan.vue"; | ||
import WorkflowRun from "@/components/Workflow/Run/WorkflowRun.vue"; | ||
interface Props { | ||
uuid: string; | ||
secret?: string; | ||
} | ||
const props = withDefaults(defineProps<Props>(), { | ||
secret: undefined, | ||
}); | ||
const workflowId = ref<string | null>(null); | ||
const errorMessage = ref<string | null>(null); | ||
const requestState = ref<Record<string, never> | null>(null); | ||
onMounted(async () => { | ||
const payload: ClaimLandingPayload = {}; | ||
if (props.secret) { | ||
payload['client_secret'] = props.secret; | ||
} | ||
const { data, error } = await GalaxyApi().POST("/api/workflow_landings/{uuid}/claim", { | ||
params: { | ||
path: { uuid: props.uuid }, | ||
}, | ||
body: payload, | ||
}); | ||
if (data) { | ||
workflowId.value = data.workflow_id; | ||
requestState.value = data.request_state; | ||
} else { | ||
errorMessage.value = errorMessageAsString(error); | ||
} | ||
console.log(data); | ||
}); | ||
</script> | ||
|
||
<template> | ||
<div> | ||
<div v-if="!workflowId"> | ||
<LoadingSpan message="Loading workflow parameters" /> | ||
</div> | ||
<div v-else-if="errorMessage"> | ||
<BAlert variant="danger" show> | ||
{{ errorMessage }} | ||
</BAlert> | ||
</div> | ||
<div v-else> | ||
<WorkflowRun :workflow-id="workflowId" :prefer-simple-form="true" :request-state="requestState" /> | ||
</div> | ||
</div> | ||
</template> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
import json | ||
from uuid import uuid4 | ||
|
||
from pydantic import UUID4 | ||
|
||
from galaxy.schema.schema import ( | ||
ClaimLandingPayload, | ||
CreateToolLandingRequestPayload, | ||
CreateWorkflowLandingRequestPayload, | ||
ToolLandingRequest, | ||
WorkflowLandingRequest, | ||
) | ||
from galaxy.structured_app import StructuredApp | ||
from .context import ProvidesUserContext | ||
|
||
|
||
class LandingRequestManager: | ||
|
||
def __init__(self, app: StructuredApp): | ||
self.app = app | ||
|
||
def create_tool_landing_request(self, payload: CreateToolLandingRequestPayload) -> ToolLandingRequest: | ||
response_model = ToolLandingRequest( | ||
tool_id=payload.tool_id, | ||
tool_version=payload.tool_version, | ||
request_state=payload.request_state, | ||
uuid=uuid4(), | ||
state="unclaimed", | ||
) | ||
|
||
with open("request.json", "w") as f: | ||
f.write(json.dumps(response_model.model_dump(mode="json"))) | ||
return response_model | ||
|
||
def create_workflow_landing_request(self, payload: CreateWorkflowLandingRequestPayload) -> WorkflowLandingRequest: | ||
response_model = WorkflowLandingRequest( | ||
workflow_id=payload.workflow_id, | ||
workflow_target_type=payload.workflow_target_type, | ||
request_state=payload.request_state, | ||
uuid=uuid4(), | ||
state="unclaimed", | ||
) | ||
|
||
with open("request.json", "w") as f: | ||
f.write(json.dumps(response_model.model_dump(mode="json"))) | ||
return response_model | ||
|
||
def claim_tool_landing_request( | ||
self, trans: ProvidesUserContext, uuid: UUID4, claim: ClaimLandingPayload | ||
) -> ToolLandingRequest: | ||
with open("request.json") as f_in: | ||
request = ToolLandingRequest.model_validate(json.load(f_in)) | ||
request.state = "claimed" | ||
|
||
with open("request.json", "w") as f_out: | ||
f_out.write(json.dumps(request.model_dump(mode="json"))) | ||
return request | ||
|
||
def claim_workflow_landing_request( | ||
self, trans: ProvidesUserContext, uuid: UUID4, claim: ClaimLandingPayload | ||
) -> WorkflowLandingRequest: | ||
with open("request.json") as f_in: | ||
request = WorkflowLandingRequest.model_validate(json.load(f_in)) | ||
request.state = "claimed" | ||
|
||
with open("request.json", "w") as f_out: | ||
f_out.write(json.dumps(request.model_dump(mode="json"))) | ||
return request | ||
|
||
def get_tool_landing_request(self, trans: ProvidesUserContext, uuid: UUID4) -> ToolLandingRequest: | ||
with open("request.json") as f_in: | ||
request = ToolLandingRequest.model_validate(json.load(f_in)) | ||
return request | ||
|
||
def get_workflow_landing_request(self, trans: ProvidesUserContext, uuid: UUID4) -> WorkflowLandingRequest: | ||
with open("request.json") as f_in: | ||
request = WorkflowLandingRequest.model_validate(json.load(f_in)) | ||
return request |
Oops, something went wrong.