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

Commit bfdf0e1

Browse files
BoykoAlexcppwfs
authored andcommitted
Stream UI adjustments for skipper mode
Fixed comments on merge
1 parent d442f0d commit bfdf0e1

12 files changed

+74
-16
lines changed

ui/src/app/shared/flo/support/app-metadata.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export class AppMetadata implements Flo.ElementMetadata {
1818
constructor(
1919
private _group: string,
2020
private _name: string,
21+
private _version: string,
2122
private _dataObs: Observable<DetailedAppRegistration>,
2223
private _metadata?: Flo.ExtraMetadata
2324
) {}
@@ -103,6 +104,10 @@ export class AppMetadata implements Flo.ElementMetadata {
103104
return this._metadata;
104105
}
105106

107+
get version(): string {
108+
return this._version;
109+
}
110+
106111
}
107112

108113
export interface CodeOptions {

ui/src/app/shared/model/app-registration.model.spec.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ describe('AppRegistration', () => {
77
const json = {
88
'name': 'file',
99
'type': 'source',
10+
'version': '1.2.0.RELEASE',
11+
'defaultVersion': true,
1012
'uri': 'maven://org.springframework.cloud.stream.app:file-source-rabbit:1.2.0.RELEASE',
1113
'_links':
1214
{
@@ -21,6 +23,8 @@ describe('AppRegistration', () => {
2123
expect(appRegistration.name).toBe('file');
2224
expect(appRegistration.type.toString()).toEqual(ApplicationType[ApplicationType.source].toString());
2325
expect(appRegistration.uri).toBe('maven://org.springframework.cloud.stream.app:file-source-rabbit:1.2.0.RELEASE');
26+
expect(appRegistration.version).toBe('1.2.0.RELEASE');
27+
expect(appRegistration.defaultVersion).toBe(true);
2428
});
2529
});
2630
});

ui/src/app/shared/model/app-registration.model.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ export class AppRegistration implements Selectable, Serializable<AppRegistration
1515
public metaDataUri: string;
1616
public force: boolean;
1717

18+
public version: string;
19+
public defaultVersion: boolean;
20+
21+
1822
constructor(
1923
name?: string,
2024
type?: ApplicationType,
@@ -41,6 +45,8 @@ export class AppRegistration implements Selectable, Serializable<AppRegistration
4145
this.name = input.name;
4246
this.type = input.type as ApplicationType;
4347
this.uri = input.uri;
48+
this.version = input.version;
49+
this.defaultVersion = input.defaultVersion;
4450
return this;
4551
}
4652

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ export class EditorService implements Flo.Editor {
6666
createHandle(owner, Constants.PROPERTIES_HANDLE_TYPE, () => {
6767
const modalRef = this.bsModalService.show(StreamPropertiesDialogComponent);
6868
modalRef.content.title = `Properties for ${element.attr('metadata/name').toUpperCase()}`;
69+
if (element.attr('metadata/version')) {
70+
modalRef.content.title += ` (${element.attr('metadata/version')})`;
71+
}
6972
modalRef.content.setData(element, flo.getGraph());
7073
}, pt);
7174
}

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export class MetamodelService implements Flo.Metamodel {
4242
* @param errorHandler used to generate the error messages.
4343
*/
4444
constructor(
45-
private appsService: SharedAppsService,
45+
private appsService: SharedAppsService
4646
) {}
4747

4848
textToGraph(flo: Flo.EditorContext, dsl: string): Promise<any> {
@@ -94,7 +94,7 @@ export class MetamodelService implements Flo.Metamodel {
9494
if (group.has(item.name)) {
9595
console.error(`Group '${item.type}' has duplicate element '${item.name}'`);
9696
} else {
97-
group.set(item.name, this.createEntry(item.type, item.name));
97+
group.set(item.name, this.createEntry(item.type, item.name, item.version));
9898
}
9999
});
100100
resolve(metamodel);
@@ -108,10 +108,11 @@ export class MetamodelService implements Flo.Metamodel {
108108
return this.request;
109109
}
110110

111-
private createEntry(type: ApplicationType, name: string, metadata?: Flo.ExtraMetadata): AppMetadata {
111+
private createEntry(type: ApplicationType, name: string, version: string, metadata?: Flo.ExtraMetadata): AppMetadata {
112112
return new AppMetadata(
113113
type.toString(),
114114
name,
115+
version,
115116
this.appsService.getAppInfo(type, name),
116117
metadata
117118
);

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,10 @@ <h4 class="modal-title pull-left">Create Stream</h4>
4040
</td>
4141
</tr>
4242
</tbody>
43-
<label class="dialog-control"><input [disabled]="isStreamCreationInProgress()" type="checkbox" [(ngModel)]="deploy"
44-
[ngModelOptions]="{standalone: true}"/>Deploy stream(s)</label>
43+
<label class="dialog-control" *ngIf="(featureInfo | async) && !(featureInfo | async)?.skipperEnabled">
44+
<input [disabled]="isStreamCreationInProgress()" type="checkbox" [(ngModel)]="deploy"
45+
[ngModelOptions]="{standalone: true}"/>Deploy stream(s)
46+
</label>
4547
<div *ngIf="progressData">
4648
<hr/>
4749
<div>Creating Streams...</div>

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ import { ToastyService } from 'ng2-toasty';
99
import { Properties } from 'spring-flo';
1010
import { Subscription } from 'rxjs/Subscription';
1111
import { Router } from '@angular/router';
12+
import { SharedAboutService } from '../../shared/services/shared-about.service';
13+
import { FeatureInfo } from '../../shared/model/about/feature-info.model';
14+
import { Observable } from 'rxjs/Observable';
15+
import { share } from 'rxjs/operators';
1216

1317
/**
1418
* Stores progress percentage.
@@ -47,6 +51,7 @@ export class StreamCreateDialogComponent implements OnInit {
4751
progressData: ProgressData;
4852
deploy = false;
4953
successCallback: () => void;
54+
featureInfo: Observable<FeatureInfo>;
5055

5156
busy: Subscription;
5257

@@ -55,14 +60,15 @@ export class StreamCreateDialogComponent implements OnInit {
5560
private toastyService: ToastyService,
5661
private parserService: ParserService,
5762
private streamService: StreamsService,
58-
private router: Router
63+
private router: Router,
64+
private aboutService: SharedAboutService
5965
) {}
6066

6167
ngOnInit() {
6268
this.form = new FormGroup({}, this.uniqueStreamNames());
69+
this.featureInfo = this.aboutService.getFeatureInfo().pipe(share());
6370
}
6471

65-
6672
setDsl(dsl: string) {
6773
// Remove empty lines from text definition and strip off white space
6874
let newLineNumber = 0;

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,16 @@
9898
class="btn btn-default" style="margin-left: 0;" title="Undeploy">
9999
<span class="glyphicon glyphicon-stop"></span>
100100
</button>
101-
<button type="button" [appRoles]="['ROLE_CREATE']" [disabled]="(item.status==='deployed' || item.status==='deploying')" (click)="deploy(item)"
101+
102+
<button *ngIf="!(featureInfo | async)?.skipperEnabled" type="button" [appRoles]="['ROLE_CREATE']" [disabled]="(item.status==='deployed' || item.status==='deploying')" (click)="deploy(item)"
102103
class="btn btn-default" style="margin-left: 0;" title="Deploy">
103104
<span class="glyphicon glyphicon-play"></span>
104105
</button>
106+
<button *ngIf="(featureInfo | async)?.skipperEnabled" type="button" [appRoles]="['ROLE_CREATE']" class="btn btn-default" style="margin-left: 0;"
107+
popover="Switch to the Shell to deploy a stream using Skipper. The Dashboard support for it is under development" popoverTitle="Unsupported" placement="bottom" triggers="focus">
108+
<span class="glyphicon glyphicon-play"></span>
109+
</button>
110+
105111
<button type="button" [appRoles]="['ROLE_CREATE']" (click)="destroy(item)"
106112
class="btn btn-default" style="margin-left: 0;" title="Destroy">
107113
<span class="glyphicon glyphicon-remove"></span>

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import {TriStateCheckboxComponent} from '../../shared/components/tri-state-check
2727
import {DeploymentPropertiesComponent} from './deployment-properties/deployment-properties.component';
2828
import { MocksSharedAboutService } from '../../tests/mocks/shared-about';
2929
import { SharedAboutService } from '../../shared/services/shared-about.service';
30+
import { DataflowVersionInfo } from '../../tests/mocks/about';
3031

3132
/**
3233
* Test {@link StreamDefinitionsComponent}.
@@ -45,7 +46,11 @@ describe('StreamDefinitionsComponent', () => {
4546

4647
beforeEach(async(() => {
4748
activeRoute = new MockActivatedRoute();
48-
const aboutService = new MocksSharedAboutService();
49+
50+
// Disable skipper mode initially to get Deploy UI tests to pass
51+
const info = new DataflowVersionInfo();
52+
info.featureInfo.skipperEnabled = false;
53+
const aboutService = new MocksSharedAboutService(info);
4954

5055
TestBed.configureTestingModule({
5156
declarations: [

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ import { StreamMetrics } from '../model/stream-metrics';
1010

1111
import { ToastyService} from 'ng2-toasty';
1212
import { Router } from '@angular/router';
13+
import { SharedAboutService } from '../../shared/services/shared-about.service';
14+
import { FeatureInfo } from '../../shared/model/about/feature-info.model';
15+
import { Observable } from 'rxjs/Observable';
16+
import { share } from 'rxjs/operators';
1317

1418
@Component({
1519
selector: 'app-stream-definitions',
@@ -42,6 +46,8 @@ export class StreamDefinitionsComponent implements OnInit, OnDestroy {
4246

4347
selectStreamDefinition: StreamDefinition;
4448

49+
featureInfo: Observable<FeatureInfo>;
50+
4551
@ViewChild('destroyMultipleStreamDefinitionsModal')
4652
public destroyMultipleStreamDefinitionsModal: ModalDirective;
4753

@@ -60,6 +66,7 @@ export class StreamDefinitionsComponent implements OnInit, OnDestroy {
6066
constructor(
6167
public streamsService: StreamsService,
6268
private toastyService: ToastyService,
69+
private aboutService: SharedAboutService,
6370
private router: Router) {
6471
}
6572

@@ -69,6 +76,7 @@ export class StreamDefinitionsComponent implements OnInit, OnDestroy {
6976
ngOnInit() {
7077
this.loadStreamDefinitions();
7178
this.metricsSubscription = IntervalObservable.create(2000).subscribe(() => this.loadStreamMetrics());
79+
this.featureInfo = this.aboutService.getFeatureInfo().pipe(share());
7280
}
7381

7482
ngOnDestroy() {

0 commit comments

Comments
 (0)