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 -->
|
||||
102
www/partials/operations/operations-list.html
Normal file
102
www/partials/operations/operations-list.html
Normal file
@@ -0,0 +1,102 @@
|
||||
<!--
|
||||
|
||||
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="queryResponse.$resolved">
|
||||
<div ng-include src="'partials/common-html/loading.html'"></div>
|
||||
</div>
|
||||
|
||||
<div ng-show="queryResponse.$resolved"> <!-- Main Message -->
|
||||
|
||||
<!-- Page Header -->
|
||||
<div ng-include src="'partials/common-html/header-list.html'"></div>
|
||||
|
||||
<div class="col-md-12">
|
||||
<div class="btn-toolbar pull-right" role="toolbar">
|
||||
<div class="btn-group mc-side-space" ng-show="filteredList.length > 0">
|
||||
<label class="mc-align-center mc-top-space-5px">Showing {{(query.pageLimit * (query.page - 1))+1}} to {{getMin(getMin(query.pageLimit * query.page, queryResponse.query.totalItems), queryResponse.query.filteredCount)}} of {{queryResponse.query.totalItems}} items</label>
|
||||
</div>
|
||||
|
||||
<div class="btn-group" role="group" aria-label="" ng-show="filteredList.length > 0">
|
||||
<!-- Single button -->
|
||||
<div class="btn-group">
|
||||
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" ng-disabled="itemIds.length == 0">
|
||||
{{ 'ACTIONS' | translate }} <span class="caret"></span>
|
||||
</button>
|
||||
<ul class="dropdown-menu">
|
||||
<li ng-class="{'disabled': itemIds.length == 0}"><a href='' ng-click="itemIds.length == 0 || delete()" class="text-danger"><i class="fa fa-lg fa-trash"></i> {{ 'DELETE' | translate }}</a></li>
|
||||
<li ng-class="{'disabled': itemIds.length != 1}"><a href='' ng-click="itemIds.length != 1 || edit()" class="text-default"><i class="fa fa-lg fa-edit"></i> {{ 'EDIT' | translate }}</a></li>
|
||||
<li ng-class="{'disabled': itemIds.length != 1}"><a href='' ng-click="itemIds.length != 1 || clone()" class="text-default"><i class="fa fa-lg fa-files-o"></i> {{ 'CLONE' | translate }}</a></li>
|
||||
<li ng-class="{'disabled': itemIds.length == 0}"><a href='' ng-click="itemIds.length == 0 || enable()" class="text-default"><i class="fa fa-lg fa-circle"></i> {{ 'ENABLE' | translate }}</a></li>
|
||||
<li ng-class="{'disabled': itemIds.length == 0}"><a href='' ng-click="itemIds.length == 0 || disable()" class="text-danger"><i class="fa fa-lg fa-circle-thin"></i> {{ 'DISABLE' | translate }}</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="btn-group" role="group">
|
||||
<a class="btn btn-primary" type="button" ui-sref="operationsAddEdit"><i class="fa fa-plus"></i> {{ 'ADD' | translate }}</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="pull-right mc-v-margin" ng-show="filteredList.length > 0">
|
||||
<div pf-sort id="itemsSort" config="sortConfig"></div>
|
||||
</div>
|
||||
|
||||
<div pf-filter id="itemsFilter" config="filterConfig" ng-show="queryResponse.query.totalItems > 0"></div>
|
||||
</div>
|
||||
|
||||
<!-- Display No Items on system -->
|
||||
<div ng-include src="'partials/common-html/no-items-system.html'"></div>
|
||||
|
||||
<!-- Display When no data on table -->
|
||||
<div ng-include src="'partials/common-html/no-items-filter.html'"></div>
|
||||
|
||||
<div ng-show="filteredList.length > 0">
|
||||
<!-- Table -->
|
||||
<table class="table table-hover table-bordered table-striped mc-table">
|
||||
<thead>
|
||||
<th class="mc-align-center"><input type="checkbox" ng-checked="itemIds.length == filteredList.length" ng-click="selectAllItems()"></th>
|
||||
<th>{{ 'ENABLED' | translate }}</th>
|
||||
<th>{{ 'NAME' | translate }}</th>
|
||||
<th>{{ 'OPERATION' | translate }}</th>
|
||||
<th>{{ 'LAST_EXECUTION' | translate }}</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr dir-paginate="item in filteredList | itemsPerPage: query.pageLimit" total-items="queryResponse.query.totalItems" current-page="currentPage"
|
||||
ng-class="{'mc-selected': itemIds.indexOf(item.id) != -1}" ng-click="selectItem(item)">
|
||||
<td class="mc-align-center"><input type="checkbox" ng-checked="itemIds.indexOf(item.id) != -1"></td>
|
||||
<td class="text-center">
|
||||
<i ng-if="item.enabled" class="text-success fa fa-circle fa-lg" uib-tooltip="{{ 'ENABLED' | translate }}"></i>
|
||||
<i ng-if="!item.enabled" class="text-danger fa fa-circle-o fa-lg" uib-tooltip="{{ 'DISABLED' | translate }}"></i>
|
||||
</td>
|
||||
<td>{{item.name}}</td>
|
||||
<td ng-bind-html="item.operationString | mcResourceRepresentation"></td>
|
||||
<td>
|
||||
<span uib-tooltip="{{item.lastExecution | date:mchelper.cfg.dateFormat:mchelper.cfg.timezone}}" tooltip-placement="left" am-time-ago="item.lastExecution"></span>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<dir-pagination-controls class="pull-right" boundary-links="true" on-page-change="pageChanged(newPageNumber)"></dir-pagination-controls>
|
||||
</div>
|
||||
|
||||
</div> <!-- Main Message -->
|
||||
|
||||
</div> <!-- Container-fluid -->
|
||||
Reference in New Issue
Block a user