-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#865 Write projects overview in react/javascript
* add SearchField * add deleteConfig function * implement backend search * add filter by user condition to configReducer for site admins
- Loading branch information
Showing
12 changed files
with
140 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,9 @@ | ||
import { UPDATE_CONFIG } from './types' | ||
import { DELETE_CONFIG, UPDATE_CONFIG } from './types' | ||
|
||
export function updateConfig(path, value) { | ||
return {type: UPDATE_CONFIG, path, value} | ||
} | ||
|
||
export function deleteConfig(path) { | ||
return {type: DELETE_CONFIG, path} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
export const FETCH_PROJECTS_SUCCESS = 'projects/fetchProjectsSuccess' | ||
export const FETCH_PROJECTS_ERROR = 'projects/fetchProjectsError' | ||
export const FETCH_PROJECTS_INIT = 'projects/fetchProjectsInit' | ||
export const DELETE_CONFIG = 'config/deleteConfig' | ||
export const FETCH_CURRENT_USER_ERROR = 'currentUser/fetchCurrentUserError' | ||
export const FETCH_CURRENT_USER_INIT = 'currentUser/fetchCurrentUserInit' | ||
export const FETCH_CURRENT_USER_SUCCESS = 'currentUser/fetchCurrentUserSuccess' | ||
export const FETCH_CURRENT_USER_ERROR = 'currentUser/fetchCurrentUserError' | ||
export const FETCH_PROJECTS_ERROR = 'projects/fetchProjectsError' | ||
export const FETCH_PROJECTS_INIT = 'projects/fetchProjectsInit' | ||
export const FETCH_PROJECTS_SUCCESS = 'projects/fetchProjectsSuccess' | ||
export const UPDATE_CONFIG = 'config/updateConfig' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
|
||
import AccountsApi from '../api/AccountsApi' | ||
import { | ||
FETCH_CURRENT_USER_ERROR, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
rdmo/projects/assets/js/components/helper/userIsManager.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import siteId from 'rdmo/core/assets/js/utils/siteId' | ||
|
||
const userIsManager = (currentUser) => { | ||
if (currentUser.is_superuser || | ||
(currentUser.role && currentUser.role.manager && currentUser.role.manager.some(manager => manager.id === siteId))) { | ||
return true | ||
} | ||
return false | ||
} | ||
|
||
export default userIsManager |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.