mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-20 11:22:15 +00:00
feat(editor): Evaluations frontend (no-changelog) (#15550)
Co-authored-by: Yiorgis Gozadinos <yiorgis@n8n.io> Co-authored-by: JP van Oosten <jp@n8n.io> Co-authored-by: Giulio Andreini <g.andreini@gmail.com> Co-authored-by: Michael Kret <michael.k@radency.com>
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
<script setup lang="ts" generic="T">
|
||||
import type { TestTableColumn } from './TestTableBase.vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
|
||||
defineProps<{
|
||||
column: TestTableColumn<T>;
|
||||
row: T;
|
||||
}>();
|
||||
|
||||
defineEmits<{
|
||||
click: [];
|
||||
}>();
|
||||
|
||||
const router = useRouter();
|
||||
|
||||
function hasProperty(row: unknown, prop: string): row is Record<string, unknown> {
|
||||
return typeof row === 'object' && row !== null && prop in row;
|
||||
}
|
||||
|
||||
const getCellContent = (column: TestTableColumn<T>, row: T) => {
|
||||
if (column.formatter) {
|
||||
return column.formatter(row);
|
||||
}
|
||||
return hasProperty(row, column.prop) ? row[column.prop] : undefined;
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div v-if="column.route?.(row)">
|
||||
<a v-if="column.openInNewTab" :href="router.resolve(column.route(row)!).href" target="_blank">
|
||||
{{ getCellContent(column, row) }}
|
||||
</a>
|
||||
<router-link v-else :to="column.route(row)!">
|
||||
{{ getCellContent(column, row) }}
|
||||
</router-link>
|
||||
</div>
|
||||
|
||||
<div v-else>
|
||||
{{ getCellContent(column, row) }}
|
||||
</div>
|
||||
</template>
|
||||
Reference in New Issue
Block a user