Skip to content

Commit

Permalink
First draft for the tour guide #172
Browse files Browse the repository at this point in the history
  • Loading branch information
m-mohr committed Aug 4, 2021
1 parent 6eac0f9 commit 8cb5ad4
Show file tree
Hide file tree
Showing 5 changed files with 151 additions and 6 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@openeo/web-editor",
"version": "0.8.0-rc.7",
"version": "0.8.0-rc.8",
"apiVersions": [
"1.0.0-rc.2",
"1.0.0",
Expand Down Expand Up @@ -57,6 +57,7 @@
"vue": "^2.6.12",
"vue-multiselect": "^2.1.6",
"vue-snotify": "^3.2.1",
"vue-tour": "^2.0.0",
"vue2-datepicker": "^3.9.0",
"vuedraggable": "^2.24.3",
"vuex": "^3.5.1"
Expand Down
3 changes: 3 additions & 0 deletions src/Page.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<component :is="modal.component" :key="modal.id" v-bind="modal.props" v-on="modal.events" @closed="hideModal(modal)" />
</template>
<vue-snotify />
<Tour v-if="tourType" v-model="tourType" />
<span v-show="activeRequests > 0" id="activeRequests">
<i class="fas fa-spinner fa-spin fa-2x"></i>
</span>
Expand Down Expand Up @@ -43,6 +44,7 @@ export default {
ProcessParameterModal: () => import('./components/modals/ProcessParameterModal.vue'),
ServerInfoModal: () => import('./components/modals/ServerInfoModal.vue'),
ServiceInfoModal: () => import('./components/modals/ServiceInfoModal.vue'),
Tour: () => import('./components/Tour.vue'),
UdfRuntimeModal: () => import('./components/modals/UdfRuntimeModal.vue'),
WebEditorModal: () => import('./components/modals/WebEditorModal.vue')
},
Expand Down Expand Up @@ -82,6 +84,7 @@ export default {
this.listen('showProcessParameter', this.showProcessParameter);
this.listen('showWebEditorInfo', this.showWebEditorInfo);
this.listen('title', this.setTitle);
this.listen('showTour', where => this.tourType = where);
},
watch: {
isDiscovered(newVal) {
Expand Down
2 changes: 1 addition & 1 deletion src/components/ConnectForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<button type="submit" class="connectBtn" :class="{loading: loading}"><i class="fas fa-spinner fa-spin fa-lg"></i> Connect</button>
</div>
</form>
<div v-else-if="this.showLoginForm" class="login">
<div v-else-if="showLoginForm" class="login">
<h3>Log in to {{ title }}</h3>
<Tabs id="credentials" ref="providers" :pills="true" :pillsMultiline="true" @selected="providerSelected">
<template #dynamic="{ tab }">
Expand Down
13 changes: 9 additions & 4 deletions src/components/IDE.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,32 @@
<header class="navbar">
<Logo />
<ul id="menu">
<li><div class="menuItem" @click="showHelp" title="Start a guided tour"><i class="fas fa-question fa-fw"></i> Help</div></li>
<li><div class="menuItem" @click="showServerInfo" title="Get server information"><i class="fas fa-info fa-fw"></i> Server</div></li>
<li><UserMenu /></li>
</ul>
</header>
<Splitpanes class="default-theme" @resize="resized" @pane-maximize="resized">
<Pane id="discovery" :size="splitpaneSize[0]">
<DiscoveryToolbar class="toolbar" :onAddProcess="insertProcess" :collectionPreview="true" />
<DiscoveryToolbar class="toolbar tour-ide-discovery" :onAddProcess="insertProcess" :collectionPreview="true" />
</Pane>
<Pane id="workspace" :size="splitpaneSize[1]">
<Splitpanes class="default-theme" horizontal @resize="resized" @pane-maximize="resized">
<Pane id="editor" size="50">
<Editor ref="editor" class="mainEditor" id="main" :value="process" @input="updateEditor" :title="contextTitle">
<Editor ref="editor" class="mainEditor tour-ide-editor" id="main" :value="process" @input="updateEditor" :title="contextTitle">
<template #file-toolbar>
<button type="button" @click="importProcess" title="Import process from external source"><i class="fas fa-cloud-download-alt"></i></button>
<button type="button" v-show="saveSupported" @click="saveProcess" :title="'Save to ' + contextTitle"><i class="fas fa-save"></i></button>
</template>
</Editor>
</Pane>
<Pane id="user" size="50" v-if="isAuthenticated">
<UserWorkspace class="userContent" />
<UserWorkspace class="userContent tour-ide-workspace" />
</Pane>
</Splitpanes>
</Pane>
<Pane id="viewer" :size="splitpaneSize[2]">
<Viewer />
<Viewer class="tour-ide-viewer" />
</Pane>
</Splitpanes>
</div>
Expand Down Expand Up @@ -159,6 +160,10 @@ export default {
this.emit('showModal', 'ServerInfoModal');
},
showHelp() {
this.emit('showTour', 'ide');
},
showDataForm(title, fields, saveCallback = null, closeCallback = null) {
var editable = typeof saveCallback === 'function';
var data = {};
Expand Down
136 changes: 136 additions & 0 deletions src/components/Tour.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
<template>
<v-tour class="web-editor-tour" name="tour" :steps="steps" :callbacks="callbacks" :options="options" />
</template>

<script>
import Utils from '../utils.js';
import VueTour from 'vue-tour';
import Vue from 'vue';
Vue.use(VueTour);
export default {
name: 'Tour',
props: {
value: {
type: String, // one of: connect, login, ide, ...
default: null
}
},
data() {
return {
callbacks: {
onSkip: this.onEnd,
onFinish: this.onEnd
},
options: {
// highlight: true, // Doesn't always work?
labels: {
buttonSkip: 'Skip tour', //'Skip tour (ESC)', - don't promote ESC key right now due to bug https://github.com/pulsardev/vue-tour/issues/202
buttonPrevious: 'Previous ⇦',
buttonNext: 'Next ⇨',
buttonStop: 'Finish' //'Finish (ESC)',
}
},
enableScrolling: [], // Add sub-tour name if scrolling should be enabled
entries: {
'ide-discovery': {
title: 'Service Offerings',
content: 'This section allows you to discover and search through the service offerings such as the available data sets (collections), the supported processes etc.'
},
'ide-editor': {
title: 'Process Editor',
content: 'This is the editor for the processes. We recommend to work in "Visual Model" mode, where you can create processing chains simply by adding collections and processes and connecting them with each other. The "Code" mode allows to see the generated JSON process, which is usually only needed if you want to run the process using another client library such as Python or R.'
},
'ide-workspace': {
title: 'User Workspace',
content: 'In this area you can find your personal workspace, which lists your stored batch jobs, web services and files.'
},
'ide-viewer': {
title: 'Data Viewer',
content: 'This area you can use to preview collections or inspect the results of batch jobs, web services or other computations. It will also be used to display log messages, if available.'
}
}
};
},
mounted() {
this.$tours['tour'].start();
},
watch: {
value(value) {
if (value !== null) {
this.$tours['tour'].start();
}
}
},
computed: {
...Utils.mapState(['isAuthenticated']),
instructions() {
let steps = [];
switch(this.value) {
case 'ide':
steps.push('ide-discovery');
steps.push('ide-editor');
if (this.isAuthenticated) {
steps.push('ide-workspace');
}
steps.push('ide-viewer');
break;
default:
if (this.value !== null) {
Utils.error(this, 'Sorry, no tour available yet.');
}
}
return steps;
},
steps() {
let steps = [];
for(let entry of this.instructions) {
if (typeof entry === 'string') {
entry = [entry];
}
let data = this.entries[entry[0]];
let obj = {
target: `.tour-${entry[0]}`,
header: {
title: data.title,
},
content: data.content,
params: {
placement: entry[1] || 'auto',
enableScrolling: this.enableScrolling.includes(this.value)
}
};
steps.push(obj);
}
return steps;
}
},
methods: {
onEnd() {
this.$emit('input', null);
}
}
}
</script>

<style lang="scss">
@import '~vue-tour/dist/vue-tour.css';
@import '../../theme.scss';
.web-editor-tour {
.v-step {
background-color: $mainColor;
color: white;
}
.v-step__header {
background-color: rgba(0,0,0,0.2);
}
.v-step__content {
text-align: justify;
}
.v-step__arrow--dark:before {
background-color: $mainColor;
}
}
</style>

0 comments on commit 8cb5ad4

Please sign in to comment.