fix: fix compatibility for existing networks after supporting tags and capabilities

This commit is contained in:
snachx 2021-12-13 22:22:27 +08:00
parent 8f891747d6
commit a813d05b3c

View file

@ -64,10 +64,11 @@ function MemberSettings({ member, network, handleChange }) {
</Grid> </Grid>
<Grid item xs={12}> <Grid item xs={12}>
<Paper style={{ padding: 20 }}> <Paper style={{ padding: 20 }}>
{Object.entries(network["capabilitiesByName"]).length === 0 {Object.entries(network["capabilitiesByName"] || []).length ===
0
? "No capabilities defined" ? "No capabilities defined"
: ""} : ""}
{Object.entries(network["capabilitiesByName"]).map( {Object.entries(network["capabilitiesByName"] || []).map(
([capName, capId]) => ( ([capName, capId]) => (
<FormControlLabel <FormControlLabel
control={ control={
@ -97,14 +98,14 @@ function MemberSettings({ member, network, handleChange }) {
<Grid item xs={12}> <Grid item xs={12}>
<Typography variant="h5">Tags</Typography> <Typography variant="h5">Tags</Typography>
</Grid> </Grid>
{Object.entries(network["tagsByName"]).length === 0 ? ( {Object.entries(network["tagsByName"] || []).length === 0 ? (
<Grid item xs={12}> <Grid item xs={12}>
<Paper style={{ padding: 20 }}>No tags defined</Paper> <Paper style={{ padding: 20 }}>No tags defined</Paper>
</Grid> </Grid>
) : ( ) : (
"" ""
)} )}
{Object.entries(network["tagsByName"]).map( {Object.entries(network["tagsByName"] || []).map(
([tagName, tagDetail]) => ( ([tagName, tagDetail]) => (
<Grid item xs={12} sm={6} key={"tag-" + tagName}> <Grid item xs={12} sm={6} key={"tag-" + tagName}>
<Tag <Tag