-
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 pull request #7 from taban03/development
Added description and version on the Dashboard
- Loading branch information
Showing
8 changed files
with
170 additions
and
112 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
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,37 +1,34 @@ | ||
import { ZOWE_VERSIONS_SUCCESS, ZOWE_VERSIONS_ERROR } from '../constants/zowe-versions-contants'; | ||
|
||
|
||
export function fetchZoweVersionsSuccess(versions) { | ||
return { | ||
type: ZOWE_VERSIONS_SUCCESS, | ||
versions: versions | ||
}; | ||
return { | ||
type: ZOWE_VERSIONS_SUCCESS, | ||
versions, | ||
}; | ||
} | ||
|
||
export function fetchZoweVersionsError(error) { | ||
return { | ||
type: ZOWE_VERSIONS_ERROR, | ||
error: error | ||
} | ||
return { | ||
type: ZOWE_VERSIONS_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)); | ||
}) | ||
} | ||
|
||
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 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,34 +1,24 @@ | ||
import { connect } from 'react-redux'; | ||
import Header from './Header'; | ||
import { | ||
fetchZoweVersionsSuccess, | ||
fetchZoweVersionsError, | ||
fetchVersions, | ||
} from '../../actions/fetch-versions-actions'; | ||
import { fetchZoweVersionsSuccess, fetchZoweVersionsError, fetchVersions } from '../../actions/fetch-versions-actions'; | ||
|
||
import { | ||
updateVersionSuccess, | ||
updateVersionError, | ||
} from '../../actions/update-version-actions'; | ||
import { updateVersionSuccess, updateVersionError } from '../../actions/update-version-actions'; | ||
|
||
const mapStateToProps = state => ({ | ||
versions: state.zoweVersionsReducer.versions, | ||
error: state.zoweVersionsReducer.error, | ||
newversion: state.updateTileReducer.newversion, | ||
versions: state.zoweVersionsReducer.versions, | ||
error: state.zoweVersionsReducer.error, | ||
newversion: state.updateTileReducer.newversion, | ||
}); | ||
|
||
const mapDispatchToProps = { | ||
fetchZoweVersionsSuccess, | ||
fetchZoweVersionsError, | ||
fetchVersions, | ||
updateVersionSuccess, | ||
updateVersionError, | ||
} | ||
fetchZoweVersionsSuccess, | ||
fetchZoweVersionsError, | ||
fetchVersions, | ||
updateVersionSuccess, | ||
updateVersionError, | ||
}; | ||
|
||
export default connect( | ||
mapStateToProps, | ||
mapDispatchToProps, | ||
mapStateToProps, | ||
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
// eslint-disable-next-line import/prefer-default-export | ||
export const ZOWE_VERSIONS_SUCCESS = 'ZOWE_VERSIONS_SUCCESS'; | ||
export const ZOWE_VERSIONS_ERROR = 'ZOWE_VERSIONS_ERROR'; | ||
export const ZOWE_VERSION_SUCCESS = 'ZOWE_VERSION_SUCCESS'; | ||
export const ZOWE_VERSION_ERROR = 'ZOWE_VERSION_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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { ZOWE_VERSION_SUCCESS, ZOWE_VERSION_ERROR } from '../constants/zowe-versions-contants'; | ||
|
||
const zoweDefaultState = { | ||
zoweVersion: '1.5.0', | ||
}; | ||
|
||
export const zoweVersionReducer = (state = zoweDefaultState, action) => { | ||
console.log(action.type); | ||
switch (action.type) { | ||
case ZOWE_VERSION_SUCCESS: | ||
return { | ||
...state, | ||
zoweVersion: action.version, | ||
}; | ||
case ZOWE_VERSION_ERROR: | ||
return { | ||
...state, | ||
error: action.error, | ||
}; | ||
default: | ||
return state; | ||
} | ||
}; | ||
|
||
export default zoweVersionReducer; |