Skip to content

Commit

Permalink
Merge pull request #12 from JamesDonovan1/repo-tab-fix
Browse files Browse the repository at this point in the history
Repo tab sends user to list of all repos
  • Loading branch information
bglob authored Dec 10, 2021
2 parents 34ef50b + 2bfc684 commit 1225d2a
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 33 deletions.
30 changes: 15 additions & 15 deletions frontend/src/components/layout/MainSidebar/MainSidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

<div class="nav-wrapper">
<d-nav class="flex-column mainSideBarNav">
<li v-for="(item, navItemIdx) in items" :key="navItemIdx" class="nav-item dropdown" @click="checkForRepoRouteChange($event)">
<li v-for="(item, navItemIdx) in items" :key="navItemIdx" class="nav-item dropdown">
<d-link class="mainSideBarLink" :class="['nav-link', item.items && item.items.length ? 'dropdown-toggle' : '']" :to="item.to" v-d-toggle="`snc-${navItemIdx}`">
<div class="item-icon-wrapper" v-if="item.htmlBefore" v-html="item.htmlBefore" />
<span v-if="item.title" class="mainSideBarV">{{ item.title }}</span>
Expand Down Expand Up @@ -130,7 +130,7 @@
}, {
title: 'Repos',
to: {
name: 'group_overview',
name: 'repos',
params: { }
},
htmlBefore: '<i class="material-icons">table_chart</i>',
Expand Down Expand Up @@ -193,19 +193,19 @@
findRepoGroup() {
console.log(Object.keys(this.$store.state.common.apiGroups));
}
checkForRepoRouteChange(e: any) {
console.log(e);
if (e.target.innerHTML !== 'Repos') {
return;
}
let currentlySelectedRepoGroup = Object.keys(this.$store.state.common.apiGroups)[Object.keys(this.$store.state.common.apiGroups).length - 1].split('/')[0];
console.log('HERE: ' + currentlySelectedRepoGroup);
if (currentlySelectedRepoGroup === 'undefined') {
this.$router.push({ name: 'repo_groups' });
} else {
this.$router.push(`/group/${currentlySelectedRepoGroup}/overview`);
}
}
// checkForRepoRouteChange(e: any) {
// console.log(e);
// if (e.target.innerHTML !== 'Repos') {
// return;
// }
// //let currentlySelectedRepoGroup = Object.keys(this.$store.state.common.apiGroups)[Object.keys(this.$store.state.common.apiGroups).length - 1].split('/')[0];
// //console.log('HERE: ' + currentlySelectedRepoGroup);
// //if (currentlySelectedRepoGroup === 'undefined') {
// // this.$router.push({ name: 'repo_groups' });
// //} else {
// this.$router.push(`/repos`);
// //}
// }
}
</script>

Expand Down
39 changes: 21 additions & 18 deletions frontend/src/views/Repos.vue
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
<tbody>
<tr v-for="repo in sortedRepos(sortColumn,ascending)" v-bind:item="repo" :key="repo.url">
<td>
<a href="#" @click="onGitRepo(repo.rg_name, repo.repo_name)">{{ repo.url }}</a>
<router-link tag="a" :to="'/repo/' + repo.rg_name + '/' + repo.repo_name + '/overview'">{{ repo.url }}</router-link>
</td>
<td>{{ repo.rg_name }}</td>
<!-- <td>{{ repo.description }}</td> -->
Expand Down Expand Up @@ -184,23 +184,26 @@ export default class Repos extends Vue{
}
}

onGitRepo (rg_name: String, repo_name: String) {
// this.$router.push({
// name: 'repo_overview',
// params: {group:e.rg_name, repo:e.repo_name, repo_group_id: e.repo_group_id, repo_id: e.repo_id, url:e.url}
// }, () => {
// console.dir(e);
// });
if (rg_name == null || repo_name == null ) {
window.alert('Error - repo name not found in store');
console.log(this.sortedRepos(this.sortColumn,this.ascending));
} else {
this.$router.push(`repo/${rg_name}/${repo_name}/overview`, () => {
console.log(`RG_NAME: ${rg_name}`);
console.log(`REPO_NAME: ${repo_name}`);
});
}
}
// Removed 12/9/2021
// Replaced by router-link element
// If something broke in regards to parameter passing to the router, this could be it
// onGitRepo (rg_name: String, repo_name: String) {
// // this.$router.push({
// // name: 'repo_overview',
// // params: {group:e.rg_name, repo:e.repo_name, repo_group_id: e.repo_group_id, repo_id: e.repo_id, url:e.url}
// // }, () => {
// // console.dir(e);
// // });
// if (rg_name == null || repo_name == null ) {
// window.alert('Error - repo name not found in store');
// console.log(this.sortedRepos(this.sortColumn,this.ascending));
// } else {
// this.$router.push(`repo/${rg_name}/${repo_name}/overview`, () => {
// console.log(`RG_NAME: ${rg_name}`);
// console.log(`REPO_NAME: ${repo_name}`);
// });
// }
// }
}

</script>

0 comments on commit 1225d2a

Please sign in to comment.