Skip to content

Commit

Permalink
Merge pull request #500 from Lgt2x/disable-girder-option
Browse files Browse the repository at this point in the history
feat(girder): allow disabling girder integration entirely
  • Loading branch information
floryst authored Jul 11, 2024
2 parents 7b9006f + a42a8e2 commit c38d3c9
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 15 deletions.
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

0 comments on commit c38d3c9

Please sign in to comment.