@girder/core 3.2.8 → 5.0.0-a7

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 -83
  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,188 +0,0 @@
1
- import $ from 'jquery';
2
- import _ from 'underscore';
3
-
4
- import AccessWidget from '@girder/core/views/widgets/AccessWidget';
5
- import CollectionModel from '@girder/core/models/CollectionModel';
6
- import EditCollectionWidget from '@girder/core/views/widgets/EditCollectionWidget';
7
- import FolderModel from '@girder/core/models/FolderModel';
8
- import HierarchyWidget from '@girder/core/views/widgets/HierarchyWidget';
9
- import router from '@girder/core/router';
10
- import View from '@girder/core/views/View';
11
- import { AccessType } from '@girder/core/constants';
12
- import { cancelRestRequests } from '@girder/core/rest';
13
- import { confirm } from '@girder/core/dialog';
14
- import { renderMarkdown, formatSize } from '@girder/core/misc';
15
- import events from '@girder/core/events';
16
-
17
- import CollectionPageTemplate from '@girder/core/templates/body/collectionPage.pug';
18
-
19
- import '@girder/core/stylesheets/body/collectionPage.styl';
20
-
21
- import 'bootstrap/js/dropdown';
22
-
23
- /**
24
- * This view shows a single collection's page.
25
- */
26
- var CollectionView = View.extend({
27
- events: {
28
- 'click .g-edit-collection': 'editCollection',
29
- 'click .g-collection-access-control': 'editAccess',
30
- 'click .g-delete-collection': 'deleteConfirmation'
31
- },
32
-
33
- initialize: function (settings) {
34
- cancelRestRequests('fetch');
35
-
36
- this.upload = settings.upload || false;
37
- this.access = settings.access || false;
38
- this.edit = settings.edit || false;
39
- this.folderAccess = settings.folderAccess || false;
40
- this.folderCreate = settings.folderCreate || false;
41
- this.folderEdit = settings.folderEdit || false;
42
- this.itemCreate = settings.itemCreate || false;
43
-
44
- // If collection model is already passed, there is no need to fetch.
45
- if (settings.collection) {
46
- this.model = settings.collection;
47
-
48
- if (settings.folderId) {
49
- this.folder = new FolderModel();
50
- this.folder.set({
51
- _id: settings.folderId
52
- }).on('g:fetched', function () {
53
- this.render();
54
- }, this).on('g:error', function () {
55
- this.folder = null;
56
- this.render();
57
- }, this).fetch();
58
- } else {
59
- this.render();
60
- }
61
- } else if (settings.id) {
62
- this.model = new CollectionModel();
63
- this.model.set('_id', settings.id);
64
-
65
- this.model.on('g:fetched', function () {
66
- this.render();
67
- }, this).fetch();
68
- }
69
- },
70
-
71
- editCollection: function () {
72
- var container = $('#g-dialog-container');
73
-
74
- if (!this.editCollectionWidget) {
75
- this.editCollectionWidget = new EditCollectionWidget({
76
- el: container,
77
- model: this.model,
78
- parentView: this
79
- }).on('g:saved', function () {
80
- this.render();
81
- }, this);
82
- }
83
- this.editCollectionWidget.render();
84
- },
85
-
86
- render: function () {
87
- this.$el.html(CollectionPageTemplate({
88
- collection: this.model,
89
- AccessType: AccessType,
90
- renderMarkdown: renderMarkdown
91
- }));
92
-
93
- if (!this.hierarchyWidget) {
94
- // The HierarchyWidget will self-render when instantiated
95
- this.hierarchyWidget = new HierarchyWidget({
96
- el: this.$('.g-collection-hierarchy-container'),
97
- parentModel: this.folder || this.model,
98
- upload: this.upload,
99
- folderAccess: this.folderAccess,
100
- folderEdit: this.folderEdit,
101
- folderCreate: this.folderCreate,
102
- itemCreate: this.itemCreate,
103
- parentView: this
104
- }).on('g:setCurrentModel', () => {
105
- // When a user descends into the hierarchy, hide the collection
106
- // actions list to avoid confusion.
107
- this.$('.g-collection-header .g-collection-actions-button').hide();
108
- });
109
- } else {
110
- this.hierarchyWidget
111
- .setElement(this.$('.g-collection-hierarchy-container'))
112
- .render();
113
- }
114
-
115
- this.upload = false;
116
- this.folderAccess = false;
117
- this.folderEdit = false;
118
- this.folderCreate = false;
119
- this.itemCreate = false;
120
-
121
- if (this.edit) {
122
- this.editCollection();
123
- } else if (this.access) {
124
- this.editAccess();
125
- }
126
-
127
- return this;
128
- },
129
-
130
- editAccess: function () {
131
- new AccessWidget({
132
- el: $('#g-dialog-container'),
133
- modelType: 'collection',
134
- model: this.model,
135
- parentView: this
136
- }).on('g:accessListSaved', function (params) {
137
- if (params.recurse) {
138
- this.hierarchyWidget.refreshFolderList();
139
- }
140
- }, this);
141
- },
142
-
143
- deleteConfirmation: function () {
144
- let params = {
145
- text: 'Are you sure you want to delete the collection <b>' +
146
- this.model.escape('name') + this.model.escape('nFolders') + '</b>?',
147
- yesText: 'Delete',
148
- escapedHtml: true,
149
- confirmCallback: () => {
150
- this.model.on('g:deleted', function () {
151
- events.trigger('g:alert', {
152
- icon: 'ok',
153
- text: 'Collection deleted.',
154
- type: 'success',
155
- timeout: 4000
156
- });
157
- router.navigate('collections', { trigger: true });
158
- }).destroy();
159
- }
160
- };
161
- if (this.model.get('nFolders') !== 0 || this.model.get('size') !== 0) {
162
- params = _.extend({
163
- additionalText: '<b>' + this.model.escape('name') + '</b>' +
164
- ' contains <b>' + this.model.escape('nFolders') +
165
- ' folders</b> taking up <b>' +
166
- formatSize(parseInt(this.model.get('size'), 10)) + '</b>',
167
- msgConfirmation: true,
168
- name: this.model.escape('name')
169
- }, params);
170
- }
171
- confirm(params);
172
- }
173
- }, {
174
- /**
175
- * Helper function for fetching the user and rendering the view with
176
- * an arbitrary set of extra parameters.
177
- */
178
- fetchAndInit: function (cid, params) {
179
- var collection = new CollectionModel();
180
- collection.set({ _id: cid }).on('g:fetched', function () {
181
- events.trigger('g:navigateTo', CollectionView, _.extend({
182
- collection: collection
183
- }, params || {}));
184
- }, this).fetch();
185
- }
186
- });
187
-
188
- export default CollectionView;
@@ -1,120 +0,0 @@
1
- import $ from 'jquery';
2
-
3
- import CollectionCollection from '@girder/core/collections/CollectionCollection';
4
- import CollectionModel from '@girder/core/models/CollectionModel';
5
- import EditCollectionWidget from '@girder/core/views/widgets/EditCollectionWidget';
6
- import PaginateWidget from '@girder/core/views/widgets/PaginateWidget';
7
- import router from '@girder/core/router';
8
- import SearchFieldWidget from '@girder/core/views/widgets/SearchFieldWidget';
9
- import View from '@girder/core/views/View';
10
- import { cancelRestRequests } from '@girder/core/rest';
11
- import { formatDate, formatSize, renderMarkdown, DATE_MINUTE } from '@girder/core/misc';
12
- import { getCurrentUser } from '@girder/core/auth';
13
-
14
- import CollectionListTemplate from '@girder/core/templates/body/collectionList.pug';
15
-
16
- import '@girder/core/stylesheets/body/collectionList.styl';
17
-
18
- /**
19
- * This view lists the collections.
20
- */
21
- var CollectionsView = View.extend({
22
- events: {
23
- 'click a.g-collection-link': function (event) {
24
- var cid = $(event.currentTarget).attr('g-collection-cid');
25
- router.navigate('collection/' + this.collection.get(cid).id, { trigger: true });
26
- },
27
- 'click button.g-collection-create-button': 'createCollectionDialog',
28
- 'submit .g-collections-search-form': function (event) {
29
- event.preventDefault();
30
- },
31
- 'click .g-show-description': '_toggleDescription'
32
- },
33
-
34
- initialize: function (settings) {
35
- cancelRestRequests('fetch');
36
- this.collection = new CollectionCollection();
37
- this.collection.on('g:changed', function () {
38
- this.render();
39
- }, this).fetch();
40
-
41
- this.paginateWidget = new PaginateWidget({
42
- collection: this.collection,
43
- parentView: this
44
- });
45
-
46
- this.searchWidget = new SearchFieldWidget({
47
- placeholder: 'Search collections...',
48
- types: ['collection'],
49
- parentView: this
50
- }).on('g:resultClicked', this._gotoCollection, this);
51
-
52
- this.create = settings.dialog === 'create';
53
- },
54
-
55
- /**
56
- * Prompt the user to create a new collection
57
- */
58
- createCollectionDialog: function () {
59
- var container = $('#g-dialog-container');
60
-
61
- new EditCollectionWidget({
62
- el: container,
63
- parentView: this
64
- }).on('g:saved', function (collection) {
65
- router.navigate('collection/' + collection.get('_id'),
66
- { trigger: true });
67
- }, this).render();
68
- },
69
-
70
- render: function () {
71
- this.$el.html(CollectionListTemplate({
72
- collections: this.collection.toArray(),
73
- getCurrentUser: getCurrentUser,
74
- formatDate: formatDate,
75
- DATE_MINUTE: DATE_MINUTE,
76
- formatSize: formatSize
77
- }));
78
-
79
- this.paginateWidget.setElement(this.$('.g-collection-pagination')).render();
80
- this.searchWidget.setElement(this.$('.g-collections-search-container')).render();
81
-
82
- if (this.create) {
83
- this.createCollectionDialog();
84
- }
85
-
86
- return this;
87
- },
88
-
89
- /**
90
- * When the user clicks a search result collection, this helper method
91
- * will navigate them to the view for that specific collection.
92
- */
93
- _gotoCollection: function (result) {
94
- var collection = new CollectionModel();
95
- collection.set('_id', result.id).on('g:fetched', function () {
96
- router.navigate('/collection/' + collection.get('_id'), { trigger: true });
97
- }, this).fetch();
98
- },
99
-
100
- _toggleDescription: function (e) {
101
- const link = $(e.currentTarget);
102
- const cid = link.attr('cid');
103
- const dest = this.$(`.g-collection-description[cid="${cid}"]`);
104
-
105
- if (link.attr('state') === 'hidden') {
106
- renderMarkdown(this.collection.get(cid).get('description'), dest);
107
- dest.removeClass('hide');
108
- link.attr('state', 'visible');
109
- link.find('i').removeClass('icon-down-dir').addClass('icon-up-dir');
110
- link.find('span').text('Hide description');
111
- } else {
112
- dest.addClass('hide');
113
- link.attr('state', 'hidden');
114
- link.find('i').removeClass('icon-up-dir').addClass('icon-down-dir');
115
- link.find('span').text('Show description');
116
- }
117
- }
118
- });
119
-
120
- export default CollectionsView;
@@ -1,83 +0,0 @@
1
- import $ from 'jquery';
2
-
3
- import BrowserWidget from '@girder/core/views/widgets/BrowserWidget';
4
- import router from '@girder/core/router';
5
- import View from '@girder/core/views/View';
6
- import { restRequest } from '@girder/core/rest';
7
-
8
- import FilesystemImportTemplate from '@girder/core/templates/body/filesystemImport.pug';
9
-
10
- var FilesystemImportView = View.extend({
11
- events: {
12
- 'submit .g-filesystem-import-form': function (e) {
13
- e.preventDefault();
14
-
15
- var destId = this.$('#g-filesystem-import-dest-id').val().trim().split(/\s/)[0],
16
- destType = this.$('#g-filesystem-import-dest-type').val(),
17
- foldersAsItems = this.$('#g-filesystem-import-leaf-items').val();
18
-
19
- this.$('.g-validation-failed-message').empty();
20
-
21
- this.assetstore.off('g:imported').on('g:imported', function () {
22
- router.navigate(destType + '/' + destId, { trigger: true });
23
- }, this).on('g:error', function (resp) {
24
- this.$('.g-validation-failed-message').text(resp.responseJSON.message);
25
- }, this).import({
26
- importPath: this.$('#g-filesystem-import-path').val().trim(),
27
- leafFoldersAsItems: foldersAsItems,
28
- destinationId: destId,
29
- destinationType: destType,
30
- progress: true
31
- });
32
- },
33
- 'click .g-open-browser': '_openBrowser'
34
- },
35
-
36
- initialize: function (settings) {
37
- this._browserWidgetView = new BrowserWidget({
38
- parentView: this,
39
- titleText: 'Destination',
40
- helpText: 'Browse to a location to select it as the destination.',
41
- submitText: 'Select Destination',
42
- validate: function (model) {
43
- const isValid = $.Deferred();
44
- if (!model) {
45
- isValid.reject('Please select a valid root.');
46
- } else {
47
- isValid.resolve();
48
- }
49
- return isValid.promise();
50
- }
51
- });
52
- this.listenTo(this._browserWidgetView, 'g:saved', function (val) {
53
- this.$('#g-filesystem-import-dest-id').val(val.id);
54
- this.$('#g-filesystem-import-dest-type').val(val.get('_modelType'));
55
- restRequest({
56
- url: `resource/${val.id}/path`,
57
- method: 'GET',
58
- data: { type: val.get('_modelType') }
59
- }).done((result) => {
60
- // Only add the resource path if the value wasn't altered
61
- if (this.$('#g-filesystem-import-dest-id').val() === val.id) {
62
- this.$('#g-filesystem-import-dest-id').val(`${val.id} (${result})`);
63
- }
64
- });
65
- });
66
- this.assetstore = settings.assetstore;
67
- this.render();
68
- },
69
-
70
- render: function () {
71
- this.$el.html(FilesystemImportTemplate({
72
- assetstore: this.assetstore
73
- }));
74
-
75
- return this;
76
- },
77
-
78
- _openBrowser: function () {
79
- this._browserWidgetView.setElement($('#g-dialog-container')).render();
80
- }
81
- });
82
-
83
- export default FilesystemImportView;
@@ -1,54 +0,0 @@
1
- import _ from 'underscore';
2
-
3
- import FolderModel from '@girder/core/models/FolderModel';
4
- import HierarchyWidget from '@girder/core/views/widgets/HierarchyWidget';
5
- import View from '@girder/core/views/View';
6
- import { cancelRestRequests } from '@girder/core/rest';
7
- import events from '@girder/core/events';
8
-
9
- /**
10
- * This view shows a single folder as a hierarchy widget.
11
- */
12
- var FolderView = View.extend({
13
- initialize: function (settings) {
14
- cancelRestRequests('fetch');
15
- this.folder = settings.folder;
16
- this.upload = settings.upload || false;
17
- this.folderAccess = settings.folderAccess || false;
18
- this.folderCreate = settings.folderCreate || false;
19
- this.folderEdit = settings.folderEdit || false;
20
- this.itemCreate = settings.itemCreate || false;
21
-
22
- this.render();
23
- },
24
-
25
- render: function () {
26
- this.hierarchyWidget = new HierarchyWidget({
27
- el: this.$el,
28
- parentModel: this.folder,
29
- upload: this.upload,
30
- folderAccess: this.folderAccess,
31
- folderEdit: this.folderEdit,
32
- folderCreate: this.folderCreate,
33
- itemCreate: this.itemCreate,
34
- parentView: this
35
- });
36
-
37
- return this;
38
- }
39
- }, {
40
- /**
41
- * Helper function for fetching the folder by id, then render the view.
42
- */
43
- fetchAndInit: function (id, params) {
44
- var folder = new FolderModel();
45
- folder.set({ _id: id }).on('g:fetched', function () {
46
- events.trigger('g:navigateTo', FolderView, _.extend({
47
- folder: folder
48
- }, params || {}));
49
- }, this).fetch();
50
- }
51
-
52
- });
53
-
54
- export default FolderView;
@@ -1,47 +0,0 @@
1
- import $ from 'jquery';
2
-
3
- import version from '@girder/core/version';
4
- import View from '@girder/core/views/View';
5
- import { cancelRestRequests, getApiRoot } from '@girder/core/rest';
6
- import events from '@girder/core/events';
7
- import { getCurrentUser } from '@girder/core/auth';
8
-
9
- import FrontPageTemplate from '@girder/core/templates/body/frontPage.pug';
10
-
11
- import '@girder/core/stylesheets/body/frontPage.styl';
12
-
13
- /**
14
- * This is the view for the front page of the app.
15
- */
16
- var FrontPageView = View.extend({
17
- events: {
18
- 'click .g-register-link': function () {
19
- events.trigger('g:registerUi');
20
- },
21
- 'click .g-login-link': function () {
22
- events.trigger('g:loginUi');
23
- },
24
- 'click .g-quicksearch-link': function () {
25
- $('.g-quick-search-container .g-search-field').trigger('focus');
26
- }
27
- },
28
-
29
- initialize: function (settings) {
30
- cancelRestRequests('fetch');
31
- this.brandName = settings.brandName || 'Girder';
32
- this.render();
33
- },
34
-
35
- render: function () {
36
- this.$el.html(FrontPageTemplate({
37
- apiRoot: getApiRoot(),
38
- currentUser: getCurrentUser(),
39
- version,
40
- brandName: this.brandName
41
- }));
42
-
43
- return this;
44
- }
45
- });
46
-
47
- export default FrontPageView;