@girder/core 3.2.3 → 5.0.0-beta.1

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.
Files changed (231) hide show
  1. package/README.md +61 -0
  2. package/package.json +79 -31
  3. package/assets/Girder_Mark.png +0 -0
  4. package/auth.js +0 -152
  5. package/collections/ApiKeyCollection.js +0 -9
  6. package/collections/AssetstoreCollection.js +0 -9
  7. package/collections/Collection.js +0 -295
  8. package/collections/CollectionCollection.js +0 -9
  9. package/collections/FileCollection.js +0 -11
  10. package/collections/FolderCollection.js +0 -11
  11. package/collections/GroupCollection.js +0 -9
  12. package/collections/ItemCollection.js +0 -11
  13. package/collections/UserCollection.js +0 -24
  14. package/collections/index.js +0 -21
  15. package/constants.js +0 -33
  16. package/dialog.js +0 -128
  17. package/events.js +0 -6
  18. package/index.js +0 -31
  19. package/main.js +0 -21
  20. package/misc.js +0 -260
  21. package/models/AccessControlledModel.js +0 -76
  22. package/models/ApiKeyModel.js +0 -31
  23. package/models/AssetstoreModel.js +0 -43
  24. package/models/CollectionCreationPolicyModel.js +0 -20
  25. package/models/CollectionModel.js +0 -12
  26. package/models/FileModel.js +0 -310
  27. package/models/FolderModel.js +0 -33
  28. package/models/GroupModel.js +0 -197
  29. package/models/ItemModel.js +0 -72
  30. package/models/MetadataMixin.js +0 -88
  31. package/models/Model.js +0 -187
  32. package/models/UserModel.js +0 -189
  33. package/models/index.js +0 -25
  34. package/pluginUtils.js +0 -11
  35. package/rest.js +0 -216
  36. package/router.js +0 -58
  37. package/routes.js +0 -231
  38. package/stylesheets/apidocs/apidocs.styl +0 -50
  39. package/stylesheets/body/adminConsole.styl +0 -21
  40. package/stylesheets/body/assetstores.styl +0 -46
  41. package/stylesheets/body/collectionList.styl +0 -39
  42. package/stylesheets/body/collectionPage.styl +0 -6
  43. package/stylesheets/body/frontPage.styl +0 -48
  44. package/stylesheets/body/groupList.styl +0 -43
  45. package/stylesheets/body/groupPage.styl +0 -116
  46. package/stylesheets/body/itemPage.styl +0 -81
  47. package/stylesheets/body/plugins.styl +0 -61
  48. package/stylesheets/body/searchResultsList.styl +0 -51
  49. package/stylesheets/body/systemConfig.styl +0 -56
  50. package/stylesheets/body/userAccount.styl +0 -57
  51. package/stylesheets/body/userList.styl +0 -79
  52. package/stylesheets/body/userPage.styl +0 -6
  53. package/stylesheets/layout/footer.styl +0 -19
  54. package/stylesheets/layout/global.styl +0 -154
  55. package/stylesheets/layout/globalNav.styl +0 -89
  56. package/stylesheets/layout/header.styl +0 -29
  57. package/stylesheets/layout/headerUser.styl +0 -33
  58. package/stylesheets/layout/layout.styl +0 -75
  59. package/stylesheets/layout/layoutVars.styl +0 -9
  60. package/stylesheets/layout/loading.styl +0 -37
  61. package/stylesheets/layout/progressArea.styl +0 -17
  62. package/stylesheets/widgets/accessWidget.styl +0 -106
  63. package/stylesheets/widgets/browserWidget.styl +0 -9
  64. package/stylesheets/widgets/hierarchyWidget.styl +0 -188
  65. package/stylesheets/widgets/markdownWidget.styl +0 -92
  66. package/stylesheets/widgets/metadataWidget.styl +0 -92
  67. package/stylesheets/widgets/searchFieldWidget.styl +0 -70
  68. package/stylesheets/widgets/taskProgress.styl +0 -41
  69. package/stylesheets/widgets/timelineWidget.styl +0 -41
  70. package/stylesheets/widgets/uploadWidget.styl +0 -43
  71. package/stylesheets/widgets/userOtpManagementWidget.styl +0 -159
  72. package/templates/body/adminConsole.pug +0 -13
  73. package/templates/body/assetstores.pug +0 -98
  74. package/templates/body/collectionList.pug +0 -40
  75. package/templates/body/collectionPage.pug +0 -36
  76. package/templates/body/filesystemImport.pug +0 -41
  77. package/templates/body/frontPage.pug +0 -84
  78. package/templates/body/groupList.pug +0 -30
  79. package/templates/body/groupPage.pug +0 -116
  80. package/templates/body/itemPage.pug +0 -61
  81. package/templates/body/plugins.pug +0 -20
  82. package/templates/body/s3Import.pug +0 -35
  83. package/templates/body/searchResults.pug +0 -15
  84. package/templates/body/searchResultsType.pug +0 -13
  85. package/templates/body/systemConfiguration.pug +0 -221
  86. package/templates/body/userAccount.pug +0 -83
  87. package/templates/body/userList.pug +0 -43
  88. package/templates/body/userPage.pug +0 -40
  89. package/templates/layout/alert.pug +0 -5
  90. package/templates/layout/layout.pug +0 -12
  91. package/templates/layout/layoutFooter.pug +0 -11
  92. package/templates/layout/layoutGlobalNav.pug +0 -7
  93. package/templates/layout/layoutHeader.pug +0 -8
  94. package/templates/layout/layoutHeaderUser.pug +0 -26
  95. package/templates/layout/layoutProgressArea.pug +0 -1
  96. package/templates/layout/loginDialog.pug +0 -30
  97. package/templates/layout/registerDialog.pug +0 -35
  98. package/templates/layout/resetPasswordDialog.pug +0 -25
  99. package/templates/widgets/accessEditor.pug +0 -23
  100. package/templates/widgets/accessEditorMixins.pug +0 -57
  101. package/templates/widgets/accessEditorNonModal.pug +0 -11
  102. package/templates/widgets/accessEntry.pug +0 -32
  103. package/templates/widgets/apiKeyList.pug +0 -50
  104. package/templates/widgets/browserWidget.pug +0 -32
  105. package/templates/widgets/checkedActionsMenu.pug +0 -46
  106. package/templates/widgets/collectionInfoDialog.pug +0 -37
  107. package/templates/widgets/confirmDialog.pug +0 -14
  108. package/templates/widgets/dateTimeRangeWidget.pug +0 -20
  109. package/templates/widgets/dateTimeWidget.pug +0 -8
  110. package/templates/widgets/editApiKeyWidget.pug +0 -43
  111. package/templates/widgets/editAssetstoreWidget.pug +0 -78
  112. package/templates/widgets/editCollectionWidget.pug +0 -27
  113. package/templates/widgets/editFileWidget.pug +0 -21
  114. package/templates/widgets/editFolderWidget.pug +0 -27
  115. package/templates/widgets/editGroupWidget.pug +0 -54
  116. package/templates/widgets/editItemWidget.pug +0 -27
  117. package/templates/widgets/fileInfoDialog.pug +0 -33
  118. package/templates/widgets/fileList.pug +0 -33
  119. package/templates/widgets/folderInfoDialog.pug +0 -42
  120. package/templates/widgets/folderList.pug +0 -21
  121. package/templates/widgets/groupAdminList.pug +0 -33
  122. package/templates/widgets/groupInviteDialog.pug +0 -76
  123. package/templates/widgets/groupInviteList.pug +0 -14
  124. package/templates/widgets/groupMemberList.pug +0 -39
  125. package/templates/widgets/groupModList.pug +0 -23
  126. package/templates/widgets/hierarchyBreadcrumb.pug +0 -37
  127. package/templates/widgets/hierarchyPaginated.pug +0 -19
  128. package/templates/widgets/hierarchyWidget.pug +0 -96
  129. package/templates/widgets/itemBreadcrumb.pug +0 -16
  130. package/templates/widgets/itemList.pug +0 -27
  131. package/templates/widgets/jsonMetadatumEditWidget.pug +0 -13
  132. package/templates/widgets/jsonMetadatumView.pug +0 -6
  133. package/templates/widgets/loadingAnimation.pug +0 -4
  134. package/templates/widgets/markdownWidget.pug +0 -34
  135. package/templates/widgets/metadataWidget.pug +0 -16
  136. package/templates/widgets/metadatumEditWidget.pug +0 -15
  137. package/templates/widgets/metadatumView.pug +0 -5
  138. package/templates/widgets/newAssetstore.pug +0 -118
  139. package/templates/widgets/paginateWidget.pug +0 -7
  140. package/templates/widgets/pluginConfigBreadcrumb.pug +0 -13
  141. package/templates/widgets/rootSelectorWidget.pug +0 -13
  142. package/templates/widgets/searchField.pug +0 -10
  143. package/templates/widgets/searchHelp.pug +0 -12
  144. package/templates/widgets/searchModeSelect.pug +0 -9
  145. package/templates/widgets/searchResults.pug +0 -14
  146. package/templates/widgets/sortCollectionWidget.pug +0 -14
  147. package/templates/widgets/taskProgress.pug +0 -16
  148. package/templates/widgets/timeline.pug +0 -15
  149. package/templates/widgets/uploadWidget.pug +0 -15
  150. package/templates/widgets/uploadWidgetMixins.pug +0 -31
  151. package/templates/widgets/uploadWidgetNonModal.pug +0 -10
  152. package/templates/widgets/userOtpBegin.pug +0 -4
  153. package/templates/widgets/userOtpDisable.pug +0 -6
  154. package/templates/widgets/userOtpEnable.pug +0 -44
  155. package/utilities/EventStream.js +0 -177
  156. package/utilities/PluginUtils.js +0 -36
  157. package/utilities/S3UploadHandler.js +0 -303
  158. package/utilities/index.js +0 -9
  159. package/utilities/jquery/girderEnable.js +0 -19
  160. package/utilities/jquery/girderModal.js +0 -48
  161. package/version.js +0 -10
  162. package/views/App.js +0 -359
  163. package/views/View.js +0 -78
  164. package/views/body/AdminView.js +0 -29
  165. package/views/body/AssetstoresView.js +0 -235
  166. package/views/body/CollectionView.js +0 -188
  167. package/views/body/CollectionsView.js +0 -120
  168. package/views/body/FilesystemImportView.js +0 -83
  169. package/views/body/FolderView.js +0 -54
  170. package/views/body/FrontPageView.js +0 -47
  171. package/views/body/GroupView.js +0 -336
  172. package/views/body/GroupsView.js +0 -106
  173. package/views/body/ItemView.js +0 -177
  174. package/views/body/PluginsView.js +0 -73
  175. package/views/body/S3ImportView.js +0 -80
  176. package/views/body/SearchResultsView.js +0 -162
  177. package/views/body/SystemConfigurationView.js +0 -196
  178. package/views/body/UserAccountView.js +0 -179
  179. package/views/body/UserView.js +0 -165
  180. package/views/body/UsersView.js +0 -124
  181. package/views/body/index.js +0 -37
  182. package/views/index.js +0 -13
  183. package/views/layout/FooterView.js +0 -29
  184. package/views/layout/GlobalNavView.js +0 -103
  185. package/views/layout/HeaderUserView.js +0 -45
  186. package/views/layout/HeaderView.js +0 -83
  187. package/views/layout/LoginView.js +0 -100
  188. package/views/layout/ProgressListView.js +0 -70
  189. package/views/layout/RegisterView.js +0 -101
  190. package/views/layout/ResetPasswordView.js +0 -70
  191. package/views/layout/index.js +0 -19
  192. package/views/widgets/AccessWidget.js +0 -427
  193. package/views/widgets/ApiKeyListWidget.js +0 -140
  194. package/views/widgets/BrowserWidget.js +0 -317
  195. package/views/widgets/CheckedMenuWidget.js +0 -68
  196. package/views/widgets/CollectionInfoWidget.js +0 -40
  197. package/views/widgets/DateTimeRangeWidget.js +0 -179
  198. package/views/widgets/DateTimeWidget.js +0 -109
  199. package/views/widgets/EditApiKeyWidget.js +0 -122
  200. package/views/widgets/EditAssetstoreWidget.js +0 -148
  201. package/views/widgets/EditCollectionWidget.js +0 -93
  202. package/views/widgets/EditFileWidget.js +0 -56
  203. package/views/widgets/EditFolderWidget.js +0 -116
  204. package/views/widgets/EditGroupWidget.js +0 -125
  205. package/views/widgets/EditItemWidget.js +0 -110
  206. package/views/widgets/FileInfoWidget.js +0 -26
  207. package/views/widgets/FileListWidget.js +0 -151
  208. package/views/widgets/FolderInfoWidget.js +0 -39
  209. package/views/widgets/FolderListWidget.js +0 -106
  210. package/views/widgets/GroupAdminsWidget.js +0 -88
  211. package/views/widgets/GroupInvitesWidget.js +0 -56
  212. package/views/widgets/GroupMembersWidget.js +0 -185
  213. package/views/widgets/GroupModsWidget.js +0 -77
  214. package/views/widgets/HierarchyWidget.js +0 -1097
  215. package/views/widgets/ItemBreadcrumbWidget.js +0 -38
  216. package/views/widgets/ItemListWidget.js +0 -345
  217. package/views/widgets/LoadingAnimation.js +0 -17
  218. package/views/widgets/MarkdownWidget.js +0 -217
  219. package/views/widgets/MetadataWidget.js +0 -504
  220. package/views/widgets/NewAssetstoreWidget.js +0 -81
  221. package/views/widgets/PaginateWidget.js +0 -37
  222. package/views/widgets/PluginConfigBreadcrumbWidget.js +0 -33
  223. package/views/widgets/RootSelectorWidget.js +0 -192
  224. package/views/widgets/SearchFieldWidget.js +0 -365
  225. package/views/widgets/SearchPaginateWidget.js +0 -149
  226. package/views/widgets/SortCollectionWidget.js +0 -53
  227. package/views/widgets/TaskProgressWidget.js +0 -91
  228. package/views/widgets/TimelineWidget.js +0 -155
  229. package/views/widgets/UploadWidget.js +0 -340
  230. package/views/widgets/UserOtpManagementWidget.js +0 -105
  231. package/views/widgets/index.js +0 -75
@@ -1,303 +0,0 @@
1
- import _ from 'underscore';
2
- import Backbone from 'backbone';
3
-
4
- import { restRequest, uploadHandlers } from '@girder/core/rest';
5
-
6
- /**
7
- * This is the upload handler for the "s3" behavior, which is responsible for
8
- * uploading data to an s3 assetstore type directly from the user agent, using
9
- * either the single-request or multi-chunk protocol depending on the size of
10
- * the file.
11
- *
12
- * The flow here is to make requests to Girder for each required chunk of
13
- * the upload, which Girder authorizes and signs using HMAC. Those signatures
14
- * are sent, along with the bytes, to the appropriate S3 bucket. For multi-
15
- * chunk uploads, one final request is required after all chunks have been
16
- * sent in order to create the final unified record in S3.
17
- */
18
- // Constructor
19
- uploadHandlers.s3 = function (params) {
20
- this.params = params;
21
- this.startByte = 0;
22
- return _.extend(this, Backbone.Events);
23
- };
24
-
25
- var prototype = uploadHandlers.s3.prototype;
26
-
27
- prototype._xhrProgress = function (event) {
28
- if (!event.lengthComputable) {
29
- return;
30
- }
31
-
32
- // We only want to count bytes of the actual file, not the bytes of
33
- // the request body corresponding to the other form parameters model
34
- // we are also sending.
35
- var loaded = this.payloadLength + event.loaded - event.total;
36
-
37
- if (loaded >= 0) {
38
- this.trigger('g:upload.progress', {
39
- startByte: this.startByte,
40
- loaded: loaded,
41
- total: this.params.file.size,
42
- file: this.params.file
43
- });
44
- }
45
- };
46
-
47
- prototype.execute = function () {
48
- var s3Info = this.params.upload.s3;
49
-
50
- var xhr = new XMLHttpRequest();
51
- xhr.open(s3Info.request.method, s3Info.request.url);
52
- _.each(s3Info.request.headers, (v, k) => {
53
- xhr.setRequestHeader(k, v);
54
- });
55
-
56
- if (s3Info.chunked) {
57
- this._multiChunkUpload(xhr);
58
- } else {
59
- this.payloadLength = this.params.file.size;
60
- xhr.onload = () => {
61
- if (xhr.status === 200) {
62
- this.trigger('g:upload.chunkSent', {
63
- bytes: this.payloadLength
64
- });
65
-
66
- restRequest({
67
- url: 'file/completion',
68
- method: 'POST',
69
- data: {
70
- uploadId: this.params.upload._id
71
- },
72
- error: null
73
- }).done((resp) => {
74
- this.trigger('g:upload.complete', resp);
75
- }).fail((resp) => {
76
- var msg;
77
-
78
- if (resp.status === 0) {
79
- msg = 'Could not connect to the server.';
80
- } else {
81
- msg = 'An error occurred when resuming upload, check console.';
82
- }
83
- this.trigger('g:upload.error', {
84
- message: msg
85
- });
86
- });
87
- } else {
88
- this.trigger('g:upload.error', {
89
- message: 'Error occurred uploading to S3 (' + xhr.status + ').'
90
- });
91
- }
92
- };
93
-
94
- xhr.upload.addEventListener('progress', (event) => {
95
- this._xhrProgress(event);
96
- });
97
-
98
- xhr.addEventListener('error', (event) => {
99
- this.trigger('g:upload.error', {
100
- message: 'Error occurred uploading to S3.',
101
- event: event
102
- });
103
- });
104
-
105
- xhr.send(this.params.file);
106
- }
107
- };
108
-
109
- prototype.resume = function () {
110
- if (this.params.upload.s3.chunked) {
111
- return this._sendNextChunk();
112
- }
113
-
114
- // If this is a single-chunk upload, we have to use the offset method
115
- // to re-generate the initial request with a new timestamp.
116
- restRequest({
117
- url: 'file/offset',
118
- method: 'GET',
119
- data: {
120
- uploadId: this.params.upload._id
121
- },
122
- error: null
123
- }).done((resp) => {
124
- this.params.upload.s3.request = resp;
125
- this.execute();
126
- }).fail((resp) => {
127
- var msg;
128
-
129
- if (resp.status === 0) {
130
- msg = 'Could not connect to the Girder server.';
131
- } else {
132
- msg = 'An error occurred when resuming upload, check console.';
133
- }
134
- this.trigger('g:upload.error', {
135
- message: msg
136
- });
137
- });
138
- };
139
-
140
- /**
141
- * If the file being uploaded is larger than a single chunk length, it
142
- * should be uploaded using the S3 multipart protocol.
143
- */
144
- prototype._multiChunkUpload = function (xhr) {
145
- this.eTagList = {};
146
- this.startByte = 0;
147
- this.chunkN = 1;
148
-
149
- xhr.onload = () => {
150
- if (xhr.status === 200) {
151
- this.s3UploadId = xhr.responseText.match(/<UploadId>(.*)<\/UploadId>/).pop();
152
- this._sendNextChunk();
153
- } else {
154
- this.trigger('g:upload.error', {
155
- message: 'Error while initializing multichunk S3 upload.',
156
- event: event
157
- });
158
- }
159
- };
160
-
161
- xhr.addEventListener('error', (event) => {
162
- this.trigger('g:upload.error', {
163
- message: 'Error occurred uploading to S3.',
164
- event: event
165
- });
166
- });
167
-
168
- xhr.send();
169
- };
170
-
171
- /**
172
- * Internal helper method used during multichunk upload protocol. This
173
- * requests a signed chunk upload request from Girder, then uses that
174
- * authorized request to send the chunk to S3.
175
- */
176
- prototype._sendNextChunk = function () {
177
- var sliceFn = this.params.file.webkitSlice ? 'webkitSlice' : 'slice';
178
- var data = this.params.file[sliceFn](this.startByte,
179
- this.startByte + this.params.upload.s3.chunkLength);
180
- this.payloadLength = data.size;
181
-
182
- // Get the authorized request from Girder
183
- restRequest({
184
- url: 'file/chunk',
185
- method: 'POST',
186
- data: {
187
- offset: 0,
188
- chunk: JSON.stringify({
189
- s3UploadId: this.s3UploadId,
190
- partNumber: this.chunkN,
191
- contentLength: this.payloadLength
192
- }),
193
- uploadId: this.params.upload._id
194
- },
195
- error: null
196
- }).done((resp) => {
197
- // Send the chunk to S3
198
- var xhr = new XMLHttpRequest();
199
- xhr.open(resp.s3.request.method, resp.s3.request.url);
200
-
201
- xhr.onload = () => {
202
- if (xhr.status === 200) {
203
- this.trigger('g:upload.chunkSent', {
204
- bytes: this.payloadLength
205
- });
206
- this.eTagList[this.chunkN] = xhr.getResponseHeader('ETag');
207
- this.startByte += this.payloadLength;
208
- this.chunkN += 1;
209
-
210
- if (this.startByte < this.params.file.size) {
211
- this._sendNextChunk();
212
- } else {
213
- this._finalizeMultiChunkUpload();
214
- }
215
- } else {
216
- this.trigger('g:upload.error', {
217
- message: 'Error occurred uploading to S3 (' + xhr.status + ').'
218
- });
219
- }
220
- };
221
-
222
- xhr.upload.addEventListener('progress', (event) => {
223
- this._xhrProgress(event);
224
- });
225
-
226
- xhr.addEventListener('error', (event) => {
227
- this.trigger('g:upload.error', {
228
- message: 'Error occurred uploading to S3.',
229
- event: event
230
- });
231
- });
232
-
233
- xhr.send(data);
234
- }).fail(() => {
235
- this.trigger('g:upload.error', {
236
- message: 'Error getting signed chunk request from Girder.'
237
- });
238
- });
239
- };
240
-
241
- /**
242
- * When all chunks of a multichunk upload have been sent, this must be
243
- * called in order to finalize the upload.
244
- */
245
- prototype._finalizeMultiChunkUpload = function () {
246
- restRequest({
247
- url: 'file/completion',
248
- method: 'POST',
249
- data: {
250
- uploadId: this.params.upload._id
251
- },
252
- error: null
253
- }).done((resp) => {
254
- // Create the XML document that will be the request body to S3
255
- var doc = document.implementation.createDocument(null, null, null);
256
- var root = doc.createElement('CompleteMultipartUpload');
257
-
258
- _.each(this.eTagList, (etag, partNumber) => {
259
- var partEl = doc.createElement('Part');
260
- var partNumberEl = doc.createElement('PartNumber');
261
- var etagEl = doc.createElement('ETag');
262
-
263
- partNumberEl.appendChild(doc.createTextNode(partNumber));
264
- etagEl.appendChild(doc.createTextNode(etag));
265
- partEl.appendChild(partNumberEl);
266
- partEl.appendChild(etagEl);
267
- root.appendChild(partEl);
268
- });
269
-
270
- var req = resp.s3FinalizeRequest;
271
- var xhr = new XMLHttpRequest();
272
-
273
- xhr.open(req.method, req.url);
274
-
275
- _.each(req.headers, (v, k) => {
276
- xhr.setRequestHeader(k, v);
277
- });
278
-
279
- xhr.onload = () => {
280
- if (xhr.status === 200) {
281
- delete resp.s3FinalizeRequest;
282
- this.trigger('g:upload.complete', resp);
283
- } else {
284
- this.trigger('g:upload.error', {
285
- message: 'Error occurred uploading to S3 (' + xhr.status + ').'
286
- });
287
- }
288
- };
289
-
290
- xhr.send(new window.XMLSerializer().serializeToString(root));
291
- }).fail((resp) => {
292
- var msg;
293
-
294
- if (resp.status === 0) {
295
- msg = 'Could not connect to the server.';
296
- } else {
297
- msg = 'Upload error during finalize, check console.';
298
- }
299
- this.trigger('g:upload.error', {
300
- message: msg
301
- });
302
- });
303
- };
@@ -1,9 +0,0 @@
1
- import eventStream from './EventStream';
2
- import * as PluginUtils from './PluginUtils';
3
- import * as S3UploadHandler from './S3UploadHandler';
4
-
5
- export {
6
- eventStream,
7
- PluginUtils,
8
- S3UploadHandler
9
- };
@@ -1,19 +0,0 @@
1
- import $ from 'jquery';
2
-
3
- /**
4
- * Helper selector to enable/disable inputs elements
5
- *
6
- * @param enable Whether to enable the element or not
7
- */
8
- $.fn.girderEnable = function (enable) {
9
- var selection = $(this);
10
- if (selection.is(':input')) {
11
- selection.prop('disabled', !enable);
12
- }
13
- if (!enable) {
14
- selection.addClass('disabled');
15
- } else {
16
- selection.removeClass('disabled');
17
- }
18
- return this;
19
- };
@@ -1,48 +0,0 @@
1
- import $ from 'jquery';
2
-
3
- import 'bootstrap/js/modal';
4
-
5
- /**
6
- * This should be used instead of calling bootstrap's modal() jQuery
7
- * method directly. This unbinds all previous events from the dialog,
8
- * then calls modal on it and binds the bootstrap close events.
9
- * @param view The view object. Pass "false" for special cases where the
10
- * dialog does not correspond to a View object. Pass 'close'
11
- * to just close an open modal dialog.
12
- */
13
- $.fn.girderModal = function (view) {
14
- /* If we have a modal dialog open, or one is in the process of closing,
15
- * close that dialog before opening the new one. This prevents
16
- * layering modal dialogs, but also makes sure that we don't have a
17
- * problem switching from one modal dialog to another. */
18
- if ($(this).is('.modal')) {
19
- /* We have to reach into the backbone modal object a little to see
20
- * if we need to do anything. By turning off the fade as we
21
- * remove the old dialog, the removal is synchronous and we are
22
- * sure it is gone before we add the new dialog. */
23
- if ($(this).data('bs.modal') && $(this).data('bs.modal').isShown) {
24
- var elem = $($(this).data('bs.modal').$element);
25
- var hasFade = elem.hasClass('fade');
26
- elem.removeClass('fade');
27
- $(this).modal('hide');
28
- elem.toggleClass('fade', hasFade);
29
- }
30
- }
31
- if (view !== 'close') {
32
- this.off();
33
- // It seems as if $foo.girderModal().on('shown.bs.modal', callback)
34
- // does not trigger the callback because the call to modal() below is showing
35
- // the modal (and sending the 'shown.bs.modal' event) *before* we get to
36
- // register the event in .on('shown.bs.modal', cb). Let's show
37
- // the modal in the next animation frame to fix this behavior for now.
38
- setTimeout(() => {
39
- this.modal().find('[data-dismiss="modal"]').off('click').on('click', () => {
40
- this.modal('hide');
41
- });
42
- }, 0);
43
- if (view !== false) {
44
- view.delegateEvents();
45
- }
46
- }
47
- return this;
48
- };
package/version.js DELETED
@@ -1,10 +0,0 @@
1
- /* global process */
2
-
3
- // Default value for external builds
4
- let version = null;
5
-
6
- try {
7
- version = process.env.GIRDER_VERSION || null;
8
- } catch (e) {}
9
-
10
- export default version;