You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streampipes.apache.org by ri...@apache.org on 2020/06/14 13:14:45 UTC
[incubator-streampipes] 03/03: [STREAMPIPES-145] Migrate pipeline
element documentation module
This is an automated email from the ASF dual-hosted git repository.
riemer pushed a commit to branch STREAMPIPES-145
in repository https://gitbox.apache.org/repos/asf/incubator-streampipes.git
commit 4bb7253aac65d95f41edbb95fc0b57c394da812a
Author: Dominik Riemer <ri...@fzi.de>
AuthorDate: Sun Jun 14 15:14:27 2020 +0200
[STREAMPIPES-145] Migrate pipeline element documentation module
---
ui/package.json | 5 +-
.../standard-dialog/standard-dialog.component.html | 2 +-
.../standard-dialog/standard-dialog.component.scss | 10 +++-
.../pipeline-element-documentation.component.html | 6 +++
.../pipeline-element-documentation.component.scss} | 25 +--------
.../pipeline-element-documentation.component.ts} | 36 +++++++++----
.../app/editor-v2/dialog/help/help.component.html | 61 +++++++++++-----------
ui/src/app/editor-v2/editor.module.ts | 8 ++-
ui/src/app/editor/editor.module.ts | 3 +-
.../app/platform-services/apis/commons.service.ts | 4 ++
.../apis/pipeline-element.service.ts | 8 +++
ui/src/scss/sp/sp-dialog.scss | 4 ++
12 files changed, 99 insertions(+), 73 deletions(-)
diff --git a/ui/package.json b/ui/package.json
index 195fcba..808e590 100644
--- a/ui/package.json
+++ b/ui/package.json
@@ -46,7 +46,6 @@
"angular-datatables": "0.6.2",
"angular-gridster2": "8.3.0",
"angular-loading-bar": "0.8.0",
- "angular-markdown-directive": "0.3.1",
"angular-material": "1.1.18",
"angular-material-icons": "0.4.0",
"angular-messages": "1.7.7",
@@ -89,7 +88,7 @@
"@danielmoncada/angular-datetime-picker": "9.2.0",
"moment": "2.24.0",
"ng-prettyjson": "0.1.8",
- "ng-showdown": "1.1.0",
+ "ngx-showdown": "5.1.0",
"ng-simple-slideshow": "1.2.9",
"ng2-charts": "2.0.3",
"ng2-dragula": "1.5.0",
@@ -101,6 +100,7 @@
"rxjs": "6.3.3",
"rxjs-compat": "6.3.3",
"shepherd.js": "2.4.0",
+ "showdown": "1.9.1",
"slick-carousel": "1.6.0",
"systemjs": "0.21.6",
"tslib": "1.11.1",
@@ -120,6 +120,7 @@
"@types/leaflet": "^1.5.9",
"@types/node": "^12.11.1",
"@types/rx": "^4.1.1",
+ "@types/showdown": "1.9.3",
"codelyzer": "^5.1.2",
"copy-webpack-plugin": "^5.0.2",
"compression-webpack-plugin": "^3.0.0",
diff --git a/ui/src/app/core-ui/dialog/standard-dialog/standard-dialog.component.html b/ui/src/app/core-ui/dialog/standard-dialog/standard-dialog.component.html
index 5a1edd0..7da4171 100644
--- a/ui/src/app/core-ui/dialog/standard-dialog/standard-dialog.component.html
+++ b/ui/src/app/core-ui/dialog/standard-dialog/standard-dialog.component.html
@@ -16,7 +16,7 @@
~
-->
-<div fxFlex="100" fxLayout="column">
+<div class="dialog-panel">
<div class="dialog-panel-header">
<span class="dialog-title">{{ dialogTitle }}</span>
<button mat-button mat-icon-button (click)="close()">
diff --git a/ui/src/app/core-ui/dialog/standard-dialog/standard-dialog.component.scss b/ui/src/app/core-ui/dialog/standard-dialog/standard-dialog.component.scss
index 1f5afb9..3fe1d06 100644
--- a/ui/src/app/core-ui/dialog/standard-dialog/standard-dialog.component.scss
+++ b/ui/src/app/core-ui/dialog/standard-dialog/standard-dialog.component.scss
@@ -24,6 +24,12 @@ standard-dialog-container {
box-shadow: -7px 0px 5px -5px #5d5d5d;
}
+.dialog-panel {
+ height: 80vh;
+ display: grid;
+ grid-template-rows: 50px auto;
+}
+
.dialog-panel-header {
display: flex;
justify-content: space-between;
@@ -35,8 +41,8 @@ standard-dialog-container {
}
.dialog-panel-content {
- flex: 1 1 100%;
- background: white;
+ height: 100%;
+ overflow-y:auto;
}
.dialog-title {
diff --git a/ui/src/app/editor-v2/components/pipeline-element-documentation/pipeline-element-documentation.component.html b/ui/src/app/editor-v2/components/pipeline-element-documentation/pipeline-element-documentation.component.html
new file mode 100644
index 0000000..26a0945
--- /dev/null
+++ b/ui/src/app/editor-v2/components/pipeline-element-documentation/pipeline-element-documentation.component.html
@@ -0,0 +1,6 @@
+<p showdown="{{documentationMarkdown}}" *ngIf="documentationMarkdown && !error" [ngClass]="useStyling ? 'note' : ''">
+
+</p>
+<p *ngIf="error" ng-class="useStyling ? 'note' : ''">
+ (no documentation available)
+</p>
diff --git a/ui/src/scss/sp/sp-dialog.scss b/ui/src/app/editor-v2/components/pipeline-element-documentation/pipeline-element-documentation.component.scss
similarity index 76%
copy from ui/src/scss/sp/sp-dialog.scss
copy to ui/src/app/editor-v2/components/pipeline-element-documentation/pipeline-element-documentation.component.scss
index dab562b..41ecef0 100644
--- a/ui/src/scss/sp/sp-dialog.scss
+++ b/ui/src/app/editor-v2/components/pipeline-element-documentation/pipeline-element-documentation.component.scss
@@ -1,4 +1,4 @@
-/*!
+/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
@@ -14,25 +14,4 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*
- */
-
-.sp-dialog-container {
- display: grid;
- height: 100%;
- grid-template-rows: auto 10px 60px;
-
-}
-
-.sp-dialog-content {
- margin: 0px;
- overflow-y:auto;
- flex: 1 1 auto;
-}
-
-.sp-dialog-actions {
- padding: 10px;
-}
-
-.p-15 {
- padding: 15px;
-}
\ No newline at end of file
+ */
\ No newline at end of file
diff --git a/ui/src/app/platform-services/apis/commons.service.ts b/ui/src/app/editor-v2/components/pipeline-element-documentation/pipeline-element-documentation.component.ts
similarity index 50%
copy from ui/src/app/platform-services/apis/commons.service.ts
copy to ui/src/app/editor-v2/components/pipeline-element-documentation/pipeline-element-documentation.component.ts
index 2c38292..42271ce 100644
--- a/ui/src/app/platform-services/apis/commons.service.ts
+++ b/ui/src/app/editor-v2/components/pipeline-element-documentation/pipeline-element-documentation.component.ts
@@ -16,23 +16,37 @@
*
*/
-import {AuthStatusService} from "../../services/auth-status.service";
-import {Injectable} from "@angular/core";
+import {Component, Input, OnInit} from "@angular/core";
+import {PipelineElementService} from "../../../platform-services/apis/pipeline-element.service";
-@Injectable()
-export class PlatformServicesCommons {
+@Component({
+ selector: 'pipeline-element-documentation',
+ templateUrl: './pipeline-element-documentation.component.html',
+ styleUrls: ['./pipeline-element-documentation.component.scss']
+})
+export class PipelineElementDocumentationComponent implements OnInit {
- constructor(private authStatusService: AuthStatusService) {
+ @Input()
+ appId: string;
- }
+ @Input()
+ useStyling: boolean;
+
+ documentationMarkdown: any;
+ error: any;
+
+ constructor(private PipelineElementService: PipelineElementService) {
- get basePath(): string {
- return '/streampipes-backend';
}
- authUserBasePath() {
- return this.basePath + '/api/v2/users/' + this.authStatusService.email;
+ ngOnInit(): void {
+ this.PipelineElementService.getDocumentation(this.appId).subscribe(msg => {
+ this.error = false;
+ this.documentationMarkdown = msg;
+ }, error => {
+ this.error = true;
+ });
}
-}
+}
\ No newline at end of file
diff --git a/ui/src/app/editor-v2/dialog/help/help.component.html b/ui/src/app/editor-v2/dialog/help/help.component.html
index 8c3db13..42de2af 100644
--- a/ui/src/app/editor-v2/dialog/help/help.component.html
+++ b/ui/src/app/editor-v2/dialog/help/help.component.html
@@ -27,42 +27,43 @@
<mat-tab *ngFor="let tab of tabs" label="{{tab.title}}">
</mat-tab>
</mat-tab-group>
+ <div style="margin-top:15px;">
+ <div *ngIf="selectedIndex == 0 && streamMode">
+ <h5>Field Names</h5>
- <div *ngIf="selectedIndex == 0 && streamMode">
- <h5>Field Names</h5>
-
- <div>
- <table class="dataTable row-border hover">
- <thead>
- <tr>
- <th>Field Name</th>
- <th>Description</th>
- <th>Runtime Name</th>
- <th>Type</th>
- </tr>
- </thead>
- <tbody id="preview-data-rows-id">
- <tr *ngFor="let property of pipelineElement.eventSchema.eventProperties">
- <td>{{property.label ? property.label : "(n/a)"}}</td>
- <td>{{property.description ? property.description : "(n/a)"}}</td>
- <td>{{property.runtimeName}}</td>
- <td>{{getFriendlyRuntimeType(property.runtimeType)}}</td>
- </tr>
- </tbody>
- </table>
+ <div>
+ <table class="dataTable row-border hover">
+ <thead>
+ <tr>
+ <th>Field Name</th>
+ <th>Description</th>
+ <th>Runtime Name</th>
+ <th>Type</th>
+ </tr>
+ </thead>
+ <tbody id="preview-data-rows-id">
+ <tr *ngFor="let property of pipelineElement.eventSchema.eventProperties">
+ <td>{{property.label ? property.label : "(n/a)"}}</td>
+ <td>{{property.description ? property.description : "(n/a)"}}</td>
+ <td>{{property.runtimeName}}</td>
+ <td>{{getFriendlyRuntimeType(property.runtimeType)}}</td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
</div>
- </div>
- <div *ngIf="selectedIndex == 1 && streamMode">
- <div>
- <pipeline-element-runtime-info [streamDescription]="pipelineElement" [pollingActive]="pollingActive"></pipeline-element-runtime-info>
+ <div *ngIf="selectedIndex == 1 && streamMode">
+ <div>
+ <pipeline-element-runtime-info [streamDescription]="pipelineElement" [pollingActive]="pollingActive"></pipeline-element-runtime-info>
+ </div>
+ </div>
+ <div *ngIf="selectedTab == 2 || !(streamMode)">
+ <pipeline-element-documentation [useStyling]="false" [appId]="pipelineElement.appId"></pipeline-element-documentation>
</div>
</div>
-<!-- <div *ngIf="selectedTab == 'documentation'">-->
-<!-- <pipeline-element-documentation use-styling="false" app-id="ctrl.pipelineElement.appId"></pipeline-element-documentation>-->
-<!-- </div>-->
</div>
<mat-divider></mat-divider>
- <div class="sp-dialog-actions">
+ <div class="sp-dialog-actions actions-align-right">
<button mat-button mat-raised-button class="mat-basic" (click)="close()">
Close
</button>
diff --git a/ui/src/app/editor-v2/editor.module.ts b/ui/src/app/editor-v2/editor.module.ts
index fc7844f..522b7b2 100644
--- a/ui/src/app/editor-v2/editor.module.ts
+++ b/ui/src/app/editor-v2/editor.module.ts
@@ -53,6 +53,8 @@ import {PipelineElementRecommendationComponent} from "./components/pipeline-elem
import {CompatibleElementsComponent} from "./dialog/compatible-elements/compatible-elements.component";
import {MatListModule} from "@angular/material/list";
import {HelpComponent} from "./dialog/help/help.component";
+import {PipelineElementDocumentationComponent} from "./components/pipeline-element-documentation/pipeline-element-documentation.component";
+import { ShowdownModule } from 'ngx-showdown';
@NgModule({
imports: [
@@ -67,7 +69,8 @@ import {HelpComponent} from "./dialog/help/help.component";
CustomMaterialModule,
FormsModule,
ConnectModule,
- MatProgressSpinnerModule
+ MatProgressSpinnerModule,
+ ShowdownModule
],
declarations: [
CompatibleElementsComponent,
@@ -75,8 +78,9 @@ import {HelpComponent} from "./dialog/help/help.component";
EditorComponent,
HelpComponent,
PipelineAssemblyComponent,
- PipelineElementIconStandComponent,
PipelineElementComponent,
+ PipelineElementDocumentationComponent,
+ PipelineElementIconStandComponent,
PipelineElementOptionsComponent,
PipelineElementRecommendationComponent,
PipelineComponent,
diff --git a/ui/src/app/editor/editor.module.ts b/ui/src/app/editor/editor.module.ts
index 81df33b..a80db0d 100644
--- a/ui/src/app/editor/editor.module.ts
+++ b/ui/src/app/editor/editor.module.ts
@@ -28,7 +28,6 @@ import 'npm/bootstrap';
import 'npm/angular-trix';
import 'npm/angular-datatables';
import 'npm/angular-sanitize';
-import 'npm/ng-showdown';
import {EditorCtrl} from './editor.controller';
import myDataBind from './my-data-bind.directive';
@@ -76,7 +75,7 @@ import {CodeEditorDirective} from "./components/code/code-editor.directive";
import {UserDefinedOutputComponent} from "./components/userdefinedoutput/user-defined-output.component";
-export default angular.module('sp.editor', [spServices, 'ngSanitize', 'angularTrix', 'ngAnimate', 'datatables', 'ng-showdown'])
+export default angular.module('sp.editor', [spServices, 'ngSanitize', 'angularTrix', 'ngAnimate', 'datatables'])
.controller('EditorCtrl', EditorCtrl)
.directive('myDataBind', myDataBind)
.directive('imageBind', imageBind)
diff --git a/ui/src/app/platform-services/apis/commons.service.ts b/ui/src/app/platform-services/apis/commons.service.ts
index 2c38292..c4781ba 100644
--- a/ui/src/app/platform-services/apis/commons.service.ts
+++ b/ui/src/app/platform-services/apis/commons.service.ts
@@ -34,5 +34,9 @@ export class PlatformServicesCommons {
return this.basePath + '/api/v2/users/' + this.authStatusService.email;
}
+ get unauthenticatedBasePath() {
+ return this.basePath + '/api/v2';
+ }
+
}
diff --git a/ui/src/app/platform-services/apis/pipeline-element.service.ts b/ui/src/app/platform-services/apis/pipeline-element.service.ts
index 0463376..c95712e 100644
--- a/ui/src/app/platform-services/apis/pipeline-element.service.ts
+++ b/ui/src/app/platform-services/apis/pipeline-element.service.ts
@@ -52,6 +52,13 @@ export class PipelineElementService {
})
}
+ getDocumentation(appId) {
+ return this.http.get(this.platformServicesCommons.unauthenticatedBasePath
+ + "/pe/"
+ + appId
+ + "/assets/documentation", {responseType: 'text'});
+ }
+
private get dataProcessorsUrl(): string {
return this.platformServicesCommons.authUserBasePath() + '/sepas'
}
@@ -63,4 +70,5 @@ export class PipelineElementService {
private get dataSinksUrl(): string {
return this.platformServicesCommons.authUserBasePath() + '/actions'
}
+
}
\ No newline at end of file
diff --git a/ui/src/scss/sp/sp-dialog.scss b/ui/src/scss/sp/sp-dialog.scss
index dab562b..d0bdea3 100644
--- a/ui/src/scss/sp/sp-dialog.scss
+++ b/ui/src/scss/sp/sp-dialog.scss
@@ -33,6 +33,10 @@
padding: 10px;
}
+.actions-align-right {
+ margin-left: auto;
+}
+
.p-15 {
padding: 15px;
}
\ No newline at end of file