Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI task details #174

Merged
merged 3 commits into from
Oct 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions ui/lib/common/colors.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,7 @@ Color offlineColor = rgba(148, 163, 184, 1);
Color successMessageColor = rgba(239, 249, 243, 1);
Color successFontColor = rgba(94, 191, 134, 1);

Color timeLogBackgroundColor = rgba(10, 12, 16, 1);
Color logFontColor = rgba(141, 148, 157, 1);


11 changes: 11 additions & 0 deletions ui/lib/models/task.dart
Original file line number Diff line number Diff line change
Expand Up @@ -143,3 +143,14 @@ class Staffs {

int length() => staffs.length;
}
class TimeLog {
String logContent;
int time;

TimeLog({
required this.logContent,
required this.time
});
}


26 changes: 5 additions & 21 deletions ui/lib/modules/agents/agent_item.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:ui/common/svg_provider.dart';
import 'package:ui/models/agents.dart';
import 'package:ui/widgets/dot/index.dart';

import '../../common/colors.dart';
import 'controller.dart';
Expand Down Expand Up @@ -58,27 +59,10 @@ class AgentItem extends GetView<AgentsController> {
fontWeight: FontWeight.w600,
)),
SizedBox(height: 2),
Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(
height: 8,
width: 8,
margin: EdgeInsets.only(right: 4, top: 3),
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(4)),
color: this.agent.isOnline ? onlineColor : offlineColor
),
),
SelectableText(this.agent.isOnline ? "Online".tr : "Offline".tr,
style: TextStyle(
color: regularFontColor,
fontSize: 12,
fontWeight: FontWeight.w400,
))
],
)
Dot(
dotTitle: this.agent.isOnline ? "Online".tr : "Offline".tr,
dotColor: this.agent.isOnline ? onlineColor : offlineColor,
),
]),
getShowItem(children: [
SelectableText(this.agent.id,
Expand Down
2 changes: 2 additions & 0 deletions ui/lib/modules/dashboard/controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ class DashboardController extends GetxController {
Rx<Tasks> tasks = Tasks.fromList([]).obs;
Rx<TaskDetail> taskDetail = TaskDetail.fromMap({}).obs;
RxString filters = ''.obs;
RxBool showDetail = true.obs;
RxString detailTaskId = ''.obs;

final String query = r'''
query {
Expand Down
6 changes: 4 additions & 2 deletions ui/lib/modules/dashboard/entry_actions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ class EntryActions extends GetView<DashboardController> {
),
),
),
onPressed: () => Get.dialog(TaskDetailDialog(taskId: data["id"])),
onPressed: () {
// Get.dialog(TaskDetailDialog(taskId: data["id"]));
controller.showDetail(true);
},
),
TextButton(
child: Padding(
Expand Down Expand Up @@ -67,7 +70,6 @@ class EntryMoreActions extends GetView<DashboardController> {

@override
Widget build(BuildContext context) {
// String name = data["name"];

return MoreActions(
onSelected: (String op) {
Expand Down
44 changes: 22 additions & 22 deletions ui/lib/modules/dashboard/index.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:get/get.dart';
import 'package:flutter/material.dart';
import 'package:ui/modules/dashboard/task_detail/index.dart';

import '../layout/index.dart';
import '../../widgets/page_description/index.dart';
Expand All @@ -17,30 +18,29 @@ class Dashboard extends GetView<DashboardController> {
c.getTasks();

return Layout(
child: Column(
children: [
PageDescription(
icon: IconData(0xe600, fontFamily: 'tpIcon'),
title: 'Tasks'.tr,
subtitle: "Create and manage your data migration tasks".tr,
),
Obx(
() => controller.tasks.value.length() == 0
child: Obx(() => controller.showDetail.value
? TaskDetail()
: Column(
children: [
PageDescription(
icon: IconData(0xe600, fontFamily: 'tpIcon'),
title: 'Tasks'.tr,
subtitle: "Create and manage your data migration tasks".tr,
),
controller.tasks.value.length() == 0
? EmptyEntryList(
icon: IconData(0xe600, fontFamily: 'tpIcon'),
title: 'The task list is empty'.tr,
subTitle:
'Please click the button below to create a task'.tr,
buttonText: 'Create task'.tr,
onClick: () => Get.dialog(CreateTaskDialog(
name: 'DM task 1',
getTasks: controller.getTasks,
)),
)
icon: IconData(0xe600, fontFamily: 'tpIcon'),
title: 'The task list is empty'.tr,
subTitle: 'Please click the button below to create a task'.tr,
buttonText: 'Create task'.tr,
onClick: () => Get.dialog(CreateTaskDialog(
name: 'DM task 1',
getTasks: controller.getTasks,
)),
)
: EntryList(),
),
],
),
],
)),
);
}
}
232 changes: 232 additions & 0 deletions ui/lib/modules/dashboard/task_detail/base_information_pane.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,232 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:ui/common/colors.dart';

import 'identity_dialog.dart';

class BaseInformationPane extends StatelessWidget {
const BaseInformationPane({ Key? key }) : super(key: key);

Widget getTitle(String title) {
return Row(
children: [
Container(
margin: EdgeInsets.only(left: 6, right: 10, top: 10, bottom: 6),
height: 4,
width: 4,
color: regularFontColor,
),
SelectableText(
title,
style: TextStyle(
fontFamily: 'Roboto',
fontWeight: FontWeight.w600,
fontStyle: FontStyle.normal,
fontSize: 14,
color: regularFontColor,
),
)
],
);
}

Widget getPane(List<Widget> children, {bool showBorder = true}) {
return Container(
padding: EdgeInsets.only(bottom: 30, top: 10),
decoration: BoxDecoration(
color: Colors.white,
border: Border(bottom: BorderSide(color: showBorder ? rgba(226, 232, 240, 1) : Colors.white, width: 1, style: BorderStyle.solid)),
),
child: Row(
children: [
Expanded(
child: Column(
children: children,
),
)
],
),
);
}

Widget getContent(String title, {String ?textContent, Widget ?customWidet}) {
if (textContent == null && customWidet == null) {
throw ArgumentError('Please fill in customWidet or textContent!');
}
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SelectableText(
title,
style: TextStyle(
fontFamily: 'Roboto',
fontWeight: FontWeight.w500,
fontStyle: FontStyle.normal,
fontSize: 12,
color: offlineColor,
),
),
SizedBox(height: 5,),
textContent != null ? SelectableText(
textContent as String,
style: TextStyle(
fontFamily: 'Roboto',
fontWeight: FontWeight.w600,
fontStyle: FontStyle.normal,
fontSize: 12,
color: regularFontColor,
),
)
: customWidet as Widget,
],
);
}

Color getForeGroundColor(Set<MaterialState> states) {
if (states.contains(MaterialState.hovered)) {
return primaryColor;
}

return regularFontColor;
}

@override
Widget build(BuildContext context) {
return Container(
padding: EdgeInsets.only(bottom: 30),
child: Column(
children: [
Expanded(
child: ListView(
children: [
getPane(
[
getTitle('source library settings'),
SizedBox(height: 20,),
Row(
children: [
SizedBox(width: 20,),
Expanded(
flex: 1,
child: getContent(
'target library',
textContent: 'local files - FS',
),
),
Expanded(
flex: 2,
child: getContent(
'Work directory',
textContent: '/ home / jack998 / Downloads',
),
)
],
)
]
),
getPane(
[
getTitle('target library settings'),
SizedBox(height: 20,),
Row(
children: [
SizedBox(width: 20,),
Expanded(
flex: 1,
child: getContent(
'target library',
textContent: 'local files - FS'
),
),
Expanded(
flex: 2,
child: getContent(
'identity',
customWidet: TextButton(
style: ButtonStyle(
foregroundColor: MaterialStateProperty.resolveWith(getForeGroundColor),
overlayColor: MaterialStateProperty.resolveWith((states) => Colors.white),
),
onPressed: () {
Get.dialog(IdentityDialog());
},
child: Text(
'QingStor - identity 1',
style: TextStyle(
decoration: TextDecoration.underline,
)
)
)
),
)
],
),
SizedBox(height: 20,),
Row(
children: [
SizedBox(width: 20,),
Expanded(
flex: 1,
child: getContent(
'bucket name',
textContent: 'QingStor bucket name',
),
),
Expanded(
flex: 2,
child: getContent(
'Work directory',
textContent: 'Root directory / file001 / ewqessad',
),
)
],
)
]
),
getPane(
[
getTitle('other settings'),
SizedBox(height: 20,),
Row(
children: [
SizedBox(width: 20,),
Expanded(
flex: 1,
child: getContent(
'task type',
textContent: 'One - time task',
),
),
Expanded(
flex: 2,
child: getContent(
'Data validate method',
textContent: 'md5',
),
)
],
),
SizedBox(height: 20,),
Row(
children: [
SizedBox(width: 20,),
Expanded(
flex: 1,
child: getContent(
'Skip existing files condition',
textContent: 'file update time',
),
)
],
)
],
showBorder: false,
),
],
),
)
],
),
);
}
}
Loading