]> git.proxmox.com Git - flutter/pve_flutter_frontend.git/commitdiff
remove replaced api client code
authorTim Marx <t.marx@proxmox.com>
Wed, 29 Jul 2020 11:58:58 +0000 (13:58 +0200)
committerTim Marx <t.marx@proxmox.com>
Wed, 29 Jul 2020 11:58:58 +0000 (13:58 +0200)
Signed-off-by: Tim Marx <t.marx@proxmox.com>
lib/bloc/pve_qemu_create_wizard_bloc.dart
lib/pages/main_layout_slim.dart
lib/pages/main_layout_wide.dart
lib/utils/utils.dart
lib/widgets/pve_guest_migrate_widget.dart
lib/widgets/pve_help_icon_button_widget.dart

index 759f6f91a147169af3a5a23715019c2c8bef9258..3767a0c777ee9dac4053c909fc865e4d3a1565fb 100644 (file)
@@ -77,8 +77,8 @@ class PveQemuCreateWizardBloc extends ProxmoxBaseBloc<PveQemuCreateWizardEvent,
 
 //TODO merge into api client
   Future<void> createVirtualMachine(PveQemuCreateWizardState qemuConfig) async {
-    var url = Uri.parse(await getPlatformAwareOrigin() +
-        '/api2/json/nodes/${qemuConfig.node}/qemu');
+    // var url = Uri.parse(await getPlatformAwareOrigin() +
+    //     '/api2/json/nodes/${qemuConfig.node}/qemu');
 
     Map<String, String> payload = {
       'name': qemuConfig.name,
@@ -93,11 +93,11 @@ class PveQemuCreateWizardBloc extends ProxmoxBaseBloc<PveQemuCreateWizardEvent,
       'memory': qemuConfig.memory.toString(),
       'net0': qemuConfig.net0,
     };
-    payload.removeWhere((key, value) => value == null || value.isEmpty);
-    var response = await apiClient.post(url,
-        headers: {'content-type': 'application/x-www-form-urlencoded'},
-        body: payload);
-    print(response.body);
+    // payload.removeWhere((key, value) => value == null || value.isEmpty);
+    // var response = await apiClient.post(url,
+    //     headers: {'content-type': 'application/x-www-form-urlencoded'},
+    //     body: payload);
+    // print(response.body);
   }
 }
 
index 1d3d0e1a67d402883fdb3ef7e9f850e29b88cbf0..19449e083457fedbd8b832aedcb2edcbfbde488b 100644 (file)
@@ -141,7 +141,12 @@ class MobileDashboard extends StatelessWidget {
         ),
         automaticallyImplyLeading: false,
         actions: <Widget>[
-          PveHelpIconButton(docPath: 'index.html'),
+          PveHelpIconButton(
+              baseUrl: Provider.of<PveResourceBloc>(context)
+                  .apiClient
+                  .credentials
+                  .apiBaseUrl,
+              docPath: 'index.html'),
         ],
       ),
       body: Stack(children: [
index b2e4675717a35746bb215daf01ffae10334f8562..ee6119c1c8a5f926d3865789278a7a370cfa0aac 100644 (file)
@@ -3,10 +3,10 @@ import 'dart:async';
 import 'package:flutter/material.dart';
 import 'package:provider/provider.dart';
 import 'package:pve_flutter_frontend/bloc/proxmox_global_error_bloc.dart';
+import 'package:pve_flutter_frontend/bloc/pve_resource_bloc.dart';
 import 'package:pve_flutter_frontend/widgets/pve_help_icon_button_widget.dart';
 import 'package:pve_flutter_frontend/widgets/pve_main_navigation_drawer.dart';
 import 'package:pve_flutter_frontend/widgets/pve_resource_overview_widget.dart';
-import 'package:proxmox_dart_api_client/proxmox_dart_api_client.dart';
 
 import 'package:pve_flutter_frontend/bloc/pve_authentication_bloc.dart';
 
@@ -45,6 +45,10 @@ class _MainLayoutWideState extends State<MainLayoutWide> {
           title: Text("Proxmox"),
           actions: <Widget>[
             PveHelpIconButton(
+              baseUrl: Provider.of<PveResourceBloc>(context)
+                  .apiClient
+                  .credentials
+                  .apiBaseUrl,
               docPath: 'index.html',
             ),
             LogButton(),
index 36571c2dee73a6e303b4983acf9af8e044e87aa9..3f4d9070edc211ad7029494928661fb7d574f4a0 100644 (file)
@@ -8,8 +8,7 @@ import 'package:url_launcher/url_launcher.dart';
 
 void registerConsoleIframe(String nodeid) => throw UnimplementedError();
 
-Future<bool> launchDocURL(String docPath) async {
-  var url = await getPlatformAwareOrigin() + docPath;
+Future<bool> launchDocURL(String url) async {
   if (await canLaunch(url)) {
     return await launch(url);
   } else {
index f713358d2808188db74a36ef47d38ab05916ddc6..28dfe7532ba858fb4f806193b0b735b703a8e71b 100644 (file)
@@ -4,6 +4,7 @@ import 'package:provider/provider.dart';
 import 'package:proxmox_dart_api_client/proxmox_dart_api_client.dart';
 import 'package:pve_flutter_frontend/bloc/pve_migrate_bloc.dart';
 import 'package:pve_flutter_frontend/bloc/pve_node_selector_bloc.dart';
+import 'package:pve_flutter_frontend/bloc/pve_resource_bloc.dart';
 import 'package:pve_flutter_frontend/states/pve_migrate_state.dart';
 import 'package:pve_flutter_frontend/states/pve_node_selector_state.dart';
 import 'package:pve_flutter_frontend/widgets/proxmox_stream_builder_widget.dart';
@@ -35,7 +36,12 @@ class PveGuestMigrate extends StatelessWidget {
               ),
               elevation: 0.0,
               actions: <Widget>[
-                PveHelpIconButton(docPath: 'pve-admin-guide.html#qm_migration')
+                PveHelpIconButton(
+                    baseUrl: Provider.of<PveResourceBloc>(context)
+                        .apiClient
+                        .credentials
+                        .apiBaseUrl,
+                    docPath: 'pve-admin-guide.html#qm_migration')
               ],
             ),
             body: PveMigrateStreamConnector(
index 170030ae78d057071fa5adc898aa11e099589f3a..7c12e64b04319439b428509468709787400e3d70 100644 (file)
@@ -4,7 +4,14 @@ import 'package:pve_flutter_frontend/utils/utils.dart';
 class PveHelpIconButton extends StatelessWidget {
   final String docPath;
 
-  const PveHelpIconButton({Key key, this.docPath}) : super(key: key);
+  final Uri baseUrl;
+
+  const PveHelpIconButton({
+    Key key,
+    @required this.baseUrl,
+    this.docPath,
+  }) : super(key: key);
+
   @override
   Widget build(BuildContext context) {
     return IconButton(
@@ -12,7 +19,7 @@ class PveHelpIconButton extends StatelessWidget {
       tooltip: "Documentation",
       onPressed: () {
         try {
-          launchDocURL('/pve-docs/$docPath');
+          launchDocURL(baseUrl.replace(path: '/pve-docs/$docPath').toString());
         } catch (e) {
           Scaffold.of(context).showSnackBar(SnackBar(
             content: Text(