Unverified Commit c83aa618 authored by Tamika Tannis's avatar Tamika Tannis Committed by GitHub

Update doc & fix Footer (#418)

* Add visble doc about python entry points

* Fix Footer logic for undefined value; Add back tests that would have caught issue

* Update version for new patch release to fix quickstart

* Update docs/configuration.md
parent 603144d4
...@@ -35,7 +35,7 @@ export class Footer extends React.Component<FooterProps> { ...@@ -35,7 +35,7 @@ export class Footer extends React.Component<FooterProps> {
render() { render() {
let content; let content;
if (this.props.lastIndexed !== null) { if (!!this.props.lastIndexed) {
content = <div>{`Amundsen was last indexed on ${this.generateDateTimeString()}`}</div>; content = <div>{`Amundsen was last indexed on ${this.generateDateTimeString()}`}</div>;
} }
return ( return (
......
import * as React from 'react'; import * as React from 'react';
import * as moment from 'moment-timezone'; import { shallow } from 'enzyme';
import { mount } from 'enzyme';
import { Footer, FooterProps, mapDispatchToProps, mapStateToProps } from '../'; import { Footer, FooterProps, mapDispatchToProps, mapStateToProps } from '../';
import globalState from 'fixtures/globalState'; import globalState from 'fixtures/globalState';
/* TODO: Issues with mocking moment-timezone, all tests are failing import * as DateUtils from 'utils/dateUtils';
const MOCK_DATE_STRING = 'Jan 1 2000 at 0:00:00 am';
jest.spyOn(DateUtils, 'formatDateTimeLong').mockReturnValue(MOCK_DATE_STRING);
describe('Footer', () => { describe('Footer', () => {
let props: FooterProps; let props: FooterProps;
let subject; let subject;
...@@ -16,7 +19,7 @@ describe('Footer', () => { ...@@ -16,7 +19,7 @@ describe('Footer', () => {
lastIndexed: 1555632106, lastIndexed: 1555632106,
getLastIndexed: jest.fn(), getLastIndexed: jest.fn(),
}; };
subject = mount(<Footer {...props} />); subject = shallow(<Footer {...props} />);
}); });
describe('componentDidMount', () => { describe('componentDidMount', () => {
...@@ -33,17 +36,22 @@ describe('Footer', () => { ...@@ -33,17 +36,22 @@ describe('Footer', () => {
}); });
it('renders correct content if this.state.lastIndexed', () => { it('renders correct content if this.state.lastIndexed', () => {
const expectedText = 'Amundsen was last indexed on April 18th 2019 at 5:01:46 pm'; const expectedText = `Amundsen was last indexed on ${MOCK_DATE_STRING}`;
expect(subject.find('#footer').props().children).toBeTruthy(); expect(subject.find('#footer').props().children).toBeTruthy();
// expect(subject.find('#footer').props().children().at(0).text()).toEqual(expectedText); expect(subject.find('#footer').text()).toEqual(expectedText);
});
it('renders no content if this.state.lastIndexed is null', () => {
subject.setProps({ lastIndexed: null });
expect(subject.find('#footer').props().children).toBeFalsy();
}); });
it('renders no content if !this.state.lastIndexed', () => { it('renders no content if this.state.lastIndexed is undefined', () => {
subject.setState({ lastIndexed: null }); subject.setProps({ lastIndexed: undefined });
expect(subject.find('#footer').props().children).toBeFalsy(); expect(subject.find('#footer').props().children).toBeFalsy();
}); });
}); });
});*/ });
describe('mapDispatchToProps', () => { describe('mapDispatchToProps', () => {
let dispatch; let dispatch;
......
...@@ -8,7 +8,6 @@ import { TableResource } from 'interfaces'; ...@@ -8,7 +8,6 @@ import { TableResource } from 'interfaces';
import BookmarkIcon from 'components/common/Bookmark/BookmarkIcon'; import BookmarkIcon from 'components/common/Bookmark/BookmarkIcon';
import { getDatabaseDisplayName, getDatabaseIconClass } from 'config/config-utils'; import { getDatabaseDisplayName, getDatabaseIconClass } from 'config/config-utils';
import { formatDate } from 'utils/dateUtils';
import BadgeList from 'components/common/BadgeList'; import BadgeList from 'components/common/BadgeList';
export interface TableListItemProps { export interface TableListItemProps {
...@@ -54,7 +53,7 @@ class TableListItem extends React.Component<TableListItemProps, {}> { ...@@ -54,7 +53,7 @@ class TableListItem extends React.Component<TableListItemProps, {}> {
</div> </div>
<div className="resource-badges"> <div className="resource-badges">
{ {
!!table.badges && table.badges.length > 0 && !!table.badges && table.badges.length > 0 &&
<div> <div>
<div className="body-secondary-3"> <div className="body-secondary-3">
<BadgeList badges={ table.badges } /> <BadgeList badges={ table.badges } />
......
...@@ -19,6 +19,37 @@ Fonts and css variables can be customized by modifying [fonts-custom.scss](https ...@@ -19,6 +19,37 @@ Fonts and css variables can be customized by modifying [fonts-custom.scss](https
[variables-custom.scss](https://github.com/lyft/amundsenfrontendlibrary/blob/master/amundsen_application/static/css/_variables-custom.scss). [variables-custom.scss](https://github.com/lyft/amundsenfrontendlibrary/blob/master/amundsen_application/static/css/_variables-custom.scss).
## Python Entry Points
The application also leverages [python entry points](https://packaging.python.org/specifications/entry-points/) for custom features.
In your local `setup.py`, point the entry points detailed below to custom classes or methods that have to be implemented for a given feature.
Run `python3 setup.py install` in your virtual environment and restart the application for the entry point changes to take effect.
```
entry_points="""
[action_log.post_exec.plugin]
analytic_clients_action_log = path.to.file:custom_action_log_method
[preview_client]
table_preview_client_class = amundsen_application.base.examples.example_superset_preview_client:SupersetPreviewClient
[announcement_client]
announcement_client_class = path.to.file:CustomAnnouncementClient
"""
```
### Action Logging
Create a custom method to handle action logging. Under the `[action_log.post_exec.plugin]` group, point the `analytic_clients_action_log` entry point in your local `setup.py` to that method.
### Preview Client
Create a custom implementation of [base_preview_client](https://github.com/lyft/amundsenfrontendlibrary/blob/master/amundsen_application/base/base_preview_client.py). Under the `[preview_client]` group, point the `table_preview_client_class` entry point in your local `setup.py` to that class.
For those who use [Apache Superset](https://github.com/apache/incubator-superset) for data exploration, see [this doc](https://github.com/lyft/amundsenfrontendlibrary/blob/master/docs/examples/superset_preview_client.md) for how to implement a preview client for Superset.
### Announcement Client
Create a custom implementation of [base_announcement_client](https://github.com/lyft/amundsenfrontendlibrary/blob/master/amundsen_application/base/base_announcement_client.py). Under the `[announcement_client]` group, point the `announcement_client_class` entry point in your local `setup.py` to that class.
Currently Amundsen does not own the input and storage of announcements. Consider having the client fetch announcement information from an external web feed.
## Authentication ## Authentication
Authentication can be hooked within Amundsen using either wrapper class or using proxy to secure the microservices Authentication can be hooked within Amundsen using either wrapper class or using proxy to secure the microservices
on the nginx/server level. Following are the ways to setup the end-to-end authentication. on the nginx/server level. Following are the ways to setup the end-to-end authentication.
......
...@@ -43,7 +43,7 @@ See the following [`example_superset_preview_client`](https://github.com/lyft/am ...@@ -43,7 +43,7 @@ See the following [`example_superset_preview_client`](https://github.com/lyft/am
## Usage ## Usage
After implementing your custom Superset preview client class, point the `[preview_client]` entry point in your local `setup.py` to this class. Under the `[preview_client]` group, point the `table_preview_client_class` entry point in your local `setup.py` to your custom class.
``` ```
entry_points=""" entry_points="""
......
...@@ -34,7 +34,7 @@ requirements_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'r ...@@ -34,7 +34,7 @@ requirements_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'r
with open(requirements_path) as requirements_file: with open(requirements_path) as requirements_file:
requirements = requirements_file.readlines() requirements = requirements_file.readlines()
__version__ = '2.1.0' __version__ = '2.1.1'
setup( setup(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment