-
Notifications
You must be signed in to change notification settings - Fork 9
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 #32 from mfrances17/details-ui
Details/Activity tabs, various other functionality
- Loading branch information
Showing
20 changed files
with
268 additions
and
108 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
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
62 changes: 62 additions & 0 deletions
62
packages/studio/src/app/components/api/apiActivityView/apiActivityView.tsx
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,62 @@ | ||
import React from 'react'; | ||
import { DataList, DataListItem, DataListItemRow, DataListItemCells, DataListCell } from '@patternfly/react-core'; | ||
import { ApiActivityItem } from '../apiActivityItem/apiActivityItem'; | ||
import { GlobalContext } from '../../../../context'; | ||
|
||
export interface ApiActivityViewProps { | ||
currentApi: any | ||
} | ||
|
||
function findId(apis: any[], id: string) { | ||
console.log(`array is ${JSON.stringify(apis)}, id is ${id}`); | ||
const apiTemp = apis.find(api => api.apiId === id); | ||
if (apiTemp !== undefined) { | ||
return apiTemp; | ||
} | ||
else { | ||
return Error; | ||
} | ||
} | ||
|
||
export const ApiActivityView = (props) => { | ||
const { recentActivity } = { ... React.useContext(GlobalContext).store }; | ||
const selectedApi = props.currentApi.id; | ||
let specificApiActivity = []; | ||
|
||
specificApiActivity = findId(recentActivity, selectedApi); | ||
|
||
const noActivityMsg = "No activity found for this API."; | ||
|
||
|
||
return ( | ||
<React.Fragment> | ||
<div className="api-details-content"> | ||
<h3>Activity</h3> | ||
{ specificApiActivity !== Error ? recentActivity.map((activity, index) => | ||
<DataList aria-label="app-data-list-api-activity" key="api-activity-list"> | ||
<React.Fragment> | ||
<DataListItem aria-labelledby={`data-list-item-${index}`} key={index}> | ||
<DataListItemRow> | ||
<DataListItemCells | ||
dataListCells={[ | ||
<DataListCell key="1"> | ||
<ApiActivityItem | ||
activityApiName={activity.apiName} | ||
activityType={activity.type} | ||
activityOn={activity.on} | ||
activityData={activity.data} | ||
/> | ||
</DataListCell> | ||
]}/> | ||
</DataListItemRow> | ||
</DataListItem> | ||
</React.Fragment> | ||
</DataList> | ||
) : | ||
<p>{noActivityMsg}</p>} | ||
</div> | ||
</React.Fragment> | ||
) | ||
} | ||
|
||
export default ApiActivityView; |
1 change: 1 addition & 0 deletions
1
packages/studio/src/app/components/api/apiActivityView/index.ts
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 @@ | ||
export * from './apiActivityView'; |
9 changes: 5 additions & 4 deletions
9
packages/studio/src/app/components/api/apiCard/apiCardView.tsx
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
30 changes: 30 additions & 0 deletions
30
packages/studio/src/app/components/api/apiDetailsView/apiDetailsView.css
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,30 @@ | ||
div span { | ||
padding-bottom: var(--pf-global--spacer--sm); | ||
margin-left: 16px; | ||
} | ||
div h3 { | ||
font-weight: bold; | ||
margin-top: var(--pf-global--spacer--md); | ||
margin-bottom: var(--pf-global--spacer--sm); | ||
} | ||
|
||
.api-details-content { | ||
padding-left: var(--pf-global--spacer--md); /* remove this when new drawer styles in pf are added */ | ||
} | ||
|
||
.app-details-content.heading { | ||
padding-bottom: var(--pf-global--spacer--sm); | ||
margin-left: 16px; | ||
} | ||
.api-details-content-body { | ||
padding: 0 !important; | ||
} | ||
|
||
.api-details-content-body .pf-c-drawer__panel-body { | ||
padding: 0; | ||
} | ||
|
||
.app-details-content-icon-text { | ||
padding-bottom: var(--pf-global--spacer--sm); | ||
margin-left: 16px; | ||
} |
28 changes: 28 additions & 0 deletions
28
packages/studio/src/app/components/api/apiDetailsView/apiDetailsView.tsx
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,28 @@ | ||
import React from 'react'; | ||
import { UserIcon, UsersIcon, OutlinedClockIcon } from '@patternfly/react-icons'; | ||
import './apiDetailsView.css'; | ||
import moment from "moment"; | ||
|
||
export interface ApiDetailsViewProps { | ||
currentApi: any | ||
} | ||
|
||
export const ApiDetailsView: React.FunctionComponent<ApiDetailsViewProps> = (props) => { | ||
const createdOn = props.currentApi.createdOn; | ||
const createdBy = props.currentApi.createdBy; | ||
|
||
return ( | ||
<React.Fragment> | ||
<div className="api-details-content"> | ||
<h3>Details</h3> | ||
<p><OutlinedClockIcon /><span>Created on {moment(createdOn).format('MMM DD, YYYY')}</span></p> | ||
<p><UserIcon /><span>Created by {createdBy}</span></p> | ||
<p><UsersIcon /><span>? Other collaborators</span></p> | ||
<br /> | ||
<h3>Collaborators</h3> | ||
</div> | ||
</React.Fragment> | ||
); | ||
} | ||
|
||
export default ApiDetailsView; |
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 @@ | ||
export * from './apiDetailsView'; |
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 |
---|---|---|
|
@@ -8,4 +8,8 @@ | |
|
||
.api-drawer-panel-body .pf-c-drawer__panel-body { | ||
padding: 0; | ||
} | ||
|
||
.api-drawer-panel-button { | ||
margin-right: 4px; | ||
} |
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
Oops, something went wrong.