Removed provision type
This commit is contained in:
parent
6c652a73a8
commit
977d60bbcb
@ -36,26 +36,7 @@
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<ng-container [formGroup]="mobileActionTypeFormGroup" [ngSwitch]="mobileActionFormGroup.get('type').value">
|
||||
<ng-template [ngSwitchCase]="mobileActionType.provisioningDevice">
|
||||
<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>
|
||||
<ng-template [ngSwitchCase]="mobileActionType.provisionDevice">
|
||||
<tb-js-func
|
||||
formControlName="handleProvisionSuccessFunction"
|
||||
functionName="handleProvisionSuccess"
|
||||
|
||||
@ -24,12 +24,10 @@ import {
|
||||
} from '@angular/forms';
|
||||
import { coerceBooleanProperty } from '@angular/cdk/coercion';
|
||||
import {
|
||||
WidgetMobileProvisionType,
|
||||
WidgetActionType,
|
||||
WidgetMobileActionDescriptor,
|
||||
WidgetMobileActionType,
|
||||
widgetMobileActionTypeTranslationMap,
|
||||
widgetMobileProvisionTypeTranslationMap
|
||||
} from '@shared/models/widget.models';
|
||||
import { CustomActionEditorCompleter } from '@home/components/widget/lib/settings/common/action/custom-action.models';
|
||||
import {
|
||||
@ -62,9 +60,6 @@ export class MobileActionEditorComponent implements ControlValueAccessor, OnInit
|
||||
mobileActionTypes = Object.keys(WidgetMobileActionType);
|
||||
mobileActionTypeTranslations = widgetMobileActionTypeTranslationMap;
|
||||
mobileActionType = WidgetMobileActionType;
|
||||
mobileProvisionType = WidgetMobileProvisionType;
|
||||
mobileProvisionTypes = Object.keys(WidgetMobileProvisionType);
|
||||
widgetMobileProvisionTypeTranslationMap = widgetMobileProvisionTypeTranslationMap;
|
||||
|
||||
customActionEditorCompleter = CustomActionEditorCompleter;
|
||||
|
||||
@ -260,7 +255,7 @@ export class MobileActionEditorComponent implements ControlValueAccessor, OnInit
|
||||
this.fb.control(processLocationFunction, [Validators.required])
|
||||
);
|
||||
break;
|
||||
case WidgetMobileActionType.provisioningDevice:
|
||||
case WidgetMobileActionType.provisionDevice:
|
||||
let handleProvisionSuccessFunction = action?.handleProvisionSuccessFunction;
|
||||
if (changed) {
|
||||
const defaultProvisioningSuccessFunction = getDefaultProvisioningSuccessFunction();
|
||||
@ -272,10 +267,6 @@ export class MobileActionEditorComponent implements ControlValueAccessor, OnInit
|
||||
'handleProvisionSuccessFunction',
|
||||
this.fb.control(handleProvisionSuccessFunction, [Validators.required])
|
||||
);
|
||||
this.mobileActionTypeFormGroup.addControl(
|
||||
'provisionType',
|
||||
this.fb.control(null, [Validators.required])
|
||||
);
|
||||
}
|
||||
}
|
||||
this.mobileActionTypeFormGroup.valueChanges.pipe(
|
||||
|
||||
@ -283,7 +283,7 @@ export const getDefaultHandleEmptyResultFunction = (type: WidgetMobileActionType
|
||||
case WidgetMobileActionType.takeScreenshot:
|
||||
message = 'Take screenshot action was cancelled!';
|
||||
break;
|
||||
case WidgetMobileActionType.provisioningDevice:
|
||||
case WidgetMobileActionType.provisionDevice:
|
||||
message = 'Provisioning device was not invoked!';
|
||||
break;
|
||||
}
|
||||
@ -317,8 +317,8 @@ export const getDefaultHandleErrorFunction = (type: WidgetMobileActionType): TbF
|
||||
case WidgetMobileActionType.takeScreenshot:
|
||||
title = 'Failed to take screenshot';
|
||||
break;
|
||||
case WidgetMobileActionType.provisioningDevice:
|
||||
title = 'Failed to make device provisioning';
|
||||
case WidgetMobileActionType.provisionDevice:
|
||||
title = 'Failed to make device provision';
|
||||
break;
|
||||
}
|
||||
return handleErrorFunctionTemplate.replace('--TITLE--', title);
|
||||
|
||||
@ -1203,11 +1203,9 @@ export class WidgetComponent extends PageComponent implements OnInit, OnChanges,
|
||||
case WidgetMobileActionType.scanQrCode:
|
||||
case WidgetMobileActionType.getLocation:
|
||||
case WidgetMobileActionType.takeScreenshot:
|
||||
case WidgetMobileActionType.provisionDevice:
|
||||
argsObservable = of([]);
|
||||
break;
|
||||
case WidgetMobileActionType.provisioningDevice:
|
||||
argsObservable = of([mobileAction.provisionType]);
|
||||
break;
|
||||
case WidgetMobileActionType.mapDirection:
|
||||
case WidgetMobileActionType.mapLocation:
|
||||
argsObservable = compileTbFunction(this.http, mobileAction.getLocationFunction, '$event', 'widgetContext', 'entityId',
|
||||
@ -1295,7 +1293,7 @@ export class WidgetComponent extends PageComponent implements OnInit, OnChanges,
|
||||
);
|
||||
}
|
||||
break;
|
||||
case WidgetMobileActionType.provisioningDevice:
|
||||
case WidgetMobileActionType.provisionDevice:
|
||||
const deviceName = actionResult.device.name;
|
||||
if (isNotEmptyTbFunction(mobileAction.handleProvisionSuccessFunction)) {
|
||||
compileTbFunction(this.http, mobileAction.handleProvisionSuccessFunction, 'deviceName', '$event', 'widgetContext', 'entityId',
|
||||
|
||||
@ -588,25 +588,9 @@ export enum WidgetMobileActionType {
|
||||
makePhoneCall = 'makePhoneCall',
|
||||
getLocation = 'getLocation',
|
||||
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 widgetActionTypeTranslationMap = new Map<WidgetActionType, string>(
|
||||
@ -632,7 +616,7 @@ export const widgetMobileActionTypeTranslationMap = new Map<WidgetMobileActionTy
|
||||
[ WidgetMobileActionType.makePhoneCall, 'widget-action.mobile.make-phone-call' ],
|
||||
[ WidgetMobileActionType.getLocation, 'widget-action.mobile.get-location' ],
|
||||
[ 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 {
|
||||
handleProvisionSuccessFunction: TbFunction;
|
||||
provisionType: WidgetMobileProvisionType;
|
||||
}
|
||||
|
||||
export interface ProcessImageDescriptor {
|
||||
|
||||
@ -6534,16 +6534,7 @@
|
||||
"URL": "URL",
|
||||
"url-required": "URL is required.",
|
||||
"mobile": {
|
||||
"provisioning-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"
|
||||
},
|
||||
"provision-device": "Provision device",
|
||||
"action-type": "Mobile action type",
|
||||
"select-action-type": "Select mobile action type",
|
||||
"action-type-required": "Mobile action type is required",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user