Browse Source

Merge pull request #59 from deaflynx/develop/2.6-edge

edgeEvents refactored
pull/3693/head
VoBa 6 years ago
committed by GitHub
parent
commit
95476b6c0c
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 12
      ui/src/app/common/types.constant.js
  2. 4
      ui/src/app/customer/customer-fieldset.tpl.html
  3. 13
      ui/src/app/edge/edge-fieldset.tpl.html
  4. 2
      ui/src/app/event/event-row-edge-event.tpl.html
  5. 18
      ui/src/app/event/event-row.directive.js
  6. 11
      ui/src/app/event/event-table.directive.js
  7. 4
      ui/src/app/locale/locale.constant-de_DE.json
  8. 6
      ui/src/app/locale/locale.constant-en_US.json
  9. 4
      ui/src/app/locale/locale.constant-es_ES.json
  10. 4
      ui/src/app/locale/locale.constant-fr_FR.json

12
ui/src/app/common/types.constant.js

@ -13,6 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { grey300, grey900 } from 'material-ui/styles/colors';
export default angular.module('thingsboard.types', [])
.constant('types',
{
@ -403,6 +405,16 @@ export default angular.module('thingsboard.types', [])
widgetType: "WIDGET_TYPE",
adminSettings: "ADMIN_SETTINGS"
},
edgeEventStatus: {
"DEPLOYED": {
name: "edge.deployed",
color: grey900
},
"PENDING": {
name: "edge.pending",
color: grey300
}
},
edgeAttributeKeys: {
active: "active",
lastConnectTime: "lastConnectTime",

4
ui/src/app/customer/customer-fieldset.tpl.html

@ -16,10 +16,10 @@
-->
<md-button ng-click="onManageUsers({event: $event})" ng-show="!isEdit && !isPublic" class="md-raised md-primary">{{ 'customer.manage-users' | translate }}</md-button>
<md-button ng-click="onManageAssets({event: $event})" ng-show="!isEdit && !isPublic" class="md-raised md-primary">{{ 'customer.manage-assets' | translate }}</md-button>
<md-button ng-click="onManageAssets({event: $event})" ng-show="!isEdit" class="md-raised md-primary">{{ 'customer.manage-assets' | translate }}</md-button>
<md-button ng-click="onManageDevices({event: $event})" ng-show="!isEdit" class="md-raised md-primary">{{ 'customer.manage-devices' | translate }}</md-button>
<md-button ng-click="onManageDashboards({event: $event})" ng-show="!isEdit" class="md-raised md-primary">{{ 'customer.manage-dashboards' | translate }}</md-button>
<md-button ng-click="onManageEdges({event: $event})" ng-show="!isEdit && !isPublic" class="md-raised md-primary">{{ 'customer.manage-edges' | translate }}</md-button>
<md-button ng-click="onManageEdges({event: $event})" ng-show="!isEdit" class="md-raised md-primary">{{ 'customer.manage-edges' | translate }}</md-button>
<md-button ng-click="onDeleteCustomer({event: $event})" ng-show="!isEdit && !isPublic" class="md-raised md-primary">{{ 'customer.delete' | translate }}</md-button>
<div layout="row">

13
ui/src/app/edge/edge-fieldset.tpl.html

@ -48,12 +48,6 @@
<md-icon md-svg-icon="mdi:clipboard-arrow-left"></md-icon>
<span translate>edge.copy-id</span>
</md-button>
<md-button ng-click="onEdgeSync(edge.id)"
ng-show="!isEdit"
class="md-raised">
<md-icon md-svg-icon="mdi:sync"></md-icon>
<span translate>edge.sync</span>
</md-button>
<md-button ngclipboard data-clipboard-action="copy"
ngclipboard-success="onEdgeInfoCopied('key')"
data-clipboard-text="{{edge.routingKey}}" ng-show="!isEdit"
@ -68,6 +62,12 @@
<md-icon md-svg-icon="mdi:clipboard-arrow-left"></md-icon>
<span translate>edge.copy-edge-secret</span>
</md-button>
<md-button ng-click="onEdgeSync(edge.id)"
ng-show="!isEdit"
class="md-raised">
<md-icon md-svg-icon="mdi:sync"></md-icon>
<span translate>edge.sync</span>
</md-button>
</div>
<md-content class="md-padding" layout="column">
@ -119,6 +119,7 @@
</md-input-container>
</fieldset>
<div layout="row">
<md-input-container class="md-block" flex>
<label translate>edge.edge-key</label>
<input ng-model="edge.routingKey" disabled>

2
ui/src/app/event/event-row-edge-event.tpl.html

@ -19,7 +19,7 @@
<div class="tb-cell" flex="20">{{ event.type }}</div>
<div class="tb-cell" flex="40">{{ event.action }}</div>
<div class="tb-cell" flex="20">{{ event.entityId }}</div>
<div class="tb-cell" flex="15" ng-style="isPending ? {'color': 'rgba(0, 0, 0, .38)'} : {'color': '#000'}">{{ updateStatus(event.createdTime) | translate }}</div>
<div class="tb-cell" flex="15" ng-style="{'color': statusColor}">{{ updateStatus(event.createdTime) }}</div>
<div class="tb-cell" flex="10">
<md-button ng-if="checkEdgeEventType(event.type)" class="md-icon-button md-primary"
ng-click="showEdgeEntityContent($event, 'edge.entity-info', 'JSON')"

18
ui/src/app/event/event-row.directive.js

@ -167,17 +167,15 @@ export default function EventRowDirective($compile, $templateCache, $mdDialog, $
$compile(element.contents())(scope);
scope.updateStatus = function(eventCreatedTime) {
if (scope.queueStartTs) {
var status;
if (eventCreatedTime < scope.queueStartTs) {
status = $translate.instant('edge.success');
scope.isPending = false;
} else {
status = $translate.instant('edge.failed');
scope.isPending = true;
}
return status;
var status;
if (eventCreatedTime < scope.queueStartTs) {
status = $translate.instant(types.edgeEventStatus.DEPLOYED.name);
scope.statusColor = types.edgeEventStatus.DEPLOYED.color;
} else {
status = $translate.instant(types.edgeEventStatus.PENDING.name);
scope.statusColor = types.edgeEventStatus.PENDING.color;
}
return status;
}
}

11
ui/src/app/event/event-table.directive.js

@ -142,7 +142,6 @@ export default function EventTableDirective($compile, $templateCache, $rootScope
scope.$watch("entityId", function(newVal, prevVal) {
if (newVal && !angular.equals(newVal, prevVal)) {
scope.loadEdgeInfo();
scope.resetFilter();
scope.reload();
}
@ -221,7 +220,6 @@ export default function EventTableDirective($compile, $templateCache, $rootScope
}
scope.subscriptionId = null;
scope.queueStartTs = 0;
scope.loadEdgeInfo = function() {
attributeService.getEntityAttributesValues(
@ -229,11 +227,10 @@ export default function EventTableDirective($compile, $templateCache, $rootScope
scope.entityId,
types.attributesScope.server.value,
types.edgeAttributeKeys.queueStartTs,
{})
.then(function success(attributes) {
scope.onEdgeAttributesUpdate(attributes);
});
null).then(
function success(attributes) {
attributes.length > 0 ? scope.onEdgeAttributesUpdate(attributes) : scope.queueStartTs = 0;
});
scope.checkSubscription();
}

4
ui/src/app/locale/locale.constant-de_DE.json

@ -805,8 +805,8 @@
"set-root-rule-chain-to-edges": "Regelkette zur Wurzel machen für die Rand",
"set-root-rule-chain-to-edges-text": "Die Regelkette zur Wurzel für { count, plural, 1 {1 Rand} other {# Rand} } machen",
"status": "Von Rand empfangen",
"success": "Bereitgestellt",
"failed": "Steht aus",
"deployed": "Bereitgestellt",
"pending": "Steht aus",
"entity-id": "Entität ID",
"entity-info": "Entitätsinfo",
"event-action": "Ereignisaktion",

6
ui/src/app/locale/locale.constant-en_US.json

@ -819,7 +819,7 @@
"make-private-edge-text": "After the confirmation the edge and all its data will be made private and won't be accessible by others.",
"import": "Import edge",
"label": "Label",
"load-entity-error": "Entity not found. Failed to load info",
"load-entity-error": "Failed to load data. Entity not found or has been deleted.",
"assign-new-edge": "Assign new edge",
"manage-edge-dashboards": "Manage edge dashboards",
"unassign-from-edge": "Unassign from edge",
@ -843,8 +843,8 @@
"set-root-rule-chain-to-edges": "Set root rule chain for Edge(s)",
"set-root-rule-chain-to-edges-text": "Set root rule chain for { count, plural, 1 {1 edge} other {# edges} }",
"status": "Received by edge",
"success": "Deployed",
"failed": "Pending"
"deployed": "Deployed",
"pending": "Pending"
},
"error": {
"unable-to-connect": "Unable to connect to the server! Please check your internet connection.",

4
ui/src/app/locale/locale.constant-es_ES.json

@ -818,8 +818,8 @@
"set-root-rule-chain-to-edges": "Establecer la cadena de reglas raíz para Edge (s)",
"set-root-rule-chain-to-edges-text": "Establecer la cadena de la regla raíz para {count, plural, 1 {1 borde} other {# bordes}}",
"status": "Recibido por borde",
"success": "Desplegada",
"failed": "Pendiente",
"deployed": "Desplegada",
"pending": "Pendiente",
"entity-id": "ID de entidad",
"entity-info": "Entity info",
"event-action": "Información de la entidad",

4
ui/src/app/locale/locale.constant-fr_FR.json

@ -823,8 +823,8 @@
"set-root-rule-chain-to-edges": "Définir la chaîne de règles racine pour bordure(s)",
"set-root-rule-chain-to-edges-text": "Définir la chaîne de règles racine pour {count, plural, 1 {1 bordure} other {# bordures} }",
"status": "Reçu par bord",
"success": "Déployée",
"failed": "En attente",
"deployed": "Déployée",
"pending": "En attente",
"entity-id": "ID d'entité",
"entity-info": "Informations sur l'entité",
"event-action": "Action d'événement",

Loading…
Cancel
Save