Skip to content

Commit 7866d71

Browse files
committed
Added full-page steps with transitions
1 parent a70c0c4 commit 7866d71

File tree

3 files changed

+41
-19
lines changed

3 files changed

+41
-19
lines changed

app/static/index.html

Lines changed: 29 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!DOCTYPE html>
2-
<html class="h-100">
2+
<html class="h-100" lang="en">
33

44
<head>
55
<title>Algo VPN</title>
@@ -10,26 +10,42 @@
1010
integrity="sha256-NSuqgY2hCZJUN6hDMFfdxvkexI7+iLxXQbL540RQ/c4=" crossorigin="anonymous"></script>
1111
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css"
1212
integrity="sha256-L/W5Wfqfa0sdBNIKN9cG6QA5F2qx4qICmU2VgLruv9Y=" crossorigin="anonymous">
13+
<style>
14+
.fade-enter-active, .fade-leave-active {
15+
transition: opacity 300ms ease-in-out;
16+
}
17+
.fade-enter, .fade-leave-to /* .fade-leave-active below version 2.1.8 */ {
18+
opacity: 0;
19+
}
20+
</style>
1321
</head>
1422

1523
<body class="d-flex flex-column h-100">
1624
<div class="container" id="algo">
1725
<h1 class="mb-5 text-center">{{ title }}</h1>
18-
<div class="row">
19-
<user-config class="col-md-4 order-md-2 mb-4"></user-config>
20-
<vpn-setup class="col-md-8 order-md-1"
21-
v-bind:extra_args="extra_args"
22-
v-on:submit="on_setup_submit"></vpn-setup>
23-
</div>
24-
<provider-setup v-bind:extra_args="extra_args" v-on:submit="on_provider_submit">
25-
</provider-setup>
26+
<transition name="fade">
27+
<div class="row" v-if="step == 'setup'">
28+
<user-config class="col-md-4 order-md-2 mb-4"></user-config>
29+
<vpn-setup class="col-md-8 order-md-1"
30+
v-bind:extra_args="extra_args"
31+
v-on:submit="set_step('provider'); update_extra_args"></vpn-setup>
32+
</div>
33+
</transition>
34+
<transition name="fade">
35+
<provider-setup v-if="step == 'provider'"
36+
v-bind:extra_args="extra_args"
37+
v-on:submit="update_extra_args"
38+
v-on:back="set_step('setup')">
39+
</provider-setup>
40+
</transition>
2641
</div>
2742

2843
<script>
2944
new window.Vue({
3045
el: '#algo',
3146
data: {
3247
playbook: {},
48+
step: 'setup',
3349
extra_args: {
3450
server_name: "algo",
3551
ondemand_cellular: false,
@@ -51,17 +67,15 @@ <h1 class="mb-5 text-center">{{ title }}</h1>
5167
'provider-setup': window.httpVueLoader('/static/provider-setup.vue'),
5268
},
5369
methods: {
54-
on_setup_submit: function(extra_args) {
55-
Object.assign(this.extra_args, extra_args);
56-
debugger;
70+
set_step: function(step) {
71+
this.step = step;
5772
},
58-
on_provider_submit: function(extra_args) {
73+
update_extra_args: function(extra_args) {
5974
Object.assign(this.extra_args, extra_args);
60-
debugger;
6175
}
6276
}
6377
})
6478
</script>
6579
</body>
6680

67-
</html>
81+
</html>

app/static/provider-setup.vue

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<template>
22
<div class="row" id="prodiver_id">
33
<h2 class="col-12">
4+
<button type="button" class="btn btn-secondary back-button" v-on:click="$emit('back')"><</button>
45
<span v-if="provider">{{ provider.name }} Setup</span>
56
<span v-else>Select cloud provider</span>
67
</h2>
@@ -13,7 +14,7 @@
1314
class="nav-link"
1415
href="#prodiver_id"
1516
v-bind:class="{ active: item.alias === (provider && provider.alias) }"
16-
@click="set_provider(item)"
17+
v-on:click="set_provider(item)"
1718
>{{item.name}}</a>
1819
</li>
1920
</ul>
@@ -60,4 +61,11 @@ module.exports = {
6061
'digitalocean': window.httpVueLoader('/static/provider-do.vue')
6162
}
6263
};
63-
</script>
64+
</script>
65+
<style scoped>
66+
.back-button {
67+
position: absolute;
68+
border-radius: 50%;
69+
left: -2em;
70+
}
71+
</style>

app/static/vpn-setup.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@
9696
Each user will have their own account for SSH tunneling
9797
</label>
9898
</div>
99-
<button @click="$emit('submit')" class="btn btn-primary" type="button">Select Cloud Provider</button>
99+
<button v-on:click="$emit('submit')" class="btn btn-primary" type="button">Select Cloud Provider</button>
100100
</section>
101101
</div>
102102
</template>
@@ -108,4 +108,4 @@ module.exports = {
108108
extra_args: Object
109109
}
110110
}
111-
</script>
111+
</script>

0 commit comments

Comments
 (0)