-
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.
Allow oauth2 file sources with Dropbox initial implementation.
- Loading branch information
Showing
41 changed files
with
1,385 additions
and
70 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
33 changes: 31 additions & 2 deletions
33
client/src/components/FileSources/Instances/CreateInstance.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 |
---|---|---|
@@ -1,34 +1,63 @@ | ||
<script setup lang="ts"> | ||
import { computed } from "vue"; | ||
import { computed, watch } from "vue"; | ||
import type { UserFileSourceModel } from "@/api/fileSources"; | ||
import { useFileSourceTemplatesStore } from "@/stores/fileSourceTemplatesStore"; | ||
import { useInstanceRouting } from "./routing"; | ||
import { getOAuth2Info } from "./services"; | ||
import CreateForm from "@/components/FileSources/Instances/CreateForm.vue"; | ||
import LoadingSpan from "@/components/LoadingSpan.vue"; | ||
interface Props { | ||
templateId: string; | ||
uuid?: string; | ||
} | ||
const OAUTH2_TYPES = ["dropbox", "googledrive"]; | ||
const fileSourceTemplatesStore = useFileSourceTemplatesStore(); | ||
fileSourceTemplatesStore.fetchTemplates(); | ||
const { goToIndex } = useInstanceRouting(); | ||
const props = defineProps<Props>(); | ||
const template = computed(() => fileSourceTemplatesStore.getLatestTemplate(props.templateId)); | ||
const requiresOAuth2AuthorizeRedirect = computed(() => { | ||
const templateValue = template.value; | ||
return props.uuid == undefined && templateValue && OAUTH2_TYPES.indexOf(templateValue.type) >= 0; | ||
}); | ||
async function onCreated(objectStore: UserFileSourceModel) { | ||
const message = `Created file source ${objectStore.name}`; | ||
goToIndex({ message }); | ||
} | ||
watch( | ||
requiresOAuth2AuthorizeRedirect, | ||
async (requiresAuth) => { | ||
const templateValue = template.value; | ||
if (templateValue && requiresAuth) { | ||
const { data } = await getOAuth2Info({ | ||
template_id: templateValue.id, | ||
template_version: templateValue.version || 0, | ||
}); | ||
window.location.href = data.authorize_url; | ||
} else { | ||
console.log("skipping this..."); | ||
} | ||
}, | ||
{ immediate: true } | ||
); | ||
</script> | ||
|
||
<template> | ||
<div> | ||
<LoadingSpan v-if="!template" message="Loading file source templates" /> | ||
<CreateForm v-else :template="template" @created="onCreated"></CreateForm> | ||
<LoadingSpan | ||
v-else-if="requiresOAuth2AuthorizeRedirect" | ||
message="Fetching redirect information, you will need to authorize Galaxy to have access to this resource remotely" /> | ||
<CreateForm v-else :uuid="uuid" :template="template" @created="onCreated"></CreateForm> | ||
</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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
7 changes: 7 additions & 0 deletions
7
lib/galaxy/files/templates/examples/dropbox_client_secrets_explicit.yml
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 @@ | ||
- id: dropbox | ||
name: Dropbox | ||
description: Connect to your Dropbox account to download and upload files. | ||
configuration: | ||
type: dropbox | ||
oauth2_client_id: abcdefgh | ||
oauth2_client_secret: ijklmnopqr |
Oops, something went wrong.