-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'development' of https://github.com/taban03/hackathon19 …
…into development * 'development' of https://github.com/taban03/hackathon19: Cleanup Add dropdown for version
- Loading branch information
Showing
20 changed files
with
170 additions
and
353 deletions.
There are no files selected for viewing
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,37 @@ | ||
import { ZOWE_VERSIONS_SUCCESS, ZOWE_VERSIONS_ERROR } from '../constants/zowe-versions-contants'; | ||
|
||
|
||
export function fetchZoweVersionsSuccess(versions) { | ||
return { | ||
type: ZOWE_VERSIONS_SUCCESS, | ||
versions: versions | ||
}; | ||
} | ||
|
||
export function fetchZoweVersionsError(error) { | ||
return { | ||
type: ZOWE_VERSIONS_ERROR, | ||
error: error | ||
} | ||
} | ||
|
||
export function fetchVersions() { | ||
return dispatch => { | ||
fetch('https://localhost:80/api/v1/ui/catalogs/versions') | ||
.then(res => res.json()) | ||
.then(res => { | ||
console.log(res) | ||
if(res.error) { | ||
console.log("ERRRORE") | ||
throw(res.error); | ||
} | ||
dispatch(fetchZoweVersionsSuccess(res)) | ||
return res.versions; | ||
}) | ||
.catch(error => { | ||
dispatch(fetchZoweVersionsError(error)); | ||
}) | ||
} | ||
|
||
} | ||
|
This file was deleted.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
@@ -1,46 +1,79 @@ | ||
import React, { Component } from 'react'; | ||
import { Button, Link, Text, Tooltip } from 'mineral-ui'; | ||
import { IconPowerSettingsNew } from 'mineral-ui-icons'; | ||
import productImage from '../../assets/images/api-catalog-logo.png'; | ||
import { Link, Text, Dropdown, Button } from 'mineral-ui'; | ||
|
||
import productImage from '../../assets/images/zowe-catatalog-logo.png'; | ||
import githubImage from '../../assets/images/github.png'; | ||
import './Header.css'; | ||
|
||
export default class Header extends Component { | ||
handleLogout = () => { | ||
const { logout } = this.props; | ||
logout(); | ||
}; | ||
|
||
|
||
// getVersions = () => { | ||
// fetch('https://localhost:80/api/v1/catalogs/versions') | ||
// .then(res => res.json()) | ||
// .then((data) => { | ||
// this.setState({ versions: data }) | ||
// }) | ||
// } | ||
componentWillMount() { | ||
const {fetchVersions} = this.props; | ||
fetchVersions(); | ||
console.log(this.props) | ||
} | ||
|
||
render() { | ||
const iconLogout = <IconPowerSettingsNew color="white" />; | ||
const dashboard = '/ui/v1/apicatalog/#/dashboard'; | ||
const dashboard = '/ui/v1/zowecatalog/#/dashboard'; | ||
const {versions, error} = this.props; | ||
// const text = {...versions.version}; | ||
// for (i = 0; i < versions.length; i++) | ||
// const text = | ||
// versions.text = versions.version; | ||
const data = versions.map(o => ({text: o.version})); | ||
|
||
console.log(data) | ||
// const {data, text = versions.map(o => ({text: o.version}))} = versions; | ||
// const data = | ||
// [ | ||
// { | ||
// text: versions, | ||
// // onClick: event => { console.log(event); } | ||
// } | ||
// ] | ||
console.log("VERSIONEEEE") | ||
// console.log(data) | ||
return ( | ||
<div className="header"> | ||
<div className="product-name"> | ||
<Link href={dashboard}> | ||
<div className="app-icon-container"> | ||
<img id="logo" alt="API Catalog Product Name" src={productImage} /> | ||
<img id="logo" alt="Zowe Catalog Product Name" src={productImage} /> | ||
</div> | ||
</Link> | ||
<Link href={dashboard}> | ||
<Text element="h3" color="#ffffff"> | ||
API Catalog | ||
Zowe Components Catalog | ||
</Text> | ||
</Link> | ||
</div> | ||
<div className="right-icons"> | ||
<div className="dropdown"> | ||
<Dropdown data={data}> | ||
<Button>Zowe Versions</Button> | ||
</Dropdown> | ||
</div> | ||
<div className="icons-container"> | ||
<Link href="https://www.zowe.org"> | ||
<img id="logo2" alt="Zowe Catalog Product Name" src={productImage} /> | ||
</Link> | ||
</div> | ||
<div className="logout-container"> | ||
<Tooltip content="Logout"> | ||
<Button | ||
iconStart={iconLogout} | ||
data-testid="logout" | ||
primary | ||
circular | ||
onClick={this.handleLogout} | ||
/> | ||
</Tooltip> | ||
<Link href="https://github.com/zowe"> | ||
<img id="logo2" alt="Zowe Catalog GitHub Icon" src={githubImage} /> | ||
</Link> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
} | ||
} | ||
|
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 |
---|---|---|
@@ -1,14 +1,27 @@ | ||
import { connect } from 'react-redux'; | ||
import { userActions } from '../../actions/user.actions'; | ||
import Header from './Header'; | ||
import { | ||
fetchZoweVersionsSuccess, | ||
fetchZoweVersionsError, | ||
fetchVersions | ||
} from '../../actions/fetch-versions-actions'; | ||
import {getVisibleTiles} from '../../selectors/selectors'; | ||
|
||
const mapStateToProps = () => ({}); | ||
const mapStateToProps = state => ({ | ||
versions: state.zoweVersionsReducer.versions, | ||
error: state.zoweVersionsReducer.error, | ||
}); | ||
|
||
const mapDispatchToProps = { | ||
logout: () => userActions.logout(), | ||
}; | ||
fetchZoweVersionsSuccess, | ||
fetchZoweVersionsError, | ||
fetchVersions, | ||
} | ||
|
||
export default connect( | ||
mapStateToProps, | ||
mapDispatchToProps | ||
mapDispatchToProps, | ||
)(Header); | ||
|
||
|
||
|
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 @@ | ||
// eslint-disable-next-line import/prefer-default-export | ||
export const ZOWE_VERSIONS_SUCCESS = 'ZOWE_VERSIONS_SUCCESS'; | ||
export const ZOWE_VERSIONS_ERROR = 'ZOWE_VERSIONS_ERROR'; |
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,29 @@ | ||
import { ZOWE_VERSIONS_SUCCESS, ZOWE_VERSIONS_ERROR } from '../constants/zowe-versions-contants'; | ||
|
||
|
||
const dropDownDefaultState = { | ||
versions: [], | ||
}; | ||
|
||
export const zoweVersionsReducer = (state = dropDownDefaultState, action) => { | ||
console.log(action.type) | ||
switch (action.type) { | ||
case ZOWE_VERSIONS_SUCCESS: | ||
console.log("SUCCESSSSSOO") | ||
return { | ||
...state, | ||
versions: action.versions | ||
} | ||
case ZOWE_VERSIONS_ERROR: | ||
console.log("ERROR") | ||
return { | ||
...state, | ||
error: action.error | ||
} | ||
default: | ||
console.log("DEFAULT") | ||
return state; | ||
} | ||
} | ||
|
||
export default zoweVersionsReducer; |
Oops, something went wrong.