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

feat(girder): allow disabling girder integration entirely #500

Merged
merged 1 commit into from
Jul 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/components/core/FileLoader/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export default {
DragAndDrop,
GirderBox,
},
inject: ['girderRest'],
props: {
value: {
type: Boolean,
Expand Down
4 changes: 2 additions & 2 deletions src/components/core/FileLoader/template.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<v-container>
<v-tabs v-model="active_tab">
<v-tab>Local</v-tab>
<v-tab>Girder</v-tab>
<v-tab v-if="girderRest">Girder</v-tab>
<v-tab-item transition="fade-transition">
<drag-and-drop
enabled
Expand All @@ -37,7 +37,7 @@
</template>
</drag-and-drop>
</v-tab-item>
<v-tab-item transition="fade-transition">
<v-tab-item transition="fade-transition" v-if="girderRest">
<girder-box />
</v-tab-item>
</v-tabs>
Expand Down
4 changes: 2 additions & 2 deletions src/components/tools/MeasurementTools/template.html
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,10 @@
<template v-else>
<div class="pt-2 body-1 teal--text text-center">No measurements yet</div>
</template>
<v-btn :disabled="!targetProxy || !girderRest.user" @click="upload">
<v-btn :disabled="!targetProxy || !girderRest || !girderRest.user" @click="upload">
Upload
</v-btn>
<span v-show="!girderRest.user" class="body-2">Log in to upload</span>
<span v-show="!girderRest || !girderRest.user" class="body-2">Log in to upload</span>
</div>
</v-card>
</v-container>
Expand Down
4 changes: 2 additions & 2 deletions src/components/tools/PaintTool/template.html
Original file line number Diff line number Diff line change
Expand Up @@ -227,12 +227,12 @@
</v-list>
</v-flex>
<v-btn
:disabled="!girderRest.user"
:disabled="!girderRest || !girderRest.user"
@click="upload()"
>
Upload
</v-btn>
<span v-show="!girderRest.user" class="body-2">Log in to upload</span>
<span v-show="!girderRest || !girderRest.user" class="body-2">Log in to upload</span>
</v-layout>
</v-container>
</div>
20 changes: 11 additions & 9 deletions src/girder.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,19 @@ import vtkURLExtract from '@kitware/vtk.js/Common/Core/URLExtract';
// Install the Vue plugin that lets us use the components
Vue.use(Girder);

// This connects to another server if the VUE_APP_API_ROOT
// environment variable is set at build-time
const { girderRoute } = vtkURLExtract.extractURLParameters();

// URL parameters to change Girder API root URL, or to disable it completely
const { girderRoute, noGirder } = vtkURLExtract.extractURLParameters();
// Create the axios-based client to be used for all API requests
const apiRoot = girderRoute || 'https://data.kitware.com/api/v1';
const girderRest = noGirder
? undefined
: new RestClient({
apiRoot,
});

// Create the axios-based client to be used for all API requests
const girderRest = new RestClient({
apiRoot,
});
girderRest.fetchUser();
if (girderRest) {
girderRest.fetchUser();
}

// This is passed to our Vue instance; it will be available in all components
const GirderProvider = {
Expand Down
Loading