Skip to content

Commit 39eb302

Browse files
committed
add anchor link to the table
1 parent 48ffd4b commit 39eb302

1 file changed

Lines changed: 36 additions & 13 deletions

File tree

webui/src/components/dashboard/ConfigCard.vue

Lines changed: 36 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const props = withDefaults(defineProps<{
1616
1717
const route = useRoute()
1818
let data: Ref<Config[] | null> | undefined
19-
console.log(props.configs)
19+
2020
if (props.configs === undefined) {
2121
const result = useDashboard().dashboard.value.getConfigs()
2222
data = result.data
@@ -40,18 +40,25 @@ function compareConfig(c1: Config | ConfigRef, c2: Config | ConfigRef) {
4040
return url1.localeCompare(url2)
4141
}
4242
43-
function showConfig(config: Config | ConfigRef){
43+
function gotToConfig(config: Config | ConfigRef, openInNewTab = false){
4444
const selection = getSelection()?.toString()
4545
if (selection) {
4646
return
4747
}
4848
49-
useRouter().push({
50-
name: getRouteName('config').value,
51-
params: { id: config.id },
52-
query: { refresh: route.query.refresh }
53-
})
54-
return
49+
const router = useRouter();
50+
const to = {
51+
name: getRouteName('config').value,
52+
params: { id: config.id },
53+
query: { refresh: route.query.refresh }
54+
}
55+
56+
if (openInNewTab) {
57+
const routeData = router.resolve(to);
58+
window.open(routeData.href, '_blank')
59+
} else {
60+
useRouter().push(to)
61+
}
5562
}
5663
</script>
5764

@@ -69,8 +76,12 @@ function showConfig(config: Config | ConfigRef){
6976
</tr>
7077
</thead>
7178
<tbody>
72-
<tr scope="row" v-for="config in configs" :key="config.url" @mouseup.left="showConfig(config)" @mousedown.middle="showConfig(config)">
73-
<td>{{ config.url }}</td>
79+
<tr scope="row" v-for="config in configs" :key="config.url" @mouseup.left="gotToConfig(config)" @mousedown.middle="gotToConfig(config, true)">
80+
<td>
81+
<router-link @click.stop class="row-link" :to="{ name: getRouteName('config').value, params: { id: config.id } }">
82+
{{ config.url }}
83+
</router-link>
84+
</td>
7485
<td class="text-center">{{ config.provider }}</td>
7586
<td class="text-center">{{ format(config.time) }}</td>
7687
</tr>
@@ -89,12 +100,24 @@ function showConfig(config: Config | ConfigRef){
89100
</tr>
90101
</thead>
91102
<tbody>
92-
<tr scope="row" v-for="config in configs" :key="config.url" @mouseup.left="showConfig(config)" @mousedown.middle="showConfig(config)">
93-
<td>{{ config.url }}</td>
103+
<tr scope="row" v-for="config in configs" :key="config.url" @mouseup.left="gotToConfig(config)" @mousedown.middle="gotToConfig(config, true)">
104+
<td>
105+
<router-link @click.stop class="row-link" :to="{ name: getRouteName('config').value, params: { id: config.id } }">
106+
{{ config.url }}
107+
</router-link>
108+
</td>
94109
<td class="text-center">{{ config.provider }}</td>
95110
<td class="text-center">{{ format(config.time) }}</td>
96111
</tr>
97112
</tbody>
98113
</table>
99114

100-
</template>
115+
</template>
116+
117+
<style scoped>
118+
.row-link {
119+
text-decoration: none;
120+
color: inherit;
121+
}
122+
123+
</style>

0 commit comments

Comments
 (0)