2019-05-06 15:58:18 +00:00
|
|
|
<template>
|
2019-05-21 10:13:21 +00:00
|
|
|
<div class="mb-2 border-solid border-gray-300 rounded border shadow-sm">
|
|
|
|
|
<p class="bg-gray-200 px-4 py-3 border-solid border-gray-300 border-b">
|
|
|
|
|
repositories from
|
|
|
|
|
<strong>{{ remotesource.name }}</strong>
|
|
|
|
|
</p>
|
2019-05-06 15:58:18 +00:00
|
|
|
<div v-if="remoterepos.length > 0">
|
2019-05-21 10:13:21 +00:00
|
|
|
<label
|
|
|
|
|
class="block px-4 py-2 border-b"
|
|
|
|
|
v-for="(repo, index) in remoterepos"
|
|
|
|
|
v-bind:key="repo.id"
|
|
|
|
|
@click="select(index)"
|
|
|
|
|
>
|
|
|
|
|
<input type="radio" :checked="selectedrepo == index && selected">
|
|
|
|
|
{{repo.path}}
|
|
|
|
|
</label>
|
2019-05-06 15:58:18 +00:00
|
|
|
</div>
|
2019-05-21 10:13:21 +00:00
|
|
|
<div v-else class="block px-4 py-2 border-b">No remote repositories</div>
|
2019-05-06 15:58:18 +00:00
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
import { userRemoteRepos } from "@/util/data.js";
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
components: {},
|
|
|
|
|
name: "remoterepos",
|
|
|
|
|
props: {
|
2019-05-13 14:25:43 +00:00
|
|
|
remotesource: Object,
|
|
|
|
|
selected: Boolean
|
2019-05-06 15:58:18 +00:00
|
|
|
},
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
selectedrepo: null,
|
|
|
|
|
remoterepos: []
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
select(index) {
|
|
|
|
|
this.selectedrepo = index;
|
|
|
|
|
this.$emit("reposelected", this.remoterepos[index].path);
|
|
|
|
|
},
|
2019-05-13 14:25:43 +00:00
|
|
|
async fetchRemoteRepos(remotesourceid) {
|
2019-05-13 14:29:47 +00:00
|
|
|
let { data, error } = await userRemoteRepos(remotesourceid);
|
|
|
|
|
if (error) {
|
|
|
|
|
this.$store.dispatch("setError", error);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
this.remoterepos = data;
|
2019-05-06 15:58:18 +00:00
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
created: function() {
|
2019-05-13 14:25:43 +00:00
|
|
|
this.fetchRemoteRepos(this.remotesource.id);
|
2019-05-06 15:58:18 +00:00
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
|
|
</style>
|