Skip to content

Commit

Permalink
Replace time and size with URL in history dropdown (#677) (#721)
Browse files Browse the repository at this point in the history
  • Loading branch information
iansu authored and gschier committed Jan 24, 2018
1 parent 88bf884 commit 3ee969a
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 4 deletions.
Expand Up @@ -2,9 +2,8 @@ import React, {PureComponent} from 'react';
import PropTypes from 'prop-types';
import autobind from 'autobind-decorator';
import {Dropdown, DropdownButton, DropdownDivider, DropdownItem} from '../base/dropdown';
import SizeTag from '../tags/size-tag';
import StatusTag from '../tags/status-tag';
import TimeTag from '../tags/time-tag';
import URLTag from '../tags/url-tag';
import PromptButton from '../base/prompt-button';
import {trackEvent} from '../../../common/analytics';
import KeydownBinder from '../keydown-binder';
Expand Down Expand Up @@ -60,8 +59,7 @@ class ResponseHistoryDropdown extends PureComponent {
statusCode={response.statusCode}
statusMessage={response.statusMessage || null}
/>
<TimeTag milliseconds={response.elapsedTime} small/>
<SizeTag bytesRead={response.bytesRead} bytesContent={response.bytesContent} small/>
<URLTag small url={response.url} />
{!response.requestVersionId && <i className="icon fa fa-info-circle" title={message}/>}
</DropdownItem>
);
Expand Down
38 changes: 38 additions & 0 deletions packages/insomnia-app/app/ui/components/tags/url-tag.js
@@ -0,0 +1,38 @@
// @flow
import * as React from 'react';
import classnames from 'classnames';
import Tooltip from '../tooltip';

type Props = {
url: string,

// Optional
small?: boolean,
className?: string
};

class URLTag extends React.PureComponent<Props> {
render () {
const {
url,
small,
className
} = this.props;

let shortUrl = url;

if (url.length > 40) {
shortUrl = url.slice(0, 37) + '...';
}

return (
<div className={classnames('tag', {'tag--small': small}, className)}>
<Tooltip message={url} position="bottom">
<strong>URL</strong> {shortUrl}
</Tooltip>
</div>
);
}
}

export default URLTag;

0 comments on commit 3ee969a

Please sign in to comment.