From 594129cb90a67c25cc27a1bad282b10f93f19060 Mon Sep 17 00:00:00 2001 From: Marcelfrueh <78954450+Marcelfrueh@users.noreply.github.com> Date: Mon, 11 Nov 2024 14:22:38 +0100 Subject: [PATCH] Add topics information to pipeline editor in view mode --- .../adapter-code-panel.component.html | 1 + .../configuration-code-panel.component.html | 28 ++- .../configuration-code-panel.component.scss | 14 ++ .../configuration-code-panel.component.ts | 23 +- ui/src/app/core-ui/core-ui.module.ts | 5 + .../core-ui/pipes/yaml-pretty-print.pipe.ts | 2 +- .../app/core-ui/topics/topics.component.html | 213 ++++++++++++++++++ .../app/core-ui/topics/topics.component.scss | 29 +++ ui/src/app/core-ui/topics/topics.component.ts | 77 +++++++ .../pipeline/pipeline.component.html | 12 + .../pipeline/pipeline.component.scss | 43 ++++ .../components/pipeline/pipeline.component.ts | 8 + .../save-pipeline-settings.component.html | 1 + ui/src/app/editor/services/editor.service.ts | 12 + .../pipeline-code-dialog.component.html | 1 + .../pipeline-details.module.ts | 2 + 16 files changed, 468 insertions(+), 3 deletions(-) create mode 100644 ui/src/app/core-ui/topics/topics.component.html create mode 100644 ui/src/app/core-ui/topics/topics.component.scss create mode 100644 ui/src/app/core-ui/topics/topics.component.ts create mode 100644 ui/src/app/editor/components/pipeline/pipeline.component.scss diff --git a/ui/src/app/connect/components/adapter-code-panel/adapter-code-panel.component.html b/ui/src/app/connect/components/adapter-code-panel/adapter-code-panel.component.html index 8a05afabd3..6f553c63e3 100644 --- a/ui/src/app/connect/components/adapter-code-panel/adapter-code-panel.component.html +++ b/ui/src/app/connect/components/adapter-code-panel/adapter-code-panel.component.html @@ -18,6 +18,7 @@
+ ++diff --git a/ui/src/app/core-ui/topics/topics.component.scss b/ui/src/app/core-ui/topics/topics.component.scss new file mode 100644 index 0000000000..c077f68f35 --- /dev/null +++ b/ui/src/app/core-ui/topics/topics.component.scss @@ -0,0 +1,29 @@ +/* + * 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. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +@import '../../../scss/sp/sp-dialog.scss'; + +.element-id { + border-radius: 5px; + margin-right: 10px; + margin-top: 5px; + margin-bottom: 5px; + font-size: small; + display: inline-block; + padding: 5px; +} diff --git a/ui/src/app/core-ui/topics/topics.component.ts b/ui/src/app/core-ui/topics/topics.component.ts new file mode 100644 index 0000000000..2ce28d6dc7 --- /dev/null +++ b/ui/src/app/core-ui/topics/topics.component.ts @@ -0,0 +1,77 @@ +/* + * 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. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +import { Component, Input, OnInit } from '@angular/core'; +import { + DataProcessorInvocation, + DataSinkInvocation, + SpDataStream, +} from '@streampipes/platform-services'; +import { DialogRef } from '@streampipes/shared-ui'; +import { PipelineElementUnion } from '../../editor/model/editor.model'; + +@Component({ + selector: 'sp-pipeline-element-topics', + templateUrl: './topics.component.html', + styleUrls: ['./topics.component.scss'], +}) +export class TopicsComponent implements OnInit { + selectedTabIndex = 0; + + availableTabs = ['Topics', 'Code']; + tabs: string[] = []; + + @Input() + pipelineElement: PipelineElementUnion; + isDataStream: boolean; + + constructor(private dialogRef: DialogRef++ +++ +++{{ pipelineElement?.name }}
+ {{ pipelineElement?.description }} ++ ID + {{ + isDataStream + ? pipelineElement?.elementId + : pipelineElement?.appId + }} +++ + ++ +++ + ++
++ ++ Output Topics + ++ ++ {{ + element?.topicDefinition?.actualTopicName + }} + +++ + + + ++
+ ++ ++ Input Topics + ++ ++ {{ + element?.eventGrounding + ?.transportProtocols?.[0] + ?.topicDefinition?.actualTopicName + }} + +++ + +
++ ++ Output Topics + ++ ++ {{ + element?.topicDefinition?.actualTopicName + }} + +++ + + ++
++ ++ Input Topics + ++ ++ {{ + element?.eventGrounding + ?.transportProtocols?.[0] + ?.topicDefinition?.actualTopicName + }} + +++ + + + + ++) {} + + ngOnInit() { + if ( + this.pipelineElement instanceof SpDataStream || + this.pipelineElement instanceof DataProcessorInvocation || + this.pipelineElement instanceof DataSinkInvocation + ) { + this.tabs = this.availableTabs; + } else { + this.tabs = [this.availableTabs[1]]; + this.selectedTabIndex = 1; + } + } + + isSpDataStream(): boolean { + return this.pipelineElement instanceof SpDataStream; + } + + isDataProcessorInvocation(): boolean { + return this.pipelineElement instanceof DataProcessorInvocation; + } + + isDataSinkInvocation(): boolean { + return this.pipelineElement instanceof DataSinkInvocation; + } + + close() { + setTimeout(() => { + this.dialogRef.close(); + }); + } + + protected readonly SpDataStream = SpDataStream; +} diff --git a/ui/src/app/editor/components/pipeline/pipeline.component.html b/ui/src/app/editor/components/pipeline/pipeline.component.html index 20b984a570..8b77b5b017 100644 --- a/ui/src/app/editor/components/pipeline/pipeline.component.html +++ b/ui/src/app/editor/components/pipeline/pipeline.component.html @@ -26,6 +26,7 @@ *ngFor=" let pipelineElementConfig of rawPipelineModel | enabledPipelineElement " + style="position: relative" > +