✨ New Home screen
This commit is contained in:
parent
10be702196
commit
d5f28a262f
@ -13,6 +13,10 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="content-m" v-if="version.snapshot === false">
|
||||
<h2>Uploaded By</h2>
|
||||
<p class="tile-m">{{ version.uploadedBy?.displayName }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import {MavenApi} from "~/utils/Api";
|
||||
import {type EnhancedResponse, useUserStore} from "~/components/users/UserStore";
|
||||
import type {User} from "~/components/users/UserStore";
|
||||
|
||||
export class Artifact
|
||||
{
|
||||
@ -18,11 +18,10 @@ export class Artifact
|
||||
|
||||
static get(onSuccess: (artifacts: Artifact[]) => void)
|
||||
{
|
||||
MavenApi.create().get<EnhancedResponse<Artifact[]>>("/artifacts")
|
||||
MavenApi.create().get<Artifact[]>("/artifacts")
|
||||
.then((response) =>
|
||||
{
|
||||
useUserStore().add(response.data.users);
|
||||
onSuccess(response.data.data);
|
||||
onSuccess(response.data);
|
||||
});
|
||||
}
|
||||
|
||||
@ -53,7 +52,9 @@ export class Version
|
||||
public artifactId: string,
|
||||
public version: string,
|
||||
public jars?: Jar[],
|
||||
public pom?: Pom
|
||||
public pom?: Pom,
|
||||
public snapshot?: boolean,
|
||||
public uploadedBy?: User
|
||||
)
|
||||
{
|
||||
}
|
||||
|
||||
@ -1,43 +0,0 @@
|
||||
<template>
|
||||
<div class="login-page">
|
||||
<h1>Login</h1>
|
||||
<UiInput label="E-Mail">
|
||||
<input type="text" v-model="sessionCreation.email">
|
||||
</UiInput>
|
||||
<UiInput label="Passwort">
|
||||
<input type="password" v-model="sessionCreation.password">
|
||||
</UiInput>
|
||||
<UiButton @click="login">Login</UiButton>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import {Session, SessionCreation} from "~/auth/Session";
|
||||
import {jwtDecode} from "jwt-decode";
|
||||
import {Account} from "~/auth/Account";
|
||||
|
||||
const sessionCreation = ref(function() {
|
||||
if (StringUtils.equals("development", process.env.NODE_ENV))
|
||||
{
|
||||
return new SessionCreation("andreas.j.dinauer@gmail.com", "pw")
|
||||
}
|
||||
return new SessionCreation();
|
||||
}());
|
||||
|
||||
function login()
|
||||
{
|
||||
Session.create(sessionCreation.value, (token: string) => {
|
||||
const decode = jwtDecode(token) as any;
|
||||
Account.get(decode.upn, token, (user: Account) => {
|
||||
useCookie<Session>(Session.COOKIE).value = new Session(user, token);
|
||||
useRouter().push('/app/artifacts');
|
||||
});
|
||||
}, () => {})
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.login-page {
|
||||
max-width: 540px;
|
||||
}
|
||||
</style>
|
||||
@ -1,7 +1,7 @@
|
||||
import axios from "axios";
|
||||
import type {Account} from "~/auth/Account";
|
||||
import {Session} from "~/auth/Session";
|
||||
import {type EnhancedResponse, useUserStore} from "~/components/users/UserStore";
|
||||
import {type EnhancedResponse, User, useUserStore} from "~/components/users/UserStore";
|
||||
|
||||
export class Event
|
||||
{
|
||||
@ -9,18 +9,17 @@ export class Event
|
||||
public type: EventType,
|
||||
public timestamp: Date,
|
||||
public resource: Resource,
|
||||
public userId: string
|
||||
public user: User
|
||||
)
|
||||
{
|
||||
}
|
||||
|
||||
static get(onSuccess: (events: Event[]) => void)
|
||||
{
|
||||
MavenApi.create().get<EnhancedResponse<Event[]>>("/events", {withCredentials: true})
|
||||
MavenApi.create().get<Event[]>("/events", {withCredentials: true})
|
||||
.then((response) =>
|
||||
{
|
||||
useUserStore().add(response.data.users);
|
||||
onSuccess(response.data.data)
|
||||
onSuccess(response.data)
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -30,7 +29,8 @@ export class Resource
|
||||
constructor(
|
||||
public groupId: string,
|
||||
public artifactId: string,
|
||||
public version: string
|
||||
public version: string,
|
||||
public isSnapshot: boolean
|
||||
)
|
||||
{
|
||||
}
|
||||
|
||||
@ -6,9 +6,9 @@
|
||||
</ContentCell>
|
||||
<ContentCell> {{ event.resource.groupId }}</ContentCell>
|
||||
<ContentCell>{{ event.resource.artifactId }}</ContentCell>
|
||||
<ContentCell>{{ event.resource.version }}</ContentCell>
|
||||
<ContentCell>{{ event.resource.version }} <div class="release" v-if="!event.resource.isSnapshot">Release</div><div class="snapshot" v-if="event.resource.isSnapshot">Snapshot</div></ContentCell>
|
||||
<ContentCell>
|
||||
<p>{{useUserStore().get(event.userId)?.displayName}}</p>
|
||||
<p>{{ event.user.displayName }}</p>
|
||||
</ContentCell>
|
||||
<ContentCell>{{ Age.calc(event.timestamp) }}</ContentCell>
|
||||
</ContentRow>
|
||||
@ -28,5 +28,16 @@ defineProps<{
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
.release, .snapshot {
|
||||
font-size: 0.9rem;
|
||||
color: white;
|
||||
padding: 0.125rem 0.5rem;
|
||||
border-radius: 2rem;
|
||||
}
|
||||
.release {
|
||||
background-color: var(--primary-color);
|
||||
}
|
||||
.snapshot {
|
||||
background-color: #656565;
|
||||
}
|
||||
</style>
|
||||
@ -12,7 +12,7 @@
|
||||
.header {
|
||||
border-bottom: 1px solid #c1c1c1;
|
||||
padding: 0.75rem 1rem;
|
||||
background-color: #efefef;
|
||||
background-color: #f3f3f3;
|
||||
}
|
||||
.header, .header * {
|
||||
font-weight: 600;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user