/
AppModel.js
246 lines (207 loc) · 9.52 KB
/
AppModel.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
/*global define */
define(['jquery', 'underscore', 'backbone'],
function($, _, Backbone) {
'use strict';
// Application Model
// ------------------
var AppModel = Backbone.Model.extend({
// This model contains all of the attributes for the Application
defaults: {
headerType: 'default',
title: MetacatUI.themeTitle || "Metacat Data Catalog",
emailContact: "",
googleAnalyticsKey: null,
nodeId: "urn:node:CN",
searchMode: MetacatUI.mapKey ? 'map' : 'list',
searchHistory: [],
sortOrder: 'dateUploaded+desc',
page: 0,
pid: null,
previousPid: null,
anchorId: null,
enableUserProfiles: true,
enableUserProfileSettings: true,
profileUsername: null,
maxDownloadSize: 3000000000,
// set this variable to true, if the content being published is moderated by the data team.
contentIsModerated: false,
// Flag which, when true shows Whole Tale features in the UI
showWholeTaleFeatures: false,
taleEnvironments: ["RStudio", "Jupyter Notebook"],
dashboardUrl: 'https://girder.wholetale.org/api/v1/integration/dataone',
baseUrl: window.location.origin || (window.location.protocol + "//" + window.location.host),
// the most likely item to change is the Metacat deployment context
context: '',
d1Service: "/cn/v2",
d1CNBaseUrl: "https://cn.dataone.org",
d1CNService: "/cn/v2",
viewServiceUrl: null,
packageServiceUrl: null,
//publishServiceUrl: null,
authServiceUrl: null,
queryServiceUrl: null,
reserveServiceUrl: null,
//If set to false, some parts of the app will send POST HTTP requests to the
// Solr search index via the `/query/solr` DataONE API.
// Set this configuration to true if using Metacat 2.10.2 or earlier
disableQueryPOSTs: true,
defaultSearchFilters: ["all", "attribute", "documents", "creator", "dataYear", "pubYear",
"id", "taxon", "spatial", "dataSource"],
metaServiceUrl: null,
metacatBaseUrl: null,
metacatServiceUrl: null,
//objectServiceUrl: null,
resolveServiceUrl: null,
d1LogServiceUrl: null,
nodeServiceUrl: null,
// NOTE: include your bioportal apikey for suggested classes
// see: http://bioportal.bioontology.org/account
//bioportalAPIKey: "24e4775e-54e0-11e0-9d7b-005056aa3316",
//bioportalSearchUrl: null, // use this to deactivate the annotator view
//bioportalBatchUrl: "https://data.bioontology.org/batch",
//annotatorUrl: null,
//orcidBaseUrl: "https://sandbox.orcid.org",
//orcidSearchUrl: null,
accountsUrl: null,
pendingMapsUrl: null,
accountMapsUrl: null,
groupsUrl: null,
signInUrl: null,
signOutUrl: null,
signInUrlOrcid: null,
//signInUrlLdap: null,
tokenUrl: null,
//mdqBaseUrl: "https://docker-ucsb-1.dataone.org:30443/quality",
mdqBaseUrl: "",
// suidIds and suiteLables must be specified as a list, even if only one suite is available.
suiteIds: ["dataone.suite.1"],
suiteLabels: ["DataONE Metadata Completeness Suite v1.0"],
// Metrics endpoint url
metricsUrl: 'https://logproc-stage-ucsb-1.test.dataone.org/metrics',
// Metrics flags for the Dataset Landing Page
// Enable these flags to enable metrics display
displayDatasetMetrics: true,
// Controlling individual functionality
// Only works if the parent flags displayDatasetMetrics is enabled
displayDatasetMetricsTooltip: true,
displayDatasetCitationMetric: true,
displayDatasetDownloadMetric: true,
displayDatasetViewMetric: true,
displayDatasetEditButton: false,
displayDatasetQualityMetric: false,
displayDatasetAnalyzeButton: false,
displayMetricModals: true,
displayDatasetControls: true,
/* Hide metrics display for SolrResult models that match the given properties.
* Properties can be functions, which are given the SolrResult model value as a parameter.
* Example:
* {
* formatId: "eml://ecoinformatics.org/eml-2.1.1",
* isPublic: true,
* dateUploaded: function(date){
* return new Date(date) < new Date('1995-12-17T03:24:00');
* }
* }
* This example would hide metrics for any objects that are:
* EML 2.1.1 OR public OR were uploaded before 12/17/1995.
*/
hideMetricsWhen: {
datasource: "urn:node:ESS_DIVE"
},
isJSONLDEnabled: true,
// If true, then archived content is available in the search index.
// Set to false if this MetacatUI is using a Metacat version before 2.10.0
archivedContentIsIndexed: true,
/**
* Set to false to hide the display of "My Portals", which shows the user's current portals
* @type {boolean}
*/
showMyPortals: true,
/**
* The user-facing term for portals in lower-case and in singular form.
* e.g. "portal"
* @type {string}
*/
portalTermSingular: "portal",
/**
* The user-facing term for portals in lower-case and in plural form.
* e.g. "portals". This allows for portal terms with irregular plurals.
* @type {string}
*/
portalTermPlural: "portals",
/**
* Set to false to prevent ANYONE from creating a new portal.
* @type {boolean}
*/
enableCreatePortals: true,
/**
* Limits only the following people or groups to create new portals.
* @type {string[]}
*/
limitPortalsToSubjects: [],
},
defaultView: "data",
initialize: function() {
if(!this.get("baseUrl")){
this.set("baseUrl", this.get("d1CNBaseUrl"));
this.set("d1Service", this.get("d1CNService"));
}
this.set('metacatBaseUrl', this.get('baseUrl') + this.get('context'));
this.set('authServiceUrl', this.get('baseUrl') + this.get('d1Service') + '/isAuthorized/');
this.set('queryServiceUrl', this.get('baseUrl') + this.get('d1Service') + '/query/solr/?');
this.set('metaServiceUrl', this.get('baseUrl') + this.get('d1Service') + '/meta/');
//this.set('objectServiceUrl', this.get('baseUrl') + this.get('d1Service') + '/object/');
this.set('resolveServiceUrl', this.get('d1CNBaseUrl') + this.get('d1Service') + '/resolve/');
this.set('nodeServiceUrl', this.get('baseUrl') + this.get('d1Service') + '/node');
this.set("reserveServiceUrl", this.get("d1CNBaseUrl") + this.get("d1CNService") + "/reserve");
// Metadata quality report services
this.set('mdqSuitesServiceUrl', this.get("mdqBaseUrl") + "/suites/");
this.set('mdqRunsServiceUrl', this.get('mdqBaseUrl') + "/runs/");
this.set('mdqSuiteIds', this.get("suiteIds"));
this.set('mdqSuiteLabels', this.get("suiteLabels"));
//The logs index
if(typeof this.get("d1LogServiceUrl") !== "undefined"){
this.set('d1LogServiceUrl', this.get('baseUrl') + this.get('d1Service') + '/query/logsolr/?');
}
//The account management links
if(typeof this.get("accountsUrl") != "undefined"){
this.set("groupsUrl", this.get("baseUrl") + this.get("d1Service") + "/groups/");
this.set("accountsUrl", this.get("baseUrl") + this.get("d1Service") + "/accounts/");
this.set("pendingMapsUrl", this.get("accountsUrl") + "pendingmap/");
this.set("accountsMapsUrl", this.get("accountsUrl") + "map/");
}
//The view service for member node installations of metacatui
this.set('viewServiceUrl', this.get('baseUrl') + this.get('d1CNService') + '/views/metacatui/');
//Authentication / portal URLs
this.set('portalUrl', this.get('d1CNBaseUrl') + '/portal/');
this.set('tokenUrl', this.get('portalUrl') + 'token');
//Annotator API
if(typeof this.get("annotatorUrl") !== "undefined")
this.set('annotatorUrl', this.get('d1CNBaseUrl') + '/portal/annotator');
//The sign-in and out URLs - allow these to be turned off by removing them in the defaults above (hence the check for undefined)
if(typeof this.get("signInUrl") !== "undefined"){
this.set("signInUrl", this.get('portalUrl') + "startRequest?target=");
this.set("signOutUrl", this.get('portalUrl') + "logout");
}
if(typeof this.get("signInUrlOrcid") !== "undefined")
this.set("signInUrlOrcid", this.get('portalUrl') + "oauth?action=start&target=");
if(typeof this.get("signInUrlLdap") !== "undefined")
this.set("signInUrlLdap", this.get('portalUrl') + "ldap?target=");
if(this.get('orcidBaseUrl'))
this.set('orcidSearchUrl', this.get('orcidBaseUrl') + '/v1.1/search/orcid-bio?q=');
//The package service for v2 DataONE API
this.set('packageServiceUrl', this.get('baseUrl') + this.get('d1Service') + '/packages/application%2Fbagit-097/');
//Only use these settings in production
if(this.get("baseUrl").indexOf("search.dataone.org") > -1)
this.set("googleAnalyticsKey", "UA-15017327-17");
//Set up the bioportal search URL
if((typeof this.get("bioportalAPIKey") == "string") && this.get("bioportalAPIKey").length)
this.set("bioportalSearchUrl", "https://data.bioontology.org/search?ontologies=ECSO&apikey=" + this.get("bioportalAPIKey") + "&pagesize=1000&suggest=true&q=")
this.on("change:pid", this.changePid);
},
changePid: function(model, name){
this.set("previousPid", model.previous("pid"));
}
});
return AppModel;
});