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

fix issue viewer cannot download view #237

Merged
merged 1 commit into from
Oct 4, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
const LOAD_BATCH_ENTITY_EDIT_URL = '/api/batch-entity-edit/'

const BatchEditButton = (props: any) => {
const {dataset} = props
const {dataset, canUpload} = props

Check warning on line 13 in django_project/dashboard/src/admin_boundaries/HeaderButtons.tsx

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🧾 Statement is not covered

Warning! Not covered statement
const navigate = useNavigate()

const createNewBatchEdit = () => {
Expand Down Expand Up @@ -41,11 +41,11 @@
navigate(_navigate_to)
}

return (
<Box>
<Button
id='batch-edit-button'
disabled={dataset?.is_empty}
disabled={dataset?.is_empty || !canUpload}

Check warning on line 48 in django_project/dashboard/src/admin_boundaries/HeaderButtons.tsx

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🌿 Branch is not covered

Warning! Not covered branch

Check warning on line 48 in django_project/dashboard/src/admin_boundaries/HeaderButtons.tsx

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🌿 Branch is not covered

Warning! Not covered branch
className={'ThemeButton MuiButton-secondary DatasetBatchEditButton'}
onClick={(event: React.MouseEvent<HTMLButtonElement>) => createNewBatchEdit()}
disableElevation
Expand Down
3 changes: 2 additions & 1 deletion django_project/dashboard/src/components/HeaderButtons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -122,17 +122,18 @@



return (
<div style={{display:'flex', flexDirection: 'row', alignItems: 'center'}}>
{ activeUpload && activeUpload.id &&
<EditButton disabled={!dataset.is_active} text={'Active Upload'} variant={'primary'} onClick={activeUploadButtonClick} />
}
<AddButton disabled={!canUpload || !dataset.is_active} text={'Add data'} variant={'secondary'}
onClick={addButtonClick}/>
{ props.moreActions ? <Divider orientation='vertical' flexItem={true} sx={{marginLeft: '10px'}} /> : null }
{ props.moreActions ? MoreActionsElement(props.moreActions, {
dataset: dataset
dataset: dataset,
canUpload: canUpload
}) : null }

Check warning on line 136 in django_project/dashboard/src/components/HeaderButtons.tsx

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🌿 Branch is not covered

Warning! Not covered branch
</div>
)

Check warning on line 138 in django_project/dashboard/src/components/HeaderButtons.tsx

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🧾 Statement is not covered

Warning! Not covered statement
}
Expand Down
4 changes: 3 additions & 1 deletion django_project/dashboard/src/views/View/ViewDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,21 +73,23 @@
dispatch(resetViewTabStatuses())
}, [])

useEffect(() => {
if (view) {
setPreviewSession(view.preview_session)
if (view.id) {
let tab = searchParams.get('tab') ? parseInt(searchParams.get('tab')) : 0
setTabSelected(tab as unknown as number)
let _viewName = view.name
if (view.is_default === 'Yes') {
_viewName = _viewName.replaceAll(` - ${view.dataset_name}`, '')
// old format
_viewName = _viewName.replaceAll(`${view.dataset_name} - `, '')
}
let _isReadOnly = isReadOnlyView(view)
if (_isReadOnly) {
setTabSelected(1)
// set tab to preview if accessing tab > 2
let _tab = tab <= 2 ? tab : 1

Check warning on line 91 in django_project/dashboard/src/views/View/ViewDetail.tsx

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🧾 Statement is not covered

Warning! Not covered statement

Check warning on line 91 in django_project/dashboard/src/views/View/ViewDetail.tsx

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🌿 Branch is not covered

Warning! Not covered branch

Check warning on line 91 in django_project/dashboard/src/views/View/ViewDetail.tsx

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🌿 Branch is not covered

Warning! Not covered branch
setTabSelected(_tab)

Check warning on line 92 in django_project/dashboard/src/views/View/ViewDetail.tsx

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🧾 Statement is not covered

Warning! Not covered statement
dispatch(updateMenu({
id: `view_edit`,
name: `View ${_viewName}`
Expand Down
Loading