@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.
- package/README.md +61 -0
- package/package.json +79 -31
- package/assets/Girder_Mark.png +0 -0
- package/auth.js +0 -152
- package/collections/ApiKeyCollection.js +0 -9
- package/collections/AssetstoreCollection.js +0 -9
- package/collections/Collection.js +0 -295
- package/collections/CollectionCollection.js +0 -9
- package/collections/FileCollection.js +0 -11
- package/collections/FolderCollection.js +0 -11
- package/collections/GroupCollection.js +0 -9
- package/collections/ItemCollection.js +0 -11
- package/collections/UserCollection.js +0 -24
- package/collections/index.js +0 -21
- package/constants.js +0 -33
- package/dialog.js +0 -128
- package/events.js +0 -6
- package/index.js +0 -31
- package/main.js +0 -21
- package/misc.js +0 -260
- package/models/AccessControlledModel.js +0 -76
- package/models/ApiKeyModel.js +0 -31
- package/models/AssetstoreModel.js +0 -43
- package/models/CollectionCreationPolicyModel.js +0 -20
- package/models/CollectionModel.js +0 -12
- package/models/FileModel.js +0 -310
- package/models/FolderModel.js +0 -33
- package/models/GroupModel.js +0 -197
- package/models/ItemModel.js +0 -72
- package/models/MetadataMixin.js +0 -88
- package/models/Model.js +0 -187
- package/models/UserModel.js +0 -189
- package/models/index.js +0 -25
- package/pluginUtils.js +0 -11
- package/rest.js +0 -216
- package/router.js +0 -58
- package/routes.js +0 -231
- package/stylesheets/apidocs/apidocs.styl +0 -50
- package/stylesheets/body/adminConsole.styl +0 -21
- package/stylesheets/body/assetstores.styl +0 -46
- package/stylesheets/body/collectionList.styl +0 -39
- package/stylesheets/body/collectionPage.styl +0 -6
- package/stylesheets/body/frontPage.styl +0 -48
- package/stylesheets/body/groupList.styl +0 -43
- package/stylesheets/body/groupPage.styl +0 -116
- package/stylesheets/body/itemPage.styl +0 -81
- package/stylesheets/body/plugins.styl +0 -61
- package/stylesheets/body/searchResultsList.styl +0 -51
- package/stylesheets/body/systemConfig.styl +0 -56
- package/stylesheets/body/userAccount.styl +0 -57
- package/stylesheets/body/userList.styl +0 -79
- package/stylesheets/body/userPage.styl +0 -6
- package/stylesheets/layout/footer.styl +0 -19
- package/stylesheets/layout/global.styl +0 -154
- package/stylesheets/layout/globalNav.styl +0 -89
- package/stylesheets/layout/header.styl +0 -29
- package/stylesheets/layout/headerUser.styl +0 -33
- package/stylesheets/layout/layout.styl +0 -75
- package/stylesheets/layout/layoutVars.styl +0 -9
- package/stylesheets/layout/loading.styl +0 -37
- package/stylesheets/layout/progressArea.styl +0 -17
- package/stylesheets/widgets/accessWidget.styl +0 -106
- package/stylesheets/widgets/browserWidget.styl +0 -9
- package/stylesheets/widgets/hierarchyWidget.styl +0 -188
- package/stylesheets/widgets/markdownWidget.styl +0 -92
- package/stylesheets/widgets/metadataWidget.styl +0 -92
- package/stylesheets/widgets/searchFieldWidget.styl +0 -70
- package/stylesheets/widgets/taskProgress.styl +0 -41
- package/stylesheets/widgets/timelineWidget.styl +0 -41
- package/stylesheets/widgets/uploadWidget.styl +0 -43
- package/stylesheets/widgets/userOtpManagementWidget.styl +0 -159
- package/templates/body/adminConsole.pug +0 -13
- package/templates/body/assetstores.pug +0 -98
- package/templates/body/collectionList.pug +0 -40
- package/templates/body/collectionPage.pug +0 -36
- package/templates/body/filesystemImport.pug +0 -41
- package/templates/body/frontPage.pug +0 -84
- package/templates/body/groupList.pug +0 -30
- package/templates/body/groupPage.pug +0 -116
- package/templates/body/itemPage.pug +0 -61
- package/templates/body/plugins.pug +0 -20
- package/templates/body/s3Import.pug +0 -35
- package/templates/body/searchResults.pug +0 -15
- package/templates/body/searchResultsType.pug +0 -13
- package/templates/body/systemConfiguration.pug +0 -221
- package/templates/body/userAccount.pug +0 -83
- package/templates/body/userList.pug +0 -43
- package/templates/body/userPage.pug +0 -40
- package/templates/layout/alert.pug +0 -5
- package/templates/layout/layout.pug +0 -12
- package/templates/layout/layoutFooter.pug +0 -11
- package/templates/layout/layoutGlobalNav.pug +0 -7
- package/templates/layout/layoutHeader.pug +0 -8
- package/templates/layout/layoutHeaderUser.pug +0 -26
- package/templates/layout/layoutProgressArea.pug +0 -1
- package/templates/layout/loginDialog.pug +0 -30
- package/templates/layout/registerDialog.pug +0 -35
- package/templates/layout/resetPasswordDialog.pug +0 -25
- package/templates/widgets/accessEditor.pug +0 -23
- package/templates/widgets/accessEditorMixins.pug +0 -57
- package/templates/widgets/accessEditorNonModal.pug +0 -11
- package/templates/widgets/accessEntry.pug +0 -32
- package/templates/widgets/apiKeyList.pug +0 -50
- package/templates/widgets/browserWidget.pug +0 -32
- package/templates/widgets/checkedActionsMenu.pug +0 -46
- package/templates/widgets/collectionInfoDialog.pug +0 -37
- package/templates/widgets/confirmDialog.pug +0 -14
- package/templates/widgets/dateTimeRangeWidget.pug +0 -20
- package/templates/widgets/dateTimeWidget.pug +0 -8
- package/templates/widgets/editApiKeyWidget.pug +0 -43
- package/templates/widgets/editAssetstoreWidget.pug +0 -78
- package/templates/widgets/editCollectionWidget.pug +0 -27
- package/templates/widgets/editFileWidget.pug +0 -21
- package/templates/widgets/editFolderWidget.pug +0 -27
- package/templates/widgets/editGroupWidget.pug +0 -54
- package/templates/widgets/editItemWidget.pug +0 -27
- package/templates/widgets/fileInfoDialog.pug +0 -33
- package/templates/widgets/fileList.pug +0 -33
- package/templates/widgets/folderInfoDialog.pug +0 -42
- package/templates/widgets/folderList.pug +0 -21
- package/templates/widgets/groupAdminList.pug +0 -33
- package/templates/widgets/groupInviteDialog.pug +0 -76
- package/templates/widgets/groupInviteList.pug +0 -14
- package/templates/widgets/groupMemberList.pug +0 -39
- package/templates/widgets/groupModList.pug +0 -23
- package/templates/widgets/hierarchyBreadcrumb.pug +0 -37
- package/templates/widgets/hierarchyPaginated.pug +0 -19
- package/templates/widgets/hierarchyWidget.pug +0 -96
- package/templates/widgets/itemBreadcrumb.pug +0 -16
- package/templates/widgets/itemList.pug +0 -27
- package/templates/widgets/jsonMetadatumEditWidget.pug +0 -13
- package/templates/widgets/jsonMetadatumView.pug +0 -6
- package/templates/widgets/loadingAnimation.pug +0 -4
- package/templates/widgets/markdownWidget.pug +0 -34
- package/templates/widgets/metadataWidget.pug +0 -16
- package/templates/widgets/metadatumEditWidget.pug +0 -15
- package/templates/widgets/metadatumView.pug +0 -5
- package/templates/widgets/newAssetstore.pug +0 -118
- package/templates/widgets/paginateWidget.pug +0 -7
- package/templates/widgets/pluginConfigBreadcrumb.pug +0 -13
- package/templates/widgets/rootSelectorWidget.pug +0 -13
- package/templates/widgets/searchField.pug +0 -10
- package/templates/widgets/searchHelp.pug +0 -12
- package/templates/widgets/searchModeSelect.pug +0 -9
- package/templates/widgets/searchResults.pug +0 -14
- package/templates/widgets/sortCollectionWidget.pug +0 -14
- package/templates/widgets/taskProgress.pug +0 -16
- package/templates/widgets/timeline.pug +0 -15
- package/templates/widgets/uploadWidget.pug +0 -15
- package/templates/widgets/uploadWidgetMixins.pug +0 -31
- package/templates/widgets/uploadWidgetNonModal.pug +0 -10
- package/templates/widgets/userOtpBegin.pug +0 -4
- package/templates/widgets/userOtpDisable.pug +0 -6
- package/templates/widgets/userOtpEnable.pug +0 -44
- package/utilities/EventStream.js +0 -177
- package/utilities/PluginUtils.js +0 -36
- package/utilities/S3UploadHandler.js +0 -303
- package/utilities/index.js +0 -9
- package/utilities/jquery/girderEnable.js +0 -19
- package/utilities/jquery/girderModal.js +0 -48
- package/version.js +0 -10
- package/views/App.js +0 -359
- package/views/View.js +0 -78
- package/views/body/AdminView.js +0 -29
- package/views/body/AssetstoresView.js +0 -235
- package/views/body/CollectionView.js +0 -188
- package/views/body/CollectionsView.js +0 -120
- package/views/body/FilesystemImportView.js +0 -83
- package/views/body/FolderView.js +0 -54
- package/views/body/FrontPageView.js +0 -47
- package/views/body/GroupView.js +0 -336
- package/views/body/GroupsView.js +0 -106
- package/views/body/ItemView.js +0 -177
- package/views/body/PluginsView.js +0 -73
- package/views/body/S3ImportView.js +0 -80
- package/views/body/SearchResultsView.js +0 -162
- package/views/body/SystemConfigurationView.js +0 -196
- package/views/body/UserAccountView.js +0 -179
- package/views/body/UserView.js +0 -165
- package/views/body/UsersView.js +0 -124
- package/views/body/index.js +0 -37
- package/views/index.js +0 -13
- package/views/layout/FooterView.js +0 -29
- package/views/layout/GlobalNavView.js +0 -103
- package/views/layout/HeaderUserView.js +0 -45
- package/views/layout/HeaderView.js +0 -83
- package/views/layout/LoginView.js +0 -100
- package/views/layout/ProgressListView.js +0 -70
- package/views/layout/RegisterView.js +0 -101
- package/views/layout/ResetPasswordView.js +0 -70
- package/views/layout/index.js +0 -19
- package/views/widgets/AccessWidget.js +0 -427
- package/views/widgets/ApiKeyListWidget.js +0 -140
- package/views/widgets/BrowserWidget.js +0 -317
- package/views/widgets/CheckedMenuWidget.js +0 -68
- package/views/widgets/CollectionInfoWidget.js +0 -40
- package/views/widgets/DateTimeRangeWidget.js +0 -179
- package/views/widgets/DateTimeWidget.js +0 -109
- package/views/widgets/EditApiKeyWidget.js +0 -122
- package/views/widgets/EditAssetstoreWidget.js +0 -148
- package/views/widgets/EditCollectionWidget.js +0 -93
- package/views/widgets/EditFileWidget.js +0 -56
- package/views/widgets/EditFolderWidget.js +0 -116
- package/views/widgets/EditGroupWidget.js +0 -125
- package/views/widgets/EditItemWidget.js +0 -110
- package/views/widgets/FileInfoWidget.js +0 -26
- package/views/widgets/FileListWidget.js +0 -151
- package/views/widgets/FolderInfoWidget.js +0 -39
- package/views/widgets/FolderListWidget.js +0 -106
- package/views/widgets/GroupAdminsWidget.js +0 -88
- package/views/widgets/GroupInvitesWidget.js +0 -56
- package/views/widgets/GroupMembersWidget.js +0 -185
- package/views/widgets/GroupModsWidget.js +0 -77
- package/views/widgets/HierarchyWidget.js +0 -1097
- package/views/widgets/ItemBreadcrumbWidget.js +0 -38
- package/views/widgets/ItemListWidget.js +0 -345
- package/views/widgets/LoadingAnimation.js +0 -17
- package/views/widgets/MarkdownWidget.js +0 -217
- package/views/widgets/MetadataWidget.js +0 -504
- package/views/widgets/NewAssetstoreWidget.js +0 -81
- package/views/widgets/PaginateWidget.js +0 -37
- package/views/widgets/PluginConfigBreadcrumbWidget.js +0 -33
- package/views/widgets/RootSelectorWidget.js +0 -192
- package/views/widgets/SearchFieldWidget.js +0 -365
- package/views/widgets/SearchPaginateWidget.js +0 -149
- package/views/widgets/SortCollectionWidget.js +0 -53
- package/views/widgets/TaskProgressWidget.js +0 -91
- package/views/widgets/TimelineWidget.js +0 -155
- package/views/widgets/UploadWidget.js +0 -340
- package/views/widgets/UserOtpManagementWidget.js +0 -105
- package/views/widgets/index.js +0 -75
|
@@ -1,80 +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 S3ImportTemplate from '@girder/core/templates/body/s3Import.pug';
|
|
9
|
-
|
|
10
|
-
var S3ImportView = View.extend({
|
|
11
|
-
events: {
|
|
12
|
-
'submit .g-s3-import-form': function (e) {
|
|
13
|
-
e.preventDefault();
|
|
14
|
-
|
|
15
|
-
var destId = this.$('#g-s3-import-dest-id').val().trim().split(/\s/)[0],
|
|
16
|
-
destType = this.$('#g-s3-import-dest-type').val();
|
|
17
|
-
|
|
18
|
-
this.$('.g-validation-failed-message').empty();
|
|
19
|
-
|
|
20
|
-
this.assetstore.off('g:imported').on('g:imported', function () {
|
|
21
|
-
router.navigate(destType + '/' + destId, { trigger: true });
|
|
22
|
-
}, this).on('g:error', function (resp) {
|
|
23
|
-
this.$('.g-validation-failed-message').text(resp.responseJSON.message);
|
|
24
|
-
}, this).import({
|
|
25
|
-
importPath: this.$('#g-s3-import-path').val().trim(),
|
|
26
|
-
destinationId: destId,
|
|
27
|
-
destinationType: destType,
|
|
28
|
-
progress: true
|
|
29
|
-
});
|
|
30
|
-
},
|
|
31
|
-
'click .g-open-browser': '_openBrowser'
|
|
32
|
-
},
|
|
33
|
-
|
|
34
|
-
initialize: function (settings) {
|
|
35
|
-
this._browserWidgetView = new BrowserWidget({
|
|
36
|
-
parentView: this,
|
|
37
|
-
titleText: 'Destination',
|
|
38
|
-
helpText: 'Browse to a location to select it as the destination.',
|
|
39
|
-
submitText: 'Select Destination',
|
|
40
|
-
validate: function (model) {
|
|
41
|
-
const isValid = $.Deferred();
|
|
42
|
-
if (!model) {
|
|
43
|
-
isValid.reject('Please select a valid root.');
|
|
44
|
-
} else {
|
|
45
|
-
isValid.resolve();
|
|
46
|
-
}
|
|
47
|
-
return isValid.promise();
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
this.listenTo(this._browserWidgetView, 'g:saved', function (val) {
|
|
51
|
-
this.$('#g-s3-import-dest-id').val(val.id);
|
|
52
|
-
this.$('#g-s3-import-dest-type').val(val.get('_modelType'));
|
|
53
|
-
restRequest({
|
|
54
|
-
url: `resource/${val.id}/path`,
|
|
55
|
-
method: 'GET',
|
|
56
|
-
data: { type: val.get('_modelType') }
|
|
57
|
-
}).done((result) => {
|
|
58
|
-
// Only add the resource path if the value wasn't altered
|
|
59
|
-
if (this.$('#g-s3-import-dest-id').val() === val.id) {
|
|
60
|
-
this.$('#g-s3-import-dest-id').val(`${val.id} (${result})`);
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
});
|
|
64
|
-
this.assetstore = settings.assetstore;
|
|
65
|
-
this.render();
|
|
66
|
-
},
|
|
67
|
-
|
|
68
|
-
render: function () {
|
|
69
|
-
this.$el.html(S3ImportTemplate({
|
|
70
|
-
assetstore: this.assetstore
|
|
71
|
-
}));
|
|
72
|
-
return this;
|
|
73
|
-
},
|
|
74
|
-
|
|
75
|
-
_openBrowser: function () {
|
|
76
|
-
this._browserWidgetView.setElement($('#g-dialog-container')).render();
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
export default S3ImportView;
|
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
import _ from 'underscore';
|
|
2
|
-
|
|
3
|
-
import View from '@girder/core/views/View';
|
|
4
|
-
import { restRequest } from '@girder/core/rest';
|
|
5
|
-
import SearchPaginateWidget from '@girder/core/views/widgets/SearchPaginateWidget';
|
|
6
|
-
import SearchFieldWidget from '@girder/core/views/widgets/SearchFieldWidget';
|
|
7
|
-
|
|
8
|
-
import SearchResultsTemplate from '@girder/core/templates/body/searchResults.pug';
|
|
9
|
-
import SearchResultsTypeTemplate from '@girder/core/templates/body/searchResultsType.pug';
|
|
10
|
-
import '@girder/core/stylesheets/body/searchResultsList.styl';
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* This view display all the search results by instantiating a subview
|
|
14
|
-
* per each type found.
|
|
15
|
-
*/
|
|
16
|
-
var SearchResultsView = View.extend({
|
|
17
|
-
initialize: function (settings) {
|
|
18
|
-
this._query = settings.query || '';
|
|
19
|
-
this._mode = settings.mode || 'text';
|
|
20
|
-
|
|
21
|
-
this._sizeOneElement = 28;
|
|
22
|
-
this.pageLimit = 10;
|
|
23
|
-
|
|
24
|
-
this._request = restRequest({
|
|
25
|
-
url: 'resource/search',
|
|
26
|
-
data: {
|
|
27
|
-
q: this._query,
|
|
28
|
-
mode: this._mode,
|
|
29
|
-
types: JSON.stringify(SearchFieldWidget.getModeTypes(this._mode)),
|
|
30
|
-
limit: this.pageLimit
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
this.render();
|
|
34
|
-
},
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Return a consistent and semantically-meaningful type ordering.
|
|
38
|
-
*/
|
|
39
|
-
_getTypeOrdering: function (resultTypes) {
|
|
40
|
-
// This ordering places hopefully-more relevant types first
|
|
41
|
-
const builtinOrdering = ['collection', 'folder', 'item', 'group', 'user'];
|
|
42
|
-
|
|
43
|
-
// _.intersection will use the ordering of its first argument
|
|
44
|
-
const orderedKnownTypes = _.intersection(builtinOrdering, resultTypes);
|
|
45
|
-
const orderedUnknownTypes = _.difference(resultTypes, builtinOrdering).sort();
|
|
46
|
-
|
|
47
|
-
return orderedKnownTypes.concat(orderedUnknownTypes);
|
|
48
|
-
},
|
|
49
|
-
|
|
50
|
-
render: function () {
|
|
51
|
-
this.$el.html(SearchResultsTemplate({
|
|
52
|
-
query: this._query
|
|
53
|
-
}));
|
|
54
|
-
this._subviews = {};
|
|
55
|
-
|
|
56
|
-
this._request
|
|
57
|
-
.done((results) => {
|
|
58
|
-
this.$('.g-search-pending').hide();
|
|
59
|
-
|
|
60
|
-
const resultTypes = _.keys(results);
|
|
61
|
-
const orderedTypes = this._getTypeOrdering(resultTypes);
|
|
62
|
-
_.each(orderedTypes, (type) => {
|
|
63
|
-
if (results[type].length) {
|
|
64
|
-
this._subviews[type] = new SearchResultsTypeView({
|
|
65
|
-
parentView: this,
|
|
66
|
-
query: this._query,
|
|
67
|
-
mode: this._mode,
|
|
68
|
-
type: type,
|
|
69
|
-
limit: this.pageLimit,
|
|
70
|
-
initResults: results[type],
|
|
71
|
-
sizeOneElement: this._sizeOneElement
|
|
72
|
-
})
|
|
73
|
-
.render();
|
|
74
|
-
this._subviews[type].$el
|
|
75
|
-
.appendTo(this.$('.g-search-results-container'));
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
if (_.isEmpty(this._subviews)) {
|
|
80
|
-
this.$('.g-search-no-results').show();
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
return this;
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* This subview display all the search results for one type.
|
|
90
|
-
* It also contain a pagination widget that provide a consistent widget
|
|
91
|
-
* for iterating amongst pages of a list of search results.
|
|
92
|
-
*/
|
|
93
|
-
var SearchResultsTypeView = View.extend({
|
|
94
|
-
className: 'g-search-results-type-container',
|
|
95
|
-
|
|
96
|
-
initialize: function (settings) {
|
|
97
|
-
this._query = settings.query;
|
|
98
|
-
this._mode = settings.mode;
|
|
99
|
-
this._type = settings.type;
|
|
100
|
-
this._initResults = settings.initResults || [];
|
|
101
|
-
this._pageLimit = settings.limit || 10;
|
|
102
|
-
this._sizeOneElement = settings.sizeOneElement || 30;
|
|
103
|
-
|
|
104
|
-
this._paginateWidget = new SearchPaginateWidget({
|
|
105
|
-
parentView: this,
|
|
106
|
-
type: this._type,
|
|
107
|
-
query: this._query,
|
|
108
|
-
mode: this._mode,
|
|
109
|
-
limit: this._pageLimit
|
|
110
|
-
})
|
|
111
|
-
.on('g:changed', () => {
|
|
112
|
-
this._results = this._paginateWidget.results;
|
|
113
|
-
this.render();
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
this._results = this._initResults;
|
|
117
|
-
},
|
|
118
|
-
|
|
119
|
-
_getTypeName: function (type) {
|
|
120
|
-
const names = {
|
|
121
|
-
collection: 'Collections',
|
|
122
|
-
group: 'Groups',
|
|
123
|
-
user: 'Users',
|
|
124
|
-
folder: 'Folders',
|
|
125
|
-
item: 'Items'
|
|
126
|
-
};
|
|
127
|
-
return names[type] || type;
|
|
128
|
-
},
|
|
129
|
-
|
|
130
|
-
_getTypeIcon: function (type) {
|
|
131
|
-
const icons = {
|
|
132
|
-
user: 'user',
|
|
133
|
-
group: 'users',
|
|
134
|
-
collection: 'sitemap',
|
|
135
|
-
folder: 'folder',
|
|
136
|
-
item: 'doc-text-inv'
|
|
137
|
-
};
|
|
138
|
-
return icons[type] || 'icon-attention-alt';
|
|
139
|
-
},
|
|
140
|
-
|
|
141
|
-
render: function () {
|
|
142
|
-
this.$el.html(SearchResultsTypeTemplate({
|
|
143
|
-
results: this._results,
|
|
144
|
-
collectionName: this._getTypeName(this._type),
|
|
145
|
-
type: this._type,
|
|
146
|
-
icon: this._getTypeIcon(this._type)
|
|
147
|
-
}));
|
|
148
|
-
|
|
149
|
-
/* This size of the results list cannot be known until after the fetch completes. And we don't want to set
|
|
150
|
-
the 'min-height' to the max results size, because we'd frequently have lots of whitespace for short result
|
|
151
|
-
lists. Do not try to move that set in stylesheet.
|
|
152
|
-
*/
|
|
153
|
-
this.$('.g-search-results-type').css('min-height', `${this._initResults.length * this._sizeOneElement}px`);
|
|
154
|
-
this._paginateWidget
|
|
155
|
-
.setElement(this.$(`#${this._type}Paginate`))
|
|
156
|
-
.render();
|
|
157
|
-
|
|
158
|
-
return this;
|
|
159
|
-
}
|
|
160
|
-
});
|
|
161
|
-
|
|
162
|
-
export default SearchResultsView;
|
|
@@ -1,196 +0,0 @@
|
|
|
1
|
-
import $ from 'jquery';
|
|
2
|
-
import _ from 'underscore';
|
|
3
|
-
|
|
4
|
-
import AccessWidget from '@girder/core/views/widgets/AccessWidget';
|
|
5
|
-
import View from '@girder/core/views/View';
|
|
6
|
-
import events from '@girder/core/events';
|
|
7
|
-
import { restRequest, cancelRestRequests } from '@girder/core/rest';
|
|
8
|
-
import CollectionCreationPolicyModel from '@girder/core/models/CollectionCreationPolicyModel';
|
|
9
|
-
|
|
10
|
-
import SystemConfigurationTemplate from '@girder/core/templates/body/systemConfiguration.pug';
|
|
11
|
-
|
|
12
|
-
import '@girder/core/stylesheets/body/systemConfig.styl';
|
|
13
|
-
|
|
14
|
-
import 'bootstrap/js/collapse';
|
|
15
|
-
import 'bootstrap/js/transition';
|
|
16
|
-
import 'bootstrap-switch'; // /dist/js/bootstrap-switch.js',
|
|
17
|
-
import 'bootstrap-switch/dist/css/bootstrap3/bootstrap-switch.css';
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* The system config page for administrators.
|
|
21
|
-
*/
|
|
22
|
-
var SystemConfigurationView = View.extend({
|
|
23
|
-
events: {
|
|
24
|
-
'submit .g-settings-form': function (event) {
|
|
25
|
-
event.preventDefault();
|
|
26
|
-
this.$('.g-submit-settings').girderEnable(false);
|
|
27
|
-
this.$('#g-settings-error-message').empty();
|
|
28
|
-
|
|
29
|
-
this.$('#g-core-collection-create-policy').val(JSON.stringify(this._covertCollectionCreationPolicy()));
|
|
30
|
-
var settings = _.map(this.settingsKeys, (key) => {
|
|
31
|
-
const element = this.$('#g-' + key.replace(/[_.]/g, '-'));
|
|
32
|
-
|
|
33
|
-
if (key === 'core.route_table') {
|
|
34
|
-
return {
|
|
35
|
-
key,
|
|
36
|
-
value: _.object(_.map($('.g-core-route-table'), function (el) {
|
|
37
|
-
return [$(el).data('webrootName'), $(el).val()];
|
|
38
|
-
}))
|
|
39
|
-
};
|
|
40
|
-
} else if (_.contains(
|
|
41
|
-
[
|
|
42
|
-
'core.api_keys',
|
|
43
|
-
'core.enable_password_login',
|
|
44
|
-
'core.enable_notification_stream'
|
|
45
|
-
],
|
|
46
|
-
key
|
|
47
|
-
)) { // booleans via checkboxes
|
|
48
|
-
return {
|
|
49
|
-
key,
|
|
50
|
-
value: element.is(':checked')
|
|
51
|
-
};
|
|
52
|
-
} else { // all other settings use $.fn.val()
|
|
53
|
-
return {
|
|
54
|
-
key,
|
|
55
|
-
value: element.val() || null
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
restRequest({
|
|
61
|
-
method: 'PUT',
|
|
62
|
-
url: 'system/setting',
|
|
63
|
-
data: {
|
|
64
|
-
list: JSON.stringify(settings)
|
|
65
|
-
},
|
|
66
|
-
error: null
|
|
67
|
-
}).done(() => {
|
|
68
|
-
this.$('.g-submit-settings').girderEnable(true);
|
|
69
|
-
events.trigger('g:alert', {
|
|
70
|
-
icon: 'ok',
|
|
71
|
-
text: 'Settings saved.',
|
|
72
|
-
type: 'success',
|
|
73
|
-
timeout: 4000
|
|
74
|
-
});
|
|
75
|
-
}).fail((resp) => {
|
|
76
|
-
this.$('.g-submit-settings').girderEnable(true);
|
|
77
|
-
this.$('#g-settings-error-message').text(resp.responseJSON.message);
|
|
78
|
-
});
|
|
79
|
-
},
|
|
80
|
-
'click #g-core-banner-default-color': function () {
|
|
81
|
-
this.$('#g-core-banner-color').val(this.defaults['core.banner_color']);
|
|
82
|
-
}
|
|
83
|
-
},
|
|
84
|
-
|
|
85
|
-
initialize: function () {
|
|
86
|
-
cancelRestRequests('fetch');
|
|
87
|
-
|
|
88
|
-
var keys = [
|
|
89
|
-
'core.api_keys',
|
|
90
|
-
'core.contact_email_address',
|
|
91
|
-
'core.brand_name',
|
|
92
|
-
'core.banner_color',
|
|
93
|
-
'core.privacy_notice',
|
|
94
|
-
'core.cookie_lifetime',
|
|
95
|
-
'core.enable_password_login',
|
|
96
|
-
'core.email_from_address',
|
|
97
|
-
'core.email_host',
|
|
98
|
-
'core.registration_policy',
|
|
99
|
-
'core.email_verification',
|
|
100
|
-
'core.server_root',
|
|
101
|
-
'core.smtp_host',
|
|
102
|
-
'core.smtp.port',
|
|
103
|
-
'core.smtp.encryption',
|
|
104
|
-
'core.smtp.username',
|
|
105
|
-
'core.smtp.password',
|
|
106
|
-
'core.upload_minimum_chunk_size',
|
|
107
|
-
'core.enable_notification_stream',
|
|
108
|
-
'core.cors.allow_origin',
|
|
109
|
-
'core.cors.allow_methods',
|
|
110
|
-
'core.cors.allow_headers',
|
|
111
|
-
'core.add_to_group_policy',
|
|
112
|
-
'core.collection_create_policy',
|
|
113
|
-
'core.user_default_folders',
|
|
114
|
-
'core.route_table'
|
|
115
|
-
];
|
|
116
|
-
this.settingsKeys = keys;
|
|
117
|
-
restRequest({
|
|
118
|
-
url: 'system/setting',
|
|
119
|
-
method: 'GET',
|
|
120
|
-
data: {
|
|
121
|
-
list: JSON.stringify(keys)
|
|
122
|
-
}
|
|
123
|
-
}).done((resp) => {
|
|
124
|
-
this.settings = resp;
|
|
125
|
-
this.render();
|
|
126
|
-
});
|
|
127
|
-
},
|
|
128
|
-
|
|
129
|
-
render: function () {
|
|
130
|
-
this.$el.html(SystemConfigurationTemplate({
|
|
131
|
-
settings: this.settings,
|
|
132
|
-
routes: this.settings['core.route_table'],
|
|
133
|
-
routeKeys: _.sortBy(
|
|
134
|
-
_.keys(this.settings['core.route_table']),
|
|
135
|
-
(a) => a.indexOf('core_') === 0 ? -1 : 0
|
|
136
|
-
),
|
|
137
|
-
JSON: window.JSON
|
|
138
|
-
}));
|
|
139
|
-
|
|
140
|
-
var enableCollectionCreationPolicy = this.settings['core.collection_create_policy'] ? this.settings['core.collection_create_policy'].open : false;
|
|
141
|
-
|
|
142
|
-
this.$('.g-setting-switch')
|
|
143
|
-
.bootstrapSwitch()
|
|
144
|
-
.bootstrapSwitch('state', enableCollectionCreationPolicy)
|
|
145
|
-
.off('switchChange.bootstrapSwitch')
|
|
146
|
-
.on('switchChange.bootstrapSwitch', (event, state) => {
|
|
147
|
-
if (state) {
|
|
148
|
-
this._renderCollectionCreationPolicyAccessWidget();
|
|
149
|
-
} else {
|
|
150
|
-
this.accessWidget.destroy();
|
|
151
|
-
this.accessWidget = null;
|
|
152
|
-
}
|
|
153
|
-
});
|
|
154
|
-
|
|
155
|
-
if (enableCollectionCreationPolicy) {
|
|
156
|
-
this._renderCollectionCreationPolicyAccessWidget();
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
return this;
|
|
160
|
-
},
|
|
161
|
-
|
|
162
|
-
_renderCollectionCreationPolicyAccessWidget: function () {
|
|
163
|
-
var collectionCreationPolicyModel = new CollectionCreationPolicyModel();
|
|
164
|
-
|
|
165
|
-
this.accessWidget = new AccessWidget({
|
|
166
|
-
el: this.$('.g-collection-create-policy-container .access-widget-container'),
|
|
167
|
-
modelType: 'collection_creation_policy',
|
|
168
|
-
model: collectionCreationPolicyModel,
|
|
169
|
-
parentView: this,
|
|
170
|
-
modal: false,
|
|
171
|
-
hideRecurseOption: true,
|
|
172
|
-
hideSaveButton: true,
|
|
173
|
-
hidePrivacyEditor: true,
|
|
174
|
-
hideAccessType: true,
|
|
175
|
-
noAccessFlag: true
|
|
176
|
-
});
|
|
177
|
-
},
|
|
178
|
-
|
|
179
|
-
_covertCollectionCreationPolicy: function () {
|
|
180
|
-
// get collection creation policy from AccessWidget and format the result properly
|
|
181
|
-
var settingValue = null;
|
|
182
|
-
if (this.$('.g-setting-switch').bootstrapSwitch('state')) {
|
|
183
|
-
settingValue = { open: this.$('.g-setting-switch').bootstrapSwitch('state') };
|
|
184
|
-
var accessList = this.accessWidget.getAccessList();
|
|
185
|
-
_.each(_.keys(accessList), (key) => {
|
|
186
|
-
settingValue[key] = _.pluck(accessList[key], 'id');
|
|
187
|
-
});
|
|
188
|
-
} else {
|
|
189
|
-
settingValue = this.settings['core.collection_create_policy'];
|
|
190
|
-
settingValue.open = false;
|
|
191
|
-
}
|
|
192
|
-
return settingValue;
|
|
193
|
-
}
|
|
194
|
-
});
|
|
195
|
-
|
|
196
|
-
export default SystemConfigurationView;
|
|
@@ -1,179 +0,0 @@
|
|
|
1
|
-
import $ from 'jquery';
|
|
2
|
-
import _ from 'underscore';
|
|
3
|
-
|
|
4
|
-
import ApiKeyListWidget from '@girder/core/views/widgets/ApiKeyListWidget';
|
|
5
|
-
import UserOtpManagementWidget from '@girder/core/views/widgets/UserOtpManagementWidget';
|
|
6
|
-
import router from '@girder/core/router';
|
|
7
|
-
import UserModel from '@girder/core/models/UserModel';
|
|
8
|
-
import View from '@girder/core/views/View';
|
|
9
|
-
import { AccessType } from '@girder/core/constants';
|
|
10
|
-
import events from '@girder/core/events';
|
|
11
|
-
import { getCurrentUser } from '@girder/core/auth';
|
|
12
|
-
import { cancelRestRequests } from '@girder/core/rest';
|
|
13
|
-
|
|
14
|
-
import UserAccountTemplate from '@girder/core/templates/body/userAccount.pug';
|
|
15
|
-
|
|
16
|
-
import '@girder/core/stylesheets/body/userAccount.styl';
|
|
17
|
-
|
|
18
|
-
import 'bootstrap/js/tab';
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* This is the view for the user account (profile) page.
|
|
22
|
-
*/
|
|
23
|
-
var UserAccountView = View.extend({
|
|
24
|
-
events: {
|
|
25
|
-
'submit #g-user-info-form': function (event) {
|
|
26
|
-
event.preventDefault();
|
|
27
|
-
this.$('#g-user-info-error-msg').empty();
|
|
28
|
-
|
|
29
|
-
var params = {
|
|
30
|
-
email: this.$('#g-email').val(),
|
|
31
|
-
firstName: this.$('#g-firstName').val(),
|
|
32
|
-
lastName: this.$('#g-lastName').val()
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
if (this.$('#g-admin').length > 0) {
|
|
36
|
-
params.admin = this.$('#g-admin').is(':checked');
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
this.user.set(params);
|
|
40
|
-
|
|
41
|
-
this.user.off('g:error').on('g:error', function (err) {
|
|
42
|
-
var msg = err.responseJSON.message;
|
|
43
|
-
this.$('#g-' + err.responseJSON.field).trigger('focus');
|
|
44
|
-
this.$('#g-user-info-error-msg').text(msg);
|
|
45
|
-
}, this).off('g:saved')
|
|
46
|
-
.on('g:saved', function () {
|
|
47
|
-
events.trigger('g:alert', {
|
|
48
|
-
icon: 'ok',
|
|
49
|
-
text: 'Info saved.',
|
|
50
|
-
type: 'success',
|
|
51
|
-
timeout: 4000
|
|
52
|
-
});
|
|
53
|
-
}, this).save();
|
|
54
|
-
},
|
|
55
|
-
'submit #g-password-change-form': function (event) {
|
|
56
|
-
event.preventDefault();
|
|
57
|
-
this.$('#g-password-change-error-msg').empty();
|
|
58
|
-
|
|
59
|
-
if (this.$('#g-password-new').val() !==
|
|
60
|
-
this.$('#g-password-retype').val()) {
|
|
61
|
-
this.$('#g-password-change-error-msg').text(
|
|
62
|
-
'Passwords do not match, try again.'
|
|
63
|
-
);
|
|
64
|
-
this.$('#g-password-retype,#g-password-new').val('');
|
|
65
|
-
this.$('#g-password-new').trigger('focus');
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
this.user.off('g:error').on('g:error', function (err) {
|
|
70
|
-
var msg = err.responseJSON.message;
|
|
71
|
-
this.$('#g-password-change-error-msg').text(msg);
|
|
72
|
-
}, this).off('g:passwordChanged')
|
|
73
|
-
.on('g:passwordChanged', function () {
|
|
74
|
-
events.trigger('g:alert', {
|
|
75
|
-
icon: 'ok',
|
|
76
|
-
text: 'Password changed.',
|
|
77
|
-
type: 'success',
|
|
78
|
-
timeout: 4000
|
|
79
|
-
});
|
|
80
|
-
this.$('#g-password-old,#g-password-new,#g-password-retype').val('');
|
|
81
|
-
}, this);
|
|
82
|
-
|
|
83
|
-
// here and in the template, an admin user who wants to change their
|
|
84
|
-
// own password is intentionally forced to re-enter their old
|
|
85
|
-
// password
|
|
86
|
-
if (this.isCurrentUser) {
|
|
87
|
-
this.user.changePassword(
|
|
88
|
-
this.$('#g-password-old').val(),
|
|
89
|
-
this.$('#g-password-new').val()
|
|
90
|
-
);
|
|
91
|
-
} else {
|
|
92
|
-
this.user.adminChangePassword(this.$('#g-password-new').val());
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
},
|
|
96
|
-
|
|
97
|
-
initialize: function (settings) {
|
|
98
|
-
this.tab = settings.tab || 'info';
|
|
99
|
-
this.user = settings.user || getCurrentUser();
|
|
100
|
-
this.isCurrentUser = getCurrentUser() &&
|
|
101
|
-
settings.user.id === getCurrentUser().id;
|
|
102
|
-
|
|
103
|
-
this.model = this.user;
|
|
104
|
-
this.temporary = settings.temporary;
|
|
105
|
-
|
|
106
|
-
if (!this.user || this.user.getAccessLevel() < AccessType.WRITE) {
|
|
107
|
-
router.navigate('', { trigger: true });
|
|
108
|
-
return;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
cancelRestRequests('fetch');
|
|
112
|
-
|
|
113
|
-
this.apiKeyListWidget = new ApiKeyListWidget({
|
|
114
|
-
user: this.user,
|
|
115
|
-
parentView: this
|
|
116
|
-
});
|
|
117
|
-
|
|
118
|
-
this.userOtpManagementWidget = new UserOtpManagementWidget({
|
|
119
|
-
user: this.user,
|
|
120
|
-
parentView: this
|
|
121
|
-
});
|
|
122
|
-
|
|
123
|
-
this.render();
|
|
124
|
-
},
|
|
125
|
-
|
|
126
|
-
render: function () {
|
|
127
|
-
if (getCurrentUser() === null) {
|
|
128
|
-
router.navigate('', { trigger: true });
|
|
129
|
-
return;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
this.$el.html(UserAccountTemplate({
|
|
133
|
-
user: this.model,
|
|
134
|
-
isCurrentUser: this.isCurrentUser,
|
|
135
|
-
getCurrentUser: getCurrentUser,
|
|
136
|
-
temporaryToken: this.temporary
|
|
137
|
-
}));
|
|
138
|
-
|
|
139
|
-
_.each($('.g-account-tabs>li>a'), function (el) {
|
|
140
|
-
var tabLink = $(el);
|
|
141
|
-
tabLink.tab().on('shown.bs.tab', (e) => {
|
|
142
|
-
this.tab = $(e.currentTarget).attr('name');
|
|
143
|
-
router.navigate('useraccount/' + this.model.id + '/' + this.tab);
|
|
144
|
-
|
|
145
|
-
if (this.tab === 'apikeys') {
|
|
146
|
-
this.apiKeyListWidget.setElement(
|
|
147
|
-
this.$('.g-api-keys-list-container')).render();
|
|
148
|
-
} else if (this.tab === 'otp') {
|
|
149
|
-
this.userOtpManagementWidget
|
|
150
|
-
.setElement(this.$('.g-account-otp-container'))
|
|
151
|
-
.render();
|
|
152
|
-
}
|
|
153
|
-
});
|
|
154
|
-
|
|
155
|
-
if (tabLink.attr('name') === this.tab) {
|
|
156
|
-
tabLink.tab('show');
|
|
157
|
-
}
|
|
158
|
-
}, this);
|
|
159
|
-
|
|
160
|
-
return this;
|
|
161
|
-
}
|
|
162
|
-
}, {
|
|
163
|
-
/**
|
|
164
|
-
* Helper function for fetching the user by id, then render the view.
|
|
165
|
-
*/
|
|
166
|
-
fetchAndInit: function (id, tab) {
|
|
167
|
-
var user = new UserModel();
|
|
168
|
-
user.set({ _id: id }).on('g:fetched', function () {
|
|
169
|
-
events.trigger('g:navigateTo', UserAccountView, {
|
|
170
|
-
user: user,
|
|
171
|
-
tab: tab
|
|
172
|
-
});
|
|
173
|
-
}, this).on('g:error', function () {
|
|
174
|
-
router.navigate('', { trigger: true });
|
|
175
|
-
}, this).fetch();
|
|
176
|
-
}
|
|
177
|
-
});
|
|
178
|
-
|
|
179
|
-
export default UserAccountView;
|