Restrict work item list to admin only
This commit is contained in:
@@ -366,6 +366,10 @@ class API extends EventEmitter {
|
|||||||
return this.delete("/workitems/" + _id)
|
return this.delete("/workitems/" + _id)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
listTeams() {
|
||||||
|
return this.get("/teams")
|
||||||
|
}
|
||||||
|
|
||||||
getActivity(_id) {
|
getActivity(_id) {
|
||||||
return this.get("/activities/" + _id)
|
return this.get("/activities/" + _id)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -106,6 +106,7 @@ export class Activity extends React.Component {
|
|||||||
this.setState({
|
this.setState({
|
||||||
binder: new FormBinder(
|
binder: new FormBinder(
|
||||||
{
|
{
|
||||||
|
...this.state.binder.getOriginalFieldValues(),
|
||||||
workItem: workItem._id,
|
workItem: workItem._id,
|
||||||
team: api.loggedInUser.team,
|
team: api.loggedInUser.team,
|
||||||
},
|
},
|
||||||
@@ -143,7 +144,7 @@ export class Activity extends React.Component {
|
|||||||
binder: new FormBinder(activity, Activity.bindings),
|
binder: new FormBinder(activity, Activity.bindings),
|
||||||
})
|
})
|
||||||
|
|
||||||
getWorkItem(activity.workItemId)
|
return getWorkItem(activity.workItem)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ import KeyboardSpacer from "react-native-keyboard-spacer"
|
|||||||
import hardhatPinImage from "./images/hardhat-pin.png"
|
import hardhatPinImage from "./images/hardhat-pin.png"
|
||||||
import clipboardPinImage from "./images/clipboard-pin.png"
|
import clipboardPinImage from "./images/clipboard-pin.png"
|
||||||
import questionPinImage from "./images/question-pin.png"
|
import questionPinImage from "./images/question-pin.png"
|
||||||
|
import moment from "moment"
|
||||||
|
|
||||||
const neverAskForLocationPermissionKeyName = "NeverAskForLocationPermission"
|
const neverAskForLocationPermissionKeyName = "NeverAskForLocationPermission"
|
||||||
const neverAskForCameraKeyName = "NeverAskForCameraPermission"
|
const neverAskForCameraKeyName = "NeverAskForCameraPermission"
|
||||||
@@ -92,8 +93,19 @@ export class Home extends React.Component {
|
|||||||
)
|
)
|
||||||
|
|
||||||
api
|
api
|
||||||
.listWorkItemActivities()
|
.listTeams()
|
||||||
.then((list) => {
|
.then((list) => {
|
||||||
|
this.teams = list.items
|
||||||
|
return api.listWorkItemActivities()
|
||||||
|
})
|
||||||
|
.then((list) => {
|
||||||
|
list.items.forEach((item) => {
|
||||||
|
item.data.forEach((datum) => {
|
||||||
|
const team = this.teams.find((team) => team._id === datum.team)
|
||||||
|
|
||||||
|
datum.teamName = team ? team.name : "???"
|
||||||
|
})
|
||||||
|
})
|
||||||
this.setState({
|
this.setState({
|
||||||
sections: list.items,
|
sections: list.items,
|
||||||
region:
|
region:
|
||||||
@@ -104,7 +116,13 @@ export class Home extends React.Component {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
console.error(err)
|
this.setState({
|
||||||
|
messageModal: {
|
||||||
|
icon: "hand",
|
||||||
|
message: "Unable to get a list of work items, activities and teams",
|
||||||
|
detail: err.message,
|
||||||
|
},
|
||||||
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -440,7 +458,9 @@ export class Home extends React.Component {
|
|||||||
{activity.resolution}
|
{activity.resolution}
|
||||||
</Text>
|
</Text>
|
||||||
<Text style={{ fontSize: 14, color: "gray" }}>
|
<Text style={{ fontSize: 14, color: "gray" }}>
|
||||||
{activity.when}
|
{activity.teamName +
|
||||||
|
" | " +
|
||||||
|
dotify(moment(activity.createdAt).format())}
|
||||||
</Text>
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
<Icon
|
<Icon
|
||||||
@@ -482,7 +502,11 @@ export class Home extends React.Component {
|
|||||||
<Icon
|
<Icon
|
||||||
name="settings"
|
name="settings"
|
||||||
size={24}
|
size={24}
|
||||||
style={{ marginRight: 15, tintColor: "gray" }}
|
style={{
|
||||||
|
display: api.loggedInUser.administrator ? "flex" : "none",
|
||||||
|
marginRight: 15,
|
||||||
|
tintColor: "gray",
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
</View>
|
</View>
|
||||||
|
|||||||
@@ -107,6 +107,8 @@ export class WorkItemRoutes {
|
|||||||
"data._id": 1,
|
"data._id": 1,
|
||||||
"data.resolution": 1,
|
"data.resolution": 1,
|
||||||
"data.status": 1,
|
"data.status": 1,
|
||||||
|
"data.createdAt": 1,
|
||||||
|
"data.team": 1,
|
||||||
})
|
})
|
||||||
|
|
||||||
const items = await aggregate.exec()
|
const items = await aggregate.exec()
|
||||||
|
|||||||
Reference in New Issue
Block a user