2019-05-06 15:58:18 +00:00
|
|
|
<template>
|
|
|
|
|
<div>
|
|
|
|
|
<div v-if="remoterepos.length > 0">
|
2019-05-13 14:25:43 +00:00
|
|
|
<nav class="panel">
|
|
|
|
|
<p class="panel-heading">
|
|
|
|
|
repositories from
|
|
|
|
|
<strong>{{ remotesource.name }}</strong>
|
|
|
|
|
</p>
|
|
|
|
|
<label
|
|
|
|
|
class="panel-block"
|
|
|
|
|
v-for="(repo, index) in remoterepos"
|
|
|
|
|
v-bind:key="repo.id"
|
|
|
|
|
@click="select(index)"
|
|
|
|
|
>
|
|
|
|
|
<input type="radio" :checked="selectedrepo == index && selected">
|
|
|
|
|
{{repo.path}}
|
|
|
|
|
</label>
|
|
|
|
|
</nav>
|
2019-05-06 15:58:18 +00:00
|
|
|
</div>
|
|
|
|
|
<div v-else class="item-list">No remote repositories</div>
|
|
|
|
|
</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">
|
|
|
|
|
@import "@/css/_variables.scss";
|
|
|
|
|
|
|
|
|
|
.item-list {
|
|
|
|
|
.item {
|
|
|
|
|
margin-bottom: 5px;
|
|
|
|
|
border: 1px solid $grey-lighter;
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
display: flex;
|
|
|
|
|
padding: 10px;
|
|
|
|
|
}
|
|
|
|
|
.name {
|
|
|
|
|
font-weight: bold;
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-05-13 14:25:43 +00:00
|
|
|
|
|
|
|
|
.panel-block input[type="radio"] {
|
|
|
|
|
margin-right: 0.75em;
|
|
|
|
|
}
|
2019-05-06 15:58:18 +00:00
|
|
|
</style>
|