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

[#59037] Primerize "Log time" dialog #17268

Merged
merged 90 commits into from
Jan 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
90 commits
Select commit Hold shift + click to select a range
92a3e06
[#59037] Primerize "Log time" dialog
klaustopher Nov 25, 2024
1d8ff07
cleanup: remove duplicated branch in CostlogController
klaustopher Nov 25, 2024
6f90d42
add skeleton for TimeEntriesController
klaustopher Nov 26, 2024
50702c6
Add routes for time entry tracking
klaustopher Nov 27, 2024
9b1edc6
Add a stub for the dialog
klaustopher Nov 27, 2024
8564ef4
Add a temporary link to log time to the project overview
klaustopher Nov 27, 2024
8af27cc
temp: also add a link to edit a time entry
klaustopher Nov 28, 2024
e4ca72f
Add body to the dialog and build a form
klaustopher Nov 28, 2024
31674be
extract logic to render custom fields into a concern
klaustopher Nov 29, 2024
047063e
implement the form
klaustopher Nov 29, 2024
33c31a2
also change wrapper id to have it only in the project custom fields form
klaustopher Nov 29, 2024
903c8cf
add stimulus controller
klaustopher Nov 29, 2024
de76339
correct filter search depending on object and add wrapper for dialog
klaustopher Nov 29, 2024
f023bb4
do not show temp links in overviews in tests
klaustopher Nov 29, 2024
bb3026b
add permitted params for time entries
klaustopher Dec 3, 2024
b47038a
add proper autocompleters and connect time value fields
klaustopher Dec 3, 2024
d938ddb
more proper input stuff
klaustopher Dec 3, 2024
52fe47d
form submission saves a time entry
klaustopher Dec 4, 2024
fe51c0e
refactor dialog to have form and footer divided correctly
klaustopher Dec 4, 2024
5145c24
enable update method
klaustopher Dec 4, 2024
4fd6e9d
persist time zone for user
klaustopher Dec 4, 2024
2adc5ff
Activities from a select list
klaustopher Dec 5, 2024
be8d1a8
more form updates
klaustopher Dec 5, 2024
0f52abf
select default activity
klaustopher Dec 5, 2024
0516c3c
Add required marks and labels
klaustopher Dec 5, 2024
bc5ca9f
use the proper date picker
klaustopher Dec 5, 2024
15764f1
enable time inputs and fix CSS for time pickers
klaustopher Dec 6, 2024
33f0d3d
method to show caption when we are +1 day
klaustopher Dec 6, 2024
bbb455a
Add conversion from HH:mm format to integer
klaustopher Dec 6, 2024
4da7e4b
add functionality to chronic duration to parse 8:15 to 8hours 15minut…
klaustopher Dec 9, 2024
b50255f
add time calculation logic
klaustopher Dec 9, 2024
9c0392f
switch to native html time input element
klaustopher Dec 10, 2024
a93b03a
fix behavior when we have disabled time tracking inputs
klaustopher Dec 10, 2024
589bba4
make rubocop happy
klaustopher Dec 10, 2024
51fbbb8
use i18n for day diff
klaustopher Dec 10, 2024
b7c2c23
render chronic duration in input field so that input does not suddenl…
klaustopher Dec 11, 2024
0a70932
Make the dialog more usable
klaustopher Dec 11, 2024
858ca57
fix form handling
klaustopher Dec 12, 2024
7b65984
split form into seperate fields
klaustopher Dec 12, 2024
dff3b97
use specific work package apis and call turbo action to replace activ…
klaustopher Dec 13, 2024
73d1c3e
render the activity form
klaustopher Dec 13, 2024
fdf505d
remove label
klaustopher Dec 13, 2024
f6e54de
Add the new dialog the calendar widget
klaustopher Dec 13, 2024
f697fbd
add new time entry modal to the context menu within a work package
klaustopher Dec 16, 2024
7c4d7fb
use the new dialog in the costs report as well
klaustopher Dec 16, 2024
d4ff3cb
extract finder stuff into before actions
klaustopher Dec 16, 2024
1da8ba5
make start and end time required conditionally
klaustopher Dec 17, 2024
1e1abaa
Use i18n for the dialog title and main button
klaustopher Dec 17, 2024
66017f6
activity form in the turbo endpoint
klaustopher Dec 17, 2024
db73a2a
get rid of component wrapping the activity form
klaustopher Dec 18, 2024
19bfa60
replace form when work package has changed
klaustopher Dec 18, 2024
c09f7ef
form knows when to render the user and work package field
klaustopher Dec 18, 2024
a8fcc97
emit a custom event when the dialog is closed
klaustopher Dec 20, 2024
105cec5
reload the costs page when the time entry is edited
klaustopher Dec 20, 2024
ffed41c
fix 2 issues in the dialog
klaustopher Dec 20, 2024
d22f258
add frozen string literal to all files i touched
klaustopher Jan 6, 2025
dabb81e
add event listener for calendar widget
klaustopher Jan 6, 2025
e08d3c6
Ensure empty line after magic comment
klaustopher Jan 6, 2025
3c613a7
revert the overview page to dev
klaustopher Jan 6, 2025
2f5de8a
fix specs
klaustopher Jan 6, 2025
d0e49f0
use the new modal in the spent time display field
klaustopher Jan 7, 2025
d30c9eb
also send a dialog:close event when the modal is closed unsuccessfull…
klaustopher Jan 7, 2025
b030cc5
remove spacing
klaustopher Jan 7, 2025
3b3ee51
fix first batch of tests
klaustopher Jan 7, 2025
2221965
improve test for WP input being disabled
klaustopher Jan 7, 2025
ac9faad
attempt to fix tests
klaustopher Jan 8, 2025
dd24be4
fix validations so that timer also works
klaustopher Jan 9, 2025
bcf9c87
fix more tests
klaustopher Jan 9, 2025
09d6f53
Handle ongoing timer in new modal
klaustopher Jan 10, 2025
4c6f0e9
add the delete button for ongoing time entries
klaustopher Jan 10, 2025
d8cd535
fix issues with multi day running timers
klaustopher Jan 13, 2025
8fd4312
fix tests for the time display field
klaustopher Jan 13, 2025
34ae4bb
fix tests for the my page
klaustopher Jan 13, 2025
3568a50
Fix spent time widget
klaustopher Jan 13, 2025
39af085
fix timer spec
klaustopher Jan 13, 2025
b1c1709
add permission checks
klaustopher Jan 13, 2025
1f9c4fc
better handling of edit and delete cases
klaustopher Jan 14, 2025
970bad5
fix styling for delete button
klaustopher Jan 14, 2025
1dcea35
add tests and add stub for upcoming feature tests
klaustopher Jan 14, 2025
fbdbecf
fix specs
klaustopher Jan 15, 2025
62b5506
add tests for behavior within the modal
klaustopher Jan 15, 2025
511e066
Update modules/costs/app/components/time_entries/entry_dialog_compone…
klaustopher Jan 16, 2025
ea1e720
undo typedef change in regards to OR
klaustopher Jan 16, 2025
19f597f
undo unrelated style changes
klaustopher Jan 16, 2025
96fa068
move the friendly_timezone_name helper into Redmine::I18n
klaustopher Jan 16, 2025
12483f2
add logic to calculate start time based on end time and hours
klaustopher Jan 16, 2025
8c6c3fc
fix single datepicker
klaustopher Jan 16, 2025
84cc980
fix tests for work package field in time entry dialog
klaustopher Jan 16, 2025
27fab51
fix query selector for the autocompleters
klaustopher Jan 16, 2025
7cd5622
fix spacing
klaustopher Jan 16, 2025
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
4 changes: 4 additions & 0 deletions app/controllers/concerns/op_turbo/component_stream.rb
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@ def add_caption_to_input_element_via_turbo_stream(target, caption:, clean_other_
.render_in(view_context)
end

def close_dialog_via_turbo_stream(target)
turbo_streams << OpTurbo::StreamComponent.new(action: :closeDialog, target:).render_in(view_context)
end

def turbo_streams
@turbo_streams ||= []
end
Expand Down
2 changes: 2 additions & 0 deletions app/forms/custom_fields/custom_field_rendering.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
#++

module CustomFields::CustomFieldRendering
include ActiveSupport::Concern

def render_custom_fields(form:)
custom_fields.each do |custom_field|
form.fields_for(:custom_field_values) do |builder|
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) the OpenProject GmbH
Expand Down
2 changes: 2 additions & 0 deletions app/forms/custom_fields/inputs/base/input.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) the OpenProject GmbH
Expand Down
2 changes: 2 additions & 0 deletions app/forms/custom_fields/inputs/multi_select_list.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) the OpenProject GmbH
Expand Down
2 changes: 2 additions & 0 deletions app/forms/custom_fields/inputs/multi_user_select_list.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) the OpenProject GmbH
Expand Down
2 changes: 2 additions & 0 deletions app/forms/custom_fields/inputs/multi_version_select_list.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) the OpenProject GmbH
Expand Down
67 changes: 10 additions & 57 deletions app/forms/projects/custom_fields/form.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) the OpenProject GmbH
Expand Down Expand Up @@ -27,12 +29,10 @@
#++
module Projects::CustomFields
class Form < ApplicationForm
include CustomFields::CustomFieldRendering

form do |custom_fields_form|
custom_fields.each do |custom_field|
custom_fields_form.fields_for(:custom_field_values) do |builder|
custom_field_input(builder, custom_field)
end
end
render_custom_fields(form: custom_fields_form)
end

def initialize(project:, custom_field_section: nil, custom_field: nil, wrapper_id: nil)
Expand All @@ -48,6 +48,11 @@ def initialize(project:, custom_field_section: nil, custom_field: nil, wrapper_i
end
end

# override since we want to add the model with @project
def additional_custom_field_input_arguments
{ model: @project, wrapper_id: @wrapper_id }
end

private

def custom_fields
Expand All @@ -62,57 +67,5 @@ def custom_fields
@project.available_custom_fields
end
end

def custom_field_input(builder, custom_field)
if custom_field.multi_value?
multi_value_custom_field_input(builder, custom_field)
else
single_value_custom_field_input(builder, custom_field)
end
end

# TBD: transform inputs called below to primer form dsl instead of form classes?
# TODOS:
# - initial values for user inputs are not displayed
# - allow/disallow-non-open version setting is not yet respected in the version selector
# - rich text editor is not yet supported

def single_value_custom_field_input(builder, custom_field)
form_args = { custom_field:, object: @project, wrapper_id: @wrapper_id }

case custom_field.field_format
when "string", "link"
CustomFields::Inputs::String.new(builder, **form_args)
when "text"
CustomFields::Inputs::Text.new(builder, **form_args)
when "int"
CustomFields::Inputs::Int.new(builder, **form_args)
when "float"
CustomFields::Inputs::Float.new(builder, **form_args)
when "list"
CustomFields::Inputs::SingleSelectList.new(builder, **form_args)
when "date"
CustomFields::Inputs::Date.new(builder, **form_args)
when "bool"
CustomFields::Inputs::Bool.new(builder, **form_args)
when "user"
CustomFields::Inputs::SingleUserSelectList.new(builder, **form_args)
when "version"
CustomFields::Inputs::SingleVersionSelectList.new(builder, **form_args)
end
end

def multi_value_custom_field_input(builder, custom_field)
form_args = { custom_field:, object: @project, wrapper_id: @wrapper_id }

case custom_field.field_format
when "list"
CustomFields::Inputs::MultiSelectList.new(builder, **form_args)
when "user"
CustomFields::Inputs::MultiUserSelectList.new(builder, **form_args)
when "version"
CustomFields::Inputs::MultiVersionSelectList.new(builder, **form_args)
end
end
end
end
24 changes: 24 additions & 0 deletions frontend/src/app/core/path-helper/path-helper.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -329,4 +329,28 @@ export class PathHelperService {
public jobStatusModalPath(jobId:string) {
return `${this.staticBase}/job_statuses/${jobId}/dialog`;
}

public timeEntriesUserTimezoneCaption(userId:string) {
return `${this.staticBase}/time_entries/users/${userId}/tz_caption`;
}

public timeEntriesWorkPackageActivity(workPackageId:string) {
return `${this.staticBase}/time_entries/work_packages/${workPackageId}/time_entry_activities`;
}

public timeEntryDialog() {
return `${this.staticBase}/time_entries/dialog`;
}

public timeEntryEditDialog(timeEntryId:string) {
return `${this.staticBase}/time_entries/${timeEntryId}/dialog`;
}

public timeEntryWorkPackageDialog(workPackageId:string) {
return `${this.workPackagePath(workPackageId)}/time_entries/dialog`;
}

public timeEntryProjectDialog(projectId:string) {
return `${this.projectPath(projectId)}/time_entries/dialog`;
}
}
Loading
Loading