-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
75 changed files
with
1,951 additions
and
7,005 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
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
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
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
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
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
44 changes: 36 additions & 8 deletions
44
...ails/GroupInfo/Policies/NewPolicy/PolicyConfigurationButton/PolicyConfigurationButton.tsx
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,26 +1,54 @@ | ||
import React from 'react'; | ||
import { Dispatch } from 'redux'; | ||
import { connect } from 'react-redux'; | ||
import uniqid from 'uniqid'; | ||
|
||
import { ILibrary } from '@/interfaces/library'; | ||
import { currentDate } from '@/utils/currentDate'; | ||
|
||
import { IGroup } from '@/interfaces/group'; | ||
import { IPolicy } from '@/interfaces/policy'; | ||
|
||
import * as groupsActions from '@/store/actions/groups'; | ||
|
||
import PolicyConfigurationButtonView from './PolicyConfigurationButton.view'; | ||
|
||
interface IProps { | ||
readonly selectedLibrary: ILibrary | null; | ||
readonly onPolicyConfiguratoinClicked: () => void; | ||
interface IPropsFromDispatch { | ||
addPolicy: (groupId: string, policy: IPolicy) => groupsActions.AddPolicy; | ||
} | ||
|
||
interface IProps extends IPropsFromDispatch { | ||
readonly isButtonDisabled: boolean; | ||
readonly selectedGroup: IGroup | null; | ||
readonly policyLabelInput: string | null; | ||
} | ||
|
||
const PolicyConfigurationButton: React.FC<IProps> = (props: React.PropsWithChildren<IProps>) => { | ||
const onCreateNewPolicy = () => { | ||
props.addPolicy(props.selectedGroup?.id || '', { | ||
id: uniqid(), | ||
label: props.policyLabelInput || '', | ||
createdAt: currentDate(), | ||
libraryName: '', | ||
rules: null, | ||
}); | ||
}; | ||
|
||
return ( | ||
<PolicyConfigurationButtonView | ||
selectedLibrary={props.selectedLibrary} | ||
policyLabelInput={props.policyLabelInput} | ||
onPolicyConfiguratoinClicked={props.onPolicyConfiguratoinClicked} | ||
isButtonDisabled={props.isButtonDisabled} | ||
onCreateNewPolicy={onCreateNewPolicy} | ||
/> | ||
); | ||
}; | ||
|
||
PolicyConfigurationButton.displayName = 'PolicyConfigurationButton'; | ||
PolicyConfigurationButton.defaultProps = {}; | ||
|
||
export default React.memo(PolicyConfigurationButton); | ||
const mapDispatchToProps = (dispatch: Dispatch<groupsActions.GroupsTypes>): IPropsFromDispatch => { | ||
return { | ||
addPolicy: (groupId: string, policy: IPolicy): groupsActions.AddPolicy => | ||
dispatch(groupsActions.addPolicy(groupId, policy)), | ||
}; | ||
}; | ||
|
||
export default connect(null, mapDispatchToProps)(React.memo(PolicyConfigurationButton)); |
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
Oops, something went wrong.