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

Small Fixes for Tiff Export #5252

Merged
merged 2 commits into from
Mar 9, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion app/controllers/JobsController.scala
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ class JobsController @Inject()(jobDAO: JobDAO,
for {
organization <- organizationDAO.findOneByName(organizationName) ?~> Messages("organization.notFound",
organizationName)
_ <- bool2Fox(request.identity._organization == organization._id) ~> FORBIDDEN
_ <- bool2Fox(request.identity._organization == organization._id) ?~> "job.export.notAllowed.organization" ~> FORBIDDEN
_ <- jobService.assertTiffExportBoundingBoxLimits(bbox)
command = "export_tiff"
exportFileName = s"${formatDateForFilename(new Date())}__${dataSetName}__${layerName}.zip"
Expand Down
1 change: 1 addition & 0 deletions conf/messages
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,7 @@ job.export.fileNotFound = Exported file not found. The link may be expired.
job.export.tiff.invalidBoundingBox = The selected bounding box could not be parsed, must be x,y,z,width,height,depth
job.export.tiff.volumeExceeded = The volume of the selected bounding box is too large.
job.export.tiff.edgeLengthExceeded = An edge length of the selected bounding box is too large.
job.export.notAllowed.organization = Currently tiff export is only allowed for datasets of your own organization.

agglomerateSkeleton.failed=Could not generate agglomerate skeleton.

Expand Down
1 change: 1 addition & 0 deletions frontend/javascripts/admin/admin_rest_api.js
Original file line number Diff line number Diff line change
Expand Up @@ -796,6 +796,7 @@ export async function getJobs(): Promise<Array<APIJob>> {
datasetName: job.commandArgs.kwargs.dataset_name,
organizationName: job.commandArgs.kwargs.organization_name,
layerName: job.commandArgs.kwargs.layer_name,
boundingBox: job.commandArgs.kwargs.bbox,
exportFileName: job.commandArgs.kwargs.export_file_name,
state: job.celeryInfo.state || "UNKNOWN",
createdAt: job.created,
Expand Down
3 changes: 2 additions & 1 deletion frontend/javascripts/admin/job/job_list_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ class JobListView extends React.PureComponent<Props, State> {
Tiff export from {job.layerName || "a"} layer of{" "}
<Link to={`/datasets/${job.organizationName}/${job.datasetName}/view`}>
{job.datasetName}
</Link>
</Link>{" "}
(Box {job.boundingBox})
fm3 marked this conversation as resolved.
Show resolved Hide resolved
</span>
);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ import * as Utils from "libs/utils";
type Props = {
destroy: () => void,
dataset: APIDataset,
hasVolumeTracing: boolean,
boundingBox: BoundingBoxType,
};

const ExportBoundingBoxModal = ({ destroy, dataset, boundingBox }: Props) => {
const ExportBoundingBoxModal = ({ destroy, dataset, hasVolumeTracing, boundingBox }: Props) => {
const [startedExports, setStartedExports] = useState([]);

const handleClose = () => {
Expand All @@ -31,12 +32,15 @@ const ExportBoundingBoxModal = ({ destroy, dataset, boundingBox }: Props) => {
};

const layerNames = dataset.dataSource.dataLayers.map(layer => {
const nameIfColor = layer.category === "color" ? layer.name : null;
const nameIfFromDataset = layer.category === "color" || !hasVolumeTracing ? layer.name : null;
const nameIfVolume =
layer.category === "segmentation" && layer.fallbackLayerInfo && layer.fallbackLayerInfo.name
hasVolumeTracing &&
layer.category === "segmentation" &&
layer.fallbackLayerInfo &&
layer.fallbackLayerInfo.name
fm3 marked this conversation as resolved.
Show resolved Hide resolved
? layer.fallbackLayerInfo.name
: null;
return nameIfColor || nameIfVolume;
return nameIfFromDataset || nameIfVolume;
fm3 marked this conversation as resolved.
Show resolved Hide resolved
});

const exportButtonsList = layerNames.map(layerName =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ class UserSettingsView extends PureComponent<UserSettingsViewProps> {
renderIndependently(destroy => (
<ExportBoundingBoxModal
dataset={this.props.dataset}
hasVolumeTracing={this.props.tracing.volume != null}
boundingBox={selectedBoundingBox.boundingBox}
destroy={destroy}
/>
Expand Down
1 change: 1 addition & 0 deletions frontend/javascripts/types/api_flow_types.js
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,7 @@ export type APIJob = {
+exportFileName: ?string,
+layerName: ?string,
+organizationName: ?string,
+boundingBox: ?string,
+type: string,
+state: string,
+createdAt: number,
Expand Down