Skip to content

Commit 4b8a5c8

Browse files
committed
[access-control] show Connected as
Signed-off-by: Alex Tugarev <[email protected]>
1 parent b8bf46a commit 4b8a5c8

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

components/dashboard/public/styles.css

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -826,7 +826,6 @@ footer .logo-icon {
826826

827827

828828
.access-control__card-container {
829-
width: 31%;
830829
min-width: 300px;
831830
margin-bottom: 30px !important;
832831
}

components/dashboard/src/components/access-control/access-control.tsx

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import CardContent from '@material-ui/core/CardActions';
2020
import DialogContentText from '@material-ui/core/DialogContentText';
2121
import DialogContent from '@material-ui/core/DialogContent';
2222
import Dialog from '@material-ui/core/Dialog';
23-
import Delete from '@material-ui/icons/Delete';
23+
import HighlightOffOutlined from '@material-ui/icons/HighlightOffOutlined';
2424
import DialogTitle from '@material-ui/core/DialogTitle';
2525
import DialogActions from '@material-ui/core/DialogActions';
2626
import { themeMode } from '../../withRoot';
@@ -328,7 +328,7 @@ export class AccessControl extends React.Component<AccessControlProps, AccessCon
328328
const icon = this.getIcon(provider);
329329
const dirty = !this.equals(oldScopes, newScopes);
330330
const identity = this.state.user && this.state.user.identities.find(i => i.authProviderId === provider.authProviderId);
331-
return (<Card key={this.renderKey++}
331+
return (<Card key={`provider-token-${this.renderKey++}`}
332332
style={{
333333
verticalAlign: "top",
334334
textAlign: 'center',
@@ -375,6 +375,15 @@ export class AccessControl extends React.Component<AccessControlProps, AccessCon
375375
</CardContent>
376376
</Grid>
377377

378+
{identity && (<Grid item direction="column">
379+
<span style={{ fontSize: "80%" }}>
380+
Connected as <strong>{identity.authName}</strong>
381+
<IconButton style={{ padding: '4px', marginLeft: '2px' }} onClick={() => this.setState({ disconnectDialog: { authHost: provider.host } })} title="Disconnect">
382+
<HighlightOffOutlined fontSize="small" style={{ verticalAlign: 'middle', color: 'var(--font-color2)' }} />
383+
</IconButton>
384+
</span>
385+
</Grid>)}
386+
378387
<Grid item direction="column">
379388
<CardActions style={{ display: 'block', textAlign: 'center', paddingTop: 15, paddingRight: 10, paddingBottom: 12 }} disableActionSpacing={true}>
380389
{!provider.isReadonly && (
@@ -384,11 +393,6 @@ export class AccessControl extends React.Component<AccessControlProps, AccessCon
384393
// for authorization we set the required (if any) plus the new scopes
385394
[...(provider.requirements && provider.requirements.default || []), ...Array.from(newScopes)]), 'Connect'))
386395
}
387-
{identity && (
388-
<IconButton className="delete-button" onClick={() => this.setState({ disconnectDialog: { authHost: provider.host } })} title="Disconnect">
389-
<Delete fontSize="small" />
390-
</IconButton>
391-
)}
392396
</CardActions>
393397
</Grid>
394398
</Card>);
@@ -492,7 +496,7 @@ export class AccessControl extends React.Component<AccessControlProps, AccessCon
492496
</DialogContentText>);
493497

494498
const returnTo = encodeURIComponent(thisUrl.with({ search: `updated=${authHost}` }).toString());
495-
const deauthorizeUrl = window.location.href = thisUrl.withApi({
499+
const deauthorizeUrl = thisUrl.withApi({
496500
pathname: '/deauthorize',
497501
search: `returnTo=${returnTo}&host=${authHost}`
498502
}).toString();

0 commit comments

Comments
 (0)