//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,
'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);
}
}
),
automaticallyImplyLeading: false,
actions: <Widget>[
- PveHelpIconButton(docPath: 'index.html'),
+ PveHelpIconButton(
+ baseUrl: Provider.of<PveResourceBloc>(context)
+ .apiClient
+ .credentials
+ .apiBaseUrl,
+ docPath: 'index.html'),
],
),
body: Stack(children: [
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';
title: Text("Proxmox"),
actions: <Widget>[
PveHelpIconButton(
+ baseUrl: Provider.of<PveResourceBloc>(context)
+ .apiClient
+ .credentials
+ .apiBaseUrl,
docPath: 'index.html',
),
LogButton(),
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 {
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';
),
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(
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(
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(