1
0
Fork 0
dri/src/views/Blob.vue

65 lines
1.3 KiB
Vue
Raw Normal View History

2018-09-26 22:27:42 +08:00
<template>
2018-09-29 16:37:40 +08:00
<Layout>
<h1 slot="title">{{ $route.params.repo }}</h1>
2018-09-29 15:39:45 +08:00
<Error slot="error" :message='error' />
2018-09-29 16:37:40 +08:00
<h2>Details</h2>
<List>
<ListItem>
<span slot="title">Full Digest</span>
<span slot="detail">{{ $route.params.digest }}</span>
</ListItem>
<ListItem>
<span slot="title">Size</span>
<BlobSize slot="detail" :repo="$route.params.repo" :blob="$route.params.digest" />
</ListItem>
</List>
</Layout>
2018-09-26 22:27:42 +08:00
</template>
<script>
2018-09-29 15:39:45 +08:00
import { blob } from '@/api';
2018-09-26 22:27:42 +08:00
import Layout from '@/components/Layout.vue';
2018-09-29 15:39:45 +08:00
import Error from '@/components/Error.vue';
2018-09-26 22:27:42 +08:00
import List from '@/components/List.vue';
import ListItem from '@/components/ListItem.vue';
import BlobSize from '@/components/BlobSize.vue';
export default {
2018-09-27 13:41:08 +08:00
components: {
Layout,
2018-09-29 15:39:45 +08:00
Error,
2018-09-27 13:41:08 +08:00
List,
ListItem,
BlobSize,
},
2018-09-29 15:39:45 +08:00
data() {
return {
error: '',
digest: '',
};
},
async created() {
await this.fetchBlob();
},
methods: {
async fetchBlob() {
try {
const r = await blob(this.$route.params.repo, this.$route.params.digest);
if (r.dockerContentDigest) {
this.digest = r.dockerContentDigest;
}
} catch (e) {
console.error(e);
this.error = `Unable to fetch blob (${e.message})`;
}
},
},
watch: {
async $route() {
await this.fetchBlob();
},
},
2018-09-26 22:27:42 +08:00
};
</script>