@girder/core 3.2.8 → 5.0.0-a6

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,165 +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 router from '@girder/core/router';
6
- import UserModel from '@girder/core/models/UserModel';
7
- import UsersView from '@girder/core/views/body/UsersView';
8
- import View from '@girder/core/views/View';
9
- import { AccessType } from '@girder/core/constants';
10
- import { cancelRestRequests } from '@girder/core/rest';
11
- import { confirm } from '@girder/core/dialog';
12
- import events from '@girder/core/events';
13
-
14
- import UserPageTemplate from '@girder/core/templates/body/userPage.pug';
15
-
16
- import '@girder/core/stylesheets/body/userPage.styl';
17
-
18
- import 'bootstrap/js/dropdown';
19
-
20
- /**
21
- * This view shows a single user's page.
22
- */
23
- var UserView = View.extend({
24
- events: {
25
- 'click a.g-edit-user': function () {
26
- var editUrl = 'useraccount/' + this.model.get('_id') + '/info';
27
- router.navigate(editUrl, { trigger: true });
28
- },
29
-
30
- 'click a.g-delete-user': function () {
31
- confirm({
32
- text: 'Are you sure you want to delete the user <b>' +
33
- this.model.escape('login') + '</b>?',
34
- yesText: 'Delete',
35
- escapedHtml: true,
36
- confirmCallback: () => {
37
- this.model.on('g:deleted', function () {
38
- router.navigate('', { trigger: true });
39
- }).destroy();
40
- }
41
- });
42
- },
43
-
44
- 'click a.g-approve-user': function () {
45
- this._setAndSave(
46
- { status: 'enabled' }, 'Approved user account.');
47
- },
48
-
49
- 'click a.g-disable-user': function () {
50
- this._setAndSave(
51
- { status: 'disabled' }, 'Disabled user account.');
52
- },
53
-
54
- 'click a.g-enable-user': function () {
55
- this._setAndSave(
56
- { status: 'enabled' }, 'Enabled user account.');
57
- }
58
- },
59
-
60
- initialize: function (settings) {
61
- cancelRestRequests('fetch');
62
- this.folderId = settings.folderId || null;
63
- this.upload = settings.upload || false;
64
- this.folderAccess = settings.folderAccess || false;
65
- this.folderCreate = settings.folderCreate || false;
66
- this.folderEdit = settings.folderEdit || false;
67
- this.itemCreate = settings.itemCreate || false;
68
-
69
- if (settings.user) {
70
- this.model = settings.user;
71
-
72
- if (settings.folderId) {
73
- this.folder = new FolderModel();
74
- this.folder.set({
75
- _id: settings.folderId
76
- }).on('g:fetched', function () {
77
- this.render();
78
- }, this).on('g:error', function () {
79
- this.folder = null;
80
- this.render();
81
- }, this).fetch();
82
- } else {
83
- this.render();
84
- }
85
- } else if (settings.id) {
86
- this.model = new UserModel();
87
- this.model.set('_id', settings.id);
88
-
89
- this.model.on('g:fetched', function () {
90
- this.render();
91
- }, this).fetch();
92
- }
93
- },
94
-
95
- render: function () {
96
- this.$el.html(UserPageTemplate({
97
- user: this.model,
98
- AccessType: AccessType
99
- }));
100
-
101
- if (!this.hierarchyWidget) {
102
- // The HierarchyWidget will self-render when instantiated
103
- this.hierarchyWidget = new HierarchyWidget({
104
- el: this.$('.g-user-hierarchy-container'),
105
- parentModel: this.folder || this.model,
106
- upload: this.upload,
107
- folderAccess: this.folderAccess,
108
- folderEdit: this.folderEdit,
109
- folderCreate: this.folderCreate,
110
- itemCreate: this.itemCreate,
111
- parentView: this
112
- });
113
- } else {
114
- this.hierarchyWidget
115
- .setElement(this.$('.g-user-hierarchy-container'))
116
- .render();
117
- }
118
-
119
- this.upload = false;
120
- this.folderAccess = false;
121
- this.folderEdit = false;
122
- this.folderCreate = false;
123
- this.itemCreate = false;
124
-
125
- return this;
126
- },
127
-
128
- _setAndSave: function (data, message) {
129
- this.model.set(data);
130
- this.model.off('g:saved').on('g:saved', function () {
131
- events.trigger('g:alert', {
132
- icon: 'ok',
133
- text: message,
134
- type: 'success',
135
- timeout: 4000
136
- });
137
- this.render();
138
- }, this).off('g:error').on('g:error', function (err) {
139
- events.trigger('g:alert', {
140
- icon: 'cancel',
141
- text: err.responseJSON.message,
142
- type: 'danger'
143
- });
144
- }).save();
145
- }
146
- }, {
147
- /**
148
- * Helper function for fetching the user and rendering the view with
149
- * an arbitrary set of extra parameters.
150
- */
151
- fetchAndInit: function (userId, params) {
152
- var user = new UserModel();
153
- user.set({
154
- _id: userId
155
- }).on('g:fetched', function () {
156
- events.trigger('g:navigateTo', UserView, _.extend({
157
- user: user
158
- }, params || {}));
159
- }, this).on('g:error', function () {
160
- events.trigger('g:navigateTo', UsersView);
161
- }, this).fetch();
162
- }
163
- });
164
-
165
- export default UserView;
@@ -1,124 +0,0 @@
1
- import $ from 'jquery';
2
-
3
- import PaginateWidget from '@girder/core/views/widgets/PaginateWidget';
4
- import RegisterView from '@girder/core/views/layout/RegisterView';
5
- import router from '@girder/core/router';
6
- import SearchFieldWidget from '@girder/core/views/widgets/SearchFieldWidget';
7
- import SortCollectionWidget from '@girder/core/views/widgets/SortCollectionWidget';
8
- import UserCollection from '@girder/core/collections/UserCollection';
9
- import UserModel from '@girder/core/models/UserModel';
10
- import View from '@girder/core/views/View';
11
- import { cancelRestRequests } from '@girder/core/rest';
12
- import { formatDate, formatSize, DATE_DAY } from '@girder/core/misc';
13
- import { getCurrentUser } from '@girder/core/auth';
14
-
15
- import UserListTemplate from '@girder/core/templates/body/userList.pug';
16
-
17
- import '@girder/core/stylesheets/body/userList.styl';
18
-
19
- /**
20
- * This view lists users.
21
- */
22
- var UsersView = View.extend({
23
- events: {
24
- 'click a.g-user-link': function (event) {
25
- var cid = $(event.currentTarget).attr('g-user-cid');
26
- router.navigate('user/' + this.collection.get(cid).id, { trigger: true });
27
- },
28
- 'click button.g-user-create-button': 'createUserDialog',
29
- 'submit .g-user-search-form': function (event) {
30
- event.preventDefault();
31
- }
32
- },
33
-
34
- initialize: function (settings) {
35
- cancelRestRequests('fetch');
36
- this.collection = new UserCollection();
37
-
38
- const promiseArray = [];
39
- promiseArray.push(this.collection.fetch());
40
-
41
- this.paginateWidget = new PaginateWidget({
42
- collection: this.collection,
43
- parentView: this
44
- });
45
-
46
- this.sortCollectionWidget = new SortCollectionWidget({
47
- collection: this.collection,
48
- parentView: this,
49
- fields: {
50
- lastName: 'Last Name',
51
- created: 'Creation Date',
52
- size: 'Used Space'
53
- }
54
- });
55
-
56
- this.searchWidget = new SearchFieldWidget({
57
- placeholder: 'Search users...',
58
- types: ['user'],
59
- modes: 'prefix',
60
- parentView: this
61
- }).on('g:resultClicked', this._gotoUser, this);
62
-
63
- if (getCurrentUser()) {
64
- const userCountPromise = UserCollection.getTotalCount()
65
- .done((count) => {
66
- this.usersCount = count;
67
- });
68
- promiseArray.push(userCountPromise);
69
- }
70
- this.register = settings.dialog === 'register' && getCurrentUser() &&
71
- getCurrentUser().get('admin');
72
-
73
- $.when(...promiseArray)
74
- .done(() => {
75
- this.listenTo(this.collection, 'g:changed', this.render);
76
- this.render();
77
- });
78
- },
79
-
80
- render: function () {
81
- this.$el.html(UserListTemplate({
82
- users: this.collection.toArray(),
83
- currentUser: getCurrentUser(),
84
- usersCount: this.usersCount,
85
- formatDate: formatDate,
86
- formatSize: formatSize,
87
- DATE_DAY: DATE_DAY
88
- }));
89
-
90
- this.paginateWidget.setElement(this.$('.g-user-pagination')).render();
91
- this.sortCollectionWidget.setElement(this.$('.g-user-sort')).render();
92
- this.searchWidget.setElement(this.$('.g-users-search-container')).render();
93
-
94
- if (this.register) {
95
- this.createUserDialog();
96
- }
97
-
98
- return this;
99
- },
100
-
101
- /**
102
- * When the user clicks a search result user, this helper method
103
- * will navigate them to the view for that specific user.
104
- */
105
- _gotoUser: function (result) {
106
- var user = new UserModel();
107
- user.set('_id', result.id).on('g:fetched', function () {
108
- router.navigate('user/' + user.get('_id'), { trigger: true });
109
- }, this).fetch();
110
- },
111
-
112
- createUserDialog: function () {
113
- var container = $('#g-dialog-container');
114
-
115
- new RegisterView({
116
- el: container,
117
- parentView: this
118
- }).on('g:userCreated', function (info) {
119
- router.navigate('user/' + info.user.id, { trigger: true });
120
- }, this).render();
121
- }
122
- });
123
-
124
- export default UsersView;
@@ -1,37 +0,0 @@
1
- import AdminView from './AdminView';
2
- import AssetstoresView from './AssetstoresView';
3
- import CollectionView from './CollectionView';
4
- import CollectionsView from './CollectionsView';
5
- import FilesystemImportView from './FilesystemImportView';
6
- import FolderView from './FolderView';
7
- import FrontPageView from './FrontPageView';
8
- import GroupView from './GroupView';
9
- import GroupsView from './GroupsView';
10
- import ItemView from './ItemView';
11
- import PluginsView from './PluginsView';
12
- import S3ImportView from './S3ImportView';
13
- import SearchResultsView from './SearchResultsView';
14
- import SystemConfigurationView from './SystemConfigurationView';
15
- import UserAccountView from './UserAccountView';
16
- import UserView from './UserView';
17
- import UsersView from './UsersView';
18
-
19
- export {
20
- AdminView,
21
- AssetstoresView,
22
- CollectionView,
23
- CollectionsView,
24
- FilesystemImportView,
25
- FolderView,
26
- FrontPageView,
27
- GroupView,
28
- GroupsView,
29
- ItemView,
30
- PluginsView,
31
- S3ImportView,
32
- SearchResultsView,
33
- SystemConfigurationView,
34
- UserAccountView,
35
- UserView,
36
- UsersView
37
- };
package/views/index.js DELETED
@@ -1,13 +0,0 @@
1
- import App from './App';
2
- import View from './View';
3
- import * as body from './body';
4
- import * as layout from './layout';
5
- import * as widgets from './widgets';
6
-
7
- export {
8
- App,
9
- View,
10
- body,
11
- layout,
12
- widgets
13
- };
@@ -1,29 +0,0 @@
1
- import View from '@girder/core/views/View';
2
- import { getApiRoot } from '@girder/core/rest';
3
-
4
- import LayoutFooterTemplate from '@girder/core/templates/layout/layoutFooter.pug';
5
-
6
- import '@girder/core/stylesheets/layout/footer.styl';
7
-
8
- /**
9
- * This view shows the footer in the layout.
10
- */
11
- var LayoutFooterView = View.extend({
12
-
13
- initialize: function (settings) {
14
- const contactEmail = settings.contactEmail || null;
15
- this.contactHref = contactEmail !== null ? `mailto:${contactEmail}` : null;
16
- this.privacyNoticeHref = settings.privacyNoticeHref || null;
17
- },
18
-
19
- render: function () {
20
- this.$el.html(LayoutFooterTemplate({
21
- apiRoot: getApiRoot(),
22
- contactHref: this.contactHref,
23
- privacyNoticeLink: this.privacyNoticeHref
24
- }));
25
- return this;
26
- }
27
- });
28
-
29
- export default LayoutFooterView;
@@ -1,103 +0,0 @@
1
- import $ from 'jquery';
2
- import Backbone from 'backbone';
3
-
4
- import router from '@girder/core/router';
5
- import View from '@girder/core/views/View';
6
- import events from '@girder/core/events';
7
- import { getCurrentUser } from '@girder/core/auth';
8
-
9
- import LayoutGlobalNavTemplate from '@girder/core/templates/layout/layoutGlobalNav.pug';
10
-
11
- import '@girder/core/stylesheets/layout/globalNav.styl';
12
-
13
- /**
14
- * This view shows a list of global navigation links that should be
15
- * displayed at all times.
16
- */
17
- var LayoutGlobalNavView = View.extend({
18
- events: {
19
- 'click .g-nav-link': function (event) {
20
- event.preventDefault(); // so we can keep the href
21
-
22
- var link = $(event.currentTarget);
23
-
24
- router.navigate(link.attr('g-target'), { trigger: true });
25
-
26
- // Must call this after calling navigateTo, since that
27
- // deactivates all global nav links.
28
- link.parent().addClass('g-active');
29
- }
30
- },
31
-
32
- initialize: function (settings) {
33
- events.on('g:highlightItem', this.selectForView, this);
34
- events.on('g:login', this.render, this);
35
- events.on('g:logout', this.render, this);
36
- events.on('g:login-changed', this.render, this);
37
-
38
- settings = settings || {};
39
- if (settings.navItems) {
40
- this.navItems = settings.navItems;
41
- } else {
42
- this.defaultNavItems = [{
43
- name: 'Collections',
44
- icon: 'icon-sitemap',
45
- target: 'collections'
46
- }, {
47
- name: 'Groups',
48
- icon: 'icon-users',
49
- target: 'groups'
50
- }];
51
- }
52
- },
53
-
54
- render: function () {
55
- var navItems;
56
- if (this.navItems) {
57
- navItems = this.navItems;
58
- } else {
59
- navItems = this.defaultNavItems;
60
- if (getCurrentUser()) {
61
- // copy navItems so that this.defaultNavItems is unchanged
62
- navItems = navItems.slice();
63
- navItems.push({
64
- name: 'Users',
65
- icon: 'icon-user',
66
- target: 'users'
67
- });
68
- if (getCurrentUser().get('admin')) {
69
- navItems.push({
70
- name: 'Admin console',
71
- icon: 'icon-wrench',
72
- target: 'admin'
73
- });
74
- }
75
- }
76
- }
77
- this.$el.html(LayoutGlobalNavTemplate({
78
- navItems: navItems
79
- }));
80
-
81
- if (Backbone.history.fragment) {
82
- this.$('[g-target="' + Backbone.history.fragment + '"]')
83
- .parent().addClass('g-active');
84
- }
85
-
86
- return this;
87
- },
88
-
89
- /**
90
- * Highlight the item with the given target attribute, which is the name
91
- * of the view it navigates to.
92
- */
93
- selectForView: function (viewName) {
94
- this.deactivateAll();
95
- this.$('[g-name="' + viewName.slice(0, -4) + '"]').parent().addClass('g-active');
96
- },
97
-
98
- deactivateAll: function () {
99
- this.$('.g-global-nav-li').removeClass('g-active');
100
- }
101
- });
102
-
103
- export default LayoutGlobalNavView;
@@ -1,45 +0,0 @@
1
- import View from '@girder/core/views/View';
2
- import events from '@girder/core/events';
3
- import { logout, getCurrentUser } from '@girder/core/auth';
4
-
5
- import LayoutHeaderUserTemplate from '@girder/core/templates/layout/layoutHeaderUser.pug';
6
-
7
- import '@girder/core/stylesheets/layout/headerUser.styl';
8
-
9
- import 'bootstrap/js/dropdown';
10
-
11
- /**
12
- * This view shows the user menu, or register/sign in links if the user is
13
- * not logged in.
14
- */
15
- var LayoutHeaderUserView = View.extend({
16
- events: {
17
- 'click a.g-login': function () {
18
- events.trigger('g:loginUi');
19
- },
20
-
21
- 'click a.g-register': function () {
22
- events.trigger('g:registerUi');
23
- },
24
-
25
- 'click a.g-logout': logout
26
- },
27
-
28
- initialize: function (settings) {
29
- this.registrationPolicy = settings.registrationPolicy;
30
-
31
- events.on('g:login', this.render, this);
32
- events.on('g:login-changed', this.render, this);
33
- events.on('g:logout', this.render, this);
34
- },
35
-
36
- render: function () {
37
- this.$el.html(LayoutHeaderUserTemplate({
38
- user: getCurrentUser(),
39
- registrationPolicy: this.registrationPolicy
40
- }));
41
- return this;
42
- }
43
- });
44
-
45
- export default LayoutHeaderUserView;
@@ -1,83 +0,0 @@
1
- import _ from 'underscore';
2
-
3
- import LayoutHeaderUserView from '@girder/core/views/layout/HeaderUserView';
4
- import router from '@girder/core/router';
5
- import SearchFieldWidget from '@girder/core/views/widgets/SearchFieldWidget';
6
- import View from '@girder/core/views/View';
7
-
8
- import LayoutHeaderTemplate from '@girder/core/templates/layout/layoutHeader.pug';
9
-
10
- import '@girder/core/stylesheets/layout/header.styl';
11
-
12
- /**
13
- * This view shows the header in the layout.
14
- */
15
- var LayoutHeaderView = View.extend({
16
- events: {
17
- 'click .g-app-title': function () {
18
- router.navigate('', { trigger: true });
19
- }
20
- },
21
-
22
- initialize: function (settings) {
23
- this.brandName = settings.brandName || 'Girder';
24
- this.bannerColor = settings.bannerColor || '#3F3B3B';
25
-
26
- this.userView = new LayoutHeaderUserView({
27
- parentView: this,
28
- registrationPolicy: settings.registrationPolicy
29
- });
30
-
31
- /*
32
- * The order of types correspond to the order of the displayed types results on the dialog box.
33
- */
34
- this.searchWidget = new SearchFieldWidget({
35
- placeholder: 'Quick search...',
36
- types: ['collection', 'folder', 'item', 'group', 'user'],
37
- parentView: this
38
- }).on('g:resultClicked', function (result) {
39
- this.searchWidget.resetState();
40
- router.navigate(result.type + '/' + result.id, {
41
- trigger: true
42
- });
43
- }, this);
44
- },
45
-
46
- render: function () {
47
- var textColor = this._getTextColor(this.bannerColor);
48
- this.$el.html(LayoutHeaderTemplate({
49
- brandName: this.brandName,
50
- bannerColor: this.bannerColor,
51
- textColor: textColor
52
- }));
53
- this.userView.setElement(this.$('.g-current-user-wrapper')).render();
54
- if (textColor !== '#ffffff') {
55
- // We will lose the hover color by setting this, so only do that if necessary
56
- this.userView.$('.g-user-text a').css('color', textColor);
57
- }
58
- this.searchWidget.setElement(this.$('.g-quick-search-container')).render();
59
-
60
- return this;
61
- },
62
-
63
- _getTextColor: function (bannerColor) {
64
- // https://stackoverflow.com/a/3943023
65
- const hexRed = bannerColor.substr(1, 2);
66
- const hexGreen = bannerColor.substr(3, 2);
67
- const hexBlue = bannerColor.substr(5, 2);
68
- const sRGB = _.map([hexRed, hexGreen, hexBlue], (hexComponent) =>
69
- parseInt(hexComponent, 16) / 255.0
70
- );
71
- const linearRBG = _.map(sRGB, (component) =>
72
- (component <= 0.03928)
73
- ? component / 12.92
74
- : Math.pow((component + 0.055) / 1.055, 2.4)
75
- );
76
- const L = 0.2126 * linearRBG[0] + 0.7152 * linearRBG[1] + 0.0722 * linearRBG[2];
77
- return ((L + 0.05) / (0.0 + 0.05) > (1.0 + 0.05) / (L + 0.05))
78
- ? '#000000'
79
- : '#ffffff';
80
- }
81
- });
82
-
83
- export default LayoutHeaderView;