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

Add image export option #327

Closed
wants to merge 2 commits into from
Closed
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
32 changes: 31 additions & 1 deletion labellab-client/src/actions/image.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ import {
FETCH_IMAGE_FAILURE,
FETCH_IMAGE_REQUEST,
FETCH_IMAGE_SUCCESS,
SET_IMAGE_STATE
SET_IMAGE_STATE,
DOWNLOAD_REQUEST,
DOWNLOAD_FAILURE,
DOWNLOAD_SUCCESS,
} from '../constants/index'

import FetchApi from '../utils/FetchAPI'
Expand Down Expand Up @@ -106,3 +109,30 @@ export const setNextPrev = (next, prev) => {
return { type: SET_IMAGE_STATE, payload: data }
}
}

export const exportDataset = (callback) => {
return dispatch => {
dispatch(request())
FetchApi('GET', '/api/v1/image/export', null, true)
.then(res => {
dispatch(success(res.data.body))
callback()
})
.catch(err => {
if (err.response) {
err.response.data
? dispatch(failure(err.response.data.msg))
: dispatch(failure(err.response.statusText, null))
}
})
}
function request() {
return { type: DOWNLOAD_REQUEST }
}
function success(data) {
return { type: DOWNLOAD_SUCCESS, payload: data }
}
function failure(error) {
return { type: DOWNLOAD_FAILURE, payload: error }
}
}
7 changes: 5 additions & 2 deletions labellab-client/src/components/labeller/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,12 @@ class LabelingLoader extends Component {
labels={lab}
labelData={(img && img.labelData) || {}}
imageUrl={
`${process.env.REACT_APP_HOST}:${process.env.REACT_APP_SERVER_PORT}/static/uploads/${image.imageUrl}?${Date.now()}`
'http://' +
process.env.REACT_APP_HOST +
':' +
process.env.REACT_APP_SERVER_PORT +
`/static/uploads/${image.imageUrl}?${Date.now()}`
}
projectUrl={`/project/${match.params.projectId}/images`}
demo={false}
{...props}
/>
Expand Down
Loading