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

Commit a57be82

Browse files
ghillertjvalkeal
authored andcommitted
gh-564 When deploying streams, show spinner after clicking Deploy
1 parent d1f6c62 commit a57be82

File tree

6 files changed

+16
-10
lines changed

6 files changed

+16
-10
lines changed

ui/src/app/streams/stream-create-dialog/stream-create-dialog.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ <h4 class="modal-title pull-left">Create Stream</h4>
44
<span aria-hidden="true">&times;</span>
55
</button>
66
</div>
7-
<div class="modal-body" [formGroup]="form">
7+
<div class="modal-body" [formGroup]="form" [ngBusy]="busy">
88
<div *ngIf="errors && errors.length > 0" class="dialog-validation">
99
<div *ngFor="let error of errors">
1010
<label class="glyphicon glyphicon-exclamation-sign dialog-error-sign">{{error}}</label>

ui/src/app/streams/stream-create-dialog/stream-create-dialog.component.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,7 @@
2323
line-height: 1em;
2424
}
2525
}
26+
27+
.ng-busy {
28+
margin-top: 0;
29+
}

ui/src/app/streams/stream-create-dialog/stream-create-dialog.component.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { Utils } from '../flo/support/utils';
77
import { StreamsService } from '../streams.service';
88
import { ToastyService } from 'ng2-toasty';
99
import { Properties } from 'spring-flo';
10+
import { Subscription } from 'rxjs/Subscription';
1011

1112
/**
1213
* Stores progress percentage.
@@ -46,6 +47,7 @@ export class StreamCreateDialogComponent implements OnInit {
4647
deploy = false;
4748
successCallback: () => void;
4849

50+
busy: Subscription;
4951

5052
constructor(
5153
private bsModalRef: BsModalRef,
@@ -220,7 +222,7 @@ export class StreamCreateDialogComponent implements OnInit {
220222
} else {
221223
// Send the request to create a stream
222224
const def = this.streamDefs[index];
223-
this.streamService.createDefinition(def.name, def.def, this.deploy).subscribe(() => {
225+
this.busy = this.streamService.createDefinition(def.name, def.def, this.deploy).subscribe(() => {
224226
console.log('Stream ' + def.name + ' created OK');
225227
// Stream created successfully, mark it as created
226228
def.created = true;

ui/src/app/streams/stream-deploy/stream-deploy.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<h1>Deploy Stream Definition {{id}}</h1>
1+
<h1 [ngBusy]="busy">Deploy Stream Definition {{id}}</h1>
22

33
<p class="index-page--subtitle">
44
Please specify any <strong>optional</strong> deployment properties.

ui/src/app/streams/stream-deploy/stream-deploy.component.spec.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ describe('StreamDeployComponent', () => {
2727
let activeRoute: MockActivatedRoute;
2828
const commonTestParams = { id: '1' };
2929

30-
3130
beforeEach(async(() => {
3231
activeRoute = new MockActivatedRoute();
3332

ui/src/app/streams/stream-deploy/stream-deploy.component.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,26 @@ import { FormGroup, FormControl, FormBuilder } from '@angular/forms';
44
import { StreamsService } from '../streams.service';
55
import { ToastyService } from 'ng2-toasty';
66
import { validateDeploymentProperties } from './stream-deploy-validators';
7-
8-
@Component({
9-
selector: 'app-stream-deploy',
10-
templateUrl: './stream-deploy.component.html',
11-
})
7+
import { Subscription } from 'rxjs/Subscription';
128

139
/**
1410
* Component used to deploy stream definitions.
1511
*
1612
* @author Janne Valkealahti
1713
* @author Glenn Renfro
1814
*/
15+
@Component({
16+
selector: 'app-stream-deploy',
17+
templateUrl: './stream-deploy.component.html'
18+
})
1919
export class StreamDeployComponent implements OnInit, OnDestroy {
2020

2121
id: String;
2222
private sub: any;
2323
form: FormGroup;
2424
deploymentProperties = new FormControl('', validateDeploymentProperties);
2525
propertiesAsMap = {};
26+
busy: Subscription;
2627

2728
/**
2829
* Adds deployment properties to the FormBuilder
@@ -82,7 +83,7 @@ export class StreamDeployComponent implements OnInit, OnDestroy {
8283
}
8384
}
8485

85-
this.streamsService.deployDefinition(this.id, this.propertiesAsMap).subscribe(
86+
this.busy = this.streamsService.deployDefinition(this.id, this.propertiesAsMap).subscribe(
8687
data => {
8788
this.toastyService.success('Successfully deployed stream definition "'
8889
+ this.id + '"');

0 commit comments

Comments
 (0)