Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/components/DataBrowser.vue
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,18 @@ export default defineComponent({
}
});

const openDicomWeb = computed(() => dicomWeb.isConfigured);
watch(
computed(() => dicomWeb.isConfigured),
openDicomWeb,
(configured) => {
if (configured) {
panels.value.push(DICOM_WEB_KEY);
} else {
// Remove from panels to avoid error in vuetify group.ts
removeFromArray(panels.value, DICOM_WEB_KEY);
}
}
},
{ immediate: true }
);

watch(
Expand Down
4 changes: 4 additions & 0 deletions src/components/EditableChipList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,8 @@ const itemsToRender = computed(() =>
background-color: rgb(var(--v-theme-selection-bg-color));
border-color: rgb(var(--v-theme-selection-border-color));
}

.v-chip:deep() .v-chip__content {
width: 100%;
}
</style>
10 changes: 10 additions & 0 deletions src/composables/untilLoaded.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { computed, unref } from 'vue';
import { until } from '@vueuse/core';
import useChunkStore from '../store/chunks';

export function untilLoaded(imageID: string) {
const doneLoading = computed(
() => !unref(useChunkStore().chunkImageById[imageID].isLoading)
);
return until(doneLoading).toBe(true);
}
157 changes: 72 additions & 85 deletions src/io/import/__tests__/dataSource.spec.ts
Original file line number Diff line number Diff line change
@@ -1,101 +1,88 @@
import { describe, it } from 'vitest';
import { expect } from 'chai';
import { DataSource, serializeDataSource } from '@/src/io/import/dataSource';
import {
getDataSourceName,
isRemoteDataSource,
} from '@/src/io/import/dataSource';
import { Chunk } from '@/src/core/streaming/chunk';

describe('serializeDataSource', () => {
it('should remove FileSources', () => {
const input: DataSource = {
fileSrc: {
file: new File([], '1.dcm'),
fileType: 'application/dicom',
},
};
const output = serializeDataSource(input);
describe('isRemoteDatasource', () => {
it('should work', () => {
expect(isRemoteDataSource(undefined)).to.be.false;

expect(output).to.deep.equal({});
});
expect(
isRemoteDataSource({
type: 'file',
file: new File([], 'name'),
fileType: 'type',
})
).to.be.false;

it('should preserve archive status', () => {
const input: DataSource = {
fileSrc: {
file: new File([], '1.dcm'),
fileType: 'application/dicom',
},
archiveSrc: {
path: 'a/b/c',
},
parent: {
fileSrc: {
file: new File([], 'archive.zip'),
fileType: 'application/zip',
expect(
isRemoteDataSource({
type: 'file',
file: new File([], 'name'),
fileType: 'type',
parent: {
type: 'uri',
uri: 'http://',
name: 'name',
},
},
};
const output = serializeDataSource(input);

expect(output).to.deep.equal({
archiveSrc: {
path: 'a/b/c',
},
parent: {},
});
})
).to.be.true;
});
});

it('should preserve UriSource', () => {
const input: DataSource = {
uriSrc: {
uri: 'https://example.com/image.jpg',
name: 'image.jpg',
},
parent: {
uriSrc: {
uri: 's3://example/bucket',
name: '',
},
},
};
const output = serializeDataSource(input);
describe('getDataSourceName', () => {
it('should work', () => {
expect(
getDataSourceName({
type: 'file',
file: new File([], 'name'),
fileType: 'ft',
})
).to.equal('name');

expect(output).to.deep.equal(input);
});
expect(
getDataSourceName({
type: 'uri',
uri: 'http://',
name: 'name',
})
).to.equal('name');

it('should serialize remote archive members', () => {
const input: DataSource = {
fileSrc: {
file: new File([], '1.dcm'),
fileType: 'application/dicom',
},
archiveSrc: {
path: 'a/b/c',
},
parent: {
fileSrc: {
file: new File([], 'archive.zip'),
fileType: 'application/zip',
},
parent: {
uriSrc: {
uri: 'https://example.com/archive.zip',
name: 'archive.zip',
expect(
getDataSourceName({
type: 'collection',
sources: [
{
type: 'file',
file: new File([], 'name'),
fileType: 'ft',
},
},
},
};
const output = serializeDataSource(input);
],
})
).to.equal('name');

expect(output).to.deep.equal({
archiveSrc: {
path: 'a/b/c',
},
parent: {
// empty parent b/c archive FileSource cannot be serialized
expect(
getDataSourceName({
type: 'chunk',
chunk: {} as Chunk,
mime: 'mime',
})
).to.equal(null);

expect(
getDataSourceName({
type: 'chunk',
chunk: {} as Chunk,
mime: 'mime',
parent: {
uriSrc: {
uri: 'https://example.com/archive.zip',
name: 'archive.zip',
},
type: 'file',
file: new File([], 'name'),
fileType: 'ft',
},
},
});
})
).to.equal('name');
});
});
22 changes: 0 additions & 22 deletions src/io/import/__tests__/importDataSources.spec.ts

This file was deleted.

6 changes: 2 additions & 4 deletions src/io/import/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,8 @@ export type ImportHandler = ChainHandler<
ImportContext
>;

export function isArchive(
ds: DataSource
): ds is DataSource & { fileSrc: FileSource } {
return !!ds.fileSrc && ARCHIVE_FILE_TYPES.has(ds.fileSrc.fileType);
export function isArchive(ds: DataSource): ds is FileSource {
return ds.type === 'file' && ARCHIVE_FILE_TYPES.has(ds.fileType);
}

export function isLoadableResult(
Expand Down
Loading
Loading