Skip to content

Commit ffb080c

Browse files
committed
refactor: update version info handling and clean up community module display
Signed-off-by: Manuel Abascal <mjabascal10@gmail.com>
1 parent e3f6673 commit ffb080c

3 files changed

Lines changed: 20 additions & 18 deletions

File tree

frontend/src/app/app-module/shared/components/app-module-card/app-module-card.component.html

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<div class="module-card card text-center p-2 m-0 d-flex flex-column align-items-center justify-content-between">
22
<div class="d-flex flex-column w-100">
3-
<div *ngIf="version === versionType.COMMUNITY && ModulesEnterprise.includes(module.moduleName)" class="d-flex justify-content-end">
3+
<!--<div *ngIf="version === versionType.COMMUNITY && ModulesEnterprise.includes(module.moduleName)" class="d-flex justify-content-end">
44
<span class="badge p-1 border-1 m-1 bg-success-300"> Enterprise </span>
5-
</div>
5+
</div>-->
66
<div class="d-flex justify-content-center">
77
<img class="p-3 mb-3 mt-1"
88
[alt]="module.prettyName"
@@ -18,16 +18,15 @@ <h6 class="card-title font-weight-semibold">{{module.prettyName}}</h6>
1818
</p>
1919
</div>
2020

21-
<button *ngIf="version === versionType.COMMUNITY && !ModulesEnterprise.includes(module.moduleName)"
22-
class="btn utm-button mb-3 " (click)="showIntegration()"
21+
<button class="btn utm-button mb-3 " (click)="showIntegration()"
2322
[ngClass]="module.moduleActive?'utm-button-success':'utm-button-primary'">
2423
<i class="mr-1 icon-puzzle2"></i>
2524
{{module.moduleActive ? 'Enabled' : 'View integration'}}
2625
</button>
2726

28-
<button *ngIf="version === versionType.COMMUNITY && ModulesEnterprise.includes(module.moduleName)"
27+
<!--<button *ngIf="version === versionType.COMMUNITY && ModulesEnterprise.includes(module.moduleName)"
2928
class="btn utm-button utm-button-primary mb-3" (click)="showMessage()">
3029
<i class="mr-1 icon-lock2"></i>
3130
Upgrade to Enterprise
32-
</button>
31+
</button>-->
3332
</div>

frontend/src/app/shared/components/layout/header/shared/components/utm-version-info/utm-version-info.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<ng-container *ngIf="currentVersion$ | async as currentVersion">
1+
<ng-container *ngIf="versionInfo as currentVersion">
22
<span *ngIf="currentVersion.build"
33
[ngClass]="'badge-success-800'"
44
class="badge badge-pill version-info cursor-pointer text-white">

frontend/src/app/shared/components/layout/header/shared/components/utm-version-info/utm-version-info.component.ts

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,35 +12,38 @@ import {VersionInfo} from '../../../../../../types/updates/updates.type';
1212
styleUrls: ['./utm-version-info.component.css']
1313
})
1414
export class UtmVersionInfoComponent implements OnInit {
15-
currentVersion$: Observable<VersionInfo> = EMPTY;
16-
destroy$ = new Subject<void>();
15+
versionInfo: VersionInfo;
1716

1817
constructor(private checkForUpdatesService: CheckForUpdatesService,
1918
private utmToastService: UtmToastService,
2019
private versionTypeService: VersionTypeService) {
2120
}
2221

2322
ngOnInit() {
24-
this.getVersionInfo();
25-
}
26-
27-
getVersionInfo() {
28-
this.currentVersion$ = this.checkForUpdatesService.getVersion()
23+
this.checkForUpdatesService.getVersion()
2924
.pipe(
3025
map(response => response.body || null),
3126
tap((versionInfo: VersionInfo) => {
32-
console.log('versionInfo', versionInfo);
3327
const version = versionInfo && versionInfo.build && versionInfo.build.version || '';
34-
const versionType = version.includes('community') || version === '' ? VersionType.COMMUNITY : VersionType.ENTERPRISE;
28+
const versionType = version.includes('community') || version === ''
29+
? VersionType.COMMUNITY
30+
: VersionType.ENTERPRISE;
3531

3632
if (versionType !== this.versionTypeService.versionType()) {
3733
this.versionTypeService.changeVersionType(versionType);
3834
}
3935
}),
4036
catchError(() => {
41-
this.utmToastService.showError('Error fetching version info', 'An error occurred while fetching version info.');
37+
this.utmToastService.showError(
38+
'Error fetching version info',
39+
'An error occurred while fetching version info.'
40+
);
4241
return EMPTY;
4342
})
44-
);
43+
)
44+
.subscribe(versionInfo => {
45+
this.versionInfo = versionInfo;
46+
});
4547
}
48+
4649
}

0 commit comments

Comments
 (0)