Commit d16ca034 authored by Luca Braun's avatar Luca Braun

Updated Cluster querying

parent 05c7962e
2021/03/15-14:11:37.409 2e54 Reusing MANIFEST C:\Users\Luca\AppData\Local\Temp\flutter_tools.6980f546\flutter_tools_chrome_device.99ecf2dc\Default\AutofillStrikeDatabase/MANIFEST-000001 2021/03/15-17:09:04.000 282c Reusing MANIFEST C:\Users\Luca\AppData\Local\Temp\flutter_tools.feb939e7\flutter_tools_chrome_device.d8bc148a\Default\AutofillStrikeDatabase/MANIFEST-000001
2021/03/15-17:09:04.000 282c Recovering log #3
2021/03/15-17:09:04.000 282c Reusing old log C:\Users\Luca\AppData\Local\Temp\flutter_tools.feb939e7\flutter_tools_chrome_device.d8bc148a\Default\AutofillStrikeDatabase/000003.log
2021/03/15-14:11:37.379 1fec Reusing MANIFEST C:\Users\Luca\AppData\Local\Temp\flutter_tools.6980f546\flutter_tools_chrome_device.99ecf2dc\Default\BudgetDatabase/MANIFEST-000001 2021/03/15-17:09:03.997 1d00 Reusing MANIFEST C:\Users\Luca\AppData\Local\Temp\flutter_tools.feb939e7\flutter_tools_chrome_device.d8bc148a\Default\BudgetDatabase/MANIFEST-000001
2021/03/15-17:09:03.997 1d00 Recovering log #3
2021/03/15-17:09:03.997 1d00 Reusing old log C:\Users\Luca\AppData\Local\Temp\flutter_tools.feb939e7\flutter_tools_chrome_device.d8bc148a\Default\BudgetDatabase/000003.log
...@@ -19,15 +19,15 @@ define("main_module.bootstrap", ["web_entrypoint.dart", "dart_sdk"], function(ap ...@@ -19,15 +19,15 @@ define("main_module.bootstrap", ["web_entrypoint.dart", "dart_sdk"], function(ap
main(); main();
}); });
} }
window.$dartAppId = "aIrnYDz2m2snmv1C+RRpHQ=="; window.$dartAppId = "rj27DCk9qhDMkSLqPeMc+A==";
window.$dartReloadConfiguration = "ReloadConfiguration.none"; window.$dartReloadConfiguration = "ReloadConfiguration.none";
window.$dartModuleStrategy = "require-js"; window.$dartModuleStrategy = "require-js";
window.$loadModuleConfig = require; window.$loadModuleConfig = require;
window.$dwdsVersion = "7.1.1"; window.$dwdsVersion = "7.1.1";
window.$dwdsDevHandlerPath = "http://localhost:55339/$dwdsSseHandler"; window.$dwdsDevHandlerPath = "http://localhost:54077/$dwdsSseHandler";
window.$dartEntrypointPath = "main_module.bootstrap.js"; window.$dartEntrypointPath = "main_module.bootstrap.js";
window.$requireLoader.forceLoadModule("dwds/src/injected/client"); window.$requireLoader.forceLoadModule("dwds/src/injected/client");
window.$dartExtensionUri = "http://127.0.0.1:55341/$debug"; window.$dartExtensionUri = "ws://127.0.0.1:54079/$debug";
} else { } else {
if(window.$dartMainExecuted){ if(window.$dartMainExecuted){
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"integration_test","path":"C:\\\\Users\\\\Luca\\\\Documents\\\\flutter\\\\flutter_windows_1.22.5-stable\\\\flutter\\\\packages\\\\integration_test\\\\","dependencies":[]},{"name":"path_provider","path":"C:\\\\Users\\\\Luca\\\\Documents\\\\flutter\\\\flutter_windows_1.22.5-stable\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider-1.6.27\\\\","dependencies":[]}],"android":[{"name":"integration_test","path":"C:\\\\Users\\\\Luca\\\\Documents\\\\flutter\\\\flutter_windows_1.22.5-stable\\\\flutter\\\\packages\\\\integration_test\\\\","dependencies":[]},{"name":"path_provider","path":"C:\\\\Users\\\\Luca\\\\Documents\\\\flutter\\\\flutter_windows_1.22.5-stable\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider-1.6.27\\\\","dependencies":[]}],"macos":[{"name":"path_provider_macos","path":"C:\\\\Users\\\\Luca\\\\Documents\\\\flutter\\\\flutter_windows_1.22.5-stable\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider_macos-0.0.4+8\\\\","dependencies":[]}],"linux":[{"name":"path_provider_linux","path":"C:\\\\Users\\\\Luca\\\\Documents\\\\flutter\\\\flutter_windows_1.22.5-stable\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider_linux-0.0.1+2\\\\","dependencies":[]}],"windows":[{"name":"path_provider_windows","path":"C:\\\\Users\\\\Luca\\\\Documents\\\\flutter\\\\flutter_windows_1.22.5-stable\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider_windows-0.0.5\\\\","dependencies":[]}],"web":[]},"dependencyGraph":[{"name":"integration_test","dependencies":[]},{"name":"path_provider","dependencies":["path_provider_macos","path_provider_linux","path_provider_windows"]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_macos","dependencies":[]},{"name":"path_provider_windows","dependencies":[]}],"date_created":"2021-03-15 14:15:50.497365","version":"2.0.1"} {"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"integration_test","path":"C:\\\\Users\\\\Luca\\\\Documents\\\\flutter\\\\flutter_windows_1.22.5-stable\\\\flutter\\\\packages\\\\integration_test\\\\","dependencies":[]},{"name":"path_provider","path":"C:\\\\Users\\\\Luca\\\\Documents\\\\flutter\\\\flutter_windows_1.22.5-stable\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider-1.6.27\\\\","dependencies":[]}],"android":[{"name":"integration_test","path":"C:\\\\Users\\\\Luca\\\\Documents\\\\flutter\\\\flutter_windows_1.22.5-stable\\\\flutter\\\\packages\\\\integration_test\\\\","dependencies":[]},{"name":"path_provider","path":"C:\\\\Users\\\\Luca\\\\Documents\\\\flutter\\\\flutter_windows_1.22.5-stable\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider-1.6.27\\\\","dependencies":[]}],"macos":[{"name":"path_provider_macos","path":"C:\\\\Users\\\\Luca\\\\Documents\\\\flutter\\\\flutter_windows_1.22.5-stable\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider_macos-0.0.4+8\\\\","dependencies":[]}],"linux":[{"name":"path_provider_linux","path":"C:\\\\Users\\\\Luca\\\\Documents\\\\flutter\\\\flutter_windows_1.22.5-stable\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider_linux-0.0.1+2\\\\","dependencies":[]}],"windows":[{"name":"path_provider_windows","path":"C:\\\\Users\\\\Luca\\\\Documents\\\\flutter\\\\flutter_windows_1.22.5-stable\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider_windows-0.0.5\\\\","dependencies":[]}],"web":[]},"dependencyGraph":[{"name":"integration_test","dependencies":[]},{"name":"path_provider","dependencies":["path_provider_macos","path_provider_linux","path_provider_windows"]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_macos","dependencies":[]},{"name":"path_provider_windows","dependencies":[]}],"date_created":"2021-03-15 17:08:16.625001","version":"2.0.1"}
\ No newline at end of file \ No newline at end of file
...@@ -4,5 +4,5 @@ class Community { ...@@ -4,5 +4,5 @@ class Community {
Community(this.name, this.trust, this.posts); Community(this.name, this.trust, this.posts);
final String name; final String name;
final double trust; final double trust;
final List<Post> posts; List<Post> posts;
} }
import 'package:circlegraph/circlegraph.dart'; import 'package:circlegraph/circlegraph.dart';
import 'package:dashboard/querying/datagetter.dart'; import 'package:dashboard/querying/datagetter.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:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
...@@ -77,7 +78,7 @@ class UserGraphViewPage extends StatelessWidget { ...@@ -77,7 +78,7 @@ class UserGraphViewPage extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
backgroundColor: Colors.white, backgroundColor: ColorHolder.color3,
appBar: LoggedInAppBar("User: $username"), appBar: LoggedInAppBar("User: $username"),
body: Container( body: Container(
constraints: BoxConstraints.expand(), constraints: BoxConstraints.expand(),
......
import 'package:dashboard/exceptions/login_exception.dart'; import 'package:dashboard/exceptions/login_exception.dart';
import 'package:dashboard/loading.dart'; import 'package:dashboard/loading.dart';
import 'package:dashboard/querying/cluster.dart';
import 'package:dashboard/ui/graphs/community/index.dart'; import 'package:dashboard/ui/graphs/community/index.dart';
import 'package:dashboard/ui/sign_in/loginpage.dart'; import 'package:dashboard/ui/sign_in/loginpage.dart';
import 'package:dashboard/util/loginhelper.dart'; import 'package:dashboard/util/loginhelper.dart';
...@@ -28,7 +29,9 @@ class _MyAppState extends State<MyApp> { ...@@ -28,7 +29,9 @@ class _MyAppState extends State<MyApp> {
} }
@override @override
Widget build(BuildContext context) => MaterialApp( Widget build(BuildContext context) {
ClusterGetter().getClusters();
return MaterialApp(
home: EnhancedFutureBuilder<BackendUser>( home: EnhancedFutureBuilder<BackendUser>(
future: _checkLoginStuff(), future: _checkLoginStuff(),
whenNotDone: LoadingScreen(), whenNotDone: LoadingScreen(),
...@@ -39,4 +42,5 @@ class _MyAppState extends State<MyApp> { ...@@ -39,4 +42,5 @@ class _MyAppState extends State<MyApp> {
}, },
), ),
); );
}
} }
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/datagetter.dart';
import 'package:dashboard/util/loginhelper.dart'; import 'package:dashboard/util/loginhelper.dart';
...@@ -5,7 +6,8 @@ import 'package:dashboard/util/user.dart'; ...@@ -5,7 +6,8 @@ import 'package:dashboard/util/user.dart';
import 'package:logger/logger.dart'; import 'package:logger/logger.dart';
class ClusterGetter { class ClusterGetter {
Future<Map<String, dynamic>> getNodesfromLayer(String layerName) async { Map<String, List<Community>> clusterMap;
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"; "https://articonf1.itec.aau.at:30101/api/use-cases/reddit/tables/reddit/layers/$layerName/nodes";
Logger().i(url); Logger().i(url);
...@@ -20,25 +22,39 @@ class ClusterGetter { ...@@ -20,25 +22,39 @@ class ClusterGetter {
await DataGetter.getJsonList(url, headers: headers); await DataGetter.getJsonList(url, headers: headers);
Logger().i(nodesList.toString()); Logger().i(nodesList.toString());
Map<String, List<Post>> resultMap = {}; Map<String, List<Post>> resultMap = {};
List<Community> communityList = [];
for (Map<String, dynamic> entry in nodesList) { for (Map<String, dynamic> entry in nodesList) {
if (resultMap[entry["subreddit"]] == null) bool communityExists = false;
resultMap[entry["subreddit"]] = []; Community community;
for (Community tmpCommunity in communityList) {
if (tmpCommunity.name == entry["subreddit"]) {
community = tmpCommunity;
communityExists = true;
break;
}
}
resultMap[entry["subreddit"]].add(Post( if (!communityExists) {
community = Community(entry["subreddit"], 1, []);
communityList.add(community);
}
community.posts.add(Post(
entry["title"], entry["title"],
entry["content"], entry["content"],
entry["user_id"], entry["user_id"],
entry["subreddit"], entry["subreddit"],
entry["percentage_upvoted"], entry["percentage_upvoted"],
entry["n_comments"])); entry["n_comments"]));
Logger().i(community.posts.toString());
} }
Logger().i(resultMap.toString());
return resultMap; return communityList;
} }
Future<Map<String, dynamic>> getClusters() async { Future<Map<String, List<Community>>> getClustersFuture() async {
List<String> layers = [ List<String> layers = [
"Upvotes_Layer", "Upvotes_Layer",
"Percentage_Layer", "Percentage_Layer",
...@@ -46,7 +62,7 @@ class ClusterGetter { ...@@ -46,7 +62,7 @@ class ClusterGetter {
"Time_Layer", "Time_Layer",
]; ];
Map<String, dynamic> clusterMap = {}; Map<String, List<Community>> clusterMap = {};
for (String layer in layers) { for (String layer in layers) {
clusterMap[layer] = await getNodesfromLayer(layer); clusterMap[layer] = await getNodesfromLayer(layer);
} }
......
...@@ -4,8 +4,9 @@ import 'package:flutter/material.dart'; ...@@ -4,8 +4,9 @@ import 'package:flutter/material.dart';
class LoggedInAppBar extends PreferredSize { class LoggedInAppBar extends PreferredSize {
final String title; final String title;
Widget bottom;
LoggedInAppBar(this.title); LoggedInAppBar(this.title, {this.bottom});
@override @override
Size get preferredSize => Size.fromHeight(60); Size get preferredSize => Size.fromHeight(60);
...@@ -23,6 +24,7 @@ class LoggedInAppBar extends PreferredSize { ...@@ -23,6 +24,7 @@ class LoggedInAppBar extends PreferredSize {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return AppBar( return AppBar(
backgroundColor: Colors.blue, backgroundColor: Colors.blue,
bottom: bottom,
title: Text(title), title: Text(title),
actions: [ actions: [
Padding( Padding(
......
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