[go: nahoru, domu]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor display application handling #15076

Draft
wants to merge 10 commits into
base: dev
Choose a base branch
from
Prev Previous commit
Next Next commit
Remove display application mako
  • Loading branch information
guerler committed Nov 19, 2022
commit 6ec908accf99e298a4a5f775af7f430c5c7998bf
31 changes: 24 additions & 7 deletions client/src/components/Visualizations/DisplayApplication.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script setup>
import { urlData } from "utils/url";
import { DatasetProvider } from "components/providers";
import { defineProps, onMounted } from "vue";
import { computed, defineProps, onMounted, ref } from "vue";
const props = defineProps({
appName: {
type: String,
Expand All @@ -16,24 +16,41 @@ const props = defineProps({
required: true,
},
});
const applicationData = ref({});
const hasData = computed(() => !!applicationData.value);
async function getCreateLink() {
const params = new URLSearchParams({
app_name: props.appName,
dataset_id: props.datasetId,
link_name: props.linkName,
});
const buildUrl = `/api/display_applications/create_link?${params.toString()}`;
const data = await urlData({ url: buildUrl });
console.log(data);
applicationData.value = await urlData({ url: buildUrl });
console.log(applicationData.value);
}
onMounted(() => {
getCreateLink();
});
</script>
<template>
<div>
{{ appName }}
{{ datasetId }}
{{ linkName }}
<div v-if="hasData">
<div v-for="(message, messageIndex) in applicationData.msg" :key="messageIndex">
<b-alert :variant="message[1]" show>{{ message[0] }}</b-alert>
</div>
<div v-if="applicationData.preparable_steps">
<h2>Preparation Status</h2>
<table class="colored">
<tr>
<th>Step Name</th>
<th>Ready</th>
<th>Dataset Status</th>
</tr>
<tr v-for="(step, stepIndex) in applicationData.preparable_steps" :key="stepIndex">
<td>{{ step.name }}</td>
<td>{{ step.ready }}</td>
<td>{{ step.state }}</td>
</tr>
</table>
</div>
</div>
</template>
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const props = defineProps({
},
});
function getUrl(link) {
return safePath(`/display_applications/${link.dataset_id}/${link.app_name}/${link.link_name}`);
return safePath(`/display_applications/${props.datasetId}/${link.app_name}/${link.link_name}`);
}
</script>
<template>
Expand Down
3 changes: 2 additions & 1 deletion lib/galaxy/datatypes/display_applications/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,8 @@ def get_prepare_steps(self, datasets_only=True):
if datasets_only and not isinstance(param, DisplayApplicationDataParameter):
continue
value = self.parameters.get(name, None)
rval.append({"name": name, "value": value, "param": param, "ready": param.ready(self.parameters)})
state = value.state if value is not None else None
rval.append({"name": name, "state": state, "ready": param.ready(self.parameters)})
return rval

def display_url(self):
Expand Down
3 changes: 1 addition & 2 deletions lib/galaxy/managers/display_applications.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ def create_link(
refresh = True
else:
# We have permissions, dataset is not deleted and is in OK state, allow access
if display_link.display_ready():
if not display_link.display_ready():
# redirect user to url generated by display link
return dict(resource=display_link.display_url())
else:
Expand All @@ -175,7 +175,6 @@ def create_link(
preparable_steps = display_link.get_prepare_steps()
return dict(
msg=msg,
display_link=display_link,
refresh=refresh,
preparable_steps=preparable_steps,
)
Expand Down
27 changes: 0 additions & 27 deletions templates/webapps/galaxy/dataset/display_application/display.mako

This file was deleted.