Skip to content

Commit 06a9971

Browse files
authored
Restore metadata file store multiple files upload (geonetwork#8648)
* Restore metadata file store multiple files upload * Restore metadata file store multiple files upload - remove duplicated check * Restore metadata file store multiple files upload - initialize default value for singleUpload (overridable)
1 parent 6ac9f07 commit 06a9971

File tree

2 files changed

+22
-11
lines changed

2 files changed

+22
-11
lines changed

web-ui/src/main/resources/catalog/components/filestore/FileStoreDirective.js

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,21 @@
6161
? "public"
6262
: attrs["visibility"];
6363
scope.queue = [];
64+
scope.singleUpload = true;
65+
66+
var input = element.find("input");
67+
if (
68+
angular.isDefined(scope.uploadOptions) &&
69+
scope.uploadOptions.singleUpload === false
70+
) {
71+
input.attr("multiple", "multiple");
72+
}
6473

6574
var uploadFile = function () {
6675
scope.queue = [];
6776
scope.filestoreUploadOptions = angular.extend(
6877
{
69-
singleUpload: true,
78+
singleUpload: scope.singleUpload,
7079
autoUpload: scope.autoUpload,
7180
url:
7281
"../api/records/" +
@@ -219,6 +228,17 @@
219228
link: function (scope, element, attrs, controller) {
220229
scope.autoUpload =
221230
angular.isUndefined(attrs["autoUpload"]) || attrs["autoUpload"] == "true";
231+
232+
scope.filestoreUploadOptions = {
233+
autoUpload: scope.autoUpload,
234+
singleUpload: false
235+
};
236+
237+
scope.filestoreUploadOptionsSetResource = {
238+
autoUpload: scope.autoUpload,
239+
singleUpload: true
240+
};
241+
222242
var defaultStatus = angular.isUndefined(attrs["defaultStatus"])
223243
? "public"
224244
: attrs["defaultStatus"];
@@ -295,15 +315,6 @@
295315
scope.loadMetadataResources();
296316

297317
scope.queue = [];
298-
scope.filestoreUploadOptions = {
299-
autoUpload: scope.autoUpload,
300-
url:
301-
"../api/records/" +
302-
scope.uuid +
303-
"/attachments?visibility=" +
304-
defaultStatus,
305-
singleUpload: false
306-
};
307318
}
308319
});
309320
if (angular.isDefined(scope.uuid)) {

web-ui/src/main/resources/catalog/components/filestore/partials/filestore.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<div
1414
data-gn-data-uploader-button="'chooseOnlinesrc'"
1515
data-after-upload-cb="setResource"
16-
data-upload-options="filestoreUploadOptions"
16+
data-upload-options="filestoreUploadOptionsSetResource"
1717
></div>
1818
</div>
1919
<div data-ng-if="layout !== 'select'">

0 commit comments

Comments
 (0)