Initial setup of mycontroller
This commit is contained in:
259
www/partials/operations/operations-add-edit.html
Normal file
259
www/partials/operations/operations-add-edit.html
Normal file
@@ -0,0 +1,259 @@
|
||||
<!--
|
||||
|
||||
Copyright (C) 2015-2016 Jeeva Kandasamy (jkandasa@gmail.com)
|
||||
|
||||
Licensed 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.
|
||||
|
||||
-->
|
||||
<div class="container-fluid"> <!-- Container-fluid -->
|
||||
|
||||
<!-- Loading icon disaplay -->
|
||||
<div ng-hide="operationTypes.$resolved">
|
||||
<div ng-include src="'partials/common-html/loading.html'"></div>
|
||||
</div>
|
||||
|
||||
<div ng-if="operationTypes.$resolved"> <!-- Main Message -->
|
||||
|
||||
<!-- Page Header -->
|
||||
<div ng-include src="'partials/common-html/header-add-update.html'"></div>
|
||||
|
||||
<div><!-- div-main -->
|
||||
<form class="form-horizontal" name="mcForm">
|
||||
<div class="col-md-7">
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">{{ 'NAME' | translate }}</label>
|
||||
<div class="col-sm-10 mc-form-fixer-left">
|
||||
<input class="form-control" placeholder="{{ 'OPERATION_NAME' | translate }}" ng-model="item.name" required/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">{{ 'ENABLED' | translate }}</label>
|
||||
<div class="col-sm-10">
|
||||
<input class="bootstrap-switch" id="bootstrap-switch-state" type="checkbox" ng-model="item.enabled" checked>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<legend><small>{{ 'OPERATION' | translate }}</small></legend>
|
||||
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">{{ 'TYPE' | translate }}</label>
|
||||
<div class="col-sm-4 mc-form-fixer-left">
|
||||
<select class="form-control" pf-select ng-options="nt.displayName as nt.displayName for nt in operationTypes | orderBy : 'id'" ng-model="item.type" required>
|
||||
<option value="" ng-hide="true"></option>
|
||||
</select>
|
||||
</div>
|
||||
<!-- Execute script Operation -->
|
||||
<div class="col-sm-6 mc-form-fixer" ng-if="item.type === 'Execute script'">
|
||||
<select class="form-control" pf-select ng-options="rT as rT for rT in scriptsList" ng-model="item.scriptFile" required>
|
||||
<option value="" ng-hide="true"></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div ng-if="item.type === 'Execute script' && item.scriptFile">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">{{ 'SCRIPT_BINDINGS' | translate }}</label>
|
||||
<div class="col-sm-10 mc-form-fixer-left">
|
||||
<input class="form-control" placeholder="{{ 'SCRIPT_BINDINGS' | translate }}" ng-model="item.altScriptBindings" pf-validation="cs.isJsonString(input)" required />
|
||||
<span class="help-block">{{ 'SYNTAX_ERROR' | translate }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- email Operation -->
|
||||
<div ng-if="item.type === 'Send email'">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">{{ 'SUBJECT' | translate }}</label>
|
||||
<div class="col-sm-10 ">
|
||||
<input class="form-control" placeholder="{{ 'SUBJECT' | translate }}" ng-model="item.emailSubject" required />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">{{ 'EMAILS' | translate }}</label>
|
||||
<div class="col-sm-10">
|
||||
<textarea class="form-control" placeholder="{{ 'EMAIL_ADDRESSES_COMMA_SEPARATED' | translate }}" ng-model="item.toEmailAddresses" rows="4" required />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">{{ 'TEMPLATE' | translate }}</label>
|
||||
<div class="col-sm-10">
|
||||
<select class="form-control" pf-select ng-options="rT as rT for rT in templatesList" ng-model="item.template" required>
|
||||
<option value="" ng-hide="true"></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">{{ 'TEMPLATE_BINDINGS' | translate }}</label>
|
||||
<div class="col-sm-10">
|
||||
<input class="form-control" placeholder="{{ 'TEMPLATE_BINDINGS' | translate }}" ng-model="item.altTemplateBindings" pf-validation="cs.isJsonString(input)" required />
|
||||
<span class="help-block">{{ 'SYNTAX_ERROR' | translate }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- SMS Operation -->
|
||||
<div ng-if="item.type === 'Send SMS'">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">{{ 'PHONE_NUMBERS' | translate }}</label>
|
||||
<div class="col-sm-10 ">
|
||||
<input class="form-control" placeholder="{{ 'PHONE_NUMBERS_COMMA_SEPARATED' | translate }}" ng-model="item.toPhoneNumbers" required />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">{{ 'CUSTOM_MESSAGE' | translate }}</label>
|
||||
<div class="col-sm-10">
|
||||
<textarea class="form-control" placeholder="{{ 'CUSTOM_MESSAGE' | translate }}" ng-model="item.customMessage" rows="4"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- TelegramBot Operation -->
|
||||
<div ng-if="item.type === 'Send telegram bot message'">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">{{ 'CHANNEL_USERNAME' | translate }}</label>
|
||||
<div class="col-sm-10 ">
|
||||
<input class="form-control" placeholder="{{ 'CHANNEL_USERNAME' | translate }}" ng-model="item.chatId" required />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">{{ 'PARSE_MODE' | translate }}</label>
|
||||
<div class="col-sm-10">
|
||||
<select pf-select ng-model="item.parseMode">
|
||||
<option value="" ng-hide="true"></option>
|
||||
<option value="Text">{{ 'TEXT' | translate }}</option>
|
||||
<option value="HTML">{{ 'HTML' | translate }}</option>
|
||||
<option value="Markdown">{{ 'MARKDOWN' | translate }}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">{{ 'CUSTOM_MESSAGE' | translate }}</label>
|
||||
<div class="col-sm-10">
|
||||
<textarea class="form-control" placeholder="{{ 'CUSTOM_MESSAGE' | translate }}" ng-model="item.customMessage" rows="4"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Pushbullet Operation -->
|
||||
<div ng-if="item.type === 'Send pushbullet note'">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">{{ 'DEVICE_IDENS' | translate }}</label>
|
||||
<div class="col-sm-10 ">
|
||||
<input class="form-control" placeholder="{{ 'DEVICE_IDENS_COMMA_SEPARATED' | translate }}" ng-model="item.idens" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">{{ 'EMAILS' | translate }}</label>
|
||||
<div class="col-sm-10 ">
|
||||
<input class="form-control" placeholder="{{ 'EMAIL_ADDRESSES_COMMA_SEPARATED' | translate }}" ng-model="item.emails" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">{{ 'CHANNEL_TAGS' | translate }}</label>
|
||||
<div class="col-sm-10 ">
|
||||
<input class="form-control" placeholder="{{ 'CHANNEL_TAGS_COMMA_SEPARATED' | translate }}" ng-model="item.channelTags" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<legend></legend>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">{{ 'TITLE' | translate }}</label>
|
||||
<div class="col-sm-10 ">
|
||||
<input class="form-control" placeholder="{{ 'TITLE' | translate }}" ng-model="item.title" required />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">{{ 'CUSTOM_MESSAGE' | translate }}</label>
|
||||
<div class="col-sm-10">
|
||||
<textarea class="form-control" placeholder="{{ 'CUSTOM_MESSAGE' | translate }}" ng-model="item.body" rows="4"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Send payload Operation -->
|
||||
<div ng-if="item.type === 'Send payload'">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">{{ 'RESOURCE' | translate }}</label>
|
||||
<div class="col-sm-4 mc-form-fixer-left">
|
||||
<select class="form-control" pf-select ng-options="rT.displayName as rT.displayName for rT in spResourceTypes | orderBy : 'id'"
|
||||
ng-change="plResourcesList = getResources(item.resourceType);updatePayloadOperations(item.resourceType);" ng-model="item.resourceType" required>
|
||||
<option value="" ng-hide="true"></option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-sm-6 mc-form-fixer" ng-hide="item.resourceType === ''"><!-- List Resource -->
|
||||
<select class="form-control" pf-select data-live-search="true" ng-model="item.resourceId" required>
|
||||
<option value="" ng-hide="true"></option>
|
||||
<option ng-repeat="res in plResourcesList" ng-bind-html="res.displayName | mcResourceRepresentation" value="{{res.id}}" ng-selected="res.id == item.resourceId"></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">{{ 'PAYLOAD_DELAY' | translate }}</label>
|
||||
<div class="col-sm-4 mc-form-fixer-left" ng-if="item.resourceType === 'Sensor variable'">
|
||||
<input class="form-control" placeholder="{{ 'PAYLOAD' | translate }}" ng-model="item.payload" required />
|
||||
</div>
|
||||
<div class="col-sm-4 mc-form-fixer-left" ng-if="item.resourceType !== 'Sensor variable'">
|
||||
<select class="form-control" pf-select ng-options="pos.id as pos.displayName for pos in payloadOperations" ng-model="item.payload" required>
|
||||
<option value="" ng-hide="true"></option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-sm-6 mc-form-fixer">
|
||||
<input class="form-control" placeholder="{{ 'DELAY_TIME_IN_SECONDS' | translate }}" ng-model="item.dt" pf-validation="cs.isNumber(input)" />
|
||||
<span class="help-block">{{ 'VALIDATION_ERROR_NUMBER' | translate }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- Request payload Operation -->
|
||||
<div ng-if="item.type === 'Request payload'">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">{{ 'RESOURCE' | translate }}</label>
|
||||
<div class="col-sm-4 mc-form-fixer-left">
|
||||
<select class="form-control" pf-select ng-options="rT.displayName as rT.displayName for rT in reqPlResourceTypes"
|
||||
ng-change="plResourcesList = getResources(item.resourceType);updatePayloadOperations(item.resourceType);" ng-model="item.resourceType" required>
|
||||
<option value="" ng-hide="true"></option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-sm-6 mc-form-fixer" ng-hide="item.resourceType === ''"><!-- List Resource -->
|
||||
<select class="form-control" pf-select data-live-search="true" ng-model="item.resourceId" required>
|
||||
<option value="" ng-hide="true"></option>
|
||||
<option ng-repeat="res in plResourcesList" ng-bind-html="res.displayName | mcResourceRepresentation" value="{{res.id}}" ng-selected="res.id == item.resourceId"></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Include save form buttons -->
|
||||
<div ng-include src="'partials/common-html/save-form.html'"></div>
|
||||
|
||||
</div>
|
||||
</form>
|
||||
</div><!-- div-main -->
|
||||
|
||||
</div> <!-- Main Message -->
|
||||
</div> <!-- container -->
|
||||
Reference in New Issue
Block a user