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

repository swagger + UI #36

Merged
merged 1 commit into from
Aug 31, 2023
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
62 changes: 62 additions & 0 deletions browser/goliac-ui/src/components/RepositoriesApp.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<template>
<el-breadcrumb separator="/">
<el-breadcrumb-item :to="{ path: '/' }">Goliac</el-breadcrumb-item>
<el-breadcrumb-item :to="{ path: '/repositories' }">repositories</el-breadcrumb-item>
</el-breadcrumb>
<el-divider />

<el-row>
<el-col :span="20" :offset="2">
<el-row>
<el-table
:data="repositories"
:stripe="true"
:highlight-current-row="false"
v-on:row-click="goToRepository"
:default-sort="{ prop: 'name', order: 'descending' }"
>
<el-table-column prop="name" align="left" label="Repository name" sortable />
<el-table-column prop="public" align="left" label="Public" />
<el-table-column prop="archived" align="left" label="Archived" />
</el-table>
</el-row>
</el-col>
</el-row>
</template>

<script>
import Axios from "axios";

import constants from "@/constants";
import helpers from "@/helpers/helpers";

const { handleErr } = helpers;

const { API_URL } = constants;

export default {
name: "RepositoriesApp",
components: {
},
data() {
return {
repositories: [],
};
},
created() {
this.getRepositories()
},
methods: {
goToRepository(row) {
this.$router.push({ name: "repository", params: { repositoryId: row.name } });
},
getRepositories() {
Axios.get(`${API_URL}/repositories`).then(response => {
let repositories = response.data;
this.repositories = repositories
}, handleErr.bind(this));
},
}
};
</script>

120 changes: 120 additions & 0 deletions browser/goliac-ui/src/components/RepositoryApp.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
<template>
<el-breadcrumb separator="/">
<el-breadcrumb-item :to="{ path: '/' }">Goliac</el-breadcrumb-item>
<el-breadcrumb-item :to="{ path: '/repositories' }">repositories</el-breadcrumb-item>
<el-breadcrumb-item>{{ repositoryid }} repository</el-breadcrumb-item>
</el-breadcrumb>
<el-divider />

<el-row>
<el-col :span="20" :offset="2">
<el-card>
<template #header>
<div class="card-header">
<el-text>{{repositoryid}} repository</el-text>
</div>
</template>
<div class="flex-container">
<el-text>Public : </el-text>
<el-text>{{ repository.public}}</el-text>
</div>
<div class="flex-container">
<el-text>Archived : </el-text>
<el-text>{{ repository.archived}}</el-text>
</div>
</el-card>
</el-col>
</el-row>

<el-row>
&nbsp;
</el-row>

<el-row>
<el-col :span="20" :offset="2">
<el-card>
<el-text>Team with write access</el-text>
<el-table
:data="writers"
:stripe="true"
:highlight-current-row="false"
v-on:row-click="goToTeam"
:default-sort="{ prop: 'name', order: 'descending' }"
>
<el-table-column prop="name" align="left" label="Team Name" sortable />

</el-table>
</el-card>
</el-col>
</el-row>

<el-row>
&nbsp;
</el-row>

<el-row>
<el-col :span="20" :offset="2">
<el-card>
<el-text>Team with read access</el-text>

<el-table
:data="readers"
:stripe="true"
:highlight-current-row="false"
v-on:row-click="goToTeam"
:default-sort="{ prop: 'name', order: 'descending' }"
>
<el-table-column prop="name" align="left" label="Team Name" sortable />

</el-table>
</el-card>
</el-col>
</el-row>
</template>

<script>
import Axios from "axios";

import constants from "@/constants";
import helpers from "@/helpers/helpers";

const { handleErr } = helpers;

const { API_URL } = constants;

export default {
name: "RepositoryApp",
components: {
},
computed: {
repositoryid() {
return this.$route.params.repositoryId;
},
},

data() {
return {
repository: {},
readers: [],
writers: [],
};
},
created() {
this.getRepository()
},
methods: {
goToTeam(row) {
this.$router.push({ name: "team", params: { teamId: row.name } });
},
getRepository() {
Axios.get(`${API_URL}/repositories/${this.repositoryid}`).then(response => {
let repository = response.data;
this.repository = repository
this.readers=repository.readers
this.writers=repository.writers
}, handleErr.bind(this));
},
}
};
</script>

4 changes: 2 additions & 2 deletions browser/goliac-ui/src/components/TeamApp.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<el-breadcrumb separator="/">
<el-breadcrumb-item :to="{ path: '/' }">Goliac</el-breadcrumb-item>
<el-breadcrumb-item :to="{ path: '/teams' }">users</el-breadcrumb-item>
<el-breadcrumb-item :to="{ path: '/teams' }">teams</el-breadcrumb-item>
<el-breadcrumb-item>{{ teamid }} team</el-breadcrumb-item>
</el-breadcrumb>
<el-divider />
Expand All @@ -11,7 +11,7 @@
<el-card>
<template #header>
<div class="card-header">
<el-text>{{teamid}}</el-text>
<el-text>{{teamid}} team</el-text>
</div>
</template>
<el-text>Team Owners</el-text>
Expand Down
2 changes: 1 addition & 1 deletion browser/goliac-ui/src/components/TeamsApp.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<el-breadcrumb separator="/">
<el-breadcrumb-item :to="{ path: '/' }">Goliac</el-breadcrumb-item>
<el-breadcrumb-item :to="{ path: '/' }">teams</el-breadcrumb-item>
<el-breadcrumb-item :to="{ path: '/teams' }">teams</el-breadcrumb-item>
</el-breadcrumb>
<el-divider />

Expand Down
2 changes: 1 addition & 1 deletion browser/goliac-ui/src/components/UsersApp.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<el-breadcrumb separator="/">
<el-breadcrumb-item :to="{ path: '/' }">Goliac</el-breadcrumb-item>
<el-breadcrumb-item :to="{ path: '/' }">users</el-breadcrumb-item>
<el-breadcrumb-item :to="{ path: '/users' }">users</el-breadcrumb-item>
</el-breadcrumb>
<el-divider />

Expand Down
12 changes: 12 additions & 0 deletions browser/goliac-ui/src/router/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import UsersApp from "@/components/UsersApp.vue";
import UserApp from "@/components/UserApp.vue";
import TeamsApp from "@/components/TeamsApp.vue";
import TeamApp from "@/components/TeamApp.vue";
import RepositoriesApp from "@/components/RepositoriesApp.vue";
import RepositoryApp from "@/components/RepositoryApp.vue";

const routes = [
{
Expand Down Expand Up @@ -31,6 +33,16 @@ const routes = [
name: "team",
component: TeamApp,
},
{
path: "/repositories",
name: "repositories",
component: RepositoriesApp,
},
{
path: "/repositories/:repositoryId",
name: "repository",
component: RepositoryApp,
},
];

const router = createRouter({
Expand Down
71 changes: 71 additions & 0 deletions docs/api_docs/bundle.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,43 @@ paths:
description: generic error response
schema:
$ref: '#/definitions/error'
/repositories:
get:
tags:
- app
operationId: getRepositories
description: Get all repositories
responses:
'200':
description: get list of repositories
schema:
$ref: '#/definitions/repositories'
default:
description: generic error response
schema:
$ref: '#/definitions/error'
/repositories/{repositoryID}:
get:
tags:
- app
operationId: getRepository
parameters:
- in: path
name: repositoryID
description: repository slug name
required: true
type: string
minLength: 1
description: Get repository and associated teams
responses:
'200':
description: get repository details especially teams that have access
schema:
$ref: '#/definitions/repositoryDetails'
default:
description: generic error response
schema:
$ref: '#/definitions/error'
definitions:
health:
type: object
Expand Down Expand Up @@ -223,6 +260,40 @@ definitions:
type: boolean
x-isnullable: false
x-omitempty: false
repositories:
type: array
items:
$ref: '#/definitions/repository'
repositoryDetails:
type: object
properties:
name:
type: string
x-isnullable: false
public:
type: boolean
x-isnullable: false
x-omitempty: false
archived:
type: boolean
x-isnullable: false
x-omitempty: false
readers:
type: array
items:
type: object
properties:
name:
type: string
minLength: 1
writers:
type: array
items:
type: object
properties:
name:
type: string
minLength: 1
teams:
type: array
items:
Expand Down
Loading