✨ Minor improvements
This commit is contained in:
parent
8889772f1c
commit
8bb234df1c
@ -3,6 +3,7 @@ export class Token
|
||||
static baseURL: "http://localhost:8080";
|
||||
|
||||
constructor(
|
||||
public id: string,
|
||||
public name: string,
|
||||
public createdAt: Date,
|
||||
public expiresAt: Date
|
||||
@ -18,6 +19,15 @@ export class Token
|
||||
onSuccess(response.data);
|
||||
});
|
||||
}
|
||||
|
||||
static delete(id: string, onSuccess: () => void)
|
||||
{
|
||||
MavenApi.create().delete("/tokens/" + id)
|
||||
.then(() =>
|
||||
{
|
||||
onSuccess();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export class TokenCreation
|
||||
@ -42,6 +52,7 @@ export class TokenCreation
|
||||
export class TokenSecret
|
||||
{
|
||||
constructor(
|
||||
public id: string,
|
||||
public name: string,
|
||||
public expiresAt: Date,
|
||||
public createdAt: Date,
|
||||
|
||||
@ -32,6 +32,15 @@ export class Artifact
|
||||
onSuccess(response.data)
|
||||
});
|
||||
}
|
||||
|
||||
static deleteById(id: string, onSuccess: () => void)
|
||||
{
|
||||
MavenApi.create().delete("/artifacts/" + id)
|
||||
.then(() =>
|
||||
{
|
||||
onSuccess()
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export class Version
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import {TokenCreation, TokenSecret} from "~/auth/Token";
|
||||
import {Token, TokenCreation, TokenSecret} from "~/auth/Token";
|
||||
import {usePopup} from "~/components/ui/popup/Popup";
|
||||
|
||||
const name: Ref<string> = ref('');
|
||||
@ -39,7 +39,7 @@ function create()
|
||||
}
|
||||
TokenCreation.create(new TokenCreation(name.value, new Date(expiresAt.value)), (_token: TokenSecret) => {
|
||||
token.value = _token;
|
||||
usePopup().get()!.config.callback?.(_token);
|
||||
usePopup().get()!.config.callback?.(new Token(_token.id, _token.name, _token.createdAt, _token.expiresAt));
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
@ -16,6 +16,12 @@
|
||||
<p class="tile-m" v-if="selectedVersion.jars" v-for="jar in selectedVersion.jars" @click="Download.download(jar.url)">{{ jar.filename }}</p>
|
||||
<a class="tile-m" v-if="selectedVersion.pom" :href="'/api/maven2/' + selectedVersion.pom.url" target="_blank">{{ selectedVersion.pom.filename }}</a>
|
||||
</div>
|
||||
<div class="content-m">
|
||||
<h2>Actions</h2>
|
||||
<div>
|
||||
<UiButton @click="del" class="delete">Delete</UiButton>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="content-m">
|
||||
<h2>Versions</h2>
|
||||
@ -44,6 +50,14 @@ onMounted(() => {
|
||||
})
|
||||
})
|
||||
|
||||
function del()
|
||||
{
|
||||
const id = useRoute().params.id as string;
|
||||
Artifact.deleteById(id, () => {
|
||||
useRouter().push("/artifacts");
|
||||
})
|
||||
}
|
||||
|
||||
const dependency = computed(() => {
|
||||
if (selectedVersion.value)
|
||||
{
|
||||
@ -71,4 +85,7 @@ const dependency = computed(() => {
|
||||
color: white;
|
||||
border: none;
|
||||
}
|
||||
.delete {
|
||||
background-color: #e63515;
|
||||
}
|
||||
</style>
|
||||
@ -29,22 +29,20 @@
|
||||
<ContentCell>{{ token.name }}</ContentCell>
|
||||
<ContentCell>{{ dayjs(token.createdAt).format("DD.MM.YYYY") }}</ContentCell>
|
||||
<ContentCell>{{ dayjs(token.expiresAt).format("DD.MM.YYYY") }}</ContentCell>
|
||||
<ContentCell style="padding: 0.25rem"><UiButton icon="delete"></UiButton></ContentCell>
|
||||
<ContentCell style="padding: 0.25rem"><UiButton @click="del(token)" icon="delete"></UiButton></ContentCell>
|
||||
</ContentRow>
|
||||
</UiTable>
|
||||
</div>
|
||||
<div>
|
||||
<UiButton @click="usePopup().open(new Popup(TokenCreationComponent, { size: PopupSize.MEDIUM, heading: 'Create Token', callback: (token: TokenSecret) => { tokens?.push(new Token(token.name, token.createdAt, token.expiresAt)) } }))">Create</UiButton>
|
||||
<UiButton @click="usePopup().open(new Popup(TokenCreationComponent, { size: PopupSize.MEDIUM, heading: 'Create Token', callback: (token: Token) => { tokens?.push(token) } }))">Create</UiButton>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import DisplayNameComponent from "~/components/auth/DisplayNameComponent.vue";
|
||||
import {Session} from "~/auth/Session";
|
||||
import TokenCreationComponent from "~/components/settings/token/TokenCreationComponent.vue";
|
||||
import {Popup, PopupSize, usePopup} from "~/components/ui/popup/Popup";
|
||||
import {Token, type TokenSecret} from "~/auth/Token";
|
||||
import {Token} from "~/auth/Token";
|
||||
import HeaderCell from "~/components/ui/table/HeaderCell.vue";
|
||||
import HeaderRow from "~/components/ui/table/HeaderRow.vue";
|
||||
import ContentRow from "~/components/ui/table/ContentRow.vue";
|
||||
@ -52,8 +50,6 @@ import ContentCell from "~/components/ui/table/ContentCell.vue";
|
||||
import dayjs from "dayjs";
|
||||
import {jwtDecode} from "jwt-decode";
|
||||
|
||||
const session = useCookie<Session>(Session.COOKIE);
|
||||
|
||||
const userId = (jwtDecode(useCookie<string>("identity").value) as any).upn;
|
||||
|
||||
const tokens: Ref<Token[] | undefined> = ref(undefined);
|
||||
@ -62,6 +58,16 @@ onMounted(() => {
|
||||
tokens.value = _tokens;
|
||||
})
|
||||
})
|
||||
|
||||
function del(token: Token)
|
||||
{
|
||||
Token.delete(token.id, () => {
|
||||
if (tokens.value)
|
||||
{
|
||||
tokens.value = tokens.value.filter(item => item.id !== token.id);
|
||||
}
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
@ -4,7 +4,7 @@ export class Download
|
||||
{
|
||||
const a = document.createElement("a");
|
||||
a.style.display = "none";
|
||||
a.href = "http://localhost:8080/maven2/" + url;
|
||||
a.href = "/api/maven2/" + url;
|
||||
document.body.appendChild(a);
|
||||
a.click();
|
||||
document.body.removeChild(a);
|
||||
|
||||
@ -9,11 +9,13 @@ export default defineNuxtConfig({
|
||||
],
|
||||
app: {
|
||||
head: {
|
||||
title: 'Registry',
|
||||
link: [
|
||||
{
|
||||
rel: 'stylesheet',
|
||||
href: 'https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200'
|
||||
}
|
||||
},
|
||||
{rel: 'icon', type: 'image/x-icon', href: '/icon.png'}
|
||||
]
|
||||
}
|
||||
},
|
||||
|
||||
BIN
public/icon.png
Normal file
BIN
public/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1012 B |
Loading…
x
Reference in New Issue
Block a user