wso2 carbon 如何修复 Cannot read 属性 'getTenantDomain' of undefined at getGadgetLocation?
wso2 carbon how to fix Cannot read property 'getTenantDomain' of undefined at getGadgetLocation?
我目前在 wso2 carbon 工作。我开发了一个小工具并成功集成,但是小工具-util.js 文件显示
错误
Uncaught TypeError: Cannot read property 'getTenantDomain' of undefined
at getGadgetLocation
我的代码是gadget-util.js
var getGadgetLocation = function (callback) {
var gadgetLocation = "/portal/store/carbon.super/fs/gadget/circle_d3";
var PATH_SEPERATOR = "/";
if (gadgetLocation.search("store") != -1)
{
wso2.gadgets.identity.getTenantDomain(function (tenantDomain) {
var gadgetPath = gadgetLocation.split(PATH_SEPERATOR);
var modifiedPath = '';
for (var i = 1; i < gadgetPath.length; i++) {
if (i === 3) {
modifiedPath = modifiedPath.concat(PATH_SEPERATOR, tenantDomain);
} else {
modifiedPath = modifiedPath.concat(PATH_SEPERATOR, gadgetPath[i])
}
}
callback(modifiedPath);
});
} else {
callback(gadgetLocation)
}
callback(gadgetLocation);
}
请帮帮我
您需要在 gadget.xml
中要求身份特征[1]
<Require feature="wso2-gadgets-identity" />
[1] http://mail.wso2.org/mailarchive/dev/2016-August/066568.html
我目前在 wso2 carbon 工作。我开发了一个小工具并成功集成,但是小工具-util.js 文件显示
错误 Uncaught TypeError: Cannot read property 'getTenantDomain' of undefined
at getGadgetLocation
我的代码是gadget-util.js
var getGadgetLocation = function (callback) {
var gadgetLocation = "/portal/store/carbon.super/fs/gadget/circle_d3";
var PATH_SEPERATOR = "/";
if (gadgetLocation.search("store") != -1)
{
wso2.gadgets.identity.getTenantDomain(function (tenantDomain) {
var gadgetPath = gadgetLocation.split(PATH_SEPERATOR);
var modifiedPath = '';
for (var i = 1; i < gadgetPath.length; i++) {
if (i === 3) {
modifiedPath = modifiedPath.concat(PATH_SEPERATOR, tenantDomain);
} else {
modifiedPath = modifiedPath.concat(PATH_SEPERATOR, gadgetPath[i])
}
}
callback(modifiedPath);
});
} else {
callback(gadgetLocation)
}
callback(gadgetLocation);
}
请帮帮我
您需要在 gadget.xml
中要求身份特征[1]<Require feature="wso2-gadgets-identity" />
[1] http://mail.wso2.org/mailarchive/dev/2016-August/066568.html