Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[VISIUM EXAMPLE] disable file check #570

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
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
120 changes: 60 additions & 60 deletions src/__test__/components/data-management/LaunchAnalysisButton.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -161,66 +161,66 @@ describe('LaunchAnalysisButton', () => {
jest.clearAllMocks();
});

it('Process project button is disabled if not all sample metadata are inserted', () => {
const notAllMetadataInserted = {
...withDataState,
samples: {
...withDataState.samples,
[sample1Uuid]: {
...withDataState.samples[sample1Uuid],
metadata: [''],
},
},
};

render(
<Provider store={mockStore(notAllMetadataInserted)}>
<LaunchAnalysisButton />
</Provider>,
);

const button = screen.getByText('Process project').closest('button');

expect(button).toBeDisabled();
});

it('Process project button is disabled if there is no data', () => {
render(
<Provider store={mockStore(noDataState)}>
<LaunchAnalysisButton />
</Provider>,
);

const button = screen.getByText('Process project').closest('button');

expect(button).toBeDisabled();
});

it('Process project button is disabled if not all data are uploaded', () => {
const notAllDataUploaded = {
...withDataState,
samples: {
...withDataState.samples,
[sample1Uuid]: {
...withDataState.samples[sample1Uuid],
files: {
...withDataState.samples[sample1Uuid].files,
'features.tsv.gz': { valid: true, upload: { status: UploadStatus.UPLOADING } },
},
},
},
};

render(
<Provider store={mockStore(notAllDataUploaded)}>
<LaunchAnalysisButton />
</Provider>,
);

const button = screen.getByText('Process project').closest('button');

expect(button).toBeDisabled();
});
// it('Process project button is disabled if not all sample metadata are inserted', () => {
// const notAllMetadataInserted = {
// ...withDataState,
// samples: {
// ...withDataState.samples,
// [sample1Uuid]: {
// ...withDataState.samples[sample1Uuid],
// metadata: [''],
// },
// },
// };

// render(
// <Provider store={mockStore(notAllMetadataInserted)}>
// <LaunchAnalysisButton />
// </Provider>,
// );

// const button = screen.getByText('Process project').closest('button');

// expect(button).toBeDisabled();
// });

// it('Process project button is disabled if there is no data', () => {
// render(
// <Provider store={mockStore(noDataState)}>
// <LaunchAnalysisButton />
// </Provider>,
// );

// const button = screen.getByText('Process project').closest('button');

// expect(button).toBeDisabled();
// });

// it('Process project button is disabled if not all data are uploaded', () => {
// const notAllDataUploaded = {
// ...withDataState,
// samples: {
// ...withDataState.samples,
// [sample1Uuid]: {
// ...withDataState.samples[sample1Uuid],
// files: {
// ...withDataState.samples[sample1Uuid].files,
// 'features.tsv.gz': { valid: true, upload: { status: UploadStatus.UPLOADING } },
// },
// },
// },
// };

// render(
// <Provider store={mockStore(notAllDataUploaded)}>
// <LaunchAnalysisButton />
// </Provider>,
// );

// const button = screen.getByText('Process project').closest('button');

// expect(button).toBeDisabled();
// });

it('Process project button is enabled if there is data and all metadata for all samples are uplaoded', () => {
render(
Expand Down
18 changes: 2 additions & 16 deletions src/components/data-management/LaunchAnalysisButton.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@ const LaunchAnalysisButton = () => {
for (const fileName of fileNames) {
const checkedFile = sample.files[fileName];
allUploaded = allUploaded
&& checkedFile.valid
&& checkedFile.upload.status === UploadStatus.UPLOADED;
&& checkedFile.valid
&& checkedFile.upload.status === UploadStatus.UPLOADED;

if (!allUploaded) break;
}
Expand Down Expand Up @@ -166,20 +166,6 @@ const LaunchAnalysisButton = () => {
return <LaunchButtonTemplate text='Loading project...' disabled loading />;
}

if (!canLaunchAnalysis()) {
return (
<Tooltip
title='Ensure all samples are uploaded and all metadata are inserted'
>
{/* disabled button inside tooltip causes tooltip to not function */}
{/* https://github.com/react-component/tooltip/issues/18#issuecomment-140078802 */}
<span>
<LaunchButtonTemplate text={buttonText} disabled />
</span>
</Tooltip>
);
}

// Popconfirm
if (gem2sRerunStatus.rerun) {
return (
Expand Down
2 changes: 1 addition & 1 deletion src/utils/upload/fileInspector.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const inspectFile = async (file, technology) => {

// check barcodes file starts with a 16 digit DNA sequence
if (file.name.startsWith('barcodes')
&& !data.toString().match(/\t/)) {
&& !data.toString().match(/\t/)) {
return valid;
}

Expand Down
6 changes: 4 additions & 2 deletions src/utils/upload/processUpload.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import fetchAPI from '../fetchAPI';

import UploadStatus from './UploadStatus';
import loadAndCompressIfNecessary from './loadAndCompressIfNecessary';
import { inspectFile, Verdict } from './fileInspector';
import { Verdict } from './fileInspector';

const putInS3 = async (projectUuid, loadedFileData, dispatch, sampleUuid, fileName, metadata) => {
const baseUrl = `/v1/projects/${projectUuid}/samples/${sampleUuid}/${fileName}/uploadUrl`;
Expand Down Expand Up @@ -226,7 +226,9 @@ const bundleToFile = async (bundle, technology) => {
? _.takeRight(bundle.path.split('/'), 2).join('/')
: bundle.name;

const verdict = await inspectFile(bundle, technology);
const verdict = true;
console.log(technology);
// const verdict = await inspectFile(bundle, technology);

let error = '';
if (verdict === Verdict.INVALID_NAME) {
Expand Down