diff --git a/ui-ngx/src/app/modules/home/pages/edge/edge.component.ts b/ui-ngx/src/app/modules/home/pages/edge/edge.component.ts
index 78c8df6c08..b7cb2b1752 100644
--- a/ui-ngx/src/app/modules/home/pages/edge/edge.component.ts
+++ b/ui-ngx/src/app/modules/home/pages/edge/edge.component.ts
@@ -20,12 +20,15 @@ import { AppState } from '@core/core.state';
import { EntityComponent } from '@home/components/entity/entity.component';
import { UntypedFormBuilder, UntypedFormGroup, Validators } from '@angular/forms';
import { EntityType } from '@shared/models/entity-type.models';
-import { EdgeInfo } from '@shared/models/edge.models';
+import { EdgeInfo, edgeVersionAttributeKey } from '@shared/models/edge.models';
import { TranslateService } from '@ngx-translate/core';
import { NULL_UUID } from '@shared/models/id/has-uuid';
import { ActionNotificationShow } from '@core/notification/notification.actions';
import { generateSecret, guid } from '@core/utils';
import { EntityTableConfig } from '@home/models/entity/entities-table-config.models';
+import { environment as env } from '@env/environment';
+import { AttributeService } from '@core/http/attribute.service';
+import { AttributeScope } from '@shared/models/telemetry/telemetry.models';
@Component({
selector: 'tb-edge',
@@ -37,9 +40,11 @@ export class EdgeComponent extends EntityComponent
{
entityType = EntityType;
edgeScope: 'tenant' | 'customer' | 'customer_user';
+ upgradeAvailable: boolean = false;
constructor(protected store: Store,
protected translate: TranslateService,
+ private attributeService: AttributeService,
@Inject('entity') protected entityValue: EdgeInfo,
@Inject('entitiesTableConfig') protected entitiesTableConfigValue: EntityTableConfig,
public fb: UntypedFormBuilder,
@@ -95,6 +100,7 @@ export class EdgeComponent extends EntityComponent {
}
});
this.generateRoutingKeyAndSecret(entity, this.entityForm);
+ this.checkEdgeVersion();
}
updateFormState() {
@@ -133,4 +139,25 @@ export class EdgeComponent extends EntityComponent {
form.get('secret').patchValue(generateSecret(20), {emitEvent: false});
}
}
+
+ checkEdgeVersion() {
+ this.attributeService.getEntityAttributes(this.entity.id, AttributeScope.SERVER_SCOPE, [edgeVersionAttributeKey])
+ .subscribe(attributes => {
+ if (attributes?.length) {
+ const edgeVersion = attributes[0].value;
+ const tbVersion = 'V_' + env.tbVersion.replaceAll('.', '_');
+ this.upgradeAvailable = this.versionUpgradeSupported(edgeVersion) && (edgeVersion !== tbVersion);
+ } else {
+ this.upgradeAvailable = false;
+ }
+ }
+ );
+ }
+
+ private versionUpgradeSupported(edgeVersion: string): boolean {
+ const edgeVersionArray = edgeVersion.split('_');
+ const major = parseInt(edgeVersionArray[1]);
+ const minor = parseInt(edgeVersionArray[2]);
+ return major >= 3 && minor >= 6;
+ }
}
diff --git a/ui-ngx/src/app/modules/home/pages/edge/edges-table-config.resolver.ts b/ui-ngx/src/app/modules/home/pages/edge/edges-table-config.resolver.ts
index 6a80388b52..4429515705 100644
--- a/ui-ngx/src/app/modules/home/pages/edge/edges-table-config.resolver.ts
+++ b/ui-ngx/src/app/modules/home/pages/edge/edges-table-config.resolver.ts
@@ -558,7 +558,7 @@ export class EdgesTableConfigResolver implements Resolve {
if (afterAdd) {
@@ -610,9 +611,12 @@ export class EdgesTableConfigResolver implements Resolve {
body: string;
}
-export interface EdgeInstallInstructions {
- installInstructions: string;
+export interface EdgeInstructions {
+ instructions: string;
}
export enum EdgeInstructionsMethod {
@@ -188,3 +188,5 @@ export enum EdgeInstructionsMethod {
centos,
docker
}
+
+export const edgeVersionAttributeKey = 'edgeVersion';
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 5e585783d5..0698f78913 100644
--- a/ui-ngx/src/assets/locale/locale.constant-en_US.json
+++ b/ui-ngx/src/assets/locale/locale.constant-en_US.json
@@ -2021,6 +2021,7 @@
"sync-process-started-successfully": "Sync process started successfully!",
"missing-related-rule-chains-title": "Edge has missing related rule chain(s)",
"missing-related-rule-chains-text": "Assigned to edge rule chain(s) use rule nodes that forward message(s) to rule chain(s) that are not assigned to this edge.
List of missing rule chain(s):
{{missingRuleChains}}",
+ "upgrade-instructions": "Upgrade Instructions",
"widget-datasource-error": "This widget supports only EDGE entity datasource"
},
"edge-event": {