Skip to content

Commit

Permalink
Events added to Experiment Modal
Browse files Browse the repository at this point in the history
  • Loading branch information
AileenCleary committed Dec 28, 2024
1 parent 2a0a9a2 commit 3c14ef0
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/ui/src/components/EventTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,14 @@ const props = defineProps({
maxEntries: {
type: Number,
default: Infinity
},
items: {
type: Array,
default: () => []
}
});
const eventsData = computed(() => events.value || []);
const eventsData = computed(() => props.items.length ? props.items : events.value || []);
const sortBy: VDataTable['sortBy'] = [{ key: 'event_timestamp', order: 'desc'}];
const minEventsData = computed(() => eventsData.value.slice(0, props.maxEntries));
Expand Down
39 changes: 39 additions & 0 deletions src/ui/src/components/Experiments.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,34 @@
</v-expansion-panel>
</v-expansion-panels>
</div>
<div>
<h3 class="title">Events:</h3>
<v-expansion-panels>
<v-expansion-panel>
<v-expansion-panel-title>
<h4>event table</h4>
</v-expansion-panel-title>
<v-expansion-panel-text>
<EventTable :items="experimentEvents"/>
</v-expansion-panel-text>
</v-expansion-panel>
<v-expansion-panel>
<v-expansion-panel-title>
<h4>event list</h4>
</v-expansion-panel-title>
<v-expansion-panel-text>
<v-list dense>
<v-list-item v-for="event in experimentEvents" :key="event.event_id">
<v-list-item-content>
<v-list-item-title>{{ event.event_name.toLowerCase() }}</v-list-item-title>
<v-list-item-subtitle>Type: {{ event.event_type.toLowerCase() }}</v-list-item-subtitle>
</v-list-item-content>
</v-list-item>
</v-list>
</v-expansion-panel-text>
</v-expansion-panel>
</v-expansion-panels>
</div>
<div>
<h3>Details:</h3>
<vue-json-pretty v-if="selectedExperiment" :data="selectedExperiment" :deep="1"></vue-json-pretty>
Expand Down Expand Up @@ -107,10 +135,12 @@ import { VDataTable } from 'vuetify/lib/components/index.mjs';
/// <reference path="../store.d.ts" />
import {
campaigns,
events,
experiment_objects,
workcell_state,
} from '@/store';
import EventTable from './EventTable.vue';
import WorkflowTable from './WorkflowTable.vue';
const sortBy: VDataTable['sortBy'] = [{ key: 'experiment_id', order: 'desc' }];
Expand All @@ -136,6 +166,15 @@ const experimentWorkflows = computed<any[]>(() => {
});
});
const experimentEvents = computed(() => {
return events.value.filter((event: any) => {
const matchExperiment = selectedExperiment.value?.experiment_id
? event.experiment_id === selectedExperiment.value?.experiment_id
: true;
return matchExperiment;
});
});
watch(experiment_objects, (newVal: any, oldVal: any) => {
console.log('Experiment Data Test:', newVal);
});
Expand Down

0 comments on commit 3c14ef0

Please sign in to comment.