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