Skip to content

Commit 2cc1fbe

Browse files
committed
Revert "Remove useless/unavailable info from AppsIndex" because it didn't go through review
This reverts commit 5dbba65.
1 parent 5dbba65 commit 2cc1fbe

File tree

2 files changed

+54
-16
lines changed

2 files changed

+54
-16
lines changed

dashboard/Apps/AppsIndex.react.js

Lines changed: 49 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,15 @@ let CloningNote = ({ app, clone_status, clone_progress }) => {
4545
return <div>Cloning is {progress}% complete</div>
4646
};
4747

48+
let CountsSection = (props) => {
49+
return (
50+
<div className={props.className}>
51+
<div className={styles.section}>{props.title}</div>
52+
{props.children}
53+
</div>
54+
);
55+
};
56+
4857
let Metric = (props) => {
4958
return (
5059
<div className={styles.count}>
@@ -54,20 +63,46 @@ let Metric = (props) => {
5463
);
5564
};
5665

57-
let AppCard = ({
58-
app,
59-
icon,
60-
}) => <li onClick={() => history.pushState(null, html`/apps/${app.slug}/browser`)}>
61-
{icon ? <a className={styles.icon}><img src={icon} /></a> : null}
62-
<div className={styles.details}>
63-
<a className={styles.appname}>{app.name}</a>
64-
{app.is_cloning ? <CloningNote
65-
app={app}
66-
clone_status={app.clone_status}
67-
clone_progress={app.clone_progress}/> :
68-
<div>Server version: <span className={styles.ago}>{app.enabledFeatures.serverVersion || 'unknown'}</span></div>}
69-
</div>
70-
</li>
66+
let AppCard = (props) => {
67+
let sharing = null;
68+
if (props.app.collabInfo) {
69+
if (props.app.isOwner()) {
70+
sharing = 'shared with ' + pluralize(props.app.collaboratorCount, 'person', 'people');
71+
} else {
72+
sharing = html`shared by ${props.app.owner}`;
73+
}
74+
}
75+
return (
76+
<li onClick={() => history.pushState(null, html`/apps/${props.app.slug}/browser`)}>
77+
<a className={styles.icon}>
78+
{props.icon ? <img src={props.icon} /> : <Icon width={56} height={56} name='blank-app-outline' fill='#1E384D' />}
79+
</a>
80+
<CountsSection className={styles.plan} title='Current plan'>
81+
<Metric number={dash(props.app.requestLimit)} label='requests/s' />
82+
<Metric number={dash(props.app.requestLimit, Math.floor(props.app.requestLimit / 20))} label='background job' />
83+
<Metric number={dash(props.app.requestLimit, '$' + (props.app.requestLimit - 30) * 10)} label='monthly' />
84+
<a href={html`/apps/${props.app.slug}/settings`} className={styles.edit} onClick={(e) => {
85+
e.stopPropagation();
86+
history.pushState(null, html`/apps/${props.app.slug}/settings`);
87+
}}>Edit</a>
88+
</CountsSection>
89+
<CountsSection className={styles.glance} title='At a glance'>
90+
<Metric number={dash(props.app.requests, prettyNumber(props.app.requests))} label='requests' />
91+
<Metric number={dash(props.app.users, prettyNumber(props.app.users))} label='total users' />
92+
<Metric number={dash(props.app.installations, prettyNumber(props.app.installations))} label='total installations' />
93+
</CountsSection>
94+
<div className={styles.details}>
95+
<a className={styles.appname}>{props.app.name}</a>
96+
{props.app.is_cloning ? <CloningNote
97+
app={props.app}
98+
clone_status={props.app.clone_status}
99+
clone_progress={props.app.clone_progress}/> :
100+
<div>Created <span className={styles.ago}>{howLongAgo(props.app.createdAt)}</span></div>}
101+
</div>
102+
{sharing}
103+
</li>
104+
)
105+
};
71106

72107
export default class AppsIndex extends React.Component {
73108
constructor() {

dashboard/Apps/AppsIndex.scss

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@
105105
margin: 14px 0;
106106
padding: 0 9px;
107107
height: 74px;
108-
108+
109109
&:hover{
110110
background: #172C3B;
111111
}
@@ -124,10 +124,13 @@
124124
}
125125

126126
.appname {
127-
@include ellipsis();
128127
display: inline-block;
129128
font-size: 22px;
130129
color: white;
130+
max-width: 180px;
131+
overflow: hidden;
132+
text-overflow: ellipsis;
133+
white-space: nowrap;
131134
}
132135

133136
.details {

0 commit comments

Comments
 (0)