Removed provision type
This commit is contained in:
parent
6c652a73a8
commit
977d60bbcb
@ -36,26 +36,7 @@
|
|||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</div>
|
</div>
|
||||||
<ng-container [formGroup]="mobileActionTypeFormGroup" [ngSwitch]="mobileActionFormGroup.get('type').value">
|
<ng-container [formGroup]="mobileActionTypeFormGroup" [ngSwitch]="mobileActionFormGroup.get('type').value">
|
||||||
<ng-template [ngSwitchCase]="mobileActionType.provisioningDevice">
|
<ng-template [ngSwitchCase]="mobileActionType.provisionDevice">
|
||||||
<div class="tb-form-row">
|
|
||||||
<div class="fixed-title-width">{{ 'widget-action.mobile.provisioning-device.type' | translate }}*</div>
|
|
||||||
<mat-form-field class="flex-1" appearance="outline" subscriptSizing="dynamic">
|
|
||||||
<mat-select required formControlName="provisionType" placeholder="{{ 'widget-action.mobile.provisioning-device.select-type' | translate }}">
|
|
||||||
<mat-option *ngFor="let actionType of mobileProvisionTypes" [value]="actionType">
|
|
||||||
{{ widgetMobileProvisionTypeTranslationMap.get(mobileProvisionType[actionType]) | translate }}
|
|
||||||
</mat-option>
|
|
||||||
</mat-select>
|
|
||||||
<mat-icon matSuffix
|
|
||||||
matTooltipPosition="above"
|
|
||||||
matTooltipClass="tb-error-tooltip"
|
|
||||||
[matTooltip]="'widget-action.mobile.provisioning-device.type-required' | translate"
|
|
||||||
*ngIf="mobileActionTypeFormGroup.get('provisionType').hasError('required')
|
|
||||||
&& mobileActionTypeFormGroup.get('provisionType').touched"
|
|
||||||
class="tb-error">
|
|
||||||
warning
|
|
||||||
</mat-icon>
|
|
||||||
</mat-form-field>
|
|
||||||
</div>
|
|
||||||
<tb-js-func
|
<tb-js-func
|
||||||
formControlName="handleProvisionSuccessFunction"
|
formControlName="handleProvisionSuccessFunction"
|
||||||
functionName="handleProvisionSuccess"
|
functionName="handleProvisionSuccess"
|
||||||
|
|||||||
@ -24,12 +24,10 @@ import {
|
|||||||
} from '@angular/forms';
|
} from '@angular/forms';
|
||||||
import { coerceBooleanProperty } from '@angular/cdk/coercion';
|
import { coerceBooleanProperty } from '@angular/cdk/coercion';
|
||||||
import {
|
import {
|
||||||
WidgetMobileProvisionType,
|
|
||||||
WidgetActionType,
|
WidgetActionType,
|
||||||
WidgetMobileActionDescriptor,
|
WidgetMobileActionDescriptor,
|
||||||
WidgetMobileActionType,
|
WidgetMobileActionType,
|
||||||
widgetMobileActionTypeTranslationMap,
|
widgetMobileActionTypeTranslationMap,
|
||||||
widgetMobileProvisionTypeTranslationMap
|
|
||||||
} from '@shared/models/widget.models';
|
} from '@shared/models/widget.models';
|
||||||
import { CustomActionEditorCompleter } from '@home/components/widget/lib/settings/common/action/custom-action.models';
|
import { CustomActionEditorCompleter } from '@home/components/widget/lib/settings/common/action/custom-action.models';
|
||||||
import {
|
import {
|
||||||
@ -62,9 +60,6 @@ export class MobileActionEditorComponent implements ControlValueAccessor, OnInit
|
|||||||
mobileActionTypes = Object.keys(WidgetMobileActionType);
|
mobileActionTypes = Object.keys(WidgetMobileActionType);
|
||||||
mobileActionTypeTranslations = widgetMobileActionTypeTranslationMap;
|
mobileActionTypeTranslations = widgetMobileActionTypeTranslationMap;
|
||||||
mobileActionType = WidgetMobileActionType;
|
mobileActionType = WidgetMobileActionType;
|
||||||
mobileProvisionType = WidgetMobileProvisionType;
|
|
||||||
mobileProvisionTypes = Object.keys(WidgetMobileProvisionType);
|
|
||||||
widgetMobileProvisionTypeTranslationMap = widgetMobileProvisionTypeTranslationMap;
|
|
||||||
|
|
||||||
customActionEditorCompleter = CustomActionEditorCompleter;
|
customActionEditorCompleter = CustomActionEditorCompleter;
|
||||||
|
|
||||||
@ -260,7 +255,7 @@ export class MobileActionEditorComponent implements ControlValueAccessor, OnInit
|
|||||||
this.fb.control(processLocationFunction, [Validators.required])
|
this.fb.control(processLocationFunction, [Validators.required])
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case WidgetMobileActionType.provisioningDevice:
|
case WidgetMobileActionType.provisionDevice:
|
||||||
let handleProvisionSuccessFunction = action?.handleProvisionSuccessFunction;
|
let handleProvisionSuccessFunction = action?.handleProvisionSuccessFunction;
|
||||||
if (changed) {
|
if (changed) {
|
||||||
const defaultProvisioningSuccessFunction = getDefaultProvisioningSuccessFunction();
|
const defaultProvisioningSuccessFunction = getDefaultProvisioningSuccessFunction();
|
||||||
@ -272,10 +267,6 @@ export class MobileActionEditorComponent implements ControlValueAccessor, OnInit
|
|||||||
'handleProvisionSuccessFunction',
|
'handleProvisionSuccessFunction',
|
||||||
this.fb.control(handleProvisionSuccessFunction, [Validators.required])
|
this.fb.control(handleProvisionSuccessFunction, [Validators.required])
|
||||||
);
|
);
|
||||||
this.mobileActionTypeFormGroup.addControl(
|
|
||||||
'provisionType',
|
|
||||||
this.fb.control(null, [Validators.required])
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.mobileActionTypeFormGroup.valueChanges.pipe(
|
this.mobileActionTypeFormGroup.valueChanges.pipe(
|
||||||
|
|||||||
@ -283,7 +283,7 @@ export const getDefaultHandleEmptyResultFunction = (type: WidgetMobileActionType
|
|||||||
case WidgetMobileActionType.takeScreenshot:
|
case WidgetMobileActionType.takeScreenshot:
|
||||||
message = 'Take screenshot action was cancelled!';
|
message = 'Take screenshot action was cancelled!';
|
||||||
break;
|
break;
|
||||||
case WidgetMobileActionType.provisioningDevice:
|
case WidgetMobileActionType.provisionDevice:
|
||||||
message = 'Provisioning device was not invoked!';
|
message = 'Provisioning device was not invoked!';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -317,8 +317,8 @@ export const getDefaultHandleErrorFunction = (type: WidgetMobileActionType): TbF
|
|||||||
case WidgetMobileActionType.takeScreenshot:
|
case WidgetMobileActionType.takeScreenshot:
|
||||||
title = 'Failed to take screenshot';
|
title = 'Failed to take screenshot';
|
||||||
break;
|
break;
|
||||||
case WidgetMobileActionType.provisioningDevice:
|
case WidgetMobileActionType.provisionDevice:
|
||||||
title = 'Failed to make device provisioning';
|
title = 'Failed to make device provision';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return handleErrorFunctionTemplate.replace('--TITLE--', title);
|
return handleErrorFunctionTemplate.replace('--TITLE--', title);
|
||||||
|
|||||||
@ -1203,11 +1203,9 @@ export class WidgetComponent extends PageComponent implements OnInit, OnChanges,
|
|||||||
case WidgetMobileActionType.scanQrCode:
|
case WidgetMobileActionType.scanQrCode:
|
||||||
case WidgetMobileActionType.getLocation:
|
case WidgetMobileActionType.getLocation:
|
||||||
case WidgetMobileActionType.takeScreenshot:
|
case WidgetMobileActionType.takeScreenshot:
|
||||||
|
case WidgetMobileActionType.provisionDevice:
|
||||||
argsObservable = of([]);
|
argsObservable = of([]);
|
||||||
break;
|
break;
|
||||||
case WidgetMobileActionType.provisioningDevice:
|
|
||||||
argsObservable = of([mobileAction.provisionType]);
|
|
||||||
break;
|
|
||||||
case WidgetMobileActionType.mapDirection:
|
case WidgetMobileActionType.mapDirection:
|
||||||
case WidgetMobileActionType.mapLocation:
|
case WidgetMobileActionType.mapLocation:
|
||||||
argsObservable = compileTbFunction(this.http, mobileAction.getLocationFunction, '$event', 'widgetContext', 'entityId',
|
argsObservable = compileTbFunction(this.http, mobileAction.getLocationFunction, '$event', 'widgetContext', 'entityId',
|
||||||
@ -1295,7 +1293,7 @@ export class WidgetComponent extends PageComponent implements OnInit, OnChanges,
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case WidgetMobileActionType.provisioningDevice:
|
case WidgetMobileActionType.provisionDevice:
|
||||||
const deviceName = actionResult.device.name;
|
const deviceName = actionResult.device.name;
|
||||||
if (isNotEmptyTbFunction(mobileAction.handleProvisionSuccessFunction)) {
|
if (isNotEmptyTbFunction(mobileAction.handleProvisionSuccessFunction)) {
|
||||||
compileTbFunction(this.http, mobileAction.handleProvisionSuccessFunction, 'deviceName', '$event', 'widgetContext', 'entityId',
|
compileTbFunction(this.http, mobileAction.handleProvisionSuccessFunction, 'deviceName', '$event', 'widgetContext', 'entityId',
|
||||||
|
|||||||
@ -588,25 +588,9 @@ export enum WidgetMobileActionType {
|
|||||||
makePhoneCall = 'makePhoneCall',
|
makePhoneCall = 'makePhoneCall',
|
||||||
getLocation = 'getLocation',
|
getLocation = 'getLocation',
|
||||||
takeScreenshot = 'takeScreenshot',
|
takeScreenshot = 'takeScreenshot',
|
||||||
provisioningDevice = 'provisioningDevice',
|
provisionDevice = 'provisionDevice',
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum WidgetMobileProvisionType {
|
|
||||||
smartConfigEspTouch = 'SmartConfigEspTouch',
|
|
||||||
smartConfigEspTouchV2 = 'SmartConfigEspTouchV2',
|
|
||||||
wifi = 'wifi',
|
|
||||||
softAp = 'SoftAp',
|
|
||||||
}
|
|
||||||
|
|
||||||
export const widgetMobileProvisionTypeTranslationMap = new Map<WidgetMobileProvisionType, string>(
|
|
||||||
[
|
|
||||||
[ WidgetMobileProvisionType.smartConfigEspTouch, 'widget-action.mobile.provisioning-device.smart-config-esp-touch' ],
|
|
||||||
[ WidgetMobileProvisionType.smartConfigEspTouchV2, 'widget-action.mobile.provisioning-device.smart-config-esp-touch-v2' ],
|
|
||||||
[ WidgetMobileProvisionType.wifi, 'widget-action.mobile.provisioning-device.wifi' ],
|
|
||||||
[ WidgetMobileProvisionType.softAp, 'widget-action.mobile.provisioning-device.soft-ap' ]
|
|
||||||
]
|
|
||||||
);
|
|
||||||
|
|
||||||
export const widgetActionTypes = Object.keys(WidgetActionType) as WidgetActionType[];
|
export const widgetActionTypes = Object.keys(WidgetActionType) as WidgetActionType[];
|
||||||
|
|
||||||
export const widgetActionTypeTranslationMap = new Map<WidgetActionType, string>(
|
export const widgetActionTypeTranslationMap = new Map<WidgetActionType, string>(
|
||||||
@ -632,7 +616,7 @@ export const widgetMobileActionTypeTranslationMap = new Map<WidgetMobileActionTy
|
|||||||
[ WidgetMobileActionType.makePhoneCall, 'widget-action.mobile.make-phone-call' ],
|
[ WidgetMobileActionType.makePhoneCall, 'widget-action.mobile.make-phone-call' ],
|
||||||
[ WidgetMobileActionType.getLocation, 'widget-action.mobile.get-location' ],
|
[ WidgetMobileActionType.getLocation, 'widget-action.mobile.get-location' ],
|
||||||
[ WidgetMobileActionType.takeScreenshot, 'widget-action.mobile.take-screenshot' ],
|
[ WidgetMobileActionType.takeScreenshot, 'widget-action.mobile.take-screenshot' ],
|
||||||
[ WidgetMobileActionType.provisioningDevice, 'widget-action.mobile.provisioning-device.label' ]
|
[ WidgetMobileActionType.provisionDevice, 'widget-action.mobile.provision-device' ]
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -673,7 +657,6 @@ export interface WidgetMobileActionResult<T extends MobileActionResult> {
|
|||||||
|
|
||||||
export interface ProvisionSuccessDescriptor {
|
export interface ProvisionSuccessDescriptor {
|
||||||
handleProvisionSuccessFunction: TbFunction;
|
handleProvisionSuccessFunction: TbFunction;
|
||||||
provisionType: WidgetMobileProvisionType;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ProcessImageDescriptor {
|
export interface ProcessImageDescriptor {
|
||||||
|
|||||||
@ -6534,16 +6534,7 @@
|
|||||||
"URL": "URL",
|
"URL": "URL",
|
||||||
"url-required": "URL is required.",
|
"url-required": "URL is required.",
|
||||||
"mobile": {
|
"mobile": {
|
||||||
"provisioning-device": {
|
"provision-device": "Provision device",
|
||||||
"label": "Provisioning device",
|
|
||||||
"type": "Provisioning device type",
|
|
||||||
"select-type": "Select provisioning device type",
|
|
||||||
"type-required": "Provisioning device type is required",
|
|
||||||
"smart-config-esp-touch": "Smart Config ESP-Touch",
|
|
||||||
"smart-config-esp-touch-v2": "Smart Config ESP-Touch v2",
|
|
||||||
"wifi": "Wi-Fi Provisioning via Bluetooth Low Energy BLE/QR code",
|
|
||||||
"soft-ap": "SoftAP"
|
|
||||||
},
|
|
||||||
"action-type": "Mobile action type",
|
"action-type": "Mobile action type",
|
||||||
"select-action-type": "Select mobile action type",
|
"select-action-type": "Select mobile action type",
|
||||||
"action-type-required": "Mobile action type is required",
|
"action-type-required": "Mobile action type is required",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user