|
| 1 | +<template> |
| 2 | + <div> |
| 3 | + <h2 class="w-full text-delphi-red text-2xl font-semibold font-serif"> |
| 4 | + <router-link :to="{ name: 'maven-g', params: { groupId: groupId } }">{{ |
| 5 | + groupId |
| 6 | + }}</router-link> |
| 7 | + | |
| 8 | + <router-link |
| 9 | + :to="{ |
| 10 | + name: 'maven-ga', |
| 11 | + params: { groupId: groupId, artifactId: artifactId }, |
| 12 | + }" |
| 13 | + >{{ artifactId }}</router-link |
| 14 | + > |
| 15 | + | {{ version }} |
| 16 | + </h2> |
| 17 | + |
| 18 | + <div v-if="isLoading">Loading...</div> |
| 19 | + <div v-else class="text-xs line-height-xs"> |
| 20 | + <table class="text-left"> |
| 21 | + <tr v-if="pom.name != null"> |
| 22 | + <th>Name</th> |
| 23 | + <td>{{ pom.name }}</td> |
| 24 | + </tr> |
| 25 | + <tr v-if="pom.description != null"> |
| 26 | + <th>Description</th> |
| 27 | + <td>{{ pom.description }}</td> |
| 28 | + </tr> |
| 29 | + <tr v-if="pom.parent != null"> |
| 30 | + <th>Parent</th> |
| 31 | + <td> |
| 32 | + <router-link |
| 33 | + :to="{ |
| 34 | + name: 'maven-gav', |
| 35 | + params: { |
| 36 | + groupId: pom.parent.groupId, |
| 37 | + artifactId: pom.parent.artifactId, |
| 38 | + version: pom.parent.version, |
| 39 | + }, |
| 40 | + }" |
| 41 | + >{{ pom.parent.groupId }} | {{ pom.parent.artifactId }} | |
| 42 | + {{ pom.parent.version }}</router-link |
| 43 | + > |
| 44 | + </td> |
| 45 | + </tr> |
| 46 | + <tr v-if="pom.url != null"> |
| 47 | + <th>URL</th> |
| 48 | + <td> |
| 49 | + <a :href="pom.url">{{ pom.url }}</a> |
| 50 | + </td> |
| 51 | + </tr> |
| 52 | + <tr v-if="pom.licenses != null && pom.licenses.license != null"> |
| 53 | + <th>License</th> |
| 54 | + <td> |
| 55 | + <a :href="pom.licenses.license.url">{{ |
| 56 | + pom.licenses.license.name |
| 57 | + }}</a> |
| 58 | + </td> |
| 59 | + </tr> |
| 60 | + </table> |
| 61 | + |
| 62 | + <table |
| 63 | + class="text-left" |
| 64 | + v-if=" |
| 65 | + pom.dependencies != null && |
| 66 | + pom.dependencies.dependency != null && |
| 67 | + pom.dependencies.dependency.length > 0 |
| 68 | + " |
| 69 | + > |
| 70 | + <caption class="text-left font-bold"> |
| 71 | + Dependencies |
| 72 | + </caption> |
| 73 | + <tr> |
| 74 | + <th>Name</th> |
| 75 | + <th>Scope</th> |
| 76 | + </tr> |
| 77 | + <tr v-for="(d, index) in pom.dependencies.dependency" :key="index"> |
| 78 | + <td> |
| 79 | + <router-link |
| 80 | + :to="{ |
| 81 | + name: 'maven-gav', |
| 82 | + params: { |
| 83 | + groupId: d.groupId, |
| 84 | + artifactId: d.artifactId, |
| 85 | + version: d.version, |
| 86 | + }, |
| 87 | + }" |
| 88 | + >{{ d.groupId }} | {{ d.artifactId }} | |
| 89 | + {{ d.version }}</router-link |
| 90 | + > |
| 91 | + </td> |
| 92 | + <td>{{ d.scope }}</td> |
| 93 | + </tr> |
| 94 | + </table> |
| 95 | + |
| 96 | + <table class="text-left" v-if="pom.properties != null"> |
| 97 | + <caption class="text-left font-bold"> |
| 98 | + Properties |
| 99 | + </caption> |
| 100 | + <tr> |
| 101 | + <th>Key</th> |
| 102 | + <th>Value</th> |
| 103 | + </tr> |
| 104 | + <tr v-for="(value, key) in pom.properties" :key="key"> |
| 105 | + <td>{{ key }}</td> |
| 106 | + <td>{{ value }}</td> |
| 107 | + </tr> |
| 108 | + </table> |
| 109 | + </div> |
| 110 | + </div> |
| 111 | +</template> |
| 112 | +<script lang="ts"> |
| 113 | +import { defineComponent, onBeforeMount, ref, watch } from "vue"; |
| 114 | +import { useRoute } from "vue-router"; |
| 115 | +
|
| 116 | +import { MavenAccess } from '@/backend/maven/Maven'; |
| 117 | +
|
| 118 | +export default defineComponent({ |
| 119 | + setup() { |
| 120 | + const route = useRoute(); |
| 121 | + const groupId = ref(""); |
| 122 | + const artifactId = ref(""); |
| 123 | + const version = ref(""); |
| 124 | +
|
| 125 | + const isLoading = ref(false); |
| 126 | + const pom = ref(null); |
| 127 | +
|
| 128 | + onBeforeMount(async () => { |
| 129 | + processRouteValues(); |
| 130 | + await loadPom(); |
| 131 | + }); |
| 132 | +
|
| 133 | + watch( |
| 134 | + () => route.params, |
| 135 | + async () => { |
| 136 | + processRouteValues(); |
| 137 | + await loadPom(); |
| 138 | + } |
| 139 | + ); |
| 140 | +
|
| 141 | + async function loadPom() { |
| 142 | + if (groupId.value === undefined || |
| 143 | + artifactId.value === undefined || |
| 144 | + version.value == undefined) return; |
| 145 | + isLoading.value = true; |
| 146 | + pom.value = await new MavenAccess().getArtifactVersion(groupId.value, artifactId.value, version.value); |
| 147 | + isLoading.value = false; |
| 148 | + } |
| 149 | +
|
| 150 | + function processRouteValues(): void { |
| 151 | + groupId.value = route.params.groupId as string; |
| 152 | + artifactId.value = route.params.artifactId as string; |
| 153 | + version.value = route.params.version as string; |
| 154 | + } |
| 155 | +
|
| 156 | + return { groupId, artifactId, version, isLoading, pom }; |
| 157 | + }, |
| 158 | +}); |
| 159 | +</script> |
0 commit comments