Skip to content
This repository has been archived by the owner on Nov 20, 2024. It is now read-only.

fix: Editor url, some index issues, project view json parsing issue #88

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions lib/kanban/Provider/board_list_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class BoardListProvider extends ChangeNotifier {
required VoidCallback setstate}) {
if (!context.mounted) return;
var prov = ref.read(ProviderList.boardProvider);
if(prov.board.lists.length <= listIndex) return;
prov.board.lists[listIndex].context = context;
var box = context.findRenderObject() as RenderBox;
var location = box.localToGlobal(Offset.zero);
Expand Down
2 changes: 1 addition & 1 deletion lib/kanban/Provider/list_item_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class ListItemProvider extends ChangeNotifier {
required VoidCallback setsate}) {
if (!context.mounted) return;
var prov = ref.read(ProviderList.boardProvider);

if (prov.board.lists.length <= listIndex) return;
prov.board.lists[listIndex].items[itemIndex].context = context;
var box = context.findRenderObject() as RenderBox;
var location = box.localToGlobal(Offset.zero);
Expand Down
35 changes: 21 additions & 14 deletions lib/provider/issues_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1248,19 +1248,27 @@ class IssuesProvider extends ChangeNotifier {
);
issueView = response.data["view_props"];
log("project view=>${response.data["view_props"]}");
issues.projectView = issueView['display_filters']['layout'] == 'list'
? ProjectView.list
: issueView['issueView'] == 'calendar'
? ProjectView.calendar
: issueView['issueView'] == 'spreadsheet'
? ProjectView.spreadsheet
: ProjectView.kanban;
issues.groupBY =
Issues.toGroupBY(issueView["display_filters"]["group_by"]);
issues.orderBY =
Issues.toOrderBY(issueView["display_filters"]["order_by"]);
issues.issueType =
Issues.toIssueType(issueView["display_filters"]["type"]);
if (issueView.containsKey('display_filters')) {
issues.projectView = issueView['display_filters']['layout'] == 'list'
? ProjectView.list
: issueView['issueView'] == 'calendar'
? ProjectView.calendar
: issueView['issueView'] == 'spreadsheet'
? ProjectView.spreadsheet
: ProjectView.kanban;
issues.groupBY =
Issues.toGroupBY(issueView["display_filters"]["group_by"]);
issues.orderBY =
Issues.toOrderBY(issueView["display_filters"]["order_by"]);
issues.issueType =
Issues.toIssueType(issueView["display_filters"]["type"]);
showEmptyStates = issueView["display_filters"]["show_empty_groups"] ?? false;
} else {
issues.projectView = ProjectView.kanban;
issues.groupBY = GroupBY.state;
issues.orderBY = OrderBY.startDate;
issues.issueType = IssueType.all;
}
issues.filters.priorities = issueView["filters"]["priority"] ?? [];
issues.filters.states = issueView["filters"]["state"] ?? [];
issues.filters.assignees = issueView["filters"]["assignees"] ?? [];
Expand All @@ -1270,7 +1278,6 @@ class IssuesProvider extends ChangeNotifier {
issues.filters.startDate = issueView["filters"]["start_date"] ?? [];
issues.filters.subscriber = issueView["filters"]["subscriber"] ?? [];
issues.filters.stateGroup = issueView["filters"]["state_group"] ?? [];
showEmptyStates = issueView["display_filters"]["show_empty_groups"];

projectViewState = StateEnum.success;
notifyListeners();
Expand Down
95 changes: 54 additions & 41 deletions lib/provider/my_issues_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -135,19 +135,30 @@ class MyIssuesProvider extends ChangeNotifier {
);
myIssueView = response.data["view_props"];
log("project view=>${response.data["view_props"]}");
issues.projectView = myIssueView["display_filters"]['layout'] == 'list'
? ProjectView.list
: myIssueView["display_filters"]['layout'] == 'calendar'
? ProjectView.calendar
: myIssueView["display_filters"]['layout'] == 'spreadsheet'
? ProjectView.spreadsheet
: ProjectView.kanban;
issues.groupBY =
Issues.toGroupBY(myIssueView["display_filters"]['group_by']);
issues.orderBY =
Issues.toOrderBY(myIssueView["display_filters"]['order_by']);
issues.issueType =
Issues.toIssueType(myIssueView["display_filters"]['type']);
if (myIssueView.containsKey('display_filters')) {
issues.projectView = (myIssueView["display_filters"] as Map)
.containsKey('layout')
? (myIssueView["display_filters"]['layout'] == 'list'
? ProjectView.list
: myIssueView["display_filters"]['layout'] == 'calendar'
? ProjectView.calendar
: myIssueView["display_filters"]['layout'] == 'spreadsheet'
? ProjectView.spreadsheet
: ProjectView.kanban)
: ProjectView.kanban;
issues.groupBY =
Issues.toGroupBY(myIssueView["display_filters"]['group_by']);
issues.orderBY =
Issues.toOrderBY(myIssueView["display_filters"]['order_by']);
issues.issueType =
Issues.toIssueType(myIssueView["display_filters"]['type']);
showEmptyStates = myIssueView["display_filters"]["show_empty_groups"] ?? true;
} else {
issues.projectView = ProjectView.kanban;
issues.groupBY = GroupBY.state;
issues.orderBY = OrderBY.manual;
issues.issueType = IssueType.all;
}
issues.filters.priorities = myIssueView["filters"]["priority"] ?? [];
issues.filters.stateGroup = myIssueView["filters"]["state_group"] ?? [];
// issues.filters.assignees = myIssueView["filters"]["assignees"] ?? [];
Expand All @@ -156,34 +167,36 @@ class MyIssuesProvider extends ChangeNotifier {
issues.filters.startDate = myIssueView["filters"]["start_date"] ?? [];
// issues.displayProperties = myIssueView["displayProperties"];
issues.filters.targetDate = myIssueView["filters"]["target_date"] ?? [];
showEmptyStates = myIssueView["display_filters"]["show_empty_groups"];
issues.displayProperties.assignee =
myIssueView['display_properties']['assignee'] ?? false;
issues.displayProperties.dueDate =
myIssueView['display_properties']['due_date'] ?? false;
issues.displayProperties.id =
myIssueView['display_properties']['key'] ?? false;
issues.displayProperties.label =
myIssueView['display_properties']['labels'] ?? false;
issues.displayProperties.state =
myIssueView['display_properties']['state'] ?? false;
issues.displayProperties.subIsseCount =
myIssueView['display_properties']['sub_issue_count'] ?? false;
issues.displayProperties.linkCount =
myIssueView['display_properties']['link'] ?? false;
issues.displayProperties.attachmentCount =
myIssueView['display_properties']['attachment_count'] ?? false;
issues.displayProperties.priority =
myIssueView['display_properties']['priority'] ?? false;
issues.displayProperties.estimate =
myIssueView['display_properties']['estimate'] ?? false;
issues.displayProperties.startDate =
myIssueView['display_properties']['start_date'] ?? false;
issues.displayProperties.createdOn =
myIssueView['display_properties']['created_on'] ?? false;
issues.displayProperties.updatedOn =
myIssueView['display_properties']['updated_on'] ?? false;

if (myIssueView.containsKey('display_properties')) {
issues.displayProperties.assignee =
myIssueView['display_properties']['assignee'] ?? false;
issues.displayProperties.dueDate =
myIssueView['display_properties']['due_date'] ?? false;
issues.displayProperties.id =
myIssueView['display_properties']['key'] ?? false;
issues.displayProperties.label =
myIssueView['display_properties']['labels'] ?? false;
issues.displayProperties.state =
myIssueView['display_properties']['state'] ?? false;
issues.displayProperties.subIsseCount =
myIssueView['display_properties']['sub_issue_count'] ?? false;
issues.displayProperties.linkCount =
myIssueView['display_properties']['link'] ?? false;
issues.displayProperties.attachmentCount =
myIssueView['display_properties']['attachment_count'] ?? false;
issues.displayProperties.priority =
myIssueView['display_properties']['priority'] ?? false;
issues.displayProperties.estimate =
myIssueView['display_properties']['estimate'] ?? false;
issues.displayProperties.startDate =
myIssueView['display_properties']['start_date'] ?? false;
issues.displayProperties.createdOn =
myIssueView['display_properties']['created_on'] ?? false;
issues.displayProperties.updatedOn =
myIssueView['display_properties']['updated_on'] ?? false;
} else {
issues.displayProperties = DisplayProperties.initialize();
}
// log("My Issues view=>${myIssueView.toString()}");

myIssuesViewState = StateEnum.success;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ class _CreateIssueState extends ConsumerState<CreateIssue> {
webviewController,
title: 'Description',
url:
'${dotenv.env['EDITOR_URL']!}m/${ref.read(ProviderList.workspaceProvider).selectedWorkspace!.workspaceSlug}/editor?editable=true',
'${dotenv.env['EDITOR_URL']!}/${ref.read(ProviderList.workspaceProvider).selectedWorkspace!.workspaceSlug}/editor?editable=true',
)));
},
child: Container(
Expand Down Expand Up @@ -516,7 +516,7 @@ class _CreateIssueState extends ConsumerState<CreateIssue> {
initialUrlRequest:
URLRequest(
url: Uri.parse(
'${dotenv.env['EDITOR_URL']!}m/${ref.read(ProviderList.workspaceProvider).selectedWorkspace!.workspaceSlug}/editor?editable=false'))),
'${dotenv.env['EDITOR_URL']!}/${ref.read(ProviderList.workspaceProvider).selectedWorkspace!.workspaceSlug}/editor?editable=false'))),
descriptionLoading
? Container(
alignment:
Expand Down Expand Up @@ -555,7 +555,7 @@ class _CreateIssueState extends ConsumerState<CreateIssue> {
controller: webviewController,
fromCreateIssue: true,
title: 'Description',
url: '${dotenv.env['EDITOR_URL']!}m/${ref.read(ProviderList.workspaceProvider).selectedWorkspace!.workspaceSlug}/editor?editable=true',
url: '${dotenv.env['EDITOR_URL']!}/${ref.read(ProviderList.workspaceProvider).selectedWorkspace!.workspaceSlug}/editor?editable=true',
)));
},
child: Container(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ class _IssueDetailState extends ConsumerState<IssueDetail> {
return Scaffold(
body: EDITOR(
url:
'${dotenv.env['EDITOR_URL']}m/$workspaceSlug/projects/$projID/issues/${widget.issueId}',
'${dotenv.env['EDITOR_URL']}/$workspaceSlug/projects/$projID/issues/${widget.issueId}',
title: widget.appBarTitle,
),
);
Expand Down
10 changes: 7 additions & 3 deletions lib/utils/editor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,13 @@ class _EDITORState extends ConsumerState<EDITOR> {
onLoadStart: (controller, url) => setState(() {
isLoading = true;
}),
onLoadStop: (controller, url) => setState(() {
isLoading = false;
}),
onLoadStop: (controller, url) {
// This is to remove the default crisp chatbot from the editor
// as it is not needed in the editor
controller.evaluateJavascript(
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

source: '\$crisp.push(["safe", true])');
setState(() => isLoading = false);
},
onConsoleMessage: (controller, msg) async {
log(msg.message);
if (msg.message.startsWith("submitted")) {
Expand Down