Browse Source

delete state gateway

pull/2627/head
nick 6 years ago
parent
commit
cddd8d7ea5
  1. 2
      application/src/main/resources/thingsboard.yml
  2. 18
      ui/src/app/components/gateway/state-gateway-dialog.scss
  3. 52
      ui/src/app/components/gateway/state-gateway-dialog.tpl.html
  4. 149
      ui/src/app/components/gateway/state-gateway-form.directive.js
  5. 18
      ui/src/app/components/gateway/state-gateway-form.scss
  6. 28
      ui/src/app/components/gateway/state-gateway-form.tpl.html

2
application/src/main/resources/thingsboard.yml

@ -380,7 +380,7 @@ spring:
database-platform: "${SPRING_JPA_DATABASE_PLATFORM:org.hibernate.dialect.PostgreSQLDialect}"
datasource:
driverClassName: "${SPRING_DRIVER_CLASS_NAME:org.postgresql.Driver}"
url: "${SPRING_DATASOURCE_URL:jdbc:postgresql://localhost:5432/thingsboard}"
url: "${SPRING_DATASOURCE_URL:jdbc:postgresql://localhost:5432/thingsboard_ce}"
username: "${SPRING_DATASOURCE_USERNAME:postgres}"
password: "${SPRING_DATASOURCE_PASSWORD:postgres}"
hikari:

18
ui/src/app/components/gateway/state-gateway-dialog.scss

@ -1,18 +0,0 @@
/**
* Copyright © 2016-2020 The Thingsboard Authors
*
* 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.
*/
.state-gateway-config-dialog {
width: 600px;
}

52
ui/src/app/components/gateway/state-gateway-dialog.tpl.html

@ -1,52 +0,0 @@
<!--
Copyright © 2016-2020 The Thingsboard Authors
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.
-->
<md-dialog class="state-gateway-config-dialog">
<md-toolbar>
<div class="md-toolbar-tools">
<h2 translate translate-values='{ typeName: "{{vm.typeName | translate}}" }'>
gateway.title-show-config
</h2>
<span flex></span>
<md-button class="md-icon-button"
ng-click="vm.cancel()"
aria-label="{{'action.close'|translate}}">
<ng-md-icon icon="close" aria-label="Close"></ng-md-icon>
</md-button>
</div>
</md-toolbar>
<md-dialog-content>
<div class="md-dialog-content">
<div tb-expand-fullscreen fullscreen-zindex="100" expand-button-id="expand-button" layout="column">
<div layout="row" layout-align="start center" class="tb-json-toolbar">
<label ng-if="vm.isReadOnly" class="tb-title no-padding" translate>gateway.read-only</label>
<label ng-if="!vm.isReadOnly" class="tb-title no-padding" translate>gateway.read-write</label>
<span flex></span>
<md-button id="expand-button" aria-label="Fullscreen"
class="md-icon-button tb-md-32 tb-fullscreen-button-style"></md-button>
</div>
<tb-gateway-form device-name = "vm.deviceName"
is-read-only="vm.isReadOnly"
is-state="vm.isState">
</tb-gateway-form>
</div>
</div>
</md-dialog-content>
</md-dialog>

149
ui/src/app/components/gateway/state-gateway-form.directive.js

@ -1,149 +0,0 @@
/*
* Copyright © 2016-2020 The Thingsboard Authors
*
* 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.
*/
import './state-gateway-form.scss';
import './state-gateway-dialog.scss';
/* eslint-disable import/no-unresolved, import/default */
import stateGatewayFormTemplate from './state-gateway-form.tpl.html';
import stateGatewayDialogTemplate from "./state-gateway-dialog.tpl.html";
/* eslint-enable import/no-unresolved, import/default */
export default angular.module('thingsboard.directives.stateGatewayForm', [])
.directive('tbStateGatewayForm', StateGatewayForm)
.name;
/*@ngInject*/
function StateGatewayForm() {
return {
restrict: "E",
scope: true,
bindToController: {
disabled: '=ngDisabled',
keyPlaceholderText: '@?',
valuePlaceholderText: '@?',
noDataText: '@?',
formId: '=',
ctx: '=',
theForm: '='
},
controller: StateGatewayFormController,
controllerAs: 'vm',
templateUrl: stateGatewayFormTemplate
};
}
/*@ngInject*/
function StateGatewayFormController($scope, $mdDialog, $injector, $document, $mdExpansionPanel, $translate, types, entityService, utils) {
$scope.$mdExpansionPanel = $mdExpansionPanel;
let vm = this;
vm.isReadOnly = false;
vm.isState = true;
vm.isDashboard = false;
$scope.$watch('vm.ctx', function() {
if (vm.ctx && vm.ctx.defaultSubscription) {
vm.settings = vm.ctx.settings;
if (vm.ctx.datasources && vm.ctx.datasources.length) {
vm.deviceName = vm.ctx.datasources[0].name;
vm.isDashboard = vm.deviceName ? true : false;
if (vm.ctx.settings) {
vm.isReadOnly = vm.ctx.settings.readOnly;
}
initializeConfig();
}
}
});
function updateWidgetDisplaying() {
if (vm.ctx && vm.ctx.$container) {
vm.changeAlignment = (vm.ctx.$container[0].offsetWidth <= 425);
}
}
function initWidgetSettings() {
if (vm.settings.stateGatewayTitle && vm.settings.stateGatewayTitle.length) {
vm.stateGatewayTitle = utils.customTranslation(vm.settings.stateGatewayTitle, vm.settings.stateGatewayTitle);
} else {
vm.stateGatewayTitle = $translate.instant('gateway.state-title');
}
vm.ctx.widgetActions = [vm.showConfig];
vm.ctx.widgetTitle = vm.stateGatewayTitle;
}
function initializeConfig() {
updateWidgetDisplaying();
initWidgetSettings();
}
$scope.$on('state-gateway-form-resize', function (event, formId) {
if (vm.formId == formId) {
updateWidgetDisplaying();
}
});
updateWidgetDisplaying();
vm.showConfig = {
name: "gateway.show-config-tip",
show: true,
onAction: function($event) {
vm.openShowConfigDialog($event)
},
icon: "visibility"
};
vm.openShowConfigDialog =($event) => {
if ($event) {
$event.stopPropagation();
}
$mdDialog.show({
controller: StateGatewayDialogController,
controllerAs: 'vm',
templateUrl: stateGatewayDialogTemplate,
parent: angular.element($document[0].body),
locals: {
deviceName: vm.deviceName,
isReadOnly: vm.isReadOnly,
isState: vm.isState
},
bindToController: true,
targetEvent: $event,
fullscreen: true,
multiple: true
}).then(function() {
}, function () {
});
}
}
/*@ngInject*/
function StateGatewayDialogController($scope, $mdDialog, deviceName, isReadOnly, isState) {
let vm = this;
vm.deviceName = deviceName;
vm.isReadOnly = isReadOnly;
vm.isState = isState;
vm.cancel = () => {
$mdDialog.hide();
};
}

18
ui/src/app/components/gateway/state-gateway-form.scss

@ -1,18 +0,0 @@
/**
* Copyright © 2016-2020 The Thingsboard Authors
*
* 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.
*/
.state-gateway-form {
padding: 5px 5px 0;
}

28
ui/src/app/components/gateway/state-gateway-form.tpl.html

@ -1,28 +0,0 @@
<!--
Copyright © 2016-2020 The Thingsboard Authors
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.
-->
<form name="stateGatewayConfiguration" class="state-gateway-form">
<md-input-container class="md-block">
<label>{{'gateway.gateway-name' | translate }}</label>
<input ng-if="vm.isDashboard" ng-disabled="true" type="text" ng-model="vm.deviceName" name="gatewayName"/>
</md-input-container>
<!-- <md-switch ng-model="vm.isReadOnly"-->
<!-- aria-label="{{ 'gateway.read-only' | translate }}">-->
<!-- {{'gateway.read-only' | translate }}-->
<!-- </md-switch>-->
</form>
Loading…
Cancel
Save