@fortawesome/free-solid-svg-icons#faDatabase JavaScript Examples

The following examples show how to use @fortawesome/free-solid-svg-icons#faDatabase. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MetaConfig.js    From Designer-Client with GNU General Public License v3.0 4 votes vote down vote up
export function MetaConfig(props) {
  const dispatch = useDispatch();
  const history = useHistory();
  const classes = useStyles();

  const [cols, setCols] = useState();

  const { id } = useParams();
  const metaDict = useSelector((state) => state.metas.dict);
  const meta = metaDict[id];
  console.log(meta);

  useEffect(() => {
    dispatch(metaActions.getMeta(id)).then((response) => {
      if(response.error) {
        alertActions.handleError(dispatch, response.error);
        return;
      }
    })  
  }, [])

  useEffect(() => {
    if(meta && meta.columns && !cols) {
      let columns = [];

      for (const col of meta.columns) {
        const obj = {...col};
        obj.isNullable = obj.isNullable || false;
        obj.isUnique = obj.isUnique || false;
        obj.isHidden = obj.isHidden || false;

        columns.push(obj);
      }

      setCols(columns);
    }
  }, [meta])

  let dataTypeIcon;
  if (meta && meta.dataType) {
    switch (meta.dataType) {
      case "file":
        dataTypeIcon = <FontAwesomeIcon icon={faFile} />
        break;
      case "database":
        dataTypeIcon = <FontAwesomeIcon icon={faDatabase} />
        break;
      case "link":
        dataTypeIcon = <FontAwesomeIcon icon={faLink} />
        break;
    }
  }

  return (

    <div className={classes.root}>
      {meta && 
        <div>
          <Grid container>
            <Grid item xs={12}>
              <div className={classes.dataInfo}>
                {dataTypeIcon}
                <span className={classes.dataName}>
                  {meta.originalFileName}
                </span>
              </div>
            </Grid>
          </Grid>

          {cols &&
            <Grid container>
              <Grid item lg={4} md={6} xs={12}>
                <MetaSchema cols={cols} />
              
                l4 m6 x12
              </Grid>
              <Grid item lg={4} md={6} xs={12}>
                <MetaOptions />
                l4 m6 x12
              </Grid>
              <Grid item lg={4} md={12}>
                <MetaDocs />
                l4 m12
              </Grid>
            </Grid>
          }
        </div>
      }
    </div>
  )
}