Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add page to view all projects of a user / group #741

Merged
merged 7 commits into from
Feb 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions web/src/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@ const routes: RouteRecordRaw[] = [
component: (): Component => import('~/views/RepoAdd.vue'),
meta: { authentication: 'required' },
},
{
path: '/:repoOwner',
name: 'repos-owner',
component: (): Component => import('~/views/ReposOwner.vue'),
props: true,
meta: { authentication: 'required' },
},
{
path: '/:repoOwner/:repoName',
name: 'repo-wrapper',
Expand Down
4 changes: 2 additions & 2 deletions web/src/views/Repos.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<template>
<FluidContainer class="flex flex-col">
<div class="flex flex-row flex-wrap border-b pb-4 mb-4 items-center dark:border-dark-200">
<div class="flex flex-row flex-wrap md:grid md:grid-cols-3 border-b pb-4 mb-4 dark:border-dark-200">
<h1 class="text-xl text-gray-500">Repositories</h1>
<TextField v-model="search" class="w-auto md:ml-auto" placeholder="Search ..." />
<TextField v-model="search" class="w-auto md:ml-auto md:mr-auto" placeholder="Search ..." />
<Button class="md:ml-auto" :to="{ name: 'repo-add' }" start-icon="plus" text="Add repository" />
</div>

Expand Down
64 changes: 64 additions & 0 deletions web/src/views/ReposOwner.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<template>
<FluidContainer class="flex flex-col">
<div class="flex flex-row flex-wrap md:grid md:grid-cols-3 border-b pb-4 mb-4 dark:border-dark-200">
<h1 class="text-xl text-gray-500">{{ repoOwner }}</h1>
<TextField v-model="search" class="w-auto md:ml-auto md:mr-auto" placeholder="Search ..." />
</div>

<div class="space-y-4">
<ListItem
v-for="repo in searchedRepos"
:key="repo.id"
clickable
@click="$router.push({ name: 'repo', params: { repoName: repo.name, repoOwner: repo.owner } })"
>
<span class="text-gray-500">{{ `${repo.name}` }}</span>
</ListItem>
nitn3lav marked this conversation as resolved.
Show resolved Hide resolved
</div>
<div v-if="(searchedRepos || []).length <= 0" class="text-center">
<span class="text-gray-500 m-auto">This organization / user does not have any projects yet.</span>
</div>
</FluidContainer>
</template>

<script lang="ts">
import { computed, defineComponent, onMounted, ref } from 'vue';

import ListItem from '~/components/atomic/ListItem.vue';
import TextField from '~/components/form/TextField.vue';
import FluidContainer from '~/components/layout/FluidContainer.vue';
import { useRepoSearch } from '~/compositions/useRepoSearch';
import RepoStore from '~/store/repos';

export default defineComponent({
name: 'ReposOwner',

components: {
FluidContainer,
ListItem,
TextField,
},

props: {
repoOwner: {
type: String,
required: true,
},
},

setup(props) {
const repoStore = RepoStore();
// TODO: filter server side
const repos = computed(() => Object.values(repoStore.repos).filter((v) => v.owner === props.repoOwner));
6543 marked this conversation as resolved.
Show resolved Hide resolved
const search = ref('');

const { searchedRepos } = useRepoSearch(repos, search);

onMounted(async () => {
await repoStore.loadRepos();
});

return { searchedRepos, search };
},
});
</script>
3 changes: 2 additions & 1 deletion web/src/views/repo/RepoWrapper.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
<FluidContainer v-if="repo && repoPermissions && $route.meta.repoHeader">
<div class="flex flex-wrap border-b items-center pb-4 mb-4 dark:border-gray-600 justify-center">
<h1 class="text-xl text-gray-500 w-full md:w-auto text-center mb-4 md:mb-0">
{{ `${repo.owner} / ${repo.name}` }}
<router-link :to="{ name: 'repos-owner', params: { repoOwner } }">{{ repoOwner }}</router-link>
{{ ` / ${repo.name}` }}
</h1>
<a v-if="badgeUrl" :href="badgeUrl" target="_blank" class="md:ml-auto">
<img :src="badgeUrl" />
Expand Down