[JENKINS-35837] add some dummy data that approximates what the new REST API will return; adjust card stack accordingly and so that it doesn't depend on Pipelines data
This commit is contained in:
parent
116324d80a
commit
f45ca8aeff
|
@ -37,27 +37,21 @@ export default class DashboardCards extends Component {
|
|||
}
|
||||
|
||||
render() {
|
||||
if (!this.props.pipelines || !this.props.favorites) {
|
||||
if (!this.props.favorites) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const favoriteCards = this.props.favorites.map(fav => {
|
||||
const pipeline = this.props.pipelines.find((pipeline1) => {
|
||||
const fullName = `/organizations/${pipeline1.organization}/pipelines/${pipeline1.fullName}`;
|
||||
return fav.pipeline === fullName;
|
||||
});
|
||||
|
||||
if (!pipeline) {
|
||||
return null;
|
||||
}
|
||||
const branch = fav.data;
|
||||
|
||||
return (
|
||||
<div key={fav.pipeline}>
|
||||
<div key={branch.fullName}>
|
||||
<PipelineCard
|
||||
organization={pipeline.organization}
|
||||
pipeline={pipeline.fullName}
|
||||
branch={'a'}
|
||||
commitId={'b'}
|
||||
organization={branch.organization}
|
||||
pipeline={branch.fullName}
|
||||
status={branch.latestRun.result}
|
||||
branch={branch.name}
|
||||
commitId={branch.commitId}
|
||||
favorite
|
||||
/>
|
||||
</div>
|
||||
|
@ -74,7 +68,6 @@ export default class DashboardCards extends Component {
|
|||
|
||||
DashboardCards.propTypes = {
|
||||
user: PropTypes.object,
|
||||
pipelines: PropTypes.array,
|
||||
favorites: PropTypes.array,
|
||||
fetchUser: PropTypes.func,
|
||||
fetchFavorites: PropTypes.func,
|
||||
|
|
|
@ -20,13 +20,33 @@ export const ACTION_TYPES = keymirror({
|
|||
SET_FAVORITES: null,
|
||||
});
|
||||
|
||||
const augmentFavoritesData = (favorites) => (
|
||||
favorites.map((fav, index) => {
|
||||
const name = fav.pipeline.split('/').slice(-1).join('');
|
||||
const commitId = 'a50b3a7c7f8adc9a41b2121aea890ad7292085f6';
|
||||
|
||||
fav.data = {
|
||||
name: name,
|
||||
fullName: name,
|
||||
organization: 'Jenkins',
|
||||
latestRun: {
|
||||
estimatedDurationInMillis: 60000,
|
||||
result: index % 2 === 0 ? 'SUCCESS' : 'FAILURE',
|
||||
},
|
||||
commitId: index % 2 === 0 ? commitId : commitId.substr(7, 7),
|
||||
};
|
||||
return fav;
|
||||
})
|
||||
);
|
||||
|
||||
const actionHandlers = {
|
||||
[ACTION_TYPES.SET_USER](state, { payload }) {
|
||||
const user = new User(payload);
|
||||
return state.set('user', user);
|
||||
},
|
||||
[ACTION_TYPES.SET_FAVORITES](state, { payload }) {
|
||||
return state.set('favorites', payload);
|
||||
const favorites = augmentFavoritesData(payload);
|
||||
return state.set('favorites', favorites);
|
||||
},
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue