✨ Add groups
This commit is contained in:
parent
8aba5abb1e
commit
3b7cfd7ef1
@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<ContentRow class="artifact pointer" @click="() => useRouter().push('artifacts/' + artifact.id)">
|
<ContentRow class="artifact pointer" @click="() => useRouter().push('/artifacts/' + artifact.id)">
|
||||||
<ContentCell>{{ artifact.groupId }}</ContentCell>
|
<ContentCell>{{ artifact.groupId }}</ContentCell>
|
||||||
<ContentCell>{{ artifact.artifactId }}</ContentCell>
|
<ContentCell>{{ artifact.artifactId }}</ContentCell>
|
||||||
<ContentCell><div v-if="artifact.versions" v-for="latest in [artifact.versions.at(0)]"><span v-if="latest">{{ latest.version }}</span></div></ContentCell>
|
<ContentCell><div v-if="artifact.versions" v-for="latest in [artifact.versions.at(0)]"><span v-if="latest">{{ latest.version }}</span></div></ContentCell>
|
||||||
|
|||||||
@ -18,13 +18,9 @@ import Table from "~/components/ui/table/Table.vue";
|
|||||||
import HeaderCell from "~/components/ui/table/HeaderCell.vue";
|
import HeaderCell from "~/components/ui/table/HeaderCell.vue";
|
||||||
import HeaderRow from "~/components/ui/table/HeaderRow.vue";
|
import HeaderRow from "~/components/ui/table/HeaderRow.vue";
|
||||||
|
|
||||||
const artifacts: Ref<Artifact[] | undefined> = ref(undefined);
|
defineProps<{
|
||||||
|
artifacts: Artifact[]
|
||||||
onMounted(() => {
|
}>()
|
||||||
Artifact.get((_artifacts: Artifact[]) => {
|
|
||||||
artifacts.value = _artifacts;
|
|
||||||
});
|
|
||||||
})
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|||||||
@ -1,9 +1,12 @@
|
|||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
|
import type {Artifact} from "~/components/artifact/Artifact";
|
||||||
|
|
||||||
export class Group
|
export class Group
|
||||||
{
|
{
|
||||||
constructor(
|
constructor(
|
||||||
public groupId: string
|
public id: string,
|
||||||
|
public groupId: string,
|
||||||
|
public artifacts: Artifact[]
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -16,4 +19,13 @@ export class Group
|
|||||||
onSuccess(response.data)
|
onSuccess(response.data)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static getById(id: string, onSuccess: (group: Group) => void)
|
||||||
|
{
|
||||||
|
MavenApi.create().get<Group>("/groups/" + id)
|
||||||
|
.then((response) =>
|
||||||
|
{
|
||||||
|
onSuccess(response.data)
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -3,7 +3,7 @@
|
|||||||
<HeaderRow>
|
<HeaderRow>
|
||||||
<HeaderCell>Group ID</HeaderCell>
|
<HeaderCell>Group ID</HeaderCell>
|
||||||
</HeaderRow>
|
</HeaderRow>
|
||||||
<ContentRow v-for="group in groups">
|
<ContentRow style="cursor: pointer" v-for="group in groups" @click="useRouter().push('/groups/' + group.id)">
|
||||||
<ContentCell>{{group.groupId}}</ContentCell>
|
<ContentCell>{{group.groupId}}</ContentCell>
|
||||||
</ContentRow>
|
</ContentRow>
|
||||||
</Table>
|
</Table>
|
||||||
|
|||||||
@ -1,12 +1,21 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="content-l">
|
<div class="content-l">
|
||||||
<h1>Artifacts</h1>
|
<h1>Artifacts</h1>
|
||||||
<ArtifactList></ArtifactList>
|
<ArtifactList v-if="artifacts" :artifacts="artifacts"></ArtifactList>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import ArtifactList from "~/components/artifact/ArtifactList.vue";
|
import ArtifactList from "~/components/artifact/ArtifactList.vue";
|
||||||
|
import {Artifact} from "~/components/artifact/Artifact";
|
||||||
|
|
||||||
|
const artifacts: Ref<Artifact[] | undefined> = ref(undefined);
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
Artifact.get((_artifacts: Artifact[]) => {
|
||||||
|
artifacts.value = _artifacts;
|
||||||
|
});
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|||||||
23
app/pages/groups/[group_id]/index.vue
Normal file
23
app/pages/groups/[group_id]/index.vue
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
<template>
|
||||||
|
<div class="content-l" v-if="group">
|
||||||
|
<h1>Group: {{group.groupId}}</h1>
|
||||||
|
<ArtifactList :artifacts="group.artifacts"></ArtifactList>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import {Group} from "~/components/group/Group";
|
||||||
|
|
||||||
|
const group: Ref<Group | undefined> = ref();
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
const id = useRoute().params.group_id as string;
|
||||||
|
Group.getById(id, (_group: Group) => {
|
||||||
|
group.value = _group;
|
||||||
|
})
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
</style>
|
||||||
Loading…
x
Reference in New Issue
Block a user