Browse Source

Merge branch 'master' of github.com:thingsboard/thingsboard

pull/5457/head
Igor Kulikov 5 years ago
parent
commit
4dd4b4e06b
  1. 13
      ui-ngx/patches/canvas-gauges+2.1.7.patch
  2. 2
      ui-ngx/src/app/modules/home/components/dashboard-page/dashboard-page.component.html
  3. 9
      ui-ngx/src/app/modules/home/components/dashboard-page/dashboard-page.component.ts
  4. 12
      ui-ngx/src/app/modules/home/components/widget/lib/canvas-digital-gauge.ts
  5. 62
      ui-ngx/src/assets/locale/locale.constant-zh_CN.json

13
ui-ngx/patches/canvas-gauges+2.1.7.patch

File diff suppressed because one or more lines are too long

2
ui-ngx/src/app/modules/home/components/dashboard-page/dashboard-page.component.html

@ -148,7 +148,7 @@
<mat-drawer-content fxLayout="column" fxLayoutAlign="center start">
<section *ngIf="!widgetEditMode" class="tb-dashboard-title"
[ngStyle]="{'color': dashboard.configuration.settings.titleColor}">
<h3 [fxShow]="!isEdit && displayTitle()">{{ dashboard.title }}</h3>
<h3 [fxShow]="!isEdit && displayTitle()">{{ translatedDashboardTitle }}</h3>
<mat-form-field [fxShow]="isEdit" class="mat-block">
<mat-label translate [ngStyle]="{'color': dashboard.configuration.settings.titleColor}">dashboard.title</mat-label>
<input matInput class="tb-dashboard-title"

9
ui-ngx/src/app/modules/home/components/dashboard-page/dashboard-page.component.ts

@ -209,6 +209,8 @@ export class DashboardPageComponent extends PageComponent implements IDashboardC
thingsboardVersion: string = env.tbVersion;
translatedDashboardTitle: string;
currentDashboardId: string;
currentCustomerId: string;
currentDashboardScope: DashboardPageScope;
@ -375,6 +377,7 @@ export class DashboardPageComponent extends PageComponent implements IDashboardC
this.reset();
this.dashboard = data.dashboard;
this.translatedDashboardTitle = this.getTranslatedDashboardTitle();
if (!this.embedded && this.dashboard.id) {
this.setStateDashboardId = true;
}
@ -424,6 +427,7 @@ export class DashboardPageComponent extends PageComponent implements IDashboardC
private reset() {
this.dashboard = null;
this.translatedDashboardTitle = null;
this.dashboardConfiguration = null;
this.dashboardLogoCache = undefined;
this.prevDashboard = null;
@ -520,6 +524,10 @@ export class DashboardPageComponent extends PageComponent implements IDashboardC
}
}
private getTranslatedDashboardTitle(): string {
return this.utils.customTranslation(this.dashboard.title, this.dashboard.title);
}
public displayExport(): boolean {
if (this.dashboard.configuration.settings &&
isDefined(this.dashboard.configuration.settings.showDashboardExport)) {
@ -817,6 +825,7 @@ export class DashboardPageComponent extends PageComponent implements IDashboardC
}
public saveDashboard() {
this.translatedDashboardTitle = this.getTranslatedDashboardTitle();
this.setEditMode(false, false);
this.notifyDashboardUpdated();
}

12
ui-ngx/src/app/modules/home/components/widget/lib/canvas-digital-gauge.ts

@ -400,10 +400,8 @@ export class CanvasDigitalGauge extends BaseGauge {
const context = this.contextValueClone;
// clear the cache
context.clearRect(x, y, w, h);
context.save();
context.drawImage(canvas.elementClone, x, y, w, h);
context.save();
drawDigitalValue(context, options, this.elementValueClone.renderedValue);
@ -426,10 +424,8 @@ export class CanvasDigitalGauge extends BaseGauge {
const context = this.contextProgressClone;
// clear the cache
context.clearRect(x, y, w, h);
context.save();
context.drawImage(this.elementValueClone, x, y, w, h);
context.save();
if (Number(fixedProgress) > 0) {
drawProgress(context, options, progress);
@ -443,10 +439,8 @@ export class CanvasDigitalGauge extends BaseGauge {
// clear the canvas
canvas.context.clearRect(x, y, w, h);
canvas.context.save();
canvas.context.drawImage(this.elementProgressClone, x, y, w, h);
canvas.context.save();
// @ts-ignore
super.draw();
@ -754,6 +748,7 @@ function drawDigitalTitle(context: DigitalGaugeCanvasRenderingContext2D, options
context.font = Drawings.font(options, 'Title', fontSizeFactor);
context.lineWidth = 0;
drawText(context, options, 'Title', options.title.toUpperCase(), textX, textY);
context.restore();
}
function drawDigitalLabel(context: DigitalGaugeCanvasRenderingContext2D, options: CanvasDigitalGaugeOptions) {
@ -772,6 +767,7 @@ function drawDigitalLabel(context: DigitalGaugeCanvasRenderingContext2D, options
context.font = Drawings.font(options, 'Label', fontSizeFactor);
context.lineWidth = 0;
drawText(context, options, 'Label', options.label, textX, textY);
context.restore();
}
function drawDigitalMinMax(context: DigitalGaugeCanvasRenderingContext2D, options: CanvasDigitalGaugeOptions) {
@ -789,6 +785,7 @@ function drawDigitalMinMax(context: DigitalGaugeCanvasRenderingContext2D, option
context.lineWidth = 0;
drawText(context, options, 'MinMax', options.minValue + '', minX, minY);
drawText(context, options, 'MinMax', options.maxValue + '', maxX, maxY);
context.restore();
}
function drawDigitalValue(context: DigitalGaugeCanvasRenderingContext2D, options: CanvasDigitalGaugeOptions, value: any) {
@ -811,6 +808,7 @@ function drawDigitalValue(context: DigitalGaugeCanvasRenderingContext2D, options
context.font = Drawings.font(options, 'Value', fontSizeFactor);
context.lineWidth = 0;
drawText(context, options, 'Value', text, textX, textY);
context.restore();
}
function getProgressColor(progress: number, colorsRange: DigitalGaugeColorRange[]): string {
@ -944,6 +942,7 @@ function drawTickBar(context: DigitalGaugeCanvasRenderingContext2D, tickValues:
function drawProgress(context: DigitalGaugeCanvasRenderingContext2D,
options: CanvasDigitalGaugeOptions, progress: number) {
let neonColor;
context.save();
if (options.neonGlowBrightness) {
context.currentColor = neonColor = getProgressColor(progress, options.neonColorsRange);
} else {
@ -1019,4 +1018,5 @@ function drawProgress(context: DigitalGaugeCanvasRenderingContext2D,
true, options.colorTicks, options.tickWidth);
}
context.restore();
}

62
ui-ngx/src/assets/locale/locale.constant-zh_CN.json

@ -1924,6 +1924,68 @@
"sign-in": "登录 ",
"username": "用户名(电子邮件)"
},
"ota-update": {
"add": "添加包",
"assign-firmware": "分配的固件",
"assign-firmware-required": "分配的固件必填",
"assign-software": "分配的软件",
"assign-software-required": "分配的软件必填",
"auto-generate-checksum": "自动生成校验和",
"checksum": "校验和",
"checksum-hint": "如果校验和为空,会自动生成",
"checksum-algorithm": "校验和算法",
"checksum-copied-message": "包校验和已复制到剪贴板",
"change-firmware": "固件的更改可能会导致 { count, plural, 1 {1 个设备} other {# 个设备} } 的更新。",
"change-software": "软件的更改可能会导致 { count, plural, 1 {1 个设备} other {# 个设备} } 的更新。",
"chose-compatible-device-profile": "上传的包仅适用于具有所选配置文件的设备。",
"chose-firmware-distributed-device": "选择将分发到设备的固件",
"chose-software-distributed-device": "选择将分发到设备的软件",
"content-type": "内容类型",
"copy-checksum": "复制校验和",
"copy-direct-url": "复制直接URL",
"copyId": "复制包ID",
"copied": "已复制!",
"delete": "删除包",
"delete-ota-update-text": "小心,OTA升级确认后不可恢复。",
"delete-ota-update-title": "您确定要删除OTA升级'{{title}}'吗?",
"delete-ota-updates-text": "小心,确认后所有选中的OTA升级将被删除。",
"delete-ota-updates-title": "您确定要删除 { count, plural, 1 {1 OTA升级} other {# OTA升级} } 吗?",
"description": "描述",
"direct-url": "直接URL",
"direct-url-copied-message": "包直接URL已复制到剪贴板",
"direct-url-required": "直接URL必填",
"download": "下载包",
"drop-file": "拖放打包文件或点击选择要上传的文件。",
"file-name": "文件名",
"file-size": "文件大小",
"file-size-bytes": "文件大小(以字节为单位)",
"idCopiedMessage": "包ID已被复制到剪贴板",
"no-firmware-matching": "没有找到与'{{entity}}'匹配的兼容固件OTA升级包。",
"no-firmware-text": "没有提供兼容的固件OTA升级包。",
"no-packages-text": "没有找到包",
"no-software-matching": "没有找到匹配 '{{entity}}' 的兼容软件OTA升级包。",
"no-software-text": "没有提供兼容的软件OTA升级包。",
"ota-update": "OTA 升级",
"ota-update-details": "OTA 升级详情",
"ota-updates": "OTA 升级",
"package-type": "包类型",
"packages-repository": "包仓库",
"search": "搜索包",
"selected-package": "{ count, plural, 1 {1 个包} other {# 个包} } 选中",
"title": "标题",
"title-required": "标题必填。",
"types": {
"firmware": "固件",
"software": "软件"
},
"upload-binary-file": "上传二进制文件",
"use-external-url": "使用外部URL",
"version": "版本",
"version-required": "版本必填。",
"version-tag": "版本标签",
"version-tag-hint": "自定义标签应与您设备报告的软件包版本相匹配。",
"warning-after-save-no-edit": "上传包后,您将无法修改标题、版本、设备配置文件和包类型。"
},
"position": {
"bottom": "底部",
"left": "左侧",

Loading…
Cancel
Save