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

feat(interview): Rewrite interview using React and Redux [0] #941

Merged
merged 72 commits into from
Dec 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
eec363f
Add project_interview view and refactor webpack config
jochenklar Mar 12, 2024
1c6489c
Add lint script to package.json
jochenklar Mar 14, 2024
4a25cfb
Move Pending container to core/assets
jochenklar Mar 14, 2024
40cd8d8
Add react/redux setup for interview
jochenklar Mar 14, 2024
97b3a44
Add breadcrumb, overview, progress, buttons and navigation to interview
jochenklar Mar 15, 2024
6cbd09a
Add location handling and refactor
jochenklar Mar 25, 2024
c33032f
Add TemplateAPI and help to sidebar in interview
jochenklar Apr 2, 2024
3ebb768
Add Page, Question, QuestionSet and widgets components
jochenklar Apr 2, 2024
bc15e43
Add Widgets and refactor actions and front end data model
jochenklar Apr 23, 2024
113ad3d
Fix DateWidget
jochenklar Apr 26, 2024
d43afbe
Fix focus for multiple questions
jochenklar Apr 26, 2024
51c5376
Add CREATE_VALUE action and fix range, file and checkbox widget
jochenklar Apr 26, 2024
27b63e8
Refactor value filtering and remove _attribute from serializer again
jochenklar Apr 29, 2024
81c6991
Move AddValue and RemoveValue components and add useFocusEffect
jochenklar Apr 29, 2024
5ca23d6
Implement QuestionSets in react front-end (and more...)
jochenklar Apr 29, 2024
922513f
Add link to new interview
jochenklar Apr 29, 2024
ee51afa
Add isDefault to new front-end and reorganize files
jochenklar Apr 29, 2024
135466a
Add QuestionEraseValue component
jochenklar Apr 29, 2024
9b50f5d
Add optional badge
jochenklar Apr 30, 2024
140a87a
Reorganize interview store, components and add read_only view
jochenklar Apr 30, 2024
97148f9
Add "done" page to interview
jochenklar Apr 30, 2024
5e277b1
Add option providers into new react front end and add markdown
jochenklar May 1, 2024
f40f10f
Add set_collection to react front end
jochenklar May 1, 2024
d27ef90
Add component for project errors
jochenklar May 1, 2024
a445797
Add error handling to react front end
jochenklar May 1, 2024
30a50b4
Restore project_questions.scss
jochenklar May 1, 2024
109077e
Fix navigation tests
jochenklar May 1, 2024
b66d854
Move widget directory in interview app
jochenklar May 3, 2024
75a9faf
Refactor styles in interview and fix range widget
jochenklar May 3, 2024
726f7af
Refactor file widget
jochenklar May 3, 2024
57f3beb
Update date picker in interview
jochenklar May 3, 2024
5f406d9
Submit PageHeadFormModal when pressing enter
jochenklar May 3, 2024
4d6bc42
Add back flag to fetchPage action
jochenklar May 3, 2024
03ec91b
Check isManager in interview
jochenklar May 3, 2024
3a37cfc
Cleanup components
jochenklar May 3, 2024
d2d4f90
Update project progress in interview
jochenklar May 3, 2024
92a1ea3
Fetch navigation after storeValue etc in interview
jochenklar May 3, 2024
93d85d5
Add resolve conditions to new front-end
jochenklar May 4, 2024
c3b676c
Fix navigation style
jochenklar May 4, 2024
0c3ac52
Refactor Widgets again and add units to interview
jochenklar May 4, 2024
b394b5f
Add async mode to SelectWidget and remove AutocompleteInput
jochenklar May 5, 2024
ef676d6
Fix SelectWidget
jochenklar May 6, 2024
34fa5e5
Add createable select to replace freeautocomplete
jochenklar May 6, 2024
06d8f6e
Add refresh to storeValue and deleteValue
jochenklar May 6, 2024
afecdd4
Fix file input
jochenklar May 13, 2024
0792023
Store unit and value_type in new front-end
jochenklar May 13, 2024
81e993f
Fix page issues and add error handling for page values
jochenklar May 13, 2024
304e528
Fix navigation in interview
jochenklar May 13, 2024
c8d1d6b
Store default values when fetching page
jochenklar May 13, 2024
2091bb8
Handle delete value and set errors
jochenklar May 14, 2024
5857c18
Update delete set api to delete descendants values
jochenklar May 14, 2024
e818b6a
Fix init page and storing of default values
jochenklar May 14, 2024
651b04c
Fix focus in interview
jochenklar May 17, 2024
6df30f9
Disable onMenuOpen in interview for now
jochenklar May 17, 2024
0bbef52
Update package.json and package-lock.json (after rebase)
jochenklar Aug 25, 2024
db4936a
Update meta location (after rebase)
jochenklar Aug 25, 2024
c9198fb
Fix imports (after rebase)
jochenklar Aug 25, 2024
5638bb1
Fix remove dist from static urls
jochenklar Aug 25, 2024
ba9d590
Add interview endpoint to webpack.config.js again (after rebase)
jochenklar Aug 25, 2024
a9e02a0
Refactor Template to Html component and add page/questionset/question…
jochenklar Aug 1, 2024
36f4e98
Add type validation to interview
jochenklar Jun 21, 2024
ed8748c
Refactor config redux store
jochenklar Aug 2, 2024
8a385f8
Add pending redux store and refactor interview and project actions
jochenklar Aug 2, 2024
6e83c89
Add success indicator to values and refactor updateValue action and w…
jochenklar Aug 6, 2024
3669c98
Add pendig flag to values
jochenklar Aug 15, 2024
cf7c09b
Fix valueIndex computation
jochenklar Aug 15, 2024
3f678df
Fix value comparison
jochenklar Aug 15, 2024
97fca6b
Update useModal use (after rebase)
jochenklar Aug 25, 2024
f972fd5
Update modals (after rebase)
jochenklar Aug 25, 2024
9712b74
Add section progress to new interview
jochenklar Jun 21, 2024
1e268c1
Fix typos
jochenklar Aug 25, 2024
9c1477c
Fix test (after rebase)
jochenklar Aug 25, 2024
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
277 changes: 276 additions & 1 deletion package-lock.json

Large diffs are not rendered by default.

7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"build:dist": "webpack --config webpack.config.js --mode production --env ignore-perf --fail-on-warnings",
"build:prod": "webpack --config webpack.config.js --mode production",
"build": "webpack --config webpack.config.js --mode development",
"watch": "webpack --config webpack.config.js --mode development --watch"
"watch": "webpack --config webpack.config.js --mode development --watch",
"lint": "eslint --ext .js rdmo/"
},
"author": "RDMO Arbeitsgemeinschaft <rdmorganiser.github.io>",
"license": "Apache-2.0",
Expand All @@ -20,6 +21,7 @@
"classnames": "^2.5.1",
"date-fns": "^3.6.0",
"font-awesome": "4.7.0",
"html-to-text": "^9.0.5",
"jquery": "^3.7.1",
"js-cookie": "^3.0.5",
"lodash": "^4.17.21",
Expand All @@ -28,6 +30,7 @@
"react": "^18.3.1",
"react-bootstrap": "0.33.1",
"react-datepicker": "7.3.0",
"react-diff-viewer-continued": "^3.4.0",
"react-dnd": "^16.0.1",
"react-dnd-html5-backend": "^16.0.1",
"react-dom": "^18.3.1",
Expand All @@ -37,7 +40,7 @@
"redux": "^4.1.1",
"redux-logger": "^3.0.6",
"redux-thunk": "^2.3.0",
"react-diff-viewer-continued": "^3.4.0"
"use-debounce": "^10.0.0"
},
"devDependencies": {
"@babel/cli": "^7.24.1",
Expand Down
2 changes: 2 additions & 0 deletions rdmo/core/assets/js/utils/lang.js
jochenklar marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// take the baseurl from the <head> of the django template
export default document.querySelector('html').getAttribute('lang')
16 changes: 15 additions & 1 deletion rdmo/core/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,21 @@
'PROJECT_TABLE_PAGE_SIZE'
]

TEMPLATES_API = []
TEMPLATES_API = [
'projects/project_interview_add_set_help.html',
'projects/project_interview_add_value_help.html',
'projects/project_interview_buttons_help.html',
'projects/project_interview_done.html',
'projects/project_interview_error.html',
'projects/project_interview_multiple_values_warning.html',
'projects/project_interview_navigation_help.html',
'projects/project_interview_overview_help.html',
'projects/project_interview_page_help.html',
'projects/project_interview_page_tabs_help.html',
'projects/project_interview_progress_help.html',
'projects/project_interview_question_help.html',
'projects/project_interview_questionset_help.html',
]

EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
DEFAULT_FROM_EMAIL = '[email protected]'
Expand Down
4 changes: 2 additions & 2 deletions rdmo/core/templates/core/base.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% load static compress core_tags %}<!DOCTYPE html>
<html>
{% load static compress core_tags i18n %}{% get_current_language as lang_code %}<!DOCTYPE html>
<html lang="{{ lang_code }}">
<head>
{% include 'core/base_head.html' %}

Expand Down
23 changes: 0 additions & 23 deletions rdmo/management/assets/js/containers/Pending.js

This file was deleted.

3 changes: 2 additions & 1 deletion rdmo/management/assets/js/management.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ import configureStore from './store/configureStore'
import { DndProvider } from 'react-dnd'
import { HTML5Backend } from 'react-dnd-html5-backend'

import Pending from '../../../core/assets/js/containers/Pending'

import Main from './containers/Main'
import Sidebar from './containers/Sidebar'
import Pending from './containers/Pending'

const store = configureStore()

Expand Down
2 changes: 2 additions & 0 deletions rdmo/options/providers.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ def get_options(self, project, search=None, user=None, site=None):

class SimpleProvider(Provider):

refresh = True

def get_options(self, project, search=None, user=None, site=None):
return [
{
Expand Down
2 changes: 1 addition & 1 deletion rdmo/projects/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def project_owners(self, obj):
@admin.register(Value)
class ValueAdmin(admin.ModelAdmin):
search_fields = ('attribute__uri', 'project__title', 'snapshot__title', 'project__user__username')
list_display = ('attribute', 'set_prefix', 'set_index', 'collection_index', 'value_type',
list_display = ('attribute', 'set_prefix', 'set_index', 'collection_index', 'set_collection', 'value_type',
'project_title', 'project_owners', 'snapshot_title', 'updated', 'created')
list_filter = ('value_type', )

Expand Down
35 changes: 35 additions & 0 deletions rdmo/projects/assets/js/interview.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import React from 'react'
import { createRoot } from 'react-dom/client'
import { Provider } from 'react-redux'

import configureStore from './interview/store/configureStore'

import { DndProvider } from 'react-dnd'
import { HTML5Backend } from 'react-dnd-html5-backend'

import Pending from '../../../core/assets/js/containers/Pending'

import Main from './interview/containers/Main'
import Sidebar from './interview/containers/Sidebar'

const store = configureStore()

createRoot(document.getElementById('main')).render(
<DndProvider backend={HTML5Backend}>
<Provider store={store}>
<Main />
</Provider>
</DndProvider>
)

createRoot(document.getElementById('sidebar')).render(
<Provider store={store}>
<Sidebar />
</Provider>
)

createRoot(document.getElementById('pending')).render(
<Provider store={store}>
<Pending />
</Provider>
)
52 changes: 52 additions & 0 deletions rdmo/projects/assets/js/interview/actions/actionTypes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
export const NOOP = 'NOOP'

export const FETCH_OVERVIEW_INIT = 'FETCH_OVERVIEW_INIT'
export const FETCH_OVERVIEW_ERROR = 'FETCH_OVERVIEW_ERROR'
export const FETCH_OVERVIEW_SUCCESS = 'FETCH_OVERVIEW_SUCCESS'

export const FETCH_PROGRESS_INIT = 'FETCH_PROGRESS_INIT'
export const FETCH_PROGRESS_ERROR = 'FETCH_PROGRESS_ERROR'
export const FETCH_PROGRESS_SUCCESS = 'FETCH_PROGRESS_SUCCESS'

export const UPDATE_PROGRESS_INIT = 'UPDATE_PROGRESS_INIT'
export const UPDATE_PROGRESS_SUCCESS = 'UPDATE_PROGRESS_SUCCESS'
export const UPDATE_PROGRESS_ERROR = 'UPDATE_PROGRESS_ERROR'

export const FETCH_PAGE_INIT = 'FETCH_PAGE_INIT'
export const FETCH_PAGE_ERROR = 'FETCH_PAGE_ERROR'
export const FETCH_PAGE_SUCCESS = 'FETCH_PAGE_SUCCESS'

export const FETCH_NAVIGATION_INIT = 'FETCH_NAVIGATION_INIT'
export const FETCH_NAVIGATION_ERROR = 'FETCH_NAVIGATION_ERROR'
export const FETCH_NAVIGATION_SUCCESS = 'FETCH_NAVIGATION_SUCCESS'

export const FETCH_OPTIONS_INIT = 'FETCH_OPTIONS_INIT'
export const FETCH_OPTIONS_SUCCESS = 'FETCH_OPTIONS_SUCCESS'
export const FETCH_OPTIONS_ERROR = 'FETCH_OPTIONS_ERROR'

export const FETCH_VALUES_INIT = 'FETCH_VALUES_INIT'
export const FETCH_VALUES_SUCCESS = 'FETCH_VALUES_SUCCESS'
export const FETCH_VALUES_ERROR = 'FETCH_VALUES_ERROR'

export const RESOLVE_CONDITION_INIT = 'RESOLVE_CONDITION_INIT'
export const RESOLVE_CONDITION_SUCCESS = 'RESOLVE_CONDITION_SUCCESS'
export const RESOLVE_CONDITION_ERROR = 'RESOLVE_CONDITION_ERROR'

export const CREATE_VALUE = 'CREATE_VALUE'
export const UPDATE_VALUE = 'UPDATE_VALUE'

export const STORE_VALUE_INIT = 'STORE_VALUE_INIT'
export const STORE_VALUE_SUCCESS = 'STORE_VALUE_SUCCESS'
export const STORE_VALUE_ERROR = 'STORE_VALUE_ERROR'

export const DELETE_VALUE_INIT = 'DELETE_VALUE_INIT'
export const DELETE_VALUE_SUCCESS = 'DELETE_VALUE_SUCCESS'
export const DELETE_VALUE_ERROR = 'DELETE_VALUE_ERROR'

export const ACTIVATE_SET = 'ACTIVATE_SET'

export const CREATE_SET = 'CREATE_SET'

export const DELETE_SET_INIT = 'DELETE_SET_INIT'
export const DELETE_SET_SUCCESS = 'DELETE_SET_SUCCESS'
export const DELETE_SET_ERROR = 'DELETE_SET_ERROR'
Loading
Loading