-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
110 changed files
with
1,615 additions
and
1,236 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
AMW_angular/io/src/app/apps/app-add/app-add.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<div class="modal-header"> | ||
<h5 class="modal-title" id="createApplicationTitle">Create application</h5> | ||
<button type="button" class="btn btn-light close" aria-label="Close" (click)="cancel()"> | ||
<span aria-hidden="true">×</span> | ||
</button> | ||
</div> | ||
<div class="modal-body"> | ||
<div class="form-horizontal mx-2"> | ||
<div class="mb-3"> | ||
<label for="name" class="form-label">Application</label> | ||
<input type="text" class="form-control" id="name" [(ngModel)]="app.appName" /> | ||
</div> | ||
<div class="mb-3"> | ||
<label class="form-label">Release</label> | ||
<ng-select id="selectRelease" [(ngModel)]="app.appReleaseId" placeholder="Select release"> | ||
@for (release of releases(); track release.id) { | ||
<ng-option [value]="release.id">{{ release.name }}</ng-option> | ||
} | ||
</ng-select> | ||
</div> | ||
<div class="mb-3"> | ||
<label class="form-label">Applicationserver</label> | ||
<ng-select id="selectAppServer" [(ngModel)]="appServerGroup" placeholder="Select applicationserver"> | ||
@for (appServer of appServerGroups(); track appServer.id) { | ||
<ng-option [value]="appServer">{{ appServer.name }}</ng-option> | ||
} | ||
</ng-select> | ||
</div> | ||
<div class="mb-3"> | ||
<label class="form-label">Applicationserver Release</label> | ||
<ng-select | ||
id="selectAppServerRelease" | ||
[(ngModel)]="appServerRelease" | ||
[disabled]="hasInvalidGroup()" | ||
placeholder="Select AS release" | ||
> | ||
@if (appServerGroup && appServerGroup.releases) { @for (release of appServerGroup.releases; track release.id) { | ||
<ng-option [value]="release">{{ release.release }}</ng-option> | ||
} } | ||
</ng-select> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="modal-footer"> | ||
<button type="button" class="btn btn-light" (click)="cancel()" [attr.data-cy]="'button-cancel'">Cancel</button> | ||
<button | ||
type="button" | ||
class="btn btn-primary" | ||
[disabled]="hasInvalidFields()" | ||
(click)="save()" | ||
[attr.data-cy]="'button-save'" | ||
> | ||
Save | ||
</button> | ||
</div> |
15 changes: 15 additions & 0 deletions
15
AMW_angular/io/src/app/apps/app-add/app-add.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { AppAddComponent } from './app-add.component'; | ||
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; | ||
|
||
describe('AppAddComponent', () => { | ||
let component: AppAddComponent; | ||
const activeModal = new NgbActiveModal(); | ||
|
||
beforeEach(async () => { | ||
component = new AppAddComponent(activeModal); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import { Component, EventEmitter, Input, Output, Signal } from '@angular/core'; | ||
import { FormsModule } from '@angular/forms'; | ||
import { NgSelectModule } from '@ng-select/ng-select'; | ||
import { Release } from '../../settings/releases/release'; | ||
import { Release as Rel } from '../../resource/release'; | ||
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; | ||
import { Resource } from '../../resource/resource'; | ||
import { AppCreate } from '../app-create'; | ||
|
||
@Component({ | ||
selector: 'app-app-add', | ||
standalone: true, | ||
imports: [FormsModule, NgSelectModule], | ||
templateUrl: './app-add.component.html', | ||
}) | ||
export class AppAddComponent { | ||
@Input() releases: Signal<Release[]>; | ||
@Input() appServerGroups: Signal<Resource[]>; | ||
@Output() saveApp: EventEmitter<AppCreate> = new EventEmitter<AppCreate>(); | ||
|
||
app: AppCreate = { appName: '', appReleaseId: null, appServerId: null, appServerReleaseId: null }; | ||
appServerGroup: Resource; | ||
appServerRelease: Rel; | ||
|
||
constructor(public activeModal: NgbActiveModal) { | ||
this.activeModal = activeModal; | ||
} | ||
|
||
hasInvalidGroup(): boolean { | ||
const isInvalid = | ||
this.appServerGroup === undefined || this.appServerGroup === null || this.appServerGroup?.releases.length === 0; | ||
if (isInvalid) { | ||
this.appServerRelease = undefined; | ||
} | ||
return isInvalid; | ||
} | ||
|
||
// apps without appserver are valid too | ||
hasInvalidFields(): boolean { | ||
return ( | ||
this.app.appName === '' || | ||
this.app.appReleaseId === null || | ||
(!this.hasInvalidGroup() && (this.appServerRelease === undefined || this.appServerRelease === null)) | ||
); | ||
} | ||
|
||
cancel() { | ||
this.activeModal.close(); | ||
} | ||
|
||
save() { | ||
const app: AppCreate = { | ||
appName: this.app.appName, | ||
appReleaseId: this.app.appReleaseId, | ||
appServerId: this.appServerGroup?.id, | ||
appServerReleaseId: this.appServerRelease?.id, | ||
}; | ||
this.saveApp.emit(app); | ||
this.activeModal.close(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export interface AppCreate { | ||
appName: string; | ||
appReleaseId: number; | ||
appServerId: number; | ||
appServerReleaseId: number; | ||
} |
26 changes: 26 additions & 0 deletions
26
AMW_angular/io/src/app/apps/app-server-add/app-server-add.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<div class="modal-header"> | ||
<h5 class="modal-title" id="createApplicationServer">Create application server</h5> | ||
<button type="button" class="btn btn-light close" aria-label="Close" (click)="cancel()"> | ||
<span aria-hidden="true">×</span> | ||
</button> | ||
</div> | ||
<div class="modal-body"> | ||
<div class="form-horizontal mx-2"> | ||
<div class="mb-3"> | ||
<label for="name" class="form-label">Applicationserver</label> | ||
<input type="text" class="form-control" id="name" [(ngModel)]="appServer.name" /> | ||
</div> | ||
<div class="mb-3"> | ||
<label class="form-label">Release</label> | ||
<ng-select id="selectRelease" [(ngModel)]="appServer.release" placeholder="Select release"> | ||
@for (release of releases(); track release.id) { | ||
<ng-option [value]="release">{{ release.name }}</ng-option> | ||
} | ||
</ng-select> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="modal-footer"> | ||
<button type="button" class="btn btn-light" (click)="cancel()">Cancel</button> | ||
<button type="button" class="btn btn-primary" [disabled]="hasInvalidFields()" (click)="save()">Save</button> | ||
</div> |
15 changes: 15 additions & 0 deletions
15
AMW_angular/io/src/app/apps/app-server-add/app-server-add.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; | ||
import { AppServerAddComponent } from './app-server-add.component'; | ||
|
||
describe('AppServerAddComponent', () => { | ||
let component: AppServerAddComponent; | ||
const activeModal = new NgbActiveModal(); | ||
|
||
beforeEach(async () => { | ||
component = new AppServerAddComponent(activeModal); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
44 changes: 44 additions & 0 deletions
44
AMW_angular/io/src/app/apps/app-server-add/app-server-add.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { Component, EventEmitter, Input, Output, Signal } from '@angular/core'; | ||
import { Release } from '../../settings/releases/release'; | ||
import { AppServer } from '../app-server'; | ||
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; | ||
import { FormsModule } from '@angular/forms'; | ||
import { NgSelectModule } from '@ng-select/ng-select'; | ||
|
||
@Component({ | ||
selector: 'app-server-add', | ||
standalone: true, | ||
imports: [FormsModule, NgSelectModule], | ||
templateUrl: './app-server-add.component.html', | ||
}) | ||
export class AppServerAddComponent { | ||
@Input() releases: Signal<Release[]>; | ||
@Output() saveAppServer: EventEmitter<AppServer> = new EventEmitter<AppServer>(); | ||
|
||
appServer: AppServer = { name: '', apps: [], deletable: false, id: null, runtimeName: '', release: null }; | ||
|
||
constructor(public activeModal: NgbActiveModal) { | ||
this.activeModal = activeModal; | ||
} | ||
|
||
hasInvalidFields(): boolean { | ||
return this.appServer.name === '' || this.appServer.release?.id === null || this.appServer.release?.name === ''; | ||
} | ||
|
||
cancel() { | ||
this.activeModal.close(); | ||
} | ||
|
||
save() { | ||
const appServer: AppServer = { | ||
name: this.appServer.name, | ||
release: this.appServer.release, | ||
deletable: this.appServer.deletable, | ||
id: this.appServer.id, | ||
runtimeName: this.appServer.runtimeName, | ||
apps: this.appServer.apps, | ||
}; | ||
this.saveAppServer.emit(appServer); | ||
this.activeModal.close(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { Release } from '../settings/releases/release'; | ||
import { App } from './app'; | ||
|
||
export interface AppServer { | ||
id: number; | ||
name: string; | ||
deletable: boolean; | ||
runtimeName: string; | ||
release: Release; | ||
apps: App[]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { Release } from '../settings/releases/release'; | ||
|
||
export interface App { | ||
id: number; | ||
name: string; | ||
release: Release; | ||
} |
Oops, something went wrong.