Merge pull request #300 from ayyoob/transport

added support to load device type configuration in  base ui
4.x.x
Ruwan 9 years ago committed by GitHub
commit e8cfb1ea45

@ -119,7 +119,7 @@ var util = function () {
encodedExtractedAssertion = this.encode(extractedAssertion);
var xhr = new XMLHttpRequest();
var tokenEndpoint = devicemgtProps.idPServer + "/oauth2/token";
var tokenEndpoint = devicemgtProps.idPServer + "/token";
xhr.open("POST", tokenEndpoint, false);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.setRequestHeader("Authorization", "Basic " + clientKeys);
@ -140,7 +140,7 @@ var util = function () {
module.refreshToken = function (tokenPair, clientData, scope) {
var xhr = new XMLHttpRequest();
var tokenEndpoint = devicemgtProps.idPServer + "/oauth2/token";
var tokenEndpoint = devicemgtProps.idPServer + "/token";
xhr.open("POST", tokenEndpoint, false);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.setRequestHeader("Authorization", "Basic " + clientData);

@ -32,18 +32,25 @@
<div class="wr-advance-operations">
<div class="row no-gutter">
<div class="wr-hidden-operations-nav col-lg-4">
<a class="selected">
<a id="generalConfigLink" href="javascript:void(0)" onclick="showAdvanceOperation('general', this)" class="selected">
<span class="wr-hidden-operations-icon fw-stack">
<i class="fw fw-settings fw-stack-2x"></i>
</span>
General Configurations
</a>
{{#each deviceTypes}}
<a id="{{name}}ConfigLink" href="javascript:void(0)" onclick="showAdvanceOperation('{{name}}', this)">
<span class="wr-hidden-operations-icon fw-stack">
<i class="fw fw-settings fw-stack-2x"></i>
</span>
{{label}} Configurations
</a>
{{/each}}
</div>
<div class="wr-hidden-operations-content col-lg-8">
<!-- general -->
<div class="wr-hidden-operation" data-operation="general"
style="display: block">
<div class="wr-hidden-operation" data-operation="general" style="display: block">
<div class="panel panel-default">
<div id="general-config-heading" class="panel-heading" role="tab">
<h2 class="sub-title panel-title">
@ -78,6 +85,12 @@
</div>
</div>
<!-- general-->
{{#each deviceTypes}}
<div class="wr-hidden-operation" data-operation="{{name}}" style="display: none;">
{{unit unitName}}
</div>
{{/each}}
</div>
</div>
</div>

@ -0,0 +1,36 @@
/*
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function onRequest(context) {
var utility = require("/app/modules/device.js").utility;
var deviceModule = require("/app/modules/device.js").deviceModule;
//get all device types
var data = deviceModule.getDeviceTypes();
var deviceTypesArray = [];
if (data) {
for (var i = 0; i < data.length; i++) {
var deviceTypeName = data[i].name;
var configUnitName = utility.getTenantedDeviceUnitName(deviceTypeName, "platform.configuration");
if(configUnitName) {
var deviceTypeConfig = utility.getDeviceTypeConfig(deviceTypeName);
deviceTypesArray.push({name: deviceTypeName, label:deviceTypeConfig.deviceType.label, unitName : configUnitName});
}
}
}
return {"deviceTypes" : deviceTypesArray};
}

@ -24,7 +24,7 @@
<WebappPublisherConfigs>
<!-- This host is used to define the host address which is used to publish APIs -->
<Host>http://localhost:${carbon.http.port}</Host>
<Host>https://localhost:${carbon.https.port}</Host>
<!-- If it is true, the APIs of this instance will be published to the defined host -->
<PublishAPI>true</PublishAPI>

Loading…
Cancel
Save