Skip to content

Commit

Permalink
Merge pull request #316 from Kitware/misc-patches-6
Browse files Browse the repository at this point in the history
Misc patches 6
  • Loading branch information
floryst authored Apr 15, 2020
2 parents b97a45e + 9dbc09f commit 549f125
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 16 deletions.
12 changes: 10 additions & 2 deletions src/components/core/App/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ export default {
screenshotCount: 0,
errors: [],
globalSingleNotification: '',
notifyPermanent: false,
};
},
computed: {
Expand Down Expand Up @@ -191,8 +192,15 @@ export default {
recordError(error) {
this.errors.push(error);
},
notify(msg) {
this.globalSingleNotification = msg;
notify(msg, permanent = false) {
if (this.globalSingleNotification) {
this.globalSingleNotification = '';
this.permanent = false;
}
this.$nextTick(() => {
this.globalSingleNotification = msg;
this.notifyPermanent = permanent;
});
},
},
};
1 change: 1 addition & 0 deletions src/components/core/App/template.html
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@
@input="globalSingleNotification = ''"
bottom
left
:timeout="notifyPermanent ? 0 : 6000"
@click="globalSingleNotification = ''"
>
{{ globalSingleNotification }}
Expand Down
39 changes: 26 additions & 13 deletions src/components/core/GirderBox/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,8 @@ export default {
});
}

this.$notify('Uploading...', true);

const image = ITKHelper.convertVtkToItkImage(dataset);
// If we don't copy here, the renderer's copy of the ArrayBuffer
// becomes invalid because it's been transferred:
Expand All @@ -176,15 +178,20 @@ export default {
.getProxyById(proxyId)
.getKey('girderProvenance') || this.location,
});
upload.start().then((response) => {
const { itemId } = response;
this.girderRest.put(
`${this.girderRest.apiRoot}/item/${itemId}`,
`metadata=${JSON.stringify(metadata)}`
);
this.$notify('Image uploaded');
this.$refs.girderFileManager.refresh();
});
upload
.start()
.then((response) => {
const { itemId } = response;
this.girderRest.put(
`${this.girderRest.apiRoot}/item/${itemId}`,
`metadata=${JSON.stringify(metadata)}`
);
this.$notify('Image uploaded');
this.$refs.girderFileManager.refresh();
})
.catch(() => {
this.$notify('Upload error');
});
});
},
uploadMeasurements(proxyId) {
Expand All @@ -196,17 +203,23 @@ export default {
const proxyName = this.$proxyManager.getProxyById(proxyId).getName();
const name = `${proxyName}.measurements.json`;
const file = new File([JSON.stringify(measurements)], name);
this.$notify('Uploading...', true);
const upload = new GirderUpload(file, {
$rest: this.girderRest,
parent:
this.$proxyManager
.getProxyById(proxyId)
.getKey('girderProvenance') || this.location,
});
upload.start().then(() => {
this.$notify('Measurements uploaded');
this.$refs.girderFileManager.refresh();
});
upload
.start()
.then(() => {
this.$notify('Measurements uploaded');
this.$refs.girderFileManager.refresh();
})
.catch(() => {
this.$notify('Upload error');
});
}
},
refreshPage() {
Expand Down
2 changes: 1 addition & 1 deletion src/io/postProcessing.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import vtkLabelMap from 'paraview-glance/src/vtk/LabelMap';
export function copyImageToLabelMap(vtkImage) {
/* eslint-disable-next-line import/no-named-as-default-member */
const lm = vtkLabelMap.newInstance(
vtkImage.get(['direction', 'origin', 'spacing'])
vtkImage.get('direction', 'origin', 'spacing')
);
lm.setDimensions(vtkImage.getDimensions());
lm.computeTransforms();
Expand Down

0 comments on commit 549f125

Please sign in to comment.