-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #186 from EyeSeeTea/development
Release 0.4.0
- Loading branch information
Showing
16 changed files
with
462 additions
and
152 deletions.
There are no files selected for viewing
This file was deleted.
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
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,3 @@ | ||
import Store from "d2-ui/lib/store/Store"; | ||
|
||
export default Store.create(); |
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,46 @@ | ||
import React from "react"; | ||
import PropTypes from "prop-types"; | ||
import CopyInUserBatchModelsMultiSelectComponent from "./batch-models-multi-select/CopyInUserBatchModelsMultiSelect.component"; | ||
import CopyInUserBatchModelsMultiSelectModel from "./batch-models-multi-select/CopyInUserBatchModelsMultiSelect.model"; | ||
import _m from "../utils/lodash-mixins"; | ||
import { getPayload } from "../models/userHelpers"; | ||
|
||
function getTitle(getTranslation, users) { | ||
const usernames = users && users.map(user => user.userCredentials.username); | ||
const info = usernames ? _m.joinString(getTranslation, usernames, 3, ", ") : "..."; | ||
return getTranslation("copyInUser") + ": " + info; | ||
} | ||
|
||
function CopyInUserDialog(props, context) { | ||
const { d2 } = context; | ||
const getTranslation = context.d2.i18n.getTranslation.bind(context.d2.i18n); | ||
const modelOptions = { | ||
parentModel: d2.models.users, | ||
parentFields: ":owner,userCredentials[id,username,userRoles[id,name],lastLogin]", | ||
childrenModel: d2.models.users, | ||
getChildren: user => user.userCredentials.userRoles, | ||
getPayload: getPayload, | ||
}; | ||
|
||
return ( | ||
<CopyInUserBatchModelsMultiSelectComponent | ||
model={new CopyInUserBatchModelsMultiSelectModel(context.d2, modelOptions)} | ||
parents={[{ ...props.user }]} | ||
onRequestClose={props.onRequestClose} | ||
getTitle={users => getTitle(getTranslation, users)} | ||
onSuccess={getTranslation("user_configuration_copied")} | ||
onError={getTranslation("user_configuration_copied_error")} | ||
/> | ||
); | ||
} | ||
|
||
CopyInUserDialog.contextTypes = { | ||
d2: PropTypes.object.isRequired, | ||
}; | ||
|
||
CopyInUserDialog.propTypes = { | ||
user: PropTypes.object.isRequired, | ||
onRequestClose: PropTypes.func.isRequired, | ||
}; | ||
|
||
export default CopyInUserDialog; |
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
1 change: 0 additions & 1 deletion
1
src/components/batch-models-multi-select/BatchModelsMultiSelect.model.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
Oops, something went wrong.