Skip to content

Commit

Permalink
Merge pull request #436 from include-dcc/fix/SJIP-109/file-entity
Browse files Browse the repository at this point in the history
fix(file): SJIP-109 add download manifest on page file entity
  • Loading branch information
lflangis authored Nov 20, 2023
2 parents 49a9d02 + 1cae062 commit 97ffdff
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion src/views/FileEntity/Title/index.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
import intl from 'react-intl-universal';
import { FileImageOutlined, LockOutlined, UnlockFilled } from '@ant-design/icons';
import { ISyntheticSqon } from '@ferlab/ui/core/data/sqon/types';
import { generateQuery, generateValueFilter } from '@ferlab/ui/core/data/sqon/utils';
import { EntityTitle } from '@ferlab/ui/core/pages/EntityPage';
import { Popover, Space } from 'antd';
import { INDEXES } from 'graphql/constants';
import { IFileEntity } from 'graphql/files/models';
import { DATA_FILES_SAVED_SETS_FIELD } from 'views/DataExploration/utils/constant';

import { FENCE_CONNECTION_STATUSES } from 'common/fenceTypes';
import CavaticaAnalyzeButton from 'components/Cavatica/AnalyzeButton';
import PopoverContentLink from 'components/uiKit/PopoverContentLink';
import DownloadFileManifestModal from 'components/uiKit/reports/DownloadFileManifestModal';
import { useFenceConnection } from 'store/fenceConnection';
import { userHasAccessToFile } from 'utils/dataFiles';

Expand All @@ -29,6 +34,17 @@ const FileEntityTitle: React.FC<OwnProps> = ({ file, loading }) => {
)
: false;

const generateSqonForFile = (): ISyntheticSqon =>
generateQuery({
newFilters: [
generateValueFilter({
field: DATA_FILES_SAVED_SETS_FIELD,
index: INDEXES.FILE,
value: file ? [file?.file_id] : [],
}),
],
});

const title = {
text: file?.file_id,
icon: <FileImageOutlined />,
Expand Down Expand Up @@ -60,7 +76,17 @@ const FileEntityTitle: React.FC<OwnProps> = ({ file, loading }) => {
<LockOutlined className={styles.locked} />
</Popover>
),
extra: <Space>{file && <CavaticaAnalyzeButton fileIds={[file.file_id]} />}</Space>,
extra: (
<Space>
<DownloadFileManifestModal
key="file-entity-manifest"
sqon={generateSqonForFile()}
isDisabled={false}
hasTooManyFiles={false}
/>
{file && <CavaticaAnalyzeButton type="primary" fileIds={[file.file_id]} />}
</Space>
),
};

return <EntityTitle {...title} loading={loading} />;
Expand Down

0 comments on commit 97ffdff

Please sign in to comment.