From bce99c66f0a2b8e5e66d3cbe318829ec478a17a2 Mon Sep 17 00:00:00 2001 From: gothub Date: Tue, 19 Oct 2021 11:04:52 -0700 Subject: [PATCH] Get node capabilities from MN if standalone repo Issue #1817 --- src/js/models/AppModel.js | 8 ++++++++ src/js/models/NodeModel.js | 7 ++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/js/models/AppModel.js b/src/js/models/AppModel.js index 3fbe5f654..5bf132608 100644 --- a/src/js/models/AppModel.js +++ b/src/js/models/AppModel.js @@ -451,6 +451,13 @@ define(['jquery', 'underscore', 'backbone'], */ nodeServiceUrl: null, /** + * The URL for the DataONE listNodes() API. This URL is contructed dynamically when the + * AppModel is initialized. Only override this if you are an advanced user and have a reason to! + * (see https://releases.dataone.org/online/api-documentation-v2.0/apis/CN_APIs.html#CNCore.listNodes) + * @type {string} + */ + getCapabilitiesServiceUrl: null, + /** * The URL for the DataONE View API. This URL is contructed dynamically when the * AppModel is initialized. Only override this if you are an advanced user and have a reason to! * (see https://releases.dataone.org/online/api-documentation-v2.0/apis/MN_APIs.html#module-MNView) @@ -1950,6 +1957,7 @@ define(['jquery', 'underscore', 'backbone'], urls.queryServiceUrl = baseUrl + '/query/solr/?'; urls.metaServiceUrl = baseUrl + '/meta/'; urls.packageServiceUrl = baseUrl + '/packages/application%2Fbagit-097/'; + urls.getCapabilitiesServiceUrl = baseUrl + '/'; if( d1Service.indexOf("mn") > 0 ){ urls.objectServiceUrl = baseUrl + '/object/'; diff --git a/src/js/models/NodeModel.js b/src/js/models/NodeModel.js index 25eb2fe7d..d0caef413 100644 --- a/src/js/models/NodeModel.js +++ b/src/js/models/NodeModel.js @@ -24,7 +24,11 @@ define(['jquery', 'underscore', 'backbone'], if(MetacatUI.appModel.get('nodeServiceUrl')){ //Get the node information from the CN this.getNodeInfo(); - } + } else if(MetacatUI.appModeel.get('getCapabilitiesServiceUrl')) { + // If the CN node service URL is not defined, see if we can get getCapabilities + // information from the node directly + this.getCapabilities(); + } }, getMember: function(memberInfo){ @@ -77,6 +81,7 @@ define(['jquery', 'underscore', 'backbone'], dataType: "text", success: function(data, textStatus, xhr) { +/ var xmlResponse = $.parseXML(data) || null; if(!xmlResponse) return;