Skip to content

Commit 5fb26d3

Browse files
committed
feat(ui): disable integrations by version type
1 parent 1f6b442 commit 5fb26d3

3 files changed

Lines changed: 27 additions & 6 deletions

File tree

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ <h6 class="card-title font-weight-semibold">{{module.prettyName}}</h6>
1212
> ...</span>
1313
</p>
1414
</div>
15-
<button class="btn utm-button mb-3 " (click)="showIntegration()"
15+
16+
<button
17+
[disabled]="version === versionType.COMMUNITY && module.moduleName === UtmModulesEnum.AS_400"
18+
class="btn utm-button mb-3 " (click)="showIntegration()"
1619
[ngClass]="module.moduleActive?'utm-button-success':'utm-button-primary'">
1720
<i class="mr-1 icon-puzzle2"></i>
1821
{{module.moduleActive ? 'Enabled' : 'View integration'}}
Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,40 @@
1-
import {ChangeDetectionStrategy, Component, EventEmitter, Input, OnInit, Output} from '@angular/core';
1+
import {ChangeDetectionStrategy, Component, EventEmitter, Input, OnDestroy, OnInit, Output} from '@angular/core';
2+
import {VersionType, VersionTypeService} from '../../../../shared/services/util/version-type.service';
23
import {UtmModuleType} from '../../type/utm-module.type';
4+
import {Subject} from "rxjs";
5+
import {takeUntil} from "rxjs/operators";
6+
import {UtmModulesEnum} from "../../enum/utm-module.enum";
37

48
@Component({
59
selector: 'app-app-module-card',
610
templateUrl: './app-module-card.component.html',
711
styleUrls: ['./app-module-card.component.scss'],
812
changeDetection: ChangeDetectionStrategy.OnPush
913
})
10-
export class AppModuleCardComponent implements OnInit {
14+
export class AppModuleCardComponent implements OnInit, OnDestroy {
1115
@Input() module: UtmModuleType;
1216
@Output() showModuleIntegration = new EventEmitter<UtmModuleType>();
17+
versionType = VersionType;
18+
version: VersionType;
19+
destroy$: Subject<void> = new Subject<void>();
1320

14-
constructor() {
21+
constructor(private versionTypeService: VersionTypeService) {
1522
}
1623

1724
ngOnInit() {
25+
this.versionTypeService.versionType$
26+
.pipe(takeUntil(this.destroy$))
27+
.subscribe(versionType => this.version = versionType);
1828
}
1929

2030
showIntegration() {
2131
this.showModuleIntegration.emit(this.module);
2232
}
33+
34+
ngOnDestroy(): void {
35+
this.destroy$.next();
36+
this.destroy$.complete();
37+
}
38+
39+
protected readonly UtmModulesEnum = UtmModulesEnum;
2340
}

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,11 @@ export class UtmVersionInfoComponent implements OnInit {
2929
.pipe(
3030
map(response => response.body || null),
3131
tap((versionInfo: VersionInfo) => {
32+
console.log('versionInfo', versionInfo);
3233
const version = versionInfo && versionInfo.build && versionInfo.build.version || '';
33-
const versionType = version.includes('community') ? VersionType.COMMUNITY : VersionType.ENTERPRISE;
34+
const versionType = version.includes('community') || version === '' ? VersionType.COMMUNITY : VersionType.ENTERPRISE;
3435

35-
if (versionType !== this.versionTypeService.versionType()){
36+
if (versionType !== this.versionTypeService.versionType()) {
3637
this.versionTypeService.changeVersionType(versionType);
3738
}
3839
}),

0 commit comments

Comments
 (0)