Commit 6c2940b5 authored by Manuel Herold's avatar Manuel Herold

extracted host information in their own files

parent c0d4a8b3
import 'package:circlegraph/circlegraph.dart'; import 'package:circlegraph/circlegraph.dart';
import 'package:dashboard/loading.dart'; import 'package:dashboard/loading.dart';
import 'package:dashboard/querying/datagetter.dart'; import 'package:dashboard/querying/communitygetter.dart';
import 'package:dashboard/ui/theme/color_holder.dart'; import 'package:dashboard/ui/theme/color_holder.dart';
import 'package:dashboard/ui/util/logged_in_appbar.dart'; import 'package:dashboard/ui/util/logged_in_appbar.dart';
import 'package:enhanced_future_builder/enhanced_future_builder.dart'; import 'package:enhanced_future_builder/enhanced_future_builder.dart';
......
import 'package:dashboard/data/cluster.dart'; import 'package:dashboard/data/cluster.dart';
import 'package:dashboard/data/community.dart'; import 'package:dashboard/data/community.dart';
import 'package:dashboard/data/post.dart'; import 'package:dashboard/data/post.dart';
import 'package:dashboard/querying/datagetter.dart'; import 'package:dashboard/querying/communitygetter.dart';
import 'package:dashboard/querying/host_provider.dart';
import 'package:dashboard/util/loginhelper.dart'; import 'package:dashboard/util/loginhelper.dart';
import 'package:dashboard/util/user.dart'; import 'package:dashboard/util/user.dart';
import 'package:logger/logger.dart'; import 'package:logger/logger.dart';
...@@ -11,7 +12,7 @@ class ClusterGetter { ...@@ -11,7 +12,7 @@ class ClusterGetter {
Future<List<Community>> getNodesfromLayer(String layerName) async { Future<List<Community>> getNodesfromLayer(String layerName) async {
String url = String url =
"https://articonf1.itec.aau.at:30101/api/use-cases/reddit/tables/reddit/layers/$layerName/nodes"; "${HostProvider.articonfHost}/api/use-cases/reddit/tables/reddit/layers/$layerName/nodes";
BackendUser user = await LoginHelper().loggedInUser; BackendUser user = await LoginHelper().loggedInUser;
String token = user.token; String token = user.token;
...@@ -21,7 +22,6 @@ class ClusterGetter { ...@@ -21,7 +22,6 @@ class ClusterGetter {
List<dynamic> nodeList = List<dynamic> nodeList =
await DataGetter.getJsonList(url, headers: headers); await DataGetter.getJsonList(url, headers: headers);
Map<String, List<Post>> resultMap = {};
List<Community> communityList = []; List<Community> communityList = [];
for (Map<String, dynamic> entry in nodeList) { for (Map<String, dynamic> entry in nodeList) {
...@@ -70,7 +70,7 @@ class ClusterGetter { ...@@ -70,7 +70,7 @@ class ClusterGetter {
Future<List<Cluster>> getClustersFromLayer(String layerName) async { Future<List<Cluster>> getClustersFromLayer(String layerName) async {
String url = String url =
"https://articonf1.itec.aau.at:30103/api/use-cases/reddit/tables/reddit/layers/$layerName/clusters"; "${HostProvider.articonfHost}/api/use-cases/reddit/tables/reddit/layers/$layerName/clusters";
BackendUser user = await LoginHelper().loggedInUser; BackendUser user = await LoginHelper().loggedInUser;
String token = user.token; String token = user.token;
......
import 'dart:convert'; import 'dart:convert';
import 'dart:io'; import 'dart:io';
import 'package:dashboard/querying/host_provider.dart';
import 'package:dashboard/util/loginhelper.dart'; import 'package:dashboard/util/loginhelper.dart';
import 'package:dashboard/util/user.dart'; import 'package:dashboard/util/user.dart';
import 'package:http/http.dart' as http; import 'package:http/http.dart' as http;
...@@ -78,7 +79,7 @@ class DataGetter { ...@@ -78,7 +79,7 @@ class DataGetter {
} }
static Future<User> getUser(String username) async { static Future<User> getUser(String username) async {
String url = "http://live.nope-api.systems:81/users/$username"; String url = "${HostProvider.manuelHost}/users/$username";
Map<String, dynamic> json = await getJson(url); Map<String, dynamic> json = await getJson(url);
...@@ -100,8 +101,7 @@ class DataGetter { ...@@ -100,8 +101,7 @@ class DataGetter {
} }
static Future<Community> getCommunity(String communityname) async { static Future<Community> getCommunity(String communityname) async {
String url = String url = "${HostProvider.manuelHost}/communities/$communityname/posts";
"http://live.nope-api.systems:81/communities/$communityname/posts";
Map<String, dynamic> json = await getJson(url); Map<String, dynamic> json = await getJson(url);
...@@ -133,7 +133,7 @@ class DataGetter { ...@@ -133,7 +133,7 @@ class DataGetter {
static Future<List<Community>> getCommunities() async { static Future<List<Community>> getCommunities() async {
Map<String, dynamic> communities = Map<String, dynamic> communities =
await DataGetter.getJson("http://live.nope-api.systems:81/communities"); await DataGetter.getJson("${HostProvider.manuelHost}/communities");
List<Community> communityList = []; List<Community> communityList = [];
......
import 'package:flutter/foundation.dart';
class HostProvider {
static String _hostArticonfDebug = "https://articonf1.itec.aau.at:30101";
static String _hostArticonfRelease = "https://articonf1";
static String _hostManuelDebug = "http://test.nope-api.systems:81";
static String _hostManuelRelease = "http://manuel";
static String get articonfHost {
return kReleaseMode ? _hostArticonfRelease : _hostArticonfDebug;
}
static String get manuelHost {
return kReleaseMode ? _hostManuelRelease : _hostManuelDebug;
}
}
...@@ -2,7 +2,7 @@ import 'dart:math'; ...@@ -2,7 +2,7 @@ import 'dart:math';
import 'package:dashboard/data/community.dart'; import 'package:dashboard/data/community.dart';
import 'package:dashboard/loading.dart'; import 'package:dashboard/loading.dart';
import 'package:dashboard/querying/datagetter.dart'; import 'package:dashboard/querying/communitygetter.dart';
import 'package:dashboard/ui/graphs/community/circle/communitygraph.dart'; import 'package:dashboard/ui/graphs/community/circle/communitygraph.dart';
import 'package:dashboard/ui/graphs/community/list/community_list.dart'; import 'package:dashboard/ui/graphs/community/list/community_list.dart';
import 'package:dashboard/ui/graphs/community_meta/cluster_view_page.dart'; import 'package:dashboard/ui/graphs/community_meta/cluster_view_page.dart';
......
...@@ -7,7 +7,7 @@ import 'package:dashboard/data/community.dart'; ...@@ -7,7 +7,7 @@ import 'package:dashboard/data/community.dart';
import 'package:dashboard/graphing/trustcolorcalculator.dart'; import 'package:dashboard/graphing/trustcolorcalculator.dart';
import 'package:dashboard/loading.dart'; import 'package:dashboard/loading.dart';
import 'package:dashboard/querying/clustergetter.dart'; import 'package:dashboard/querying/clustergetter.dart';
import 'package:dashboard/querying/datagetter.dart'; import 'package:dashboard/querying/communitygetter.dart';
import 'package:dashboard/ui/graphs/community/community_graph_view_page.dart'; import 'package:dashboard/ui/graphs/community/community_graph_view_page.dart';
import 'package:dashboard/ui/graphs/community/list/cluster_list.dart'; import 'package:dashboard/ui/graphs/community/list/cluster_list.dart';
import 'package:dashboard/ui/theme/color_holder.dart'; import 'package:dashboard/ui/theme/color_holder.dart';
......
import 'package:dashboard/querying/clustergetter.dart'; import 'package:dashboard/querying/clustergetter.dart';
import 'package:dashboard/querying/datagetter.dart'; import 'package:dashboard/querying/communitygetter.dart';
import 'package:dashboard/ui/theme/color_holder.dart'; import 'package:dashboard/ui/theme/color_holder.dart';
import 'package:dashboard/ui/util/logged_in_appbar.dart'; import 'package:dashboard/ui/util/logged_in_appbar.dart';
import 'package:enhanced_future_builder/enhanced_future_builder.dart'; import 'package:enhanced_future_builder/enhanced_future_builder.dart';
......
...@@ -6,7 +6,7 @@ import 'package:dashboard/data/community.dart'; ...@@ -6,7 +6,7 @@ import 'package:dashboard/data/community.dart';
import 'package:dashboard/graphing/trustcolorcalculator.dart'; import 'package:dashboard/graphing/trustcolorcalculator.dart';
import 'package:dashboard/loading.dart'; import 'package:dashboard/loading.dart';
import 'package:dashboard/querying/clustergetter.dart'; import 'package:dashboard/querying/clustergetter.dart';
import 'package:dashboard/querying/datagetter.dart'; import 'package:dashboard/querying/communitygetter.dart';
import 'package:dashboard/ui/graphs/community/community_graph_view_page.dart'; import 'package:dashboard/ui/graphs/community/community_graph_view_page.dart';
import 'package:dashboard/ui/theme/color_holder.dart'; import 'package:dashboard/ui/theme/color_holder.dart';
import 'package:dashboard/ui/util/logged_in_appbar.dart'; import 'package:dashboard/ui/util/logged_in_appbar.dart';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment