Skip to content

Commit

Permalink
Merge branch 'dev-2.6'
Browse files Browse the repository at this point in the history
  • Loading branch information
laurenwalker committed Jun 26, 2019
2 parents 74ad969 + b597de4 commit 6c4f87c
Show file tree
Hide file tree
Showing 8 changed files with 309 additions and 238 deletions.
2 changes: 1 addition & 1 deletion src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@


<!-- Pull in correct theme configuration, then use Require.js to manage dependencies -->
<script id="loader" type="text/javascript" src="/metacatui/loader.js?v=2.6.3"
<script id="loader" type="text/javascript" src="/metacatui/loader.js?v=2.6.4"
data-theme="default"
data-metacat-context="metacat"
data-map-key="YOUR-GOOGLE-MAPS-API-KEY"
Expand Down
350 changes: 176 additions & 174 deletions src/js/collections/DataPackage.js

Large diffs are not rendered by default.

44 changes: 34 additions & 10 deletions src/js/models/metadata/eml211/EML211.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ define(['jquery', 'underscore', 'backbone', 'uuid',
"attributelist" : "attributeList",
"attributename" : "attributeName",
"attributeorientation" : "attributeOrientation",
"blockedmembernode" : "blockedMemberNode",
"casesensitive" : "caseSensitive",
"changehistory" : "changeHistory",
"changedate" : "changeDate",
Expand All @@ -132,29 +133,48 @@ define(['jquery', 'underscore', 'backbone', 'uuid',
"codeexplanation" : "codeExplanation",
"codesetname" : "codesetName",
"codeseturl" : "codesetURL",
"collapsedelimiters" : "collapseDelimiters",
"constanttosi" : "constantToSI",
"customunit" : "customUnit",
"dataformat" : "dataFormat",
"datatable" : "dataTable",
"datatype" : "dataType",
"datetime" : "dateTime",
"datetimedomain" : "dateTimeDomain",
"datetimeprecision" : "dateTimePrecision",
"definitionattributereference" : "definitionAttributeReference",
"dictref" : "dictRef",
"endcondition" : "endCondition",
"entitycodelist" : "entityCodeList",
"entitydescription" : "entityDescription",
"entityname" : "entityName",
"entityreference" : "entityReference",
"entitytype" : "entityType",
"enumerateddomain" : "enumeratedDomain",
"errorbasis" : "errorBasis",
"errorvalues" : "errorValues",
"externalcodeset" : "externalCodeSet",
"externallydefinedformat" : "externallyDefinedFormat",
"fielddelimiter" : "fieldDelimiter",
"formatname" : "formatName",
"formatstring" : "formatString",
"fractiondigits" : "fractionDigits",
"intellectualrights" : "intellectualRights",
"literalcharacter" : "literalCharacter",
"literallayout" : "literalLayout",
"maintenanceupdatefrequency" : "maintenanceUpdateFrequency",
"matrixtype" : "matrixType",
"maxexclusive" : "maxExclusive",
"maxinclusive" : "maxInclusive",
"maxlength" : "maxLength",
"maxrecordlength" : "maxRecordLength",
"maxvalues" : "maxValues",
"measurementscale" : "measurementScale",
"methodstep" : "methodStep",
"minexclusive" : "minExclusive",
"mininclusive" : "minInclusive",
"minlength" : "minLength",
"minvalues" : "minValues",
"missingvaluecode" : "missingValueCode",
"multipliertosi" : "multiplierToSI",
"nonnumericdomain" : "nonNumericDomain",
Expand All @@ -173,24 +193,31 @@ define(['jquery', 'underscore', 'backbone', 'uuid',
"packageid" : "packageId",
"parentsi" : "parentSI",
"physicallinedelimiter" : "physicalLineDelimiter",
"preferredmembernode" : "preferredMemberNode",
"pubdate" : "pubDate",
"pubplace" : "pubPlace",
"quantitativeattributeaccuracyassessment" : "quantitativeAttributeAccuracyAssessment",
"quotecharacter" : "quoteCharacter",
"recommendedunits" : "recommendedUnits",
"researchtopic" : "researchTopic",
"recorddelimiter" : "recordDelimiter",
"samplingdescription" : "samplingDescription",
"shortname" : "shortName",
"simpledelimited" : "simpleDelimited",
"standardunit" : "standardUnit",
"startcondition" : "startCondition",
"storagetype" : "storageType",
"studyextent" : "studyExtent",
"studytype" : "studyType",
"textdomain" : "textDomain",
"textformat" : "textFormat",
"totaldigits" : "totalDigits",
"typesystem" : "typeSystem",
"unittype" : "unitType",
"unitlist" : "unitList",
"valueattributereference" : "valueAttributeReference",
"xsi:schemalocation" : "xsi:schemaLocation"
"whitespace" : "whiteSpace",
"xsi:schemalocation" : "xsi:schemaLocation"
}
);
},
Expand Down Expand Up @@ -471,16 +498,13 @@ define(['jquery', 'underscore', 'backbone', 'uuid',
}
});

// Insert new nodes
if (fieldName.toLowerCase() === "alternateidentifier") {
datasetNode.prepend(nodes);
var insertAfter = this.getEMLPosition(eml, fieldName.toLowerCase());

if(insertAfter){
insertAfter.after(nodes);
}
else if (fieldName.toLowerCase() === "title") {
if (datasetNode.find("alternateidentifier").length > 0) {
datasetNode.find("alternateidentifier").last().after(nodes);
} else {
datasetNode.prepend(nodes);
}
else{
datasetNode.prepend(nodes);
}

}, this);
Expand Down
40 changes: 22 additions & 18 deletions src/js/templates/api.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
<%
var title = MetacatUI.appModel.get("title");
var apiBaseUrl = MetacatUI.appModel.get("baseUrl") + MetacatUI.appModel.get("context") + MetacatUI.appModel.get("d1Service");
%>
<article id="API">
<div class="container">
<div class="row-fluid">
<div class="text-left">
<h2>
<i class="icon icon-code"></i>
KNB Developer Tools
<%=title%> Developer Tools
</h2>
<p class="lead">The KNB supports the DataONE REST API, and Java, Python, and R libraries for easily creating client tools.
<p class="lead">The <%=title%> supports the DataONE REST API, and Java, Python, and R libraries for easily creating client tools.
</p>
</div>
</div>
Expand All @@ -18,8 +22,8 @@ <h3 id="api">
</h3>
<p class="lead">A REST API for accessing and contributing data.</p>
<p>
The KNB supports the DataONE REST API for automating the process of
uploading, downloading, and searching for data on the KNB using scripted
The <%=title%> supports the DataONE REST API for automating the process of
uploading, downloading, and searching for data on the <%=title%> using scripted
languages such as shell, R, Matlab, and Python, among others. This guide
is a brief synopsis of the DataONE API, which is more comprehensively
documented in the <a
Expand All @@ -29,9 +33,9 @@ <h3 id="api">
target="_external">development version of the architecture guide for future releases</a>).
This API allows any software
tool that supports the DataONE API (such as the <a href="https://releases.dataone.org/online/dataone_r/">rDataONE R
package</a>) to also be able to seamlessly interact with KNB data.
package</a>) to also be able to seamlessly interact with <%=title%> data.
While DataONE maintains the full technical documentation on the
API, here is a brief overview for commonly accessed services on the KNB.
API, here is a brief overview for commonly accessed services on the <%=title%>.
</p>
<section name="summary">
<h3>Summary</h3>
Expand Down Expand Up @@ -73,28 +77,28 @@ <h3>Summary</h3>
<p>
In addition to aggregation, Resource Maps can describe the origin of objects by asserting
<a href="https://www.dataone.org/webinars/provenance-and-dataone-facilitating-reproducible-science">
provenance relationships.</a> These relationships will be displayed on the KNB.
provenance relationships.</a> These relationships will be displayed on the <%=title%>.
</p>
</li>
</ul>
<p>
<blockquote><i class="icon icon-warning-sign"></i>
<p class="text-warning">
All API access is over HTTPS, and accessed via the
<code>https://knb.ecoinformatics.org/knb/d1/mn/v2/</code>
<code><%=apiBaseUrl%>/</code>
endpoint. The relative path prefix
<code>/v2/</code>
indicates that we are currently using version 2 of the DataONE
API.
</blockquote>
<blockquote><i class="icon icon-warning-sign"></i>
<p class="text-warning">
The examples below show calls to the production KNB data
The examples below show calls to the production <%=title%> data
repository REST endpoint
(<code>https://knb.ecoinformatics.org/knb/d1/mn/v2</code>), but users
should not create test data on the production KNB. Instead, please use
(<code><%=apiBaseUrl%></code>), but users
should not create test data in the production environment. Instead, please use
a test Metacat server to explore the API and create test data
(e.g., <code>https://dev.nceas.ucsb.edu/knb/d1/mn/v2</code>).
(e.g., <code><%=apiBaseUrl%></code>).
</p></blockquote>

</p>
Expand Down Expand Up @@ -173,7 +177,7 @@ <h3 id="requestFormat">Request Format</h3>
</ul>
<h3 id="responseFormat">Response Format</h3>
<p>Version 1.0 of the DataONE services only support XML serialization, and
this format MUST be used when communicating with the KNB.
this format MUST be used when communicating with the <%=title%>.
Request and response documents MUST also be encoded using UTF-8.</p>

<h3 id="auth">Authentication and Authorization</h3>
Expand All @@ -198,7 +202,7 @@ <h3 id="auth">Authentication and Authorization</h3>
tool will have is own mechanism for setting HTTP headers. For example, for curl an authenticated request
can be made using the '-H' command line option, such as:<code class="code_example">
$ export TOKEN='eyJhbGciOiJSUzI1NiJ9.eyJzdWIiOiJodHRwOlwvXC9vcmNp...'
$ curl -H "Authorization: Bearer $TOKEN" https://knb.ecoinformatics.org/knb/d1/mn/v2/object
$ curl -H "Authorization: Bearer $TOKEN" <%=apiBaseUrl%>/object
</code>
The token expires in 18 hours, and so a new token can be retrieved beforehand.
<blockquote><i class="icon icon-warning-sign icon-warning"></i>
Expand All @@ -215,7 +219,7 @@ <h3 id="auth">Authentication and Authorization</h3>
to download a client certificate,
which can then be included in requests as part of the SSL session with the host.
The Subject of the provided certificate
will be used by the KNB to determine all access control decisions for accessing,
will be used by the <%=title%> to determine all access control decisions for accessing,
creating, updating, archiving, and deleting objects. If a client-side certificate
is not provided, the user will be considered an anonymous <code>public</code> user
and will only be able to access public content.
Expand All @@ -228,7 +232,7 @@ <h3 id="auth">Authentication and Authorization</h3>
and later is broken and does not support providing PEM certificates via the command line.
Instead, it uses certificates registered in the system keychain, as described on the
<a href="http://curl.haxx.se/mail/archive-2014-10/0053.html">curl mailing list</a>.
Thus, calls to the KNB that require a certificate will fail on the standard Mac curl
Thus, calls to the <%=title%> that require a certificate will fail on the standard Mac curl
version, which can be fixed by replacing this with the MacPorts version
of curl, or by using a certificate converted to PK12 format. A workaround for these issues
is being explored, as the behavior differs in Mavericks and Yosemite.
Expand All @@ -249,7 +253,7 @@ <h3 name="get">Get an Object</h3>
<code>doi:10.5063%2FF1HT2M7Q</code> when used in a URL.

<code class="code_example">
ENDPOINT="https://knb.ecoinformatics.org/knb/d1/mn/v2"
ENDPOINT="<%=apiBaseUrl%>"
curl -X GET \
-H "Accept: text/xml" \
"${ENDPOINT}/object/doi:10.5063%2FF1HT2M7Q"
Expand Down Expand Up @@ -382,7 +386,7 @@ <h3 name="query">Search the metadata index</h3>
-H "Accept: text/xml" \
"${ENDPOINT}/query/solr"
</code>
<p>Example: To retrieve the download/view counts of a particular object in the KNB, use this Solr query:</p>
<p>Example: To retrieve the download/view counts of a particular object in the <%=title%>, use this Solr query:</p>
<code class="code_example">
curl -X GET \
-H "Accept: text/xml" \
Expand Down
11 changes: 10 additions & 1 deletion src/js/views/DataItemView.js
Original file line number Diff line number Diff line change
Expand Up @@ -457,14 +457,23 @@ define(['underscore', 'jquery', 'backbone', 'models/DataONEObject',
// Read each file, and make a DataONEObject
_.each(fileList, function(file) {

var uploadStatus = "l",
errorMessage = "";

if( file.size == 0 ){
uploadStatus = "e";
errorMessage = "This is an empty file. It won't be included in the dataset.";
}

var dataONEObject = new DataONEObject({
synced: true,
type: "Data",
fileName: file.name,
size: file.size,
mediaType: file.type,
uploadFile: file,
uploadStatus: "l",
uploadStatus: uploadStatus,
errorMessage: errorMessage,
isDocumentedBy: [this.parentSciMeta.id],
resourceMap: [this.collection.packageModel.id]
});
Expand Down
Loading

0 comments on commit 6c4f87c

Please sign in to comment.