Skip to content

Commit

Permalink
Fix formatting errors
Browse files Browse the repository at this point in the history
  • Loading branch information
JosephVolosin committed Oct 7, 2024
1 parent 45e4426 commit 3a82532
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 27 deletions.
1 change: 0 additions & 1 deletion e2e-tests/tests/external-sources.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ let page: Page;
let context: BrowserContext;
let externalSources: ExternalSources;


test.beforeAll(async ({ browser }) => {
context = await browser.newContext();
page = await context.newPage();
Expand Down
6 changes: 5 additions & 1 deletion src/components/external-source/ExternalSourceManager.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,11 @@
async function onDeleteExternalSource(selectedSources: ExternalSourceSlim[] | null | undefined) {
if (selectedSources !== null && selectedSources !== undefined) {
const deleteExternalSourceResult = await effects.deleteExternalSource(selectedSources, $planDerivationGroupLinks, user);
const deleteExternalSourceResult = await effects.deleteExternalSource(
selectedSources,
$planDerivationGroupLinks,
user,
);
if (deleteExternalSourceResult !== undefined && deleteExternalSourceResult !== null) {
selectedSources = null;
selectedSource = null;
Expand Down
4 changes: 1 addition & 3 deletions src/components/external-source/ExternalSourcesPanel.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,7 @@
{/each}
{:else}
<div class="st-typography-body">
<p class="no-derivation-groups-linked">
No Derivation Groups Linked To This Plan
</p>
<p class="no-derivation-groups-linked">No Derivation Groups Linked To This Plan</p>
</div>
<div class="st-typography-body">
<p>
Expand Down
5 changes: 4 additions & 1 deletion src/components/modals/ManageGroupsAndTypesModal.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,10 @@
const derivationGroup = $derivationGroups.find(
derivationGroup => derivationGroup.name === viewedDerivationGroup.name,
);
if ((selectedDerivationGroup === undefined && derivationGroup !== undefined) || selectedDerivationGroup !== derivationGroup) {
if (
(selectedDerivationGroup === undefined && derivationGroup !== undefined) ||
selectedDerivationGroup !== derivationGroup
) {
selectedDerivationGroup = derivationGroup;
selectedExternalSourceType = undefined;
selectedExternalEventType = undefined;
Expand Down
9 changes: 8 additions & 1 deletion src/components/timeline/TimelinePanel.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,14 @@
} from '../../stores/views';
import type { ActivityDirectiveId } from '../../types/activity';
import type { User } from '../../types/app';
import type { ActivityOptions, Axis, MouseDown, MouseOver, Row, Timeline as TimelineType } from '../../types/timeline';
import type {
ActivityOptions,
Axis,
MouseDown,
MouseOver,
Row,
Timeline as TimelineType,
} from '../../types/timeline';
import effects from '../../utilities/effects';
import { getExternalEventRowId } from '../../utilities/externalEvents';
import { featurePermissions } from '../../utilities/permissions';
Expand Down
8 changes: 4 additions & 4 deletions src/utilities/generic.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,11 +164,11 @@ describe('Generic utility function tests', () => {
});

test('Should not make a list of objects unique', () => {
const base = [{'a': 1}, {'a': 3}, {'a': 1}];
const base = [{ a: 1 }, { a: 3 }, { a: 1 }];
const uniqued = unique(base);
expect(uniqued).toEqual([{'a': 1}, {'a': 3}, {'a': 1}]);
})
})
expect(uniqued).toEqual([{ a: 1 }, { a: 3 }, { a: 1 }]);
});
});

describe('parseJSONStream', () => {
test('Should be able to parse a really long JSON string', async () => {
Expand Down
11 changes: 6 additions & 5 deletions src/utilities/timeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ import type {
Timeline,
VerticalGuide,
XRangeLayer,
XRangeLayerColorScheme
XRangeLayerColorScheme,
} from '../types/timeline';
import { generateRandomPastelColor } from './color';
import { getExternalEventRowId } from './externalEvents';
Expand Down Expand Up @@ -1134,12 +1134,13 @@ function getUniqueNodeItems(nodes: DiscreteTreeNode[]) {
if (nodeItem.directive && !uniqueDirectiveLookup.has(nodeItem.directive.id)) {
uniqueDirectiveLookup.add(nodeItem.directive.id);
flattenedNodes.push(nodeItem);
}
else if (nodeItem.span && !uniqueSpanLookup.has(nodeItem.span.span_id)) {
} else if (nodeItem.span && !uniqueSpanLookup.has(nodeItem.span.span_id)) {
uniqueSpanLookup.add(nodeItem.span.span_id);
flattenedNodes.push(nodeItem);
}
else if (nodeItem.externalEvent && !uniqueExternalEventLookup.has(getExternalEventRowId(nodeItem.externalEvent.pkey))) {
} else if (
nodeItem.externalEvent &&
!uniqueExternalEventLookup.has(getExternalEventRowId(nodeItem.externalEvent.pkey))
) {
uniqueExternalEventLookup.add(getExternalEventRowId(nodeItem.externalEvent.pkey));
flattenedNodes.push(nodeItem);
}
Expand Down
15 changes: 4 additions & 11 deletions src/utilities/view.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ describe('generateDefaultView', () => {
{ name: 'resource1', schema: { type: 'boolean' } },
{ name: 'resource2', schema: { type: 'int' } },
{ name: 'resource2', schema: { items: { type: 'boolean' }, type: 'series' } },
]
],
);
const { valid, errors } = validateViewJSONAgainstSchema(view.definition);
expect(errors).to.deep.equal([]);
Expand All @@ -19,14 +19,7 @@ describe('generateDefaultView', () => {

describe('generateDefaultViewWithEvents', () => {
test('Should generate a valid view with events', async () => {
const view = generateDefaultView(
[],
[],
[
{name: 'external-event-type_1'},
{name: 'external-event-type_2'}
]
);
const view = generateDefaultView([], [], [{ name: 'external-event-type_1' }, { name: 'external-event-type_2' }]);

// validate against schema
const { valid, errors } = validateViewJSONAgainstSchema(view.definition);
Expand All @@ -37,11 +30,11 @@ describe('generateDefaultViewWithEvents', () => {
const timelines = view.definition.plan.timelines;
expect(timelines.length).toBe(1);
expect(timelines[0].rows.length).toBe(2);
expect(timelines[0].rows[1].name).toBe("External Events");
expect(timelines[0].rows[1].name).toBe('External Events');

const layers = timelines[0].rows[1].layers;
expect(layers.length).toBe(1);
expect(layers[0].filter.externalEvent).toBeDefined();
expect(layers[0].filter.externalEvent?.event_types).toEqual(['external-event-type_1', 'external-event-type_2']);
});
});
});

0 comments on commit 3a82532

Please sign in to comment.