forked from community/device-mgt-plugins
parent
9cfb57e983
commit
afcabb7fbc
@ -1,88 +0,0 @@
|
||||
<style>
|
||||
::-webkit-input-placeholder { color:#161616; }
|
||||
::-moz-placeholder { color:#161616; }
|
||||
:-ms-input-placeholder { color:#161616; }
|
||||
input:-moz-placeholder { color:#161616; }
|
||||
</style>
|
||||
|
||||
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading" role="tab" id="headingOne">
|
||||
<h2 class="sub-title panel-title">
|
||||
<a data-toggle="collapse"
|
||||
href="#collapseOne" aria-expanded="true"
|
||||
aria-controls="collapseOne">
|
||||
<span class="fw-stack">
|
||||
<i class="fw fw-ring fw-stack-2x"></i>
|
||||
<i class="fw fw-arrow fw-down fw-stack-1x"></i>
|
||||
</span>
|
||||
Device Operations
|
||||
</a>
|
||||
</h2>
|
||||
</div>
|
||||
<div id="collapseOne" class="panel-collapse collapse in"
|
||||
role="tabpanel" aria-labelledby="headingOne">
|
||||
<div id="device-location" class="panel-body">
|
||||
{{#if control_operations}}
|
||||
{{#each control_operations}}
|
||||
<form action="{{@app.context}}/api/operations/{{../../device.type}}/{{operation}}" method="post">
|
||||
<div class="row">
|
||||
<div class="wr-input-control">
|
||||
<label class="wr-input-label">{{name}}</label>
|
||||
<input type="hidden" name="owner"
|
||||
value={{../../device.owner}}>
|
||||
<input type="hidden" name="deviceId"
|
||||
value={{../../device.deviceIdentifier}}>
|
||||
|
||||
{{#if editcontent}}
|
||||
<input type="text" name="path"
|
||||
placeholder="page no">
|
||||
<input type="text" name="attribute"
|
||||
placeholder="attribute">
|
||||
<input type="text" name="new-value"
|
||||
placeholder="new-value">
|
||||
{{/if}}
|
||||
|
||||
{{#if add}}
|
||||
<input type="text" name="type"
|
||||
placeholder="type">
|
||||
<input type="text" name="time"
|
||||
placeholder="time">
|
||||
<input type="text" name="path"
|
||||
placeholder="page no">
|
||||
{{/if}}
|
||||
|
||||
{{#if before}}
|
||||
<input type="text" name="next-page"
|
||||
placeholder="next-page">
|
||||
{{/if}}
|
||||
{{#if after}}
|
||||
<input type="text" name="before-page"
|
||||
placeholder="before-page">
|
||||
{{/if}}
|
||||
{{#if removeresource}}
|
||||
<input type="text" name="path"
|
||||
placeholder="page no">
|
||||
{{/if}}
|
||||
{{#if remove}}
|
||||
<input type="text" name="directory-name"
|
||||
placeholder="directory-name">
|
||||
{{/if}}
|
||||
{{#if content}}
|
||||
<input type="text" name="content"
|
||||
placeholder="content">
|
||||
{{/if}}
|
||||
|
||||
<button class="wr-btn"> Send
|
||||
to Device </button>
|
||||
<label id="lblSending" class="wr-input-label hidden"><i class="fw fw-lifecycle fw-spin fw-2x"></i> Sending..</label>
|
||||
<label id="lblSent" class="wr-input-label hidden"><i class="fw fw-check fw-2x"></i> Sent</label>
|
||||
<label id="lblLastState" class="wr-input-label wr-input-label-status"></label>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
{{/each}}
|
||||
{{/if}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
@ -1,6 +0,0 @@
|
||||
function onRequest(context) {
|
||||
var operationModule = require("/app/modules/operation.js").operationModule;
|
||||
var device = context.unit.params.device;
|
||||
var control_operations = operationModule.getControlOperations(device.type);
|
||||
return {"control_operations": control_operations, "device": device};
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
{
|
||||
"version": "1.0.0"
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 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.
|
||||
*/
|
||||
|
||||
$("form").on('submit', function (e) {
|
||||
var postOperationRequest = $.ajax({
|
||||
url: $(this).attr("action") + '&' + $(this).serialize(),
|
||||
method: "post"
|
||||
});
|
||||
|
||||
var lblSending = $('#lblSending', this);
|
||||
lblSending.removeClass('hidden');
|
||||
|
||||
var lblSent = $('#lblSent', this);
|
||||
postOperationRequest.done(function (data) {
|
||||
lblSending.addClass('hidden');
|
||||
lblSent.removeClass('hidden');
|
||||
setTimeout(function () {
|
||||
lblSent.addClass('hidden');
|
||||
}, 3000);
|
||||
});
|
||||
|
||||
postOperationRequest.fail(function (jqXHR, textStatus) {
|
||||
lblSending.addClass('hidden');
|
||||
lblSent.addClass('hidden');
|
||||
});
|
||||
e.preventDefault();
|
||||
});
|
Loading…
Reference in new issue