Skip to content
This repository has been archived by the owner on Sep 27, 2021. It is now read-only.

Commit

Permalink
log component
Browse files Browse the repository at this point in the history
  • Loading branch information
Monty committed Jan 27, 2020
1 parent d3809bb commit ffe3e85
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/rclone.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
const execa = require('execa');
const log = require('./worker-logger');

const binaryPath = `/usr/bin/rclone`;
const binaryPath = `rclone`;

module.exports = {
async ls(path) {
Expand Down
6 changes: 6 additions & 0 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ router.get('/user/:user/json', async ctx => {
ctx.body = JSON.stringify(JSON.parse(raw), null, '\t');
});

router.get('/user/:user/log', async ctx => {
ctx.set('Content-Type', 'text/plain');

ctx.body = await rclone.cat(`${pathing.encode(ctx.params.user)}.log`);
});

router.get('/repos/:user/:repo', async ctx => {
ctx.set('Content-Type', 'application/zip');

Expand Down
45 changes: 45 additions & 0 deletions ui/components/UserLog.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<template>
<div class="card">
<div class="card-header justify-content-between align-items-center">
<div class="row">
<div class="col">
<router-link v-bind:to="'/user/' + username">
<button class="btn btn-sm btn-outline-dark">
<i class="fas fa-long-arrow-alt-left"></i>
Back
</button>
</router-link>
</div>

<div class="col" style="text-align: center; padding-top: 3px;">
<i class="fas fa-user"></i> {{username}}
</div>

<div class="col">
</div>
</div>
</div>

<pre>{{log}}</pre>
</div>
</template>

<script>
const axios = require('axios');
module.exports = {
computed: {
username() {
return this.$route.params.username;
}
},
data: () => ({
log: ''
}),
async created() {
const {data} = await axios.get(`/user/${this.username}/log`);
this.log = data;
}
};
</script>
7 changes: 7 additions & 0 deletions ui/components/UserPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@
Back
</button>
</router-link>

<router-link v-bind:to="'/user/' + username + '/log'">
<button class="btn btn-sm btn-outline-dark">
<i class="fas fa-logs"></i>
View Logs
</button>
</router-link>
</div>

<div class="col" style="text-align: center; padding-top: 3px;">
Expand Down
5 changes: 5 additions & 0 deletions ui/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const Router = require('vue-router');
const App = require('./components/App.vue');
const UserList = require('./components/UserList.vue');
const UserPage = require('./components/UserPage.vue');
const UserLog = require('./components/UserLog.vue');

Vue.use(Router);

Expand All @@ -16,6 +17,10 @@ const router = new Router({
{
path: '/user/:username',
component: UserPage
},
{
path: '/user/:username/log',
component: UserLog
}
]
});
Expand Down

0 comments on commit ffe3e85

Please sign in to comment.