Skip to content

Commit

Permalink
Merge pull request #3 from vito-go/dev
Browse files Browse the repository at this point in the history
0.0.6
  • Loading branch information
vito-go authored Sep 23, 2024
2 parents c98bda1 + 7914ae2 commit 0683f1f
Show file tree
Hide file tree
Showing 7 changed files with 97 additions and 67 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.0.6
- Remove overflow-x; word-wrap:break-word;
- Support folding/unfolding the middle column
- Web index.html base href is set to ./, so that the relative path can work
## 0.0.5
- Make search results colorful and configurable with font size, overflow, and color
- Make search results of traceId clickable to show the total details of the trace
Expand Down
135 changes: 82 additions & 53 deletions lib/pages/home.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import 'package:fsearch/service/search_ws_web.dart';

import 'package:fsearch/service/types.dart';


import 'package:fsearch/widgets/text_search_region.dart';
import 'package:url_launcher/url_launcher.dart';

Expand Down Expand Up @@ -36,8 +35,6 @@ class _HomeState extends State<Home> {
}
}

List<String> get appNames => nodeConfigInfo.appNames;

List<String> appNamesWithFilter(String filter) {
List<String> items = [];
for (var name in nodeConfigInfo.appNames) {
Expand Down Expand Up @@ -78,7 +75,10 @@ class _HomeState extends State<Home> {
itemCheckMap["_"] = v ?? false;
setState(() {});
},
title: const Text("Select All the Files",style: TextStyle(fontWeight: FontWeight.bold),));
title: const Text(
"Select All the Files",
style: TextStyle(fontWeight: FontWeight.bold),
));
}
final fileName = items[index - 1];

Expand Down Expand Up @@ -106,7 +106,7 @@ class _HomeState extends State<Home> {
}

void aboutOnTap() async {
String version = "0.0.1";
String version = "0.0.6";
const applicationName = "File Search";
if (context.mounted) {
showAboutDialog(
Expand All @@ -119,9 +119,7 @@ class _HomeState extends State<Home> {
applicationVersion: "version: $version",
applicationLegalese: '© All rights reserved',
children: [
const SizedBox(
height: 5,
),
const SizedBox(height: 5),
const Text("author:liushihao888@gmail.com"),
const SizedBox(
height: 2,
Expand Down Expand Up @@ -179,15 +177,32 @@ class _HomeState extends State<Home> {
}
return Column(
children: [
ListTile(
title: Text("App Names(${children.length})",
style: const TextStyle(fontWeight: FontWeight.bold)),
trailing: IconButton(
onPressed: () {
appName = "";
setState(() {});
},
icon: const Icon(Icons.refresh)),
// ListTile(
// title: Text("App Names(${children.length})",
// style: const TextStyle(fontWeight: FontWeight.bold)),
// trailing: IconButton(
// onPressed: () {
// setState(() {
// appName = "";
// });
// updateHomeInfo();
// },
// icon: const Icon(Icons.refresh)),
// ),
Row(
children: [
Text("App Names(${children.length})",
style: const TextStyle(fontWeight: FontWeight.bold)),
IconButton(
onPressed: () {
setState(() {
appName = "";
});
updateHomeInfo();
},
icon: const Icon(Icons.refresh)),
],
mainAxisAlignment: MainAxisAlignment.spaceBetween,
),
CupertinoSearchTextField(
style: TextStyle(
Expand Down Expand Up @@ -272,48 +287,65 @@ class _HomeState extends State<Home> {
eventConsumer = consume(eventHandler);
}

bool hiddenHostFiles = false;

Widget get hiddenHostFilesDivider => Column(
children: [
const Expanded(child: VerticalDivider()),
IconButton(
onPressed: () {
setState(() {
hiddenHostFiles = !hiddenHostFiles;
});
},
icon: hiddenHostFiles
? const Icon(Icons.arrow_circle_right)
: const Icon(Icons.arrow_circle_left)),
const Expanded(child: VerticalDivider()),
],
);

Widget get getClusterFiles => Column(children: [
const SizedBox(height: 10),
const Text("Clusters", style: TextStyle(fontWeight: FontWeight.bold)),
SizedBox(
height: MediaQuery.of(context).size.height * 0.37,
child: ListView(children: buildRadioHosts()),
),
const Divider(),
const Text("Files", style: TextStyle(fontWeight: FontWeight.bold)),
Expanded(
child: ListView(
children: nodeId == 0
? buildCheckboxListTile(allFiles, fileCheckMap)
: buildCheckboxListTile(files, fileCheckMap)))
]);
final gitRepoURL = "https://github.com/vito-go/fsearch";

@override
Widget build(BuildContext context) {
final mediaHeight = MediaQuery.of(context).size.height;
final right = TextSearchRegion(
appName: appName,
nodeId: nodeId,
files: fileChecked,
searchPathHTTP: nodeConfigInfo.searchPathHTTP,
);
final List<Widget> bodyChildren = [];
bodyChildren.add(SizedBox(width: 256, child: buildRadioAppNames()));
if (!hiddenHostFiles) {
bodyChildren.add(const VerticalDivider());
bodyChildren.add(Flexible(flex: 12, child: getClusterFiles));
}
bodyChildren.add(hiddenHostFilesDivider);
bodyChildren.add(Flexible(flex: 50, child: right));
final Widget body = Row(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.start,
children: [
Flexible(
flex: 10,
child: buildRadioAppNames(),
),
const VerticalDivider(),
Flexible(
flex: 12,
child: Column(children: [
const SizedBox(height: 10),
const Text("Clusters",
style: TextStyle(fontWeight: FontWeight.bold)),
SizedBox(
height: mediaHeight * 0.37,
child: ListView(children: buildRadioHosts()),
),
const Divider(),
const Text("Files",
style: TextStyle(fontWeight: FontWeight.bold)),
Expanded(
child: ListView(
children: nodeId == 0
? buildCheckboxListTile(allFiles, fileCheckMap)
: buildCheckboxListTile(files, fileCheckMap)))
])),
const VerticalDivider(),
Expanded(flex: 50, child: right),
],
children: bodyChildren,
);
final sunIcon=prefs.themeMode == ThemeMode.light?Icons.nightlight_round:Icons.sunny;
final sunIcon = prefs.themeMode == ThemeMode.light
? Icons.nightlight_round
: Icons.sunny;

return Scaffold(
appBar: AppBar(
Expand All @@ -322,7 +354,7 @@ class _HomeState extends State<Home> {
actions: [
IconButton(
onPressed: () {
launchUrl(Uri.parse("https://github.com/vito-go/fsearch"));
launchUrl(Uri.parse(gitRepoURL));
},
icon: githubSVGContent == ""
? const Icon(Icons.link)
Expand All @@ -332,14 +364,11 @@ class _HomeState extends State<Home> {
icon: const Icon(Icons.help_outline, color: Colors.white)),
IconButton(
onPressed: changeThemeMode,
icon: Icon(sunIcon, color: Colors.white)),
IconButton(
onPressed: updateHomeInfo,
icon: const Icon(Icons.refresh, color: Colors.white)),
icon: Icon(sunIcon, color: Colors.white)),
const SizedBox(width: 20),
],
),
body: body,
body: Padding(padding: const EdgeInsets.all(10), child: body),
);
}
}
2 changes: 0 additions & 2 deletions lib/service/search_ws_web.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ Future<String> searchTextHTTP({
required List<String> kw,
int fontSize = 0,
String normalColor = "",
String overflowX = "auto",
String dataType = "html",
}) async {
final params = <String, dynamic>{
Expand All @@ -30,7 +29,6 @@ Future<String> searchTextHTTP({
'dataType': dataType,
'fontSize': fontSize,
'normalColor': normalColor,
'overflowX': overflowX,
'locationOrigin': kDebugMode ? debugAddr : prefs.locationOrigin,
};
String url = searchPathHTTP;
Expand Down
2 changes: 1 addition & 1 deletion lib/service/types.dart
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class NodeConfigInfo {
List<String> get appNames => List<String>.generate(
clusterNodes.length, (index) => clusterNodes[index].appName);

List<String> hosts(String appName) {
List<String> hosts(String appName) {
for (var ele in clusterNodes) {
if (ele.appName == appName) {
List<String> hosts = [];
Expand Down
18 changes: 8 additions & 10 deletions lib/widgets/text_search_region.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class TextSearchRegionState extends State<TextSearchRegion> {
String get normalColor => isDark ? "#ffffff" : "#000000";

String buildHTML() {
return '<div id="container" style="font-size: ${prefs.searchHTMLFontSize}px; color: $normalColor; overflow-x: ${prefs.searchHTMLOverflowX};">$searchHTML</div>';
return '<div id="container" style="font-size: ${prefs.searchHTMLFontSize}px; color: $normalColor;word-wrap:break-word;">$searchHTML</div>';
}

@override
Expand Down Expand Up @@ -110,7 +110,6 @@ class TextSearchRegionState extends State<TextSearchRegion> {
dataType: dataType,
fontSize: prefs.searchHTMLFontSize,
normalColor: normalColor,
overflowX: prefs.searchHTMLOverflowX,
);
if (needLoading) {
setState(() {
Expand Down Expand Up @@ -254,13 +253,13 @@ class TextSearchRegionState extends State<TextSearchRegion> {
const SizedBox(width: 10),

myButtonSearch,
const SizedBox(width: 20),
const Align(
alignment: AlignmentDirectional.center,
child: Text("overflow-x: "),
),
const SizedBox(width: 10),
// const Align(
// alignment: AlignmentDirectional.center,
// child: Text("overflow-x: "),
// ),
// overflow-x DropdownMenu
dropButtonOverflowX,
// dropButtonOverflowX,
slider,
Align(
alignment: AlignmentDirectional.center,
Expand All @@ -279,8 +278,7 @@ class TextSearchRegionState extends State<TextSearchRegion> {
onPressed: downloadLog,
icon: Icon(Icons.save_alt,
color: isDark ? Colors.white70 : Colors.black)),
const SizedBox(width: 20),
],
],
);

return Column(
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.
version: 0.0.5+1
version: 0.0.6+1

environment:
sdk: '>=3.1.0 <4.0.0'
Expand Down
1 change: 1 addition & 0 deletions web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
the `--base-href` argument provided to `flutter build`.
-->
<!-- <base href="$FLUTTER_BASE_HREF">-->
<base href="./">

<meta charset="UTF-8">
<meta content="IE=Edge" http-equiv="X-UA-Compatible">
Expand Down

0 comments on commit 0683f1f

Please sign in to comment.