Skip to content

Commit

Permalink
Fixes and refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
AaronPlave committed Dec 2, 2024
1 parent 2c7b2f2 commit 6d887d8
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 22 deletions.
2 changes: 0 additions & 2 deletions src/components/TimelineItemList.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,7 @@
}
function onIndividualLayerPicked(event: CustomEvent<{ item?: TimelineItemType; layer?: Layer; row?: Row }>) {
console.log('event :>> ', event);
if (event.detail.item) {
console.log('object :>> ', event.detail.item);
viewAddFilterToRow([event.detail.item], typeName, {}, event.detail.row?.id, event.detail.layer);
}
}
Expand Down
2 changes: 0 additions & 2 deletions src/components/form/Input.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@
}
// because the content of the slot might not have been fully rendered by the time this function is called
// we must kick it out to a timeout to wait for it to be rendered
// await tick();
if (left !== null) {
left.style.left = `${padLeft}px`;
Expand All @@ -89,7 +88,6 @@
}
// because the content of the slot might not have been fully rendered by the time this function is called
// we must kick it out to a timeout to wait for it to be rendered
// await tick();
if (right !== null) {
right.style.right = `${padRight}px`;
Expand Down
20 changes: 4 additions & 16 deletions src/components/timeline/Row.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,6 @@
let hasActivityLayer: boolean = false;
let hasExternalEventsLayer: boolean = false;
let hasResourceLayer: boolean = false;
let associatedActivityTypes: number;
$: if ($selectedRow?.id === id && rowRef) {
rowRef.scrollIntoView({ block: 'nearest' });
Expand Down Expand Up @@ -342,24 +341,13 @@
discreteOptions?.activityOptions?.composition === 'both' ||
discreteOptions?.activityOptions?.composition === 'directives';
// helper for hasExternalEventsLayer; counts how many external event types are associated with this row (if all layers have 0 event types, we
// don't want to allocate any canvas space in the row for the layer)
// TODO figure out what it means for new activities here
// $: associatedActivityTypes = activityLayers
// .map(layer =>
// layer.filter.activity
// ? (layer.filter.activity.dynamic_type_filters?.length || layer.filter.activity.static_types?.length) ?? 0
// : 0,
// )
// .reduce((currentSum, newValue) => currentSum + newValue, 0);
$: associatedActivityTypes = 1;
// helper for hasExternalEventsLayer; counts how many external event types are associated with this row
// (if all layers have 0 event types, we don't want to allocate any canvas space in the row for the layer)
$: associatedEventTypes = externalEventLayers
.map(layer => (layer.filter.externalEvent ? layer.filter.externalEvent.event_types.length : 0))
.reduce((currentSum, newValue) => currentSum + newValue, 0);
// only consider a layer to be present if it is defined AND it actually has types/values selected.
$: hasActivityLayer = activityLayers.length > 0 && associatedActivityTypes > 0;
$: hasExternalEventsLayer = externalEventLayers.length > 0 && associatedEventTypes > 0;
$: hasResourceLayer = lineLayers.length + xRangeLayers.length > 0;
Expand Down Expand Up @@ -495,6 +483,8 @@
timeFilteredActivityDirectives = [];
timeFilteredSpans = [];
}
hasActivityLayer = timeFilteredActivityDirectives.length > 0 || timeFilteredActivityDirectives.length > 0;
}
if (hasExternalEventsLayer) {
Expand Down Expand Up @@ -732,8 +722,6 @@
// Determine if the row will visualize all requested activities
let activitiesInRow = new Set();
activityLayers.forEach(layer => {
// TODO should we consider dynamic types here? Or just static?
// TODO could this be cached from the reactive statement above?
let spansList = Object.values(spansMap);
const { directives: layerActivities } = applyActivityLayerFilter(
layer.filter.activity,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,7 @@
does_not_include: { type: 'tag', values: $subsystemTags },
includes: { type: 'tag', values: $subsystemTags },
},
// TODO make this a searchable dropdown, same for parameter variants?
Type: {
does_not_equal: { type: 'variant', values: $activityTypes.map(type => type.name) },
does_not_include: { type: 'string' },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,9 @@
if (schemaField) {
operatorKeys = Object.keys(schemaField) as (keyof typeof FilterOperator)[];
currentType = Object.values(schemaField)[0].type;
currentValuePossibilities = Object.values(schemaField)[0].values || [];
const firstSchemaField = Object.values(schemaField)[0];
currentType = firstSchemaField.type;
currentValuePossibilities = firstSchemaField.values || [];
if (currentOperator) {
const schemaOperator = schemaField[currentOperator];
if (schemaOperator !== undefined) {
Expand Down

0 comments on commit 6d887d8

Please sign in to comment.