Added user name to the header.

feature/appm-store/pbac
Menaka Jayawardena 7 years ago
parent 6b944a4e9f
commit 75427e1021

@ -19,7 +19,6 @@
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import React, {Component} from 'react'; import React, {Component} from 'react';
import {withRouter} from 'react-router-dom'; import {withRouter} from 'react-router-dom';
import Axios from 'axios';
import AuthHandler from "../../api/authHandler"; import AuthHandler from "../../api/authHandler";
import {Button, Col, Container, Input, Row,} from 'reactstrap'; import {Button, Col, Container, Input, Row,} from 'reactstrap';
import ApplicationCreate from '../Application/Create/ApplicationCreate'; import ApplicationCreate from '../Application/Create/ApplicationCreate';
@ -50,7 +49,7 @@ class BaseLayout extends Component {
} }
componentWillMount() { componentWillMount() {
this.setState({user: this.props.user});
} }
handleApplicationClick() { handleApplicationClick() {
@ -86,29 +85,43 @@ class BaseLayout extends Component {
} }
render() { render() {
const userName = this.state.user._userName[0];
return ( return (
<div> <div>
<div id="header-content"> <div className="header-content">
<div className="header">
<div id="header"> <Row>
<span id="header-text"> <Col md="6">
<Logo className="header-image" image_name="logo.png"/> <span id="header-text">
IoT <FormattedMessage id="App.Publisher" defaultMessage="Application Publisher"/> <Logo className="header-image" image_name="logo.png"/>
</span> IoT <FormattedMessage id="App.Publisher" defaultMessage="Application Publisher"/>
<div id="header-btn-container"> </span>
<Button id="header-button"><i className="fw fw-notification btn-header"></i></Button> </Col>
<Button id="header-button"><i className="fw fw-user btn-header"></i></Button> <Col>
</div> <div className="header-button-container">
<div id="search-box"> <Button id="header-button">
<i className="fw fw-search search-icon"> <i className="fw fw-notification btn-header"></i></Button>
</i> <span className="header-user-name">
<Input {userName.charAt(0).toUpperCase() + userName.slice(1)}
id="search" </span>
name="search" <Button id="header-button">
placeholder={'Search for Applications'} <i className="fw fw-user btn-header"></i></Button>
onChange={(event) => console.log(event.target.value)} //TODO: Remove this </div>
/> </Col>
</div> </Row>
<Row>
<Col>
<div className="search-box">
<i className="fw fw-search"></i>
<Input
id="search"
name="search"
placeholder={'Search for Applications'}
onChange={(event) => console.log(event.target.value)} //TODO: Remove this
/>
</div>
</Col>
</Row>
</div> </div>
<Container> <Container>
<div id="add-btn-container"> <div id="add-btn-container">

Loading…
Cancel
Save