+
+
+
+
+
+
+
diff --git a/ui-ngx/src/app/modules/home/components/widget/config/data-key-config.component.scss b/ui-ngx/src/app/modules/home/components/widget/config/data-key-config.component.scss
deleted file mode 100644
index 2ef3488e53..0000000000
--- a/ui-ngx/src/app/modules/home/components/widget/config/data-key-config.component.scss
+++ /dev/null
@@ -1,128 +0,0 @@
-/**
- * Copyright © 2016-2023 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 '../../../../../../scss/constants';
-
-:host {
- .tb-datakey-config {
- height: 100%;
-
- .settings{
- &> :first-child{
- padding-top: 12px;
- }
- &> :nth-child(n){
- padding-right: 12px;
- padding-left: 12px;
- }
- }
-
- .fields-group {
- padding: 0 16px 8px;
- margin-bottom: 10px;
- border: 1px groove rgba(0, 0, 0, .25);
- border-radius: 4px;
-
- legend {
- color: rgba(0, 0, 0, .7);
- width: fit-content;
- }
-
- legend + * {
- display: block;
- margin-top: 16px;
- }
-
- &.fields-group-slider {
- padding: 0;
-
- legend {
- margin-left: 16px;
- }
-
- > .tb-settings {
- margin-top: 0;
- padding: 0 16px 8px;
- }
- }
- }
-
- .tb-hint.after-fields {
- margin-top: -1.25em;
- max-width: fit-content;
- line-height: 15px;
- }
- }
-}
-
-:host ::ng-deep {
- .tb-datakey-config {
- .mat-mdc-tab-body.mat-mdc-tab-body-active {
- .mat-mdc-tab-body-content > div {
- height: calc(65vh - 50px);
- overflow: initial;
- @media #{$mat-xs} {
- height: 500px;
- }
- }
- }
- .mat-expansion-panel {
- &.tb-settings {
- box-shadow: none;
-
- .mat-content {
- overflow: visible;
- }
-
- .mat-expansion-panel-header {
- padding: 0;
- color: rgba(0, 0, 0, 0.87);
-
- &:hover {
- background: none;
- }
-
- .mat-expansion-indicator {
- padding: 2px;
- }
- }
-
- &.comparison {
- .mat-expansion-panel-header {
- height: fit-content;
- }
- }
-
- .mat-expansion-panel-header-description {
- align-items: center;
- }
-
- > .mat-expansion-panel-content {
- > .mat-expansion-panel-body {
- padding: 0;
- }
- }
- }
-
- .mat-expansion-panel-content {
- font: inherit;
- }
- }
-
- .mat-slide {
- margin: 8px 0;
- }
- }
-}
diff --git a/ui-ngx/src/app/modules/home/components/widget/config/data-key-config.component.ts b/ui-ngx/src/app/modules/home/components/widget/config/data-key-config.component.ts
index a7cf923c44..f37451d32d 100644
--- a/ui-ngx/src/app/modules/home/components/widget/config/data-key-config.component.ts
+++ b/ui-ngx/src/app/modules/home/components/widget/config/data-key-config.component.ts
@@ -22,7 +22,7 @@ import {
ComparisonResultType,
comparisonResultTypeTranslationMap,
DataKey,
- dataKeyAggregationTypeHintTranslationMap,
+ dataKeyAggregationTypeHintTranslationMap, DataKeyConfigMode,
Widget,
widgetType
} from '@shared/models/widget.models';
@@ -57,7 +57,7 @@ import { coerceBoolean } from '@shared/decorators/coercion';
@Component({
selector: 'tb-data-key-config',
templateUrl: './data-key-config.component.html',
- styleUrls: ['./data-key-config.component.scss'],
+ styleUrls: [],
providers: [
{
provide: NG_VALUE_ACCESSOR,
@@ -73,6 +73,8 @@ import { coerceBoolean } from '@shared/decorators/coercion';
})
export class DataKeyConfigComponent extends PageComponent implements OnInit, ControlValueAccessor, Validator {
+ dataKeyConfigModes = DataKeyConfigMode;
+
dataKeyTypes = DataKeyType;
widgetTypes = widgetType;
@@ -91,6 +93,9 @@ export class DataKeyConfigComponent extends PageComponent implements OnInit, Con
comparisonResultTypeTranslations = comparisonResultTypeTranslationMap;
+ @Input()
+ dataKeyConfigMode: DataKeyConfigMode;
+
@Input()
deviceId: string;
@@ -142,7 +147,7 @@ export class DataKeyConfigComponent extends PageComponent implements OnInit, Con
@ViewChild('funcBodyEdit') funcBodyEdit: JsFuncComponent;
@ViewChild('postFuncBodyEdit') postFuncBodyEdit: JsFuncComponent;
- displayAdvanced = false;
+ hasAdvanced = false;
modelValue: DataKey;
@@ -193,7 +198,7 @@ export class DataKeyConfigComponent extends PageComponent implements OnInit, Con
}
if (this.dataKeySettingsSchema && this.dataKeySettingsSchema.schema ||
this.dataKeySettingsDirective && this.dataKeySettingsDirective.length) {
- this.displayAdvanced = true;
+ this.hasAdvanced = true;
this.dataKeySettingsData = {
schema: this.dataKeySettingsSchema?.schema || {
type: 'object',
@@ -291,7 +296,7 @@ export class DataKeyConfigComponent extends PageComponent implements OnInit, Con
}
this.dataKeyFormGroup.patchValue(this.modelValue, {emitEvent: false});
this.updateValidators();
- if (this.displayAdvanced) {
+ if (this.hasAdvanced) {
this.dataKeySettingsData.model = this.modelValue.settings;
this.dataKeySettingsFormGroup.patchValue({
settings: this.dataKeySettingsData
@@ -370,7 +375,7 @@ export class DataKeyConfigComponent extends PageComponent implements OnInit, Con
private updateModel() {
this.modelValue = {...this.modelValue, ...this.dataKeyFormGroup.value};
- if (this.displayAdvanced) {
+ if (this.hasAdvanced) {
this.modelValue.settings = this.dataKeySettingsFormGroup.get('settings').value.model;
}
if (this.modelValue.name) {
@@ -449,7 +454,7 @@ export class DataKeyConfigComponent extends PageComponent implements OnInit, Con
}
};
}
- if (this.displayAdvanced && (!this.dataKeySettingsFormGroup.valid || !this.modelValue.settings)) {
+ if (this.hasAdvanced && (!this.dataKeySettingsFormGroup.valid || !this.modelValue.settings)) {
return {
dataKeySettings: {
valid: false
diff --git a/ui-ngx/src/app/modules/home/components/widget/config/datasource.component.html b/ui-ngx/src/app/modules/home/components/widget/config/datasource.component.html
index ab7411488e..7f816e4593 100644
--- a/ui-ngx/src/app/modules/home/components/widget/config/datasource.component.html
+++ b/ui-ngx/src/app/modules/home/components/widget/config/datasource.component.html
@@ -38,6 +38,7 @@
datasourceFormGroup.get('type').value === datasourceType.alarmCount ? datasourceFormGroup.get('type').value : ''">
= [];
datasourceTypesTranslations = datasourceTypeTranslationMap;
+ alarmSearchStatus = AlarmSearchStatus;
+
datasourceFormGroup: UntypedFormGroup;
private propagateChange = (_val: any) => {};
diff --git a/ui-ngx/src/app/modules/home/components/widget/config/datasources.component.html b/ui-ngx/src/app/modules/home/components/widget/config/datasources.component.html
index a5a8a89004..2e4a984858 100644
--- a/ui-ngx/src/app/modules/home/components/widget/config/datasources.component.html
+++ b/ui-ngx/src/app/modules/home/components/widget/config/datasources.component.html
@@ -15,28 +15,21 @@
limitations under the License.
-->
-