scottyaslan commented on code in PR #9855:
URL: https://github.com/apache/nifi/pull/9855#discussion_r2308659262


##########
nifi-frontend/src/main/frontend/apps/nifi-registry/src/app/service/droplets.service.ts:
##########
@@ -0,0 +1,64 @@
+/*
+ * 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 { Injectable } from '@angular/core';
+import { Observable } from 'rxjs';
+import { HttpClient, HttpHeaders } from '@angular/common/http';
+
+@Injectable({ providedIn: 'root' })
+export class DropletsService {
+    private static readonly API: string = '../nifi-registry-api';
+
+    constructor(private httpClient: HttpClient) {}
+
+    getDroplets(bucketId?: string): Observable<any> {
+        if (bucketId) {
+            return 
this.httpClient.get(`${DropletsService.API}/items/${bucketId}`);
+        }
+        return this.httpClient.get(`${DropletsService.API}/items`);
+    }
+
+    deleteDroplet(href: string): Observable<any> {
+        return 
this.httpClient.delete(`${DropletsService.API}/${href}?version=0`);
+    }
+
+    createNewFlow(bucketUri: string, name: string, description: string): 
Observable<any> {
+        return 
this.httpClient.post(`${DropletsService.API}/${bucketUri}/flows`, {
+            name: name,
+            description: description
+        });
+    }
+
+    uploadFlow(flowUri: string, file: File, description: string): 
Observable<any> {
+        return 
this.httpClient.post(`${DropletsService.API}/${flowUri}/versions/import`, file, 
{
+            headers: { Comments: description }
+        });
+    }
+
+    exportDropletVersionedSnapshot(dropletUri: string, versionNumber: number): 
Observable<any> {
+        const headers = new HttpHeaders({ 'Content-Type': 'application/json' 
});
+        return 
this.httpClient.get(`${DropletsService.API}/${dropletUri}/versions/${versionNumber}/export`,
 {
+            headers,
+            observe: 'response',
+            responseType: 'text'
+        });
+    }
+
+    getDropletSnapshotMetadata(dropletUri: string): Observable<any> {

Review Comment:
   That is exactly what we did for NiFi 2.0. Maybe it is possible to do what 
you are suggesting here in nifi registry but in Nifi we couldn't do that. 
@mcgilman can describe the issue better than I can but essentially even though 
we have the swagger.json from the build we aren't able to leverage it in that 
way.
   
   Please file a jira to address this and as we continue with this new nifi 
registry UI we can either do as you stated and generate the types or we need to 
start creating them.



-- 
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]

Reply via email to