-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathdatabase.vue
More file actions
121 lines (115 loc) · 4.74 KB
/
Copy pathdatabase.vue
File metadata and controls
121 lines (115 loc) · 4.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
<script>
/**
* APIShift Engine v1.0.0
*
* Copyright 2020-present Sapir Shemer, DevShift (devshift.biz)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @author Sapir Shemer
* @contributor Ilan Dazanashvili
*/
module.exports = {
data() {
return {
is_main_page: true,
sub_pages: [
{ title: "Database Connections", sub_title: "Manage database connections", url: "/database/database_list" },
{ title: "Data Model Editor", sub_title: "Create database schemas using a smart ORM", url: "/database/model_editor" }
],
mixins_loaded: false
}
},
created() {
this.is_main_page = app.$router.currentRoute.path === '/database';
window.holder = this;
// Load necessary components
Promise.all([
APIShift.API.getMixin('graph/graph_view', true),
APIShift.API.getMixin('graph/graph_element', true),
APIShift.API.getMixin('graph/line_parent', true),
APIShift.API.getMixin('graph/container_element', true)
]).then(() => {
this.mixins_loaded = true;
});
},
beforeRouteUpdate (to, from, next) {
if(to.path == '/database' || to.path == '/database/') this.is_main_page = true;
else this.is_main_page = false;
next();
},
methods: {
getPageTitle: function () {
if(app.$router.currentRoute.path === '/database') return "Manage Data";
for(let key in this.sub_pages) if(this.sub_pages[key].url == app.$router.currentRoute.path) return this.sub_pages[key].title;
return "Not Found";
},
updateIndex(new_index) {
this.index = new_index;
}
},
};
</script>
<template>
<v-main>
<v-container fluid fill-height>
<v-card v-if="is_main_page" class="mx-auto" width="90%" min-height="75%" elevation-2>
<!-- Header -->
<v-app-bar>
<v-menu offset-y>
<template v-slot:activator="{ on }">
<v-toolbar-title v-on="on">
<v-btn>
{{ getPageTitle() }}
<v-icon right>mdi-menu-down</v-icon>
</v-btn>
</v-toolbar-title>
</template>
<v-list>
<v-list-item to="/database">Main Page</v-list-item>
<v-list-item v-for="(item, key) in sub_pages" :key="key" :to="item.url">{{ item.title }}</v-list-item>
</v-list>
</v-menu>
<v-spacer></v-spacer>
</v-app-bar>
<!-- Body -->
<div class="overflow-box" v-bar>
<div>
<v-layout class="mx-auto" align-start justify-center row wrap>
<v-card v-for="(item, key) in sub_pages" :key="key" :to="item.url" class="page-card" elevation-4 outlined>
<v-container>
<v-row justify="space-between">
<v-col>
<v-list-item-title>{{ item.title }}</v-list-item-title>
<v-list-item-subtitle>{{ item.sub_title }}</v-list-item-subtitle>
</v-col>
</v-row>
</v-container>
</v-card>
</v-layout>
</div>
</div>
</v-card>
<router-view v-if="!is_main_page && mixins_loaded"></router-view>
</v-container>
</v-main>
</template>
<style scoped>
.page-card {
margin: 5px;
min-width: 500px;
}
.page-card:hover {
cursor: pointer;
}
</style>