-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'development' into Tim_bm_materials_list_index
- Loading branch information
Showing
51 changed files
with
1,566 additions
and
455 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,16 +1,16 @@ | ||
# Define a imagem base | ||
FROM node:14-alpine | ||
# Set the working directory to /app | ||
WORKDIR /app | ||
# Copy the package.json and yarn.lock files to the container | ||
COPY package.json yarn.lock ./ | ||
# Install dependencies | ||
RUN yarn install | ||
# Copy the rest of the app files to the container | ||
COPY . ./ | ||
# Build the app | ||
RUN yarn build | ||
# Expose port 3000 | ||
EXPOSE 3000 | ||
# Set the startup command to run the app using Node.js | ||
# Define a imagem base | ||
FROM node:14-alpine | ||
# Set the working directory to /app | ||
WORKDIR /app | ||
# Copy the package.json and yarn.lock files to the container | ||
COPY package.json yarn.lock ./ | ||
# Install dependencies | ||
RUN yarn install | ||
# Copy the rest of the app files to the container | ||
COPY . ./ | ||
# Build the app | ||
RUN yarn build | ||
# Expose port 3000 | ||
EXPOSE 3000 | ||
# Set the startup command to run the app using Node.js | ||
CMD ["yarn", "start:local"] |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,80 @@ | ||
import configureStore from 'redux-mock-store'; | ||
import TeamMembersPopup from 'components/Teams/TeamMembersPopup'; | ||
import thunk from 'redux-thunk'; | ||
import { authMock, userProfileMock, rolesMock } from '../../__tests__/mockStates'; | ||
import { render, screen, fireEvent } from '@testing-library/react'; | ||
import { Provider } from 'react-redux'; | ||
|
||
const mockStore = configureStore([thunk]); | ||
|
||
const mockProps = { | ||
members: { teamMembers: [] }, | ||
usersdata: { userProfiles: [] }, | ||
}; | ||
|
||
const renderComponent = props => { | ||
const store = mockStore({ | ||
auth: authMock, | ||
userProfile: userProfileMock, | ||
role: rolesMock.role, | ||
...props, | ||
}); | ||
|
||
render( | ||
<Provider store={store}> | ||
<TeamMembersPopup {...props} /> | ||
</Provider>, | ||
); | ||
}; | ||
|
||
const initialState = { | ||
open: true, | ||
selectedTeamName: 'Test Team', | ||
hasPermission: jest.fn(), | ||
members: { | ||
teamMembers: { toSorted: jest.fn(() => []) }, | ||
}, | ||
roles: [{}], | ||
auth: { | ||
user: { | ||
role: 'Owner', | ||
permissions: { | ||
frontPermissions: ['assignTeamToUsers'], | ||
}, | ||
}, | ||
}, | ||
userProfile: { userProfiles: [] }, | ||
requestorRole: '', | ||
userPermissions: [], | ||
onClose: jest.fn(), | ||
onDeleteClick: jest.fn(), | ||
}; | ||
|
||
const usersdata = { userProfiles: [] }; | ||
|
||
describe('TeamMembersPopup', () => { | ||
it('should render correctly', () => { | ||
renderComponent(mockProps); | ||
}); | ||
|
||
it('should render "Add" button', () => { | ||
renderComponent({ ...initialState, usersdata }); | ||
expect(screen.getByRole('button', { name: 'Add' })).toBeInTheDocument(); | ||
}); | ||
|
||
it('should render "Close" button', () => { | ||
renderComponent({ ...initialState, usersdata }); | ||
expect(screen.getByText('Close')).toBeInTheDocument(); | ||
}); | ||
|
||
it('should call closePopup function', () => { | ||
renderComponent({ ...initialState, usersdata }); | ||
fireEvent.click(screen.getByText('Close')); | ||
expect(initialState.onClose).toHaveBeenCalledTimes(1); | ||
}); | ||
|
||
it('displays the team name in the modal header', () => { | ||
renderComponent({ ...initialState, usersdata }); | ||
expect(screen.getByText(`Members of ${initialState.selectedTeamName}`)).toBeInTheDocument(); | ||
}); | ||
}); |
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,77 @@ | ||
import axios from 'axios'; | ||
import { ENDPOINTS } from '../utils/URL'; | ||
import * as types from "../constants/rolePermissionPresets"; | ||
|
||
export const fetchPresets = (presets) => { | ||
return { | ||
type: types.RECEIVE_PRESETS, | ||
presets, | ||
}; | ||
}; | ||
|
||
export const postNewPreset = payload => { | ||
return { | ||
type: types.ADD_NEW_PRESET, | ||
payload, | ||
}; | ||
}; | ||
|
||
export const deletePreset = presetId => { | ||
return { | ||
type: types.DELETE_PRESET, | ||
presetId, | ||
}; | ||
}; | ||
|
||
export const updatePreset = payload => { | ||
return { | ||
type: types.UPDATE_PRESET, | ||
payload, | ||
}; | ||
}; | ||
|
||
export const getPresetsByRole = (roleName) => async dispatch => { | ||
const URL = ENDPOINTS.PRESETS_BY_ID(roleName); | ||
const { data } = await axios.get(URL); | ||
return dispatch(fetchPresets(data)); | ||
}; | ||
|
||
export const createNewPreset = newPreset => { | ||
return async dispatch => { | ||
try { | ||
const res = await axios.post(ENDPOINTS.PRESETS(), newPreset); | ||
if (res.status === 201){ | ||
dispatch(postNewPreset(res.data.newPreset)); | ||
} | ||
} catch (error) { | ||
console.log(error) | ||
} | ||
return status; | ||
}; | ||
}; | ||
|
||
export const updatePresetById = (updatedPreset) => { | ||
return async dispatch => { | ||
try { | ||
const res = await axios.put(ENDPOINTS.PRESETS_BY_ID(updatedPreset._id), updatedPreset); | ||
if (res.status === 200){ | ||
dispatch(updatePreset(updatedPreset)); | ||
} | ||
} catch (err) { | ||
console.log(err); | ||
} | ||
}; | ||
}; | ||
|
||
export const deletePresetById = (presetId) => { | ||
return async dispatch => { | ||
try { | ||
const res = await axios.delete(ENDPOINTS.PRESETS_BY_ID(presetId)); | ||
if (res.status === 200){ | ||
dispatch(deletePreset(presetId)); | ||
} | ||
} catch (error) { | ||
console.log(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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
.bm-dashboard__header h1{ | ||
font-size: 1.5em; | ||
text-align: center; | ||
margin-top: 2em; | ||
} | ||
|
||
.bm-dashboard__button.btn.btn-secondary{ | ||
background-color: #2e5061; | ||
} | ||
|
||
@media (min-width: 650px){ | ||
|
||
.bm-dashboard__button.btn.btn-secondary{ | ||
padding-left: 0; | ||
padding-right: 0; | ||
max-height: 38px; | ||
} | ||
} | ||
|
||
/* project summaries */ | ||
.projects-list{ | ||
width: 80%; | ||
list-style-type: none; | ||
max-height: 80vh; | ||
overflow-x: hidden; | ||
overflow-y: auto; | ||
} | ||
|
||
.project-summary{ | ||
background-color: #e8f4f9; | ||
min-height: 20vh; | ||
height: auto; | ||
margin-bottom: 2em; | ||
padding: 1em; | ||
border-radius: 5px; | ||
} | ||
|
||
.project-summary_header{ | ||
font-size: clamp(1em, 3vw, 1.3em); | ||
font-weight: bold; | ||
} | ||
|
||
.project-summary p{ | ||
margin: 0; | ||
font-size: clamp(0.9em, 2.5vw, 1em); | ||
} | ||
|
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.