@aics/vole-app 2.13.7 → 2.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/aics-image-viewer/components/App/index.js +8 -2
- package/es/aics-image-viewer/components/ViewerStateProvider/ResetStateProvider.js +4 -1
- package/es/aics-image-viewer/shared/utils/datatypes.js +29 -0
- package/es/aics-image-viewer/shared/utils/firebase/index.js +109 -0
- package/es/aics-image-viewer/shared/utils/math.js +3 -0
- package/es/aics-image-viewer/shared/utils/test/urlParsing.test.js +1112 -0
- package/es/aics-image-viewer/shared/utils/urlParsing.js +1255 -0
- package/es/index.js +2 -1
- package/package.json +1 -1
- package/type-declarations/aics-image-viewer/components/App/types.d.ts +1 -0
- package/type-declarations/aics-image-viewer/components/Toolbar/index.d.ts +1 -1
- package/type-declarations/aics-image-viewer/components/ViewerStateProvider/index.d.ts +1 -1
- package/type-declarations/aics-image-viewer/shared/utils/datatypes.d.ts +10 -0
- package/type-declarations/aics-image-viewer/shared/utils/firebase/index.d.ts +69 -0
- package/type-declarations/aics-image-viewer/shared/utils/math.d.ts +1 -0
- package/type-declarations/aics-image-viewer/shared/utils/urlParsing.d.ts +344 -0
- package/type-declarations/index.d.ts +3 -1
|
@@ -122,6 +122,7 @@ var App = function App(props) {
|
|
|
122
122
|
onResetChannel = _viewerState$current.onResetChannel;
|
|
123
123
|
var _props = props,
|
|
124
124
|
onControlPanelToggle = _props.onControlPanelToggle,
|
|
125
|
+
onImageTitleChange = _props.onImageTitleChange,
|
|
125
126
|
metadata = _props.metadata,
|
|
126
127
|
metadataFormatter = _props.metadataFormatter;
|
|
127
128
|
useMemo(function () {
|
|
@@ -208,8 +209,9 @@ var App = function App(props) {
|
|
|
208
209
|
};
|
|
209
210
|
})
|
|
210
211
|
});
|
|
212
|
+
onImageTitleChange === null || onImageTitleChange === void 0 || onImageTitleChange(newImage.imageInfo.imageInfo.name);
|
|
211
213
|
view3d.updateActiveChannels(newImage);
|
|
212
|
-
}, [view3d, viewerState]);
|
|
214
|
+
}, [view3d, viewerState, onImageTitleChange]);
|
|
213
215
|
var onChannelLoaded = useCallback(function (image, channelIndex, isInitialLoad) {
|
|
214
216
|
// TODO this was once a search by name - is that still necessary or will the index always be correct?
|
|
215
217
|
var thisChannelSettings = channelSettings[channelIndex];
|
|
@@ -268,10 +270,14 @@ var App = function App(props) {
|
|
|
268
270
|
view3d.updateActiveChannels(image);
|
|
269
271
|
}
|
|
270
272
|
}, [view3d, channelSettings, maskChannelName, viewerState]);
|
|
273
|
+
var onError = useCallback(function (error) {
|
|
274
|
+
showError(error);
|
|
275
|
+
onImageTitleChange === null || onImageTitleChange === void 0 || onImageTitleChange(undefined);
|
|
276
|
+
}, [showError, onImageTitleChange]);
|
|
271
277
|
var volume = useVolume(scenes, {
|
|
272
278
|
onCreateImage: onCreateImage,
|
|
273
279
|
onChannelLoaded: onChannelLoaded,
|
|
274
|
-
onError:
|
|
280
|
+
onError: onError,
|
|
275
281
|
maskChannelName: maskChannelName
|
|
276
282
|
});
|
|
277
283
|
var image = volume.image,
|
|
@@ -132,7 +132,10 @@ var ResetStateProvider = /*#__PURE__*/function () {
|
|
|
132
132
|
}, this.savedViewerState);
|
|
133
133
|
var newChannelSettings = channelSettings.map(function (_, index) {
|
|
134
134
|
var initialChannelSetting = initializeOneChannelSetting(channelSettings[index].name, index, getDefaultChannelColor(index), _this.savedViewerChannelSettings);
|
|
135
|
-
return initialChannelSetting
|
|
135
|
+
return _objectSpread(_objectSpread({}, initialChannelSetting), {}, {
|
|
136
|
+
plotMin: channelSettings[index].plotMin,
|
|
137
|
+
plotMax: channelSettings[index].plotMax
|
|
138
|
+
});
|
|
136
139
|
});
|
|
137
140
|
this.resetToState(newViewerState, newChannelSettings);
|
|
138
141
|
this.useDefaultViewerChannelSettings = false;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { isEqual } from "lodash";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Returns a (shallow) copy of an object with all properties that are
|
|
5
|
+
* `undefined` removed.
|
|
6
|
+
*/
|
|
7
|
+
export function removeUndefinedProperties(obj) {
|
|
8
|
+
var result = {};
|
|
9
|
+
for (var key in obj) {
|
|
10
|
+
if (obj[key] !== undefined) {
|
|
11
|
+
result[key] = obj[key];
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
return result;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Returns a copy of `obj` where all properties with values that match the properties of `match`
|
|
19
|
+
* are removed. Matching is determined by deep equality (see `isDeepEqual()`).
|
|
20
|
+
*/
|
|
21
|
+
export function removeMatchingProperties(obj, match) {
|
|
22
|
+
var result = {};
|
|
23
|
+
for (var key in obj) {
|
|
24
|
+
if (!isEqual(obj[key], match[key])) {
|
|
25
|
+
result[key] = obj[key];
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return result;
|
|
29
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
5
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
6
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
7
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
8
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
9
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
10
|
+
// TODO: These types are shared with Cell Feature Explorer. Can they be moved to
|
|
11
|
+
// a shared package?
|
|
12
|
+
|
|
13
|
+
function isDevOrStagingSite(host) {
|
|
14
|
+
// first condition is for testing with no client
|
|
15
|
+
return !host || host.includes("localhost") || host.includes("staging") || host.includes("stg");
|
|
16
|
+
}
|
|
17
|
+
var FirebaseRequest = /*#__PURE__*/_createClass(
|
|
18
|
+
// TODO: These properties are private and unused. Remove?
|
|
19
|
+
|
|
20
|
+
function FirebaseRequest(firestore) {
|
|
21
|
+
var _this = this;
|
|
22
|
+
_classCallCheck(this, FirebaseRequest);
|
|
23
|
+
_defineProperty(this, "getDoc", function (docPath) {
|
|
24
|
+
return _this.firestore.doc(docPath).get();
|
|
25
|
+
});
|
|
26
|
+
_defineProperty(this, "getAvailableDatasets", function () {
|
|
27
|
+
return _this.firestore.collection("dataset-descriptions").get().then(function (snapShot) {
|
|
28
|
+
var datasets = [];
|
|
29
|
+
snapShot.forEach(function (doc) {
|
|
30
|
+
var metadata = doc.data();
|
|
31
|
+
/** if running the site in a local development env or on staging.cfe.allencell.org
|
|
32
|
+
* include all cards, otherwise, only include cards with a production flag.
|
|
33
|
+
* this is based on hostname instead of a build time variable so we don't
|
|
34
|
+
* need a separate build for staging and production
|
|
35
|
+
*/
|
|
36
|
+
|
|
37
|
+
if (isDevOrStagingSite(location.hostname)) {
|
|
38
|
+
datasets.push(metadata);
|
|
39
|
+
} else if (metadata.production) {
|
|
40
|
+
datasets.push(metadata);
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
return datasets;
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
_defineProperty(this, "setCollectionRef", function (id) {
|
|
47
|
+
_this.collectionRef = _this.firestore.collection("cfe-datasets").doc(id);
|
|
48
|
+
});
|
|
49
|
+
_defineProperty(this, "getManifest", function (ref) {
|
|
50
|
+
return _this.firestore.doc(ref).get().then(function (manifestDoc) {
|
|
51
|
+
return manifestDoc.data();
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
_defineProperty(this, "selectDataset", function (ref) {
|
|
55
|
+
return _this.getManifest(ref).then(function (data) {
|
|
56
|
+
_this.featuresDataPath = data.featuresDataPath;
|
|
57
|
+
_this.thumbnailRoot = data.thumbnailRoot;
|
|
58
|
+
_this.downloadRoot = data.downloadRoot;
|
|
59
|
+
_this.volumeViewerDataRoot = data.volumeViewerDataRoot;
|
|
60
|
+
_this.featuresDisplayOrder = data.featuresDisplayOrder;
|
|
61
|
+
_this.cellLineDataPath = data.cellLineDataPath;
|
|
62
|
+
_this.fileInfoPath = data.fileInfoPath;
|
|
63
|
+
_this.featuresDataOrder = data.featuresDataOrder;
|
|
64
|
+
_this.featureDefsPath = data.featureDefsPath;
|
|
65
|
+
_this.albumPath = data.albumPath;
|
|
66
|
+
return _objectSpread({}, data);
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
_defineProperty(this, "getFileInfoByCellId", function (cellId) {
|
|
70
|
+
return _this.getDoc("".concat(_this.fileInfoPath, "/").concat(cellId)).then(function (doc) {
|
|
71
|
+
var data = doc.data();
|
|
72
|
+
if (!data) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
return _objectSpread(_objectSpread({}, data), {}, {
|
|
76
|
+
CellId: data.CellId.toString(),
|
|
77
|
+
FOVId: data.FOVId.toString()
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
_defineProperty(this, "getFileInfoByArrayOfCellIds", function (cellIds) {
|
|
82
|
+
return Promise.all(cellIds.map(function (id) {
|
|
83
|
+
return _this.getDoc("".concat(_this.fileInfoPath, "/").concat(id)).then(function (doc) {
|
|
84
|
+
var data = doc.data();
|
|
85
|
+
if (!data) {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
return _objectSpread(_objectSpread({}, data), {}, {
|
|
89
|
+
CellId: data.CellId.toString(),
|
|
90
|
+
FOVId: data.FOVId.toString()
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
}));
|
|
94
|
+
});
|
|
95
|
+
this.firestore = firestore;
|
|
96
|
+
this.featuresDataPath = "";
|
|
97
|
+
this.cellLineDataPath = "";
|
|
98
|
+
this.thumbnailRoot = "";
|
|
99
|
+
this.downloadRoot = "";
|
|
100
|
+
this.volumeViewerDataRoot = "";
|
|
101
|
+
this.featuresDisplayOrder = [];
|
|
102
|
+
this.fileInfoPath = "";
|
|
103
|
+
this.datasetId = "";
|
|
104
|
+
this.featuresDataOrder = [];
|
|
105
|
+
this.albumPath = "";
|
|
106
|
+
this.featureDefsPath = "";
|
|
107
|
+
this.collectionRef = firestore.collection("cfe-datasets").doc("v1");
|
|
108
|
+
});
|
|
109
|
+
export default FirebaseRequest;
|