Skip to content
This repository was archived by the owner on May 14, 2025. It is now read-only.

Commit 5697ceb

Browse files
oodamienghillert
authored andcommitted
gh-633 Stream Deployment: UX improvements
* Add lib SaveFile * Fix Lint Errors * Implement UX Deployment Resolves #633 Resolves #647
1 parent cf8508f commit 5697ceb

22 files changed

+1852
-256
lines changed

ui/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
"zone.js": "0.8.20",
3131
"bootstrap-sass": "3.3.7",
3232
"d3": "4.12.0",
33+
"file-saver": "1.3.3",
3334
"dagre": "0.7.4",
3435
"moment": "2.19.3",
3536
"ng2-stomp-service": "1.2.2",

ui/src/app/apps/apps.module.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ import {AppsWorkaroundService} from './apps.workaround.service';
3333
],
3434
providers: [
3535
AppsService, AppsWorkaroundService
36+
],
37+
exports: [
38+
AppTypeComponent,
39+
AppVersionLabelComponent
3640
]
3741
})
3842
export class AppsModule {

ui/src/app/shared/services/shared-apps.service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ export class SharedAppsService {
2828
const params = HttpUtils.getPaginationParams(pageRequest.page, pageRequest.size);
2929
const requestOptionsArgs: RequestOptionsArgs = HttpUtils.getDefaultRequestOptions();
3030

31-
if (type) {
31+
if (type !== null) {
3232
params.append('type', ApplicationType[type]);
3333
}
34-
if (search) {
34+
if (search !== null) {
3535
params.append('search', search);
3636
}
3737
if (sort) {

ui/src/app/streams/flo/editor.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import { dia } from 'jointjs';
2222
import { StreamPropertiesDialogComponent } from './properties/stream-properties-dialog.component';
2323
import { Utils } from './support/utils';
2424
import * as _joint from 'jointjs';
25-
import {StreamGraphPropertiesSource, StreamHead} from "./properties/stream-properties-source";
25+
import {StreamGraphPropertiesSource, StreamHead} from './properties/stream-properties-source';
2626
const joint: any = _joint;
2727

2828
const NODE_DROPPING = false;

ui/src/app/streams/flo/properties/stream-properties-source.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {dia} from 'jointjs';
66
import PropertiesSource = Properties.PropertiesSource;
77

88
export interface StreamHead {
9-
presentStreamNames: string[]
9+
presentStreamNames: string[];
1010
}
1111

1212
export interface StreamAppPropertiesSource extends PropertiesSource {
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/**
2+
* Represents a Stream Deploy Config.
3+
*
4+
* @author Damien Vitrac
5+
*/
6+
export class StreamDeployConfig {
7+
8+
skipper = false;
9+
10+
id: string;
11+
12+
platform: any;
13+
14+
deployers: any;
15+
16+
apps: any;
17+
18+
constructor() {
19+
20+
}
21+
22+
platformExist(key: string): boolean {
23+
if (!key) {
24+
return true;
25+
}
26+
if (this.platform) {
27+
return this.platform.values.filter((a) => a.key === key).length > 0;
28+
}
29+
return false;
30+
}
31+
32+
}

ui/src/app/streams/stream-definitions/deployment-properties/deployment-properties.component.ts

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import {Component, OnInit, Output, EventEmitter, Input, OnDestroy} from '@angular/core';
22
import {FormGroup, FormControl, FormBuilder} from '@angular/forms';
3-
import {validateDeploymentProperties} from '../../stream-deploy/stream-deploy-validators';
43
import {StreamDefinition} from '../../model/stream-definition';
54
import {Subscription} from 'rxjs/Subscription';
65
import {Platform} from '../../model/platform';
76
import {SharedAboutService} from '../../../shared/services/shared-about.service';
87
import {StreamsService} from '../../streams.service';
9-
import { takeUntil } from 'rxjs/operators';
10-
import { Subject } from 'rxjs/Subject';
8+
import {takeUntil} from 'rxjs/operators';
9+
import {Subject} from 'rxjs/Subject';
10+
import {StreamDeployValidator} from '../../stream-deploy/stream-deploy.validator';
1111

1212
@Component({
1313
selector: 'app-stream-deployment-properties',
@@ -26,7 +26,7 @@ export class DeploymentPropertiesComponent implements OnInit, OnDestroy {
2626

2727
id: String;
2828
form: FormGroup;
29-
deploymentProperties = new FormControl('', validateDeploymentProperties);
29+
deploymentProperties = new FormControl('', StreamDeployValidator.validateDeploymentProperties);
3030
deploymentPlatform = new FormControl('');
3131

3232
platforms: Platform[];
@@ -66,17 +66,17 @@ export class DeploymentPropertiesComponent implements OnInit, OnDestroy {
6666
*/
6767
ngOnInit() {
6868
this.subscriptionFeatureInfo = this.sharedAboutService.getFeatureInfo()
69-
.pipe(takeUntil(this.ngUnsubscribe$))
70-
.subscribe(featureInfo => {
71-
this.skipperEnabled = featureInfo.skipperEnabled;
72-
if (this.skipperEnabled) {
73-
this.subscriptionPlatforms = this.streamsService.platforms()
74-
.pipe(takeUntil(this.ngUnsubscribe$))
75-
.subscribe((platforms: Platform[]) => {
76-
this.platforms = platforms;
77-
});
78-
}
79-
});
69+
.pipe(takeUntil(this.ngUnsubscribe$))
70+
.subscribe(featureInfo => {
71+
this.skipperEnabled = featureInfo.skipperEnabled;
72+
if (this.skipperEnabled) {
73+
this.subscriptionPlatforms = this.streamsService.platforms()
74+
.pipe(takeUntil(this.ngUnsubscribe$))
75+
.subscribe((platforms: Platform[]) => {
76+
this.platforms = platforms;
77+
});
78+
}
79+
});
8080
this.deploymentPlatform.setValue('default');
8181
if (this.stream.deploymentProperties instanceof Object) {
8282
if (this.stream.deploymentProperties.platformName) {
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
import {Component, EventEmitter, ViewEncapsulation} from '@angular/core';
2+
import {PropertiesDialogComponent} from '../../../shared/flo/properties/properties-dialog.component';
3+
import {BsModalRef} from 'ngx-bootstrap';
4+
import {StreamsService} from '../../streams.service';
5+
import {StreamAppPropertiesSource, StreamHead} from '../../flo/properties/stream-properties-source';
6+
import {StreamPropertiesGroupModel} from '../../flo/properties/stream-properties-dialog.component';
7+
import {Observable} from 'rxjs/Observable';
8+
import {Properties} from 'spring-flo';
9+
10+
/**
11+
* Component for displaying application properties and capturing their values.
12+
*
13+
* @author Damien Vitrac
14+
*/
15+
@Component({
16+
selector: 'app-stream-deploy-app-properties',
17+
templateUrl: '../../../shared/flo/properties/properties-dialog.component.html',
18+
styleUrls: ['../../../shared/flo/properties/properties-dialog.component.scss'],
19+
encapsulation: ViewEncapsulation.None
20+
})
21+
export class StreamDeployAppPropertiesComponent extends PropertiesDialogComponent {
22+
23+
public title: string;
24+
25+
constructor(bsModalRef: BsModalRef,
26+
private streamService: StreamsService) {
27+
28+
super(bsModalRef);
29+
}
30+
31+
setData(propertiesSource: StreamAppPropertiesSource) {
32+
this.propertiesGroupModel = new StreamPropertiesGroupModel(
33+
propertiesSource,
34+
this.streamService);
35+
this.propertiesGroupModel.load();
36+
}
37+
38+
}
39+
40+
export class AppPropertiesSource implements StreamAppPropertiesSource {
41+
42+
private options: Array<any>;
43+
public confirm = new EventEmitter();
44+
45+
constructor(options: Array<any>) {
46+
this.options = options;
47+
}
48+
49+
getStreamHead(): StreamHead {
50+
return {presentStreamNames: []};
51+
}
52+
53+
getProperties(): Promise<Properties.Property[]> {
54+
return Observable.of(this.options).toPromise();
55+
}
56+
57+
applyChanges(properties: Properties.Property[]): void {
58+
this.confirm.emit(properties);
59+
}
60+
61+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<div *ngIf="raw && raw.length > 0" class="properties-box">
2+
<div class="property" *ngFor="let val of raw" [class.invalid]="val.status == 'invalid'">
3+
<span *ngIf="val.status == 'invalid'" class="fa fa-warning">
4+
</span>
5+
<span class="key">{{ val.key }}</span>
6+
<span class="equal"> = </span>
7+
<span class="value">{{ val.value }}</span>
8+
</div>
9+
</div>
10+
<div class="alert alert-info" style="display: inline-block" *ngIf="raw && raw.length == 0">
11+
No properties defined
12+
</div>
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import {ChangeDetectionStrategy, Component, Input, OnChanges, SimpleChanges} from '@angular/core';
2+
3+
/**
4+
* Component used to display parameters of a stream deployment
5+
*
6+
* @author Damien Vitrac
7+
*/
8+
@Component({
9+
selector: 'app-stream-deploy-properties-debug',
10+
templateUrl: 'properties-debug.component.html',
11+
styleUrls: ['../styles.scss'],
12+
changeDetection: ChangeDetectionStrategy.OnPush
13+
})
14+
export class StreamDeployPropertiesDebugComponent implements OnChanges {
15+
16+
/**
17+
* Array of properties
18+
*/
19+
@Input() raw: Array<PropertiesDebug>;
20+
21+
constructor() {
22+
}
23+
24+
/**
25+
* On Change
26+
* @param {SimpleChanges} changes
27+
*/
28+
ngOnChanges(changes: SimpleChanges): void {
29+
if (changes.raw.currentValue) {
30+
this.raw = changes.raw.currentValue;
31+
} else {
32+
this.raw = [];
33+
}
34+
}
35+
36+
}
37+
38+
/**
39+
* Dedicate Interface for {@Link StreamDeployPropertiesDebugComponent}
40+
*/
41+
export interface PropertiesDebug {
42+
key: string;
43+
value: string;
44+
status: string;
45+
}

0 commit comments

Comments
 (0)