@@ -354,6 +354,7 @@ export class TbPopoverComponent implements OnDestroy, OnInit {
tbMouseEnterDelay?: number;
tbMouseLeaveDelay?: number;
tbHideOnClickOutside = true;
+ tbShowCloseButton = true;
tbAnimationState = 'active';
diff --git a/ui-ngx/src/app/shared/components/popover.service.ts b/ui-ngx/src/app/shared/components/popover.service.ts
index 4a3b59da93..2b64ee8009 100644
--- a/ui-ngx/src/app/shared/components/popover.service.ts
+++ b/ui-ngx/src/app/shared/components/popover.service.ts
@@ -55,7 +55,8 @@ export class TbPopoverService {
displayPopover(trigger: Element, renderer: Renderer2, hostView: ViewContainerRef,
componentType: Type, preferredPlacement: PopoverPlacement = 'top', hideOnClickOutside = true,
- injector?: Injector, context?: any, overlayStyle: any = {}, popoverStyle: any = {}, style?: any): TbPopoverComponent {
+ injector?: Injector, context?: any, overlayStyle: any = {}, popoverStyle: any = {}, style?: any,
+ showCloseButton = true): TbPopoverComponent {
const componentRef = hostView.createComponent(this.componentFactory);
const component = componentRef.instance;
this.popoverWithTriggers.push({
@@ -76,6 +77,7 @@ export class TbPopoverService {
component.tbPopoverInnerStyle = popoverStyle;
component.tbComponentStyle = style;
component.tbHideOnClickOutside = hideOnClickOutside;
+ component.tbShowCloseButton = showCloseButton;
component.tbVisibleChange.subscribe((visible: boolean) => {
if (!visible) {
component.tbAnimationDone.subscribe(() => {
diff --git a/ui-ngx/src/app/shared/components/vc/branch-autocomplete.component.html b/ui-ngx/src/app/shared/components/vc/branch-autocomplete.component.html
index 74672b1772..b5f7ceb02e 100644
--- a/ui-ngx/src/app/shared/components/vc/branch-autocomplete.component.html
+++ b/ui-ngx/src/app/shared/components/vc/branch-autocomplete.component.html
@@ -36,8 +36,11 @@
(closed)="onPanelClosed()"
#branchAutocomplete="matAutocomplete"
[displayWith]="displayBranchFn">
-
+
+ check
+
+ {{ 'version-control.default' | translate }}
diff --git a/ui-ngx/src/app/shared/components/vc/branch-autocomplete.component.scss b/ui-ngx/src/app/shared/components/vc/branch-autocomplete.component.scss
new file mode 100644
index 0000000000..06b464db27
--- /dev/null
+++ b/ui-ngx/src/app/shared/components/vc/branch-autocomplete.component.scss
@@ -0,0 +1,30 @@
+/**
+ * Copyright © 2016-2022 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.
+ */
+.mat-option.branch-option {
+ .mat-icon, .check-placeholder {
+ margin-right: 8px;
+ }
+ .check-placeholder {
+ width: 18px;
+ display: inline-block;
+ }
+ .mat-option-text {
+ width: 100%;
+ .default-branch {
+ float: right;
+ }
+ }
+}
diff --git a/ui-ngx/src/app/shared/components/vc/branch-autocomplete.component.ts b/ui-ngx/src/app/shared/components/vc/branch-autocomplete.component.ts
index 45f4504bd2..3a0eb1d173 100644
--- a/ui-ngx/src/app/shared/components/vc/branch-autocomplete.component.ts
+++ b/ui-ngx/src/app/shared/components/vc/branch-autocomplete.component.ts
@@ -14,9 +14,19 @@
/// limitations under the License.
///
-import { AfterViewInit, Component, ElementRef, forwardRef, Input, NgZone, OnInit, ViewChild } from '@angular/core';
+import {
+ AfterViewInit,
+ Component,
+ ElementRef,
+ forwardRef,
+ Input,
+ NgZone,
+ OnInit,
+ ViewChild,
+ ViewEncapsulation
+} from '@angular/core';
import { ControlValueAccessor, FormBuilder, FormGroup, NG_VALUE_ACCESSOR } from '@angular/forms';
-import { Observable, of } from 'rxjs';
+import { Observable } from 'rxjs';
import { debounceTime, distinctUntilChanged, map, share, switchMap, tap } from 'rxjs/operators';
import { Store } from '@ngrx/store';
import { AppState } from '@app/core/core.state';
@@ -29,12 +39,13 @@ import { MatAutocomplete, MatAutocompleteTrigger } from '@angular/material/autoc
@Component({
selector: 'tb-branch-autocomplete',
templateUrl: './branch-autocomplete.component.html',
- styleUrls: [],
+ styleUrls: ['./branch-autocomplete.component.scss'],
providers: [{
provide: NG_VALUE_ACCESSOR,
useExisting: forwardRef(() => BranchAutocompleteComponent),
multi: true
- }]
+ }],
+ encapsulation: ViewEncapsulation.None
})
export class BranchAutocompleteComponent implements ControlValueAccessor, OnInit, AfterViewInit {
@@ -216,30 +227,22 @@ export class BranchAutocompleteComponent implements ControlValueAccessor, OnInit
selectAvailableValue() {
if (this.selectionMode) {
const branch = this.branchFormGroup.get('branch').value;
- let branchInfo: Observable = null;
- if (isNotEmptyStr(branch)) {
- branchInfo = this.getBranches().pipe(
- map(branches => {
- let foundBranch = branches.find(b => b.name === branch);
- if (!foundBranch && isNotEmptyStr(this.modelValue)) {
- foundBranch = branches.find(b => b.name === this.modelValue);
- }
- return foundBranch;
- })
- );
- } else if (!branch) {
- branchInfo = of(null);
- }
- if (branchInfo) {
- branchInfo.subscribe((val) => {
- if (!val && this.defaultBranch) {
- val = this.defaultBranch;
+ this.getBranches().pipe(
+ map(branches => {
+ let foundBranch = branches.find(b => b.name === branch);
+ if (!foundBranch && isNotEmptyStr(this.modelValue)) {
+ foundBranch = branches.find(b => b.name === this.modelValue);
}
- this.zone.run(() => {
- this.branchFormGroup.get('branch').patchValue(val, {emitEvent: true});
- }, 0);
- });
- }
+ return foundBranch;
+ })
+ ).subscribe((val) => {
+ if (!val && this.defaultBranch) {
+ val = this.defaultBranch;
+ }
+ this.zone.run(() => {
+ this.branchFormGroup.get('branch').patchValue(val, {emitEvent: true});
+ }, 0);
+ });
}
}
diff --git a/ui-ngx/src/assets/locale/locale.constant-en_US.json b/ui-ngx/src/assets/locale/locale.constant-en_US.json
index 106f941f4e..202597ade1 100644
--- a/ui-ngx/src/assets/locale/locale.constant-en_US.json
+++ b/ui-ngx/src/assets/locale/locale.constant-en_US.json
@@ -3112,22 +3112,21 @@
"version-control": "Version control",
"management": "Version control management",
"branch": "Branch",
+ "default": "Default",
"select-branch": "Select branch",
"branch-required": "Branch is required",
- "export-entity-version": "Export entity version",
- "entity-version-exported": "Entity version successfully exported",
+ "create-entity-version": "Create entity version",
"version-name": "Version name",
"version-name-required": "Version name is required",
"export-entity-relations": "Export entity relations",
- "export-entity-version-result-message": "Entity exported with version '{{name}}' and commit id '{{commitId}}'.",
- "export-to-git": "Export to Git",
"entity-versions": "Entity versions",
"versions": "Versions",
"created-time": "Created time",
"version-id": "Version ID",
"no-entity-versions-text": "No entity versions found",
"no-versions-text": "No versions found",
- "copy-full-version-id": "Copy full version id"
+ "copy-full-version-id": "Copy full version id",
+ "create-version": "Create version"
},
"widget": {
"widget-library": "Widgets Library",