Skip to content

Commit

Permalink
gh-633 Stream Deployment: UX improvements
Browse files Browse the repository at this point in the history
* Add lib SaveFile
* Fix Lint Errors
* Implement UX Deployment

Resolves #633
Resolves #647
  • Loading branch information
oodamien authored and ghillert committed Mar 9, 2018
1 parent cf8508f commit 5697ceb
Show file tree
Hide file tree
Showing 22 changed files with 1,852 additions and 256 deletions.
1 change: 1 addition & 0 deletions ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"zone.js": "0.8.20",
"bootstrap-sass": "3.3.7",
"d3": "4.12.0",
"file-saver": "1.3.3",
"dagre": "0.7.4",
"moment": "2.19.3",
"ng2-stomp-service": "1.2.2",
Expand Down
4 changes: 4 additions & 0 deletions ui/src/app/apps/apps.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ import {AppsWorkaroundService} from './apps.workaround.service';
],
providers: [
AppsService, AppsWorkaroundService
],
exports: [
AppTypeComponent,
AppVersionLabelComponent
]
})
export class AppsModule {
Expand Down
4 changes: 2 additions & 2 deletions ui/src/app/shared/services/shared-apps.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ export class SharedAppsService {
const params = HttpUtils.getPaginationParams(pageRequest.page, pageRequest.size);
const requestOptionsArgs: RequestOptionsArgs = HttpUtils.getDefaultRequestOptions();

if (type) {
if (type !== null) {
params.append('type', ApplicationType[type]);
}
if (search) {
if (search !== null) {
params.append('search', search);
}
if (sort) {
Expand Down
2 changes: 1 addition & 1 deletion ui/src/app/streams/flo/editor.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { dia } from 'jointjs';
import { StreamPropertiesDialogComponent } from './properties/stream-properties-dialog.component';
import { Utils } from './support/utils';
import * as _joint from 'jointjs';
import {StreamGraphPropertiesSource, StreamHead} from "./properties/stream-properties-source";
import {StreamGraphPropertiesSource, StreamHead} from './properties/stream-properties-source';
const joint: any = _joint;

const NODE_DROPPING = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {dia} from 'jointjs';
import PropertiesSource = Properties.PropertiesSource;

export interface StreamHead {
presentStreamNames: string[]
presentStreamNames: string[];
}

export interface StreamAppPropertiesSource extends PropertiesSource {
Expand Down
32 changes: 32 additions & 0 deletions ui/src/app/streams/model/stream-deploy-config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/**
* Represents a Stream Deploy Config.
*
* @author Damien Vitrac
*/
export class StreamDeployConfig {

skipper = false;

id: string;

platform: any;

deployers: any;

apps: any;

constructor() {

}

platformExist(key: string): boolean {
if (!key) {
return true;
}
if (this.platform) {
return this.platform.values.filter((a) => a.key === key).length > 0;
}
return false;
}

}
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import {Component, OnInit, Output, EventEmitter, Input, OnDestroy} from '@angular/core';
import {FormGroup, FormControl, FormBuilder} from '@angular/forms';
import {validateDeploymentProperties} from '../../stream-deploy/stream-deploy-validators';
import {StreamDefinition} from '../../model/stream-definition';
import {Subscription} from 'rxjs/Subscription';
import {Platform} from '../../model/platform';
import {SharedAboutService} from '../../../shared/services/shared-about.service';
import {StreamsService} from '../../streams.service';
import { takeUntil } from 'rxjs/operators';
import { Subject } from 'rxjs/Subject';
import {takeUntil} from 'rxjs/operators';
import {Subject} from 'rxjs/Subject';
import {StreamDeployValidator} from '../../stream-deploy/stream-deploy.validator';

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

id: String;
form: FormGroup;
deploymentProperties = new FormControl('', validateDeploymentProperties);
deploymentProperties = new FormControl('', StreamDeployValidator.validateDeploymentProperties);
deploymentPlatform = new FormControl('');

platforms: Platform[];
Expand Down Expand Up @@ -66,17 +66,17 @@ export class DeploymentPropertiesComponent implements OnInit, OnDestroy {
*/
ngOnInit() {
this.subscriptionFeatureInfo = this.sharedAboutService.getFeatureInfo()
.pipe(takeUntil(this.ngUnsubscribe$))
.subscribe(featureInfo => {
this.skipperEnabled = featureInfo.skipperEnabled;
if (this.skipperEnabled) {
this.subscriptionPlatforms = this.streamsService.platforms()
.pipe(takeUntil(this.ngUnsubscribe$))
.subscribe((platforms: Platform[]) => {
this.platforms = platforms;
});
}
});
.pipe(takeUntil(this.ngUnsubscribe$))
.subscribe(featureInfo => {
this.skipperEnabled = featureInfo.skipperEnabled;
if (this.skipperEnabled) {
this.subscriptionPlatforms = this.streamsService.platforms()
.pipe(takeUntil(this.ngUnsubscribe$))
.subscribe((platforms: Platform[]) => {
this.platforms = platforms;
});
}
});
this.deploymentPlatform.setValue('default');
if (this.stream.deploymentProperties instanceof Object) {
if (this.stream.deploymentProperties.platformName) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import {Component, EventEmitter, ViewEncapsulation} from '@angular/core';
import {PropertiesDialogComponent} from '../../../shared/flo/properties/properties-dialog.component';
import {BsModalRef} from 'ngx-bootstrap';
import {StreamsService} from '../../streams.service';
import {StreamAppPropertiesSource, StreamHead} from '../../flo/properties/stream-properties-source';
import {StreamPropertiesGroupModel} from '../../flo/properties/stream-properties-dialog.component';
import {Observable} from 'rxjs/Observable';
import {Properties} from 'spring-flo';

/**
* Component for displaying application properties and capturing their values.
*
* @author Damien Vitrac
*/
@Component({
selector: 'app-stream-deploy-app-properties',
templateUrl: '../../../shared/flo/properties/properties-dialog.component.html',
styleUrls: ['../../../shared/flo/properties/properties-dialog.component.scss'],
encapsulation: ViewEncapsulation.None
})
export class StreamDeployAppPropertiesComponent extends PropertiesDialogComponent {

public title: string;

constructor(bsModalRef: BsModalRef,
private streamService: StreamsService) {

super(bsModalRef);
}

setData(propertiesSource: StreamAppPropertiesSource) {
this.propertiesGroupModel = new StreamPropertiesGroupModel(
propertiesSource,
this.streamService);
this.propertiesGroupModel.load();
}

}

export class AppPropertiesSource implements StreamAppPropertiesSource {

private options: Array<any>;
public confirm = new EventEmitter();

constructor(options: Array<any>) {
this.options = options;
}

getStreamHead(): StreamHead {
return {presentStreamNames: []};
}

getProperties(): Promise<Properties.Property[]> {
return Observable.of(this.options).toPromise();
}

applyChanges(properties: Properties.Property[]): void {
this.confirm.emit(properties);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<div *ngIf="raw && raw.length > 0" class="properties-box">
<div class="property" *ngFor="let val of raw" [class.invalid]="val.status == 'invalid'">
<span *ngIf="val.status == 'invalid'" class="fa fa-warning">
</span>
<span class="key">{{ val.key }}</span>
<span class="equal"> = </span>
<span class="value">{{ val.value }}</span>
</div>
</div>
<div class="alert alert-info" style="display: inline-block" *ngIf="raw && raw.length == 0">
No properties defined
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import {ChangeDetectionStrategy, Component, Input, OnChanges, SimpleChanges} from '@angular/core';

/**
* Component used to display parameters of a stream deployment
*
* @author Damien Vitrac
*/
@Component({
selector: 'app-stream-deploy-properties-debug',
templateUrl: 'properties-debug.component.html',
styleUrls: ['../styles.scss'],
changeDetection: ChangeDetectionStrategy.OnPush
})
export class StreamDeployPropertiesDebugComponent implements OnChanges {

/**
* Array of properties
*/
@Input() raw: Array<PropertiesDebug>;

constructor() {
}

/**
* On Change
* @param {SimpleChanges} changes
*/
ngOnChanges(changes: SimpleChanges): void {
if (changes.raw.currentValue) {
this.raw = changes.raw.currentValue;
} else {
this.raw = [];
}
}

}

/**
* Dedicate Interface for {@Link StreamDeployPropertiesDebugComponent}
*/
export interface PropertiesDebug {
key: string;
value: string;
status: string;
}
28 changes: 0 additions & 28 deletions ui/src/app/streams/stream-deploy/stream-deploy-validators.spec.ts

This file was deleted.

26 changes: 0 additions & 26 deletions ui/src/app/streams/stream-deploy/stream-deploy-validators.ts

This file was deleted.

Loading

0 comments on commit 5697ceb

Please sign in to comment.