dominikriemer commented on code in PR #3942:
URL: https://github.com/apache/streampipes/pull/3942#discussion_r2538653335
##########
streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/admin/ExportProviderConfigurationResource.java:
##########
@@ -48,14 +59,72 @@ public ResponseEntity<List<ExportProviderSettings>>
getExportProviderConfigurati
}
@GetMapping(value = "/{providerId}", produces =
MediaType.APPLICATION_JSON_VALUE)
-@PreAuthorize(AuthConstants.IS_ADMIN_ROLE)
-public ResponseEntity<ExportProviderSettings>
getExportProviderSettingById(@PathVariable String providerId) {
+ @PreAuthorize(AuthConstants.IS_ADMIN_ROLE)
+ public ResponseEntity<ExportProviderSettings>
getExportProviderSettingById(@PathVariable String providerId) {
return
getSpCoreConfigurationStorage().get().getExportProviderSettings().stream()
.filter(setting ->
setting.getProviderId().equalsIgnoreCase(providerId))
.findFirst()
.map(ResponseEntity::ok)
.orElse(ResponseEntity.notFound().build());
-}
+ }
+
+ @GetMapping(value = "/test/{providerId}", produces =
MediaType.APPLICATION_JSON_VALUE)
+ @PreAuthorize(AuthConstants.IS_ADMIN_ROLE)
+ public ResponseEntity<?> testExportProviderSettingById(@PathVariable String
providerId) {
+ // Get Export Provider Settings
+ Optional<ExportProviderSettings> exportProviderSetting =
getSpCoreConfigurationStorage().get()
+ .getExportProviderSettings().stream()
+ .filter(setting ->
setting.getProviderId().equalsIgnoreCase(providerId))
+ .findFirst();
+
+ if (exportProviderSetting.isPresent()) {
+ ExportProviderSettings setting = exportProviderSetting.get();
+ ProviderType providerType = setting.getProviderType();
+
+ try {
+
+ IObjectStorage exportProvider =
ExportProviderFactory.createExportProvider(
+ providerType, "TEST", setting,
+ "csv");
+
+ String filePath = exportProvider.getFileName();
+
+ String csvData = "Message\nThis Testfile was automatically creates as a
connectivity test by Streampipes.\n";
Review Comment:
```suggestion
String csvData = "Message\nThis test file was automatically created as
a connectivity test by StreamPipes.\n";
```
##########
ui/deployment/i18n/de.json:
##########
@@ -901,8 +891,8 @@
"No assets found - use assets to better organize resources!": "Keine Assets
gefunden - verwenden Sie Assets, um Ressourcen besser zu organisieren!",
"Manage assets": "Assets verwalten",
"Asset Browser": "Asset-Browser",
- "Browse assets": "Assets durchsuchen",
"Filter assets": "Assets filtern",
+ "All assets": "Alle Vermögenswerte",
Review Comment:
```suggestion
"All assets": "Alle Assets",
```
##########
ui/src/app/configuration/dialog/export-provider-connection-test/export-provider-connection-test.component.ts:
##########
@@ -0,0 +1,78 @@
+/*
+ * 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, inject, Input, OnInit } from '@angular/core';
+import { DialogRef } from '@streampipes/shared-ui';
+import { ExportProviderService } from '@streampipes/platform-services';
+import { TranslateService } from '@ngx-translate/core';
+
+@Component({
+ selector: 'sp-export-provider-connection-test',
+ templateUrl: './export-provider-connection-test.component.html',
+ standalone: false,
+})
+export class ExportProviderConnectionTestComponent implements OnInit {
+ ngOnInit(): void {
+ this.testExportProvider();
+ }
+ @Input()
+ providerId: string;
+
+ private dialogRef = inject(
+ DialogRef<ExportProviderConnectionTestComponent>,
+ );
+ private exportProviderRestService = inject(ExportProviderService);
+ private translateService = inject(TranslateService);
+
+ isInProgress = false;
+ currentStatus: any;
+ errorMessage = '';
+ isError = false;
+ message = '';
+ filePath = '';
+
+ close(refreshDataLakeIndex: boolean) {
+ this.dialogRef.close(refreshDataLakeIndex);
+ }
+
+ testExportProvider() {
+ this.isInProgress = true;
+ this.currentStatus = this.translateService.instant(
+ 'Testing the connection.',
+ );
+ this.exportProviderRestService
+ .testExportProviderById(this.providerId)
+ .subscribe(
+ data => {
+ this.isInProgress = false;
Review Comment:
probably makes sense to set `isError` to false in case of multiple attempts
##########
ui/src/app/configuration/datalake-configuration/datalake-configuration.component.ts:
##########
@@ -237,6 +239,25 @@ export class DatalakeConfigurationComponent implements
OnInit {
}
});
}
+ testExportProvider(providerId: string) {
+ const dialogRef: DialogRef<ExportProviderConnectionTestComponent> =
+ this.dialogService.open(ExportProviderConnectionTestComponent, {
+ panelType: PanelType.STANDARD_PANEL,
+ title: this.translateService.instant(
+ ' Test Export Provider Connection',
Review Comment:
```suggestion
'Test Export Provider Connection',
```
##########
ui/src/app/configuration/datalake-configuration/datalake-configuration.component.ts:
##########
@@ -237,6 +239,25 @@ export class DatalakeConfigurationComponent implements
OnInit {
}
});
}
+ testExportProvider(providerId: string) {
+ const dialogRef: DialogRef<ExportProviderConnectionTestComponent> =
+ this.dialogService.open(ExportProviderConnectionTestComponent, {
+ panelType: PanelType.STANDARD_PANEL,
+ title: this.translateService.instant(
+ ' Test Export Provider Connection',
Review Comment:
this should also be changed in the translation files
##########
ui/src/app/configuration/dialog/export-provider-connection-test/export-provider-connection-test.component.ts:
##########
@@ -0,0 +1,78 @@
+/*
+ * 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, inject, Input, OnInit } from '@angular/core';
+import { DialogRef } from '@streampipes/shared-ui';
+import { ExportProviderService } from '@streampipes/platform-services';
+import { TranslateService } from '@ngx-translate/core';
+
+@Component({
+ selector: 'sp-export-provider-connection-test',
+ templateUrl: './export-provider-connection-test.component.html',
+ standalone: false,
+})
+export class ExportProviderConnectionTestComponent implements OnInit {
+ ngOnInit(): void {
+ this.testExportProvider();
+ }
+ @Input()
+ providerId: string;
+
+ private dialogRef = inject(
+ DialogRef<ExportProviderConnectionTestComponent>,
+ );
+ private exportProviderRestService = inject(ExportProviderService);
+ private translateService = inject(TranslateService);
+
+ isInProgress = false;
+ currentStatus: any;
Review Comment:
Can `currentStatus` be a `string`?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]