Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

re #2613 Apicurio Integration #2886

Merged
merged 23 commits into from
Jul 16, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
8f81cbb
Res merge conflicts in package.json
kahboom Jun 25, 2018
b958f11
Add Apicurio references to ApiConnectorModule
kahboom Jun 15, 2018
1f575a0
Add Apicurio references to ApiConnectorCreateComponent
kahboom Jun 15, 2018
416e819
Add temporary API definition in constructor
kahboom Jun 15, 2018
341ae13
Add selector, reference fnx in template
kahboom Jun 15, 2018
ff1160d
Display editor only on submitting step 2
kahboom Jun 19, 2018
57fc47e
Show or hide editor
kahboom Jun 20, 2018
507f7cc
Pass param via EventEmitter to determine whether or not ot hide or sh…
kahboom Jun 20, 2018
dcde98d
Hide Step 2 to display editor
kahboom Jun 20, 2018
129267f
Add reference to existing specification file uploaded
kahboom Jun 20, 2018
77b98d2
Add header for template
kahboom Jun 20, 2018
27f511d
Styling for Review btn, minor changes
kahboom Jun 25, 2018
4394651
chore: read swagger document locally and pass to api editor
gashcrumb Jun 26, 2018
ef2a27a
update to patternfly 3.51.2
mcoker Jun 27, 2018
42a5468
chore: Update to AtlasMap 1.35.4
igarashitm Jun 28, 2018
7cc4e0e
chore(deps): upgrade angular core and rxjs
seanforyou23 Jun 5, 2018
0ad99d2
chore: upgrade to patternfly-ng 4.x (partial)
gashcrumb Jul 2, 2018
f95acb7
fix: app/ui/.snyk & app/ui/package.json to reduce vulnerabilities
snyk-bot Jun 26, 2018
2bd8b9e
Fix for Angular 6 upgrade with CLI 7 causing fs not found for yamljs
kahboom Jul 5, 2018
7d76b68
Moving polyfills to polyfills file
kahboom Jul 5, 2018
3fbe6f7
Moving shims to shims file
kahboom Jul 5, 2018
b6f892a
Rm postinstall script
kahboom Jul 5, 2018
72d6147
Fix lint issues
kahboom Jul 13, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/ui/.yarnrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
config set ignore-engines true
5 changes: 5 additions & 0 deletions app/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"@angular/platform-browser-dynamic": "^6.0.3",
"@angular/router": "^6.0.3",
"@atlasmap/atlasmap-data-mapper": "1.35.4",
"apicurio-design-studio": "^0.2.11-3",
"@ng-dynamic-forms/core": "^5.4.6",
"@ngrx/effects": "^6.0.1",
"@ngrx/store": "^6.0.1",
Expand All @@ -51,6 +52,7 @@
"angular2-text-mask": "^9.0.0",
"better-npm-run": "^0.0.15",
"bootstrap": "3.3.7",
"brace": "^0.11.1",
"core-js": "^2.5.5",
"file-saver": "^1.3.3",
"jquery": "3.1.1",
Expand All @@ -60,6 +62,8 @@
"ng2-file-upload": "1.3.0",
"ngx-bootstrap": "^3.0.0",
"ngx-chips": "^1.9.2",
"oai-ts-commands": "^0.2.28",
"oai-ts-core": "^0.2.15",
"patternfly": "3.51.2",
"patternfly-ng": "^4.0.0",
"pluralize": "5.0.0",
Expand All @@ -69,6 +73,7 @@
"ts-helpers": "1.1.2",
"typescript-logging": "0.4.0",
"url": "^0.11.0",
"yamljs": "^0.3.0",
"zone.js": "^0.8.26"
},
"devDependencies": {
Expand Down
1 change: 0 additions & 1 deletion app/ui/src/app/connections/list/list.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { RouterTestingModule } from '@angular/router/testing';
import { CoreModule } from '@syndesis/ui/core';
import { VendorModule } from '@syndesis/ui/vendor';
import { SyndesisStoreModule } from '../../store/store.module';

import { SyndesisCommonModule } from '../../common/common.module';
import { ConnectionsListComponent } from './list.component';
import { TestApiModule } from '@syndesis/ui/api/testing';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
*ngIf="currentActiveStep == 1"
(request)="onValidationRequest($event)">
</syndesis-api-connector-swagger-upload>
<syndesis-api-connector-review *ngIf="currentActiveStep == 2"
<syndesis-api-connector-review *ngIf="currentActiveStep == 2 && displayDefinitionEditor === false"
[apiConnectorTemplateName]="'OpenAPI'"
[apiConnectorData]="(apiConnectorState$ | async)?.createRequest"
[showNextButton]="true"
Expand All @@ -58,6 +58,24 @@
</syndesis-api-connector-info>
</div>
</div>

<div class="row row-cards-pf apicurio" *ngIf="currentActiveStep == 2 && displayDefinitionEditor === true">
<div class="card-pf">
<div class="card-pf-heading">
<h2 class="card-pf-title">
Edit Definition
</h2>
</div>
<div class="card-pf-body">
<api-editor #apiEditor
[api]="apiDef"
[embedded]="true"
(onCommandExecuted)="onUserChange($event)"
(onSelectionChanged)="onUserSelection($event)"></api-editor>
</div>
</div>
</div>

</section>
</article>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,8 @@
.wizard__body {
max-width: 700px;
margin: auto;

.apicurio {
//z-index: auto;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ import { Router } from '@angular/router';
import { Observable } from 'rxjs';
import { Store } from '@ngrx/store';

import { WindowRef } from '../../window-ref';
import * as YAML from 'yamljs';

import { ModalService, NavigationService } from '@syndesis/ui/common';
import {
ApiConnectorState,
Expand All @@ -20,6 +23,9 @@ import {
CustomApiConnectorAuthSettings
} from '@syndesis/ui/customizations/api-connector';

import { ApiEditorComponent, ApiDefinition } from 'apicurio-design-studio';
import { OtCommand } from 'oai-ts-commands';

enum WizardSteps {
UploadSwagger = 1,
ReviewApiConnector = 2,
Expand All @@ -35,16 +41,36 @@ enum WizardSteps {
export class ApiConnectorCreateComponent implements OnInit, OnDestroy {
currentActiveStep = 1;
apiConnectorState$: Observable<ApiConnectorState>;
displayDefinitionEditor = false;

@ViewChild('_apiEditor') _apiEditor: ApiEditorComponent;
apiDef: ApiDefinition;

@ViewChild('cancelModalTemplate') cancelModalTemplate: TemplateRef<any>;

private cancelModalId = 'create-cancellation-modal';

constructor(
private router: Router,
private modalService: ModalService,
private apiConnectorStore: Store<ApiConnectorStore>,
private nav: NavigationService
) {}
private modalService: ModalService,
private nav: NavigationService,
private router: Router,
private winRef: WindowRef
) {
this.winRef.nativeWindow.dump = YAML.dump;
}

public onUserSelection(selection: string): void {
//console.log('User selection changed: ', selection);
}

public onUserChange(command: OtCommand): void {
//console.log('Something happened! ' + JSON.stringify(command));
}

public showDefinitionEditor(): boolean {
return true;
}

ngOnInit() {
this.modalService.registerModal(
Expand All @@ -56,12 +82,23 @@ export class ApiConnectorCreateComponent implements OnInit, OnDestroy {
);

// Once the request validation results are yielded for the 1st time, we move user to step 2
this.apiConnectorState$
.pipe(map(apiConnectorState => apiConnectorState.createRequest))
.pipe(first(request => !!request && !!request.actionsSummary))
.subscribe(
() => (this.currentActiveStep = WizardSteps.ReviewApiConnector)
);
this.apiConnectorState$.map(apiConnectorState => apiConnectorState.createRequest)
.first(request => !!request && !!request.actionsSummary)
.subscribe( apiConnectorState => {
// TODO error handling!
const reader = new FileReader();
reader.onload = () => {
this.apiDef = new ApiDefinition();
this.apiDef.createdBy = 'user1';
this.apiDef.createdOn = new Date();
this.apiDef.tags = [];
this.apiDef.description = '';
this.apiDef.id = 'api-1';
this.apiDef.spec = reader.result;
this.currentActiveStep = WizardSteps.ReviewApiConnector;
};
reader.readAsText(apiConnectorState.specificationFile);
});

// Once the request object is flagged as 'isComplete', we redirect the user to the main listing
this.apiConnectorState$
Expand Down Expand Up @@ -89,8 +126,15 @@ export class ApiConnectorCreateComponent implements OnInit, OnDestroy {
);
}

onReviewComplete(): void {
this.currentActiveStep = WizardSteps.UpdateAuthSettings;
onReviewComplete({event: event, displayEditor: displayEditor}): void {
// Check if request is to show editor or not
if (displayEditor === true) {
this.displayDefinitionEditor = true;

} else {
this.displayDefinitionEditor = false;
this.currentActiveStep = WizardSteps.UpdateAuthSettings;
}
}

onAuthSetup(authSettings: CustomApiConnectorAuthSettings): void {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,20 @@ <h5 class="connector-actions__header" *ngIf="warnings.length">
</ol>
</div>

<button *ngIf="showNextButton" (click)="reviewComplete.emit()" type="button" class="connector-form__submit btn btn-primary">
<button *ngIf="showNextButton"
(click)="reviewComplete.emit({event: event, displayEditor: false})"
type="button"
class="connector-form__submit btn btn-primary">
Next
</button>

<button *ngIf="showNextButton"
(click)="reviewComplete.emit({event: event, displayEditor: true})"
type="button"
class="connector-form__submit btn btn-default apicurio pull-right">
Review/Edit
</button>

</div>
<ng-template #validationFallback>
<h5 class="connector-fallback">No connector details are currently available.</h5>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
padding-bottom: 1.4em;
}

button.connector-form__submit.btn.btn-default.apicurio.pull-right {
margin-top: -25px;
}

.connector-actions {
padding-bottom: 0.5em;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ import { apiConnectorReducer } from './api-connector.reducer';
import { ApiConnectorEffects } from './api-connector.effects';
import { ApiConnectorService } from './api-connector.service';

import { ApicurioEditorModule, ApicurioCommonComponentsModule } from 'apicurio-design-studio';

@NgModule({
imports: [
CommonModule,
Expand All @@ -35,7 +37,9 @@ import { ApiConnectorService } from './api-connector.service';
ApiConnectorRoutingModule,
ApiModule.forChild(apiConnectorEndpoints),
StoreModule.forFeature('apiConnectorState', apiConnectorReducer),
EffectsModule.forFeature([ApiConnectorEffects])
EffectsModule.forFeature([ApiConnectorEffects]),
ApicurioEditorModule,
ApicurioCommonComponentsModule
],
exports: [RouterModule],
declarations: [
Expand Down
4 changes: 3 additions & 1 deletion app/ui/src/app/customizations/customizations.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { RouterModule, Routes } from '@angular/router';
import { FileUploadModule } from 'ng2-file-upload';
import { VendorModule } from '@syndesis/ui/vendor';
import { SyndesisCommonModule, PatternflyUIModule } from '@syndesis/ui/common';
import { WindowRef } from './window-ref';

import {
ApiConnectorListComponent,
Expand Down Expand Up @@ -72,6 +73,7 @@ const routes: Routes = [
TechExtensionImportComponent,
TechExtensionDeleteModalComponent,
TechExtensionDetailComponent
]
],
providers: [WindowRef]
})
export class CustomizationsModule {}
12 changes: 12 additions & 0 deletions app/ui/src/app/customizations/window-ref.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { Injectable } from '@angular/core';

function _window(): Window {
return window;
}

@Injectable()
export class WindowRef {
get nativeWindow(): any {
return _window();
}
}
4 changes: 4 additions & 0 deletions app/ui/src/global-shims.ts
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
(window as any).global = window;

// Does nothing. Used to shim out node.js modules
// which are no-ops in the browser.
export const NOOP = 0;
4 changes: 2 additions & 2 deletions app/ui/src/polyfills.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ import 'zone.js/dist/zone'; // Included with Angular CLI.
// import 'rxjs/add/operator/combineLatest';
// import 'rxjs/add/operator/do';
// import 'rxjs/add/operator/filter';
// import 'rxjs/add/operator/first';
// import 'rxjs/add/operator/map';
import 'rxjs/add/operator/first';
import 'rxjs/add/operator/map';
// import 'rxjs/add/operator/mergeMap';
// import 'rxjs/add/operator/share';
// import 'rxjs/add/operator/switchMap';
Expand Down
3 changes: 2 additions & 1 deletion app/ui/src/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@
],
"@syndesis/ui/*": [
"app/*"
]
],
"fs": [ "./global-shims" ]
}
}
}
Loading