Skip to content

Commit

Permalink
Fix UDP loading with authentication
Browse files Browse the repository at this point in the history
  • Loading branch information
m-mohr committed Oct 25, 2023
1 parent dd7845a commit 84d76f2
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 8 deletions.
6 changes: 5 additions & 1 deletion src/Page.vue
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,13 @@ export default {
});
}
if (Utils.param('discover') || resultUrl) {
const discover = Utils.param('discover');
if (discover === "1" || resultUrl) {
this.skipLogin = true;
}
else if (discover === "0") {
this.skipLogin = false;
}
// Count active requests
axios.interceptors.request.use(config => {
Expand Down
3 changes: 3 additions & 0 deletions src/components/ConnectForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,9 @@ export default {
if (discover && !this.$config.skipLogin) {
params.set('discover', 1);
}
else if (!discover && this.$config.skipLogin) {
params.set('discover', 0);
}
else {
params.delete('discover');
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/wizards/SpectralIndices.vue
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export default {
temporal_extent: null
};
},
created() {
beforeMount() {
this.scale = this.processes.has('apply') && this.processes.has('linear_scale_range') ? false : null;
},
computed: {
Expand Down
6 changes: 5 additions & 1 deletion src/components/wizards/UDP.vue
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,12 @@ export default {
};
}
},
async created() {
async beforeMount() {
this.loading = true;
if (typeof this.process !== 'string' || this.process.length === 0) {
this.$emit('close', `Sorry, no process specified.`);
return;
}
let [id, namespace] = Utils.extractUDPParams(this.process);
try {
this.processSpec = await this.loadProcess({id, namespace});
Expand Down
9 changes: 8 additions & 1 deletion src/components/wizards/tabs/ChooseProcessParameters.vue
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
<template>
<div class="step choose-process-parameters">
<p v-if="process.parameters.length === 0">No editable parameters available.</p>
<p v-if="parameters.length === 0">
This process doesn't expose any parameters.
You can skip this step.
</p>
<Parameters v-else v-model="value" :parameters="parameters" :parent="process" />
</div>
</template>

<script>
import { ProcessParameter } from '@openeo/js-commons';
import Parameters from '../../Parameters.vue';
import Utils from '../../../utils';
export default {
name: 'ChooseProcessParameters',
Expand All @@ -26,6 +30,9 @@ export default {
},
computed: {
parameters() {
if (!Utils.isObject(this.process) || !Array.isArray(this.process.parameters)) {
return [];
}
return this.process.parameters.map(p => new ProcessParameter(p)).filter(p => p.isEditable());
}
}
Expand Down
18 changes: 14 additions & 4 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,11 @@ class Utils extends VueUtils {
}

static param(name) {
const urlParams = new URLSearchParams(window.location.search);
return urlParams.get(name);
const urlParams = new URLSearchParams(window.location.search);
if (urlParams.has(name)) {
return urlParams.get(name);
}
return undefined;
}

static isBboxInWebMercator(bboxes) {
Expand Down Expand Up @@ -407,8 +410,15 @@ class Utils extends VueUtils {
return resolver(schema);
}
static extractUDPParams(process) {
let [id, ...namespace] = process.split('@');
return [id, namespace.join('@')];
const pos = process.indexOf('@');
if (pos < 0) {
return [process, undefined];
}
else {
const id = process.substring(0, pos);
const namespace = process.substring(pos + 1);
return [id, namespace];
}
}
static getProcessingExpression(stac) {
let key = 'processing:expression';
Expand Down

0 comments on commit 84d76f2

Please sign in to comment.