-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
28b713b
commit ebfae02
Showing
5 changed files
with
184 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
{% extends "layout.html" %} | ||
{% block title %}Home{% endblock %} | ||
{% block content %} | ||
|
||
<v-app id="index"> | ||
<!-- NAVIGATION DRAWER --> | ||
<v-navigation-drawer app v-model="drawer" color="grey lighten-2" clipped right> | ||
<v-list> | ||
<v-list-item-group color="primary"> | ||
<v-list-item href="/"> | ||
<v-list-item-icon> | ||
<v-icon>mdi-home</v-icon> | ||
</v-list-item-icon> | ||
<v-list-item-title>Home</v-list-item-title> | ||
</v-list-item> | ||
<v-divider></v-divider> | ||
<v-subheader>APPLICATIONS</v-subheader> | ||
<v-list-item href="http://localhost:8888" target="_blank"> | ||
<v-list-item-icon> | ||
<v-icon>mdi-language-python</v-icon> | ||
</v-list-item-icon> | ||
<v-list-item-title>JupyterLab</v-list-item-title> | ||
</v-list-item> | ||
<v-list-item href="http://localhost:8081" target="_blank"> | ||
<v-list-item-icon> | ||
<v-icon>mdi-database-search</v-icon> | ||
</v-list-item-icon> | ||
<v-list-item-title>Mongo Express</v-list-item-title> | ||
</v-list-item> | ||
</v-list-item-group> | ||
</v-list> | ||
</v-navigation-drawer> | ||
|
||
<!-- HEADER --> | ||
<v-app-bar app clipped-left color="deep-orange darken-4" dark dense clipped-right> | ||
<v-toolbar-title href="/" class="title font-weight-black">UMA Prediction</v-toolbar-title> | ||
<v-spacer></v-spacer> | ||
<v-app-bar-nav-icon @click.stop="drawer = !drawer"></v-app-bar-nav-icon> | ||
</v-app-bar> | ||
|
||
<v-content> | ||
<v-container> | ||
<v-row justify="center"> | ||
<v-col cols="12" sm="9"> | ||
<v-card> | ||
<v-card-title class="font-weight-bold"> | ||
最近のレース | ||
<v-spacer></v-spacer> | ||
<v-icon @click="recent">mdi-refresh</v-icon> | ||
<v-snackbar v-model="snackbar" :timeout="timeout"> | ||
タスクを実行しました | ||
<v-icon dark @click="snackbar = false">mdi-close-box</v-icon> | ||
</v-snackbar> | ||
</v-card-title> | ||
<v-simple-table> | ||
<template v-slot:default> | ||
<thead> | ||
<tr> | ||
<th class="text-left">場所</th> | ||
<th class="text-left">ラウンド</th> | ||
<th class="text-left">レース名</th> | ||
<th class="text-left">コース</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr v-for="rec in results" :key="rec._id" @click="showAlert(rec._id)"> | ||
<td>[[ rec.place ]]</td> | ||
<td>[[ rec.round ]]</td> | ||
<td>[[ rec.title ]]</td> | ||
<td>[[ rec.track ]]</td> | ||
</tr> | ||
</tbody> | ||
</template> | ||
</v-simple-table> | ||
</v-card> | ||
</v-col> | ||
<v-col cols="12" sm="3"> | ||
<v-card> | ||
<v-card-title class="font-weight-bold">IDを指定して実行</v-card-title> | ||
<v-card-actions> | ||
<v-text-field v-model="race_id" :append-outer-icon="'mdi-send'" filled label="Race ID" | ||
type="text" @click:append-outer="collect"></v-text-field> | ||
</v-card-actions> | ||
</v-card> | ||
</v-col> | ||
</v-row> | ||
</v-container> | ||
</v-content> | ||
</v-app> | ||
|
||
|
||
<script> | ||
new Vue({ | ||
el: '#index', | ||
delimiters: ["[[", "]]"], | ||
vuetify: new Vuetify(), | ||
data: { | ||
drawer: false, | ||
race_id: "{{ rid }}", | ||
results: [], | ||
snackbar: false, | ||
text: 'My timeout is set to 2000.', | ||
timeout: 2000, | ||
}, | ||
mounted: function () { | ||
axios.get("/api/races/" + this.race_id).then(response => { | ||
this.results = response.data; | ||
}) | ||
}, | ||
methods: { | ||
collect: async function () { | ||
await axios.post("/api/races/" + this.race_id); | ||
await this.get_race(); | ||
}, | ||
get_race: async function () { | ||
await axios.get("/api/races/" + this.race_id) | ||
.then(response => { this.results = response.data }) | ||
}, | ||
recent: async function () { | ||
this.snackbar = true; | ||
await axios.post("/api/races"); | ||
await axios.get("/api/races") | ||
.then(response => { this.results = response.data }); | ||
}, | ||
showAlert: function (rid) { | ||
window.location.href = rid; | ||
} | ||
} | ||
}) | ||
</script> | ||
{% endblock %} |