Skip to content

Commit

Permalink
resolved merge conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
allisonsuarez committed Aug 14, 2020
2 parents 34bd2f2 + c9bba88 commit c7cda63
Show file tree
Hide file tree
Showing 95 changed files with 19,133 additions and 12,149 deletions.
8 changes: 8 additions & 0 deletions .dependabot/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: 1
update_configs:
- package_manager: "python"
directory: "/"
update_schedule: "weekly"
- package_manager: "javascript"
directory: "/amundsen_application/static/"
update_schedule: "weekly"
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ matrix:
after_success:
- codecov
before_deploy:
- python -c "import fcntl; fcntl.fcntl(1, fcntl.F_SETFL, 0)"
- python -c "import fcntl; fcntl.fcntl(1, fcntl.F_SETFL, 0)"
deploy:
- provider: pypi
user: amundsen-dev
Expand All @@ -41,14 +41,14 @@ deploy:
skip_existing: true
on:
tags: true
repo: lyft/amundsenfrontendlibrary
repo: amundsen-io/amundsenfrontendlibrary
condition: "$IS_DEPLOYABLE = true"
- provider: script
script: docker login -u amundsendev -p $DOCKER_LOGIN_PASSWORD && make build-push-image
on:
branch: master
tags: true
repo: lyft/amundsenfrontendlibrary
repo: amundsen-io/amundsenfrontendlibrary
condition: "$IS_DEPLOYABLE = true"
env:
global:
Expand Down
51 changes: 39 additions & 12 deletions amundsen_application/api/utils/metadata_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,7 @@ def marshall_table_full(table_dict: Dict) -> Dict:

# We follow same style as column stat order for arranging the programmatic descriptions
prog_descriptions = results['programmatic_descriptions']
if prog_descriptions:
_update_prog_descriptions(prog_descriptions)
results['programmatic_descriptions'] = _convert_prog_descriptions(prog_descriptions)

return results

Expand Down Expand Up @@ -150,16 +149,44 @@ def marshall_dashboard_full(dashboard_dict: Dict) -> Dict:
return dashboard_dict


def _update_prog_descriptions(prog_descriptions: List) -> None:
# We want to make sure there is a display title that is just source
for desc in prog_descriptions:
source = desc.get('source')
if not source:
logging.warning("no source found in: " + str(desc))
prog_display_config = app.config['PROGRAMMATIC_DISPLAY']
if prog_display_config and prog_descriptions:
# If config is defined for programmatic disply we look to see what configuration is being used
prog_descriptions.sort(key=lambda x: _sort_prog_descriptions(prog_display_config, x))
def _convert_prog_descriptions(prog_descriptions: List = None) -> Dict:
"""
Apply the PROGRAMMATIC_DISPLAY configuration to convert to the structure.
:param prog_descriptions: A list of objects representing programmatic descriptions
:return: A dictionary with organized programmatic_descriptions
"""
left = [] # type: List
right = [] # type: List
other = [] # type: List
updated_descriptions = {}

if prog_descriptions:
# We want to make sure there is a display title that is just source
for desc in prog_descriptions:
source = desc.get('source')
if not source:
logging.warning("no source found in: " + str(desc))

# If config is defined for programmatic disply we organize and sort them based on the configuration
prog_display_config = app.config['PROGRAMMATIC_DISPLAY']
if prog_display_config:
left_config = prog_display_config.get('LEFT', {})
left = [x for x in prog_descriptions if x.get('source') in left_config]
left.sort(key=lambda x: _sort_prog_descriptions(left_config, x))

right_config = prog_display_config.get('RIGHT', {})
right = [x for x in prog_descriptions if x.get('source') in right_config]
right.sort(key=lambda x: _sort_prog_descriptions(right_config, x))

other_config = dict(filter(lambda x: x not in ['LEFT', 'RIGHT'], prog_display_config.items()))
other = list(filter(lambda x: x.get('source') not in left_config and x.get('source')
not in right_config, prog_descriptions))
other.sort(key=lambda x: _sort_prog_descriptions(other_config, x))

updated_descriptions['left'] = left
updated_descriptions['right'] = right
updated_descriptions['other'] = other
return updated_descriptions


def _sort_prog_descriptions(base_config: Dict, prog_description: Dict) -> int:
Expand Down
38 changes: 38 additions & 0 deletions amundsen_application/static/.storybook/amundsenTheme.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import { create } from '@storybook/theming/create';

export default create({
base: 'light',

colorPrimary: '#9c9bff', // indigo30
colorSecondary: '#665aff', // indigo60

// UI
appBg: '#fcfcff', // gray0
appContentBg: '#cacad9', // gray20
appBorderColor: '#63637b', // gray60
appBorderRadius: 4,

// Typography
fontBase: '"Open Sans", sans-serif',
fontCode: '"Menlo-Bold", monospace',

// Text colors
textColor: '#292936', // gray100
textInverseColor: '#fcfcff', // gray0

// Toolbar default and active colors
barTextColor: '#dcdcff', // indigo10
barSelectedColor: '#292936', // gray100
barBg: '#665aff', // indigo60

// Form colors
inputBg: 'white',
inputBorder: 'silver',
inputTextColor: 'black',
inputBorderRadius: 4,

brandTitle: "Amundsen's Storybook",
brandUrl: 'https://amundsen.lyft.net/',
brandImage:
'https://raw.githubusercontent.com/lyft/amundsen/master/docs/img/logos/amundsen_logo_on_light.svg?sanitize=true',
});
11 changes: 11 additions & 0 deletions amundsen_application/static/.storybook/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import merge from 'webpack-merge';

import devWebpackConfig from '../webpack.dev';

module.exports = {
stories: ['../js/**/*.story.tsx'],
addons: ['@storybook/addon-actions', '@storybook/addon-links'],
webpackFinal: async (config) => {
return merge(devWebpackConfig, config);
},
};
17 changes: 17 additions & 0 deletions amundsen_application/static/.storybook/manager.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { addons } from '@storybook/addons';

import amundsenTheme from './amundsenTheme';

addons.setConfig({
isFullscreen: false,
showNav: true,
showPanel: true,
panelPosition: 'bottom',
sidebarAnimations: true,
enableShortcuts: true,
isToolshown: true,
theme: amundsenTheme,
selectedPanel: undefined,
initialActive: 'sidebar',
showRoots: false,
});
22 changes: 22 additions & 0 deletions amundsen_application/static/.storybook/preview.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import anysort from 'anysort';
import { addParameters } from '@storybook/react';

import '../css/styles.scss';

const categoriesOrder = [
'Overview/Introduction',
'Attributes/**',
'Components/**',
];

addParameters({
options: {
showRoots: true,
storySort: (previous, next) => {
const [previousStory, previousMeta] = previous;
const [nextStory, nextMeta] = next;

return anysort(previousMeta.kind, nextMeta.kind, categoriesOrder);
},
},
});
12 changes: 6 additions & 6 deletions amundsen_application/static/css/_labels.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@

@import 'variables';

.label-danger {
background-color: $badge-danger-color;
.label-negative {
background-color: $badge-negative-color;
color: $badge-text-color;
}

.label-default {
background-color: $badge-default-color;
.label-neutral {
background-color: $badge-neutral-color;
color: $badge-text-color;
}

Expand All @@ -18,8 +18,8 @@
color: $badge-text-color;
}

.label-success {
background-color: $badge-success-color;
.label-positive {
background-color: $badge-positive-color;
color: $badge-text-color;
}

Expand Down
14 changes: 11 additions & 3 deletions amundsen_application/static/css/_variables-default.scss
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,20 @@ $line-height-large: 1.5 !default;

// Badges
$badge-text-color: $text-primary;
$badge-danger-color: $sunset20;
$badge-default-color: $gray20;
$badge-negative-color: $sunset20;
$badge-neutral-color: $gray20;
$badge-primary-color: $cyan10;
$badge-success-color: $mint20;
$badge-positive-color: $mint20;
$badge-warning-color: $amber30;

$badge-overlay: $gray100;
$badge-opacity-light: 0.14;
$badge-opacity-dark: 0.16;
$badge-pressed-light: 0.21;
$badge-pressed-dark: 0.22;

$badge-height: 20px;

// Buttons
$btn-border-radius-base: 4px;

Expand Down
2 changes: 2 additions & 0 deletions amundsen_application/static/global.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
export {};

declare const require: {
<T>(path: string): T;
(paths: string[], callback: (...modules: any[]) => void): void;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,12 @@ import { BrowsePage } from '..';

describe('BrowsePage', () => {
const setup = () => {
const wrapper = shallow<BrowsePage>(<BrowsePage />);
return { props, wrapper };
return shallow<BrowsePage>(<BrowsePage />);
};

let props;
let wrapper;

beforeAll(() => {
const setupResult = setup();
props = setupResult.props;
wrapper = setupResult.wrapper;
wrapper = setup();
});

describe('render', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ type CodeBlockProps = {
text: string;
};

const CodeBlock: React.SFC<CodeBlockProps> = ({ text }: CodeBlockProps) => {
const CodeBlock: React.FC<CodeBlockProps> = ({ text }: CodeBlockProps) => {
return (
<CopyBlock
text={text}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { dashboardMetadata } from 'fixtures/metadata/dashboard';
import { NO_TIMESTAMP_TEXT } from 'components/constants';
import * as LogUtils from 'utils/logUtils';
import { ResourceType } from 'interfaces';
import { BadgeStyle } from 'config/config-types';
import ChartList from './ChartList';
import ImagePreview from './ImagePreview';

Expand Down Expand Up @@ -146,15 +147,15 @@ describe('DashboardPage', () => {
({ wrapper } = setup());
});

it('returns success if status === LAST_RUN_SUCCEEDED', () => {
it('returns BadgeStyle.SUCCESS if status === LAST_RUN_SUCCEEDED', () => {
expect(
wrapper.instance().mapStatusToStyle(Constants.LAST_RUN_SUCCEEDED)
).toBe('success');
).toBe(BadgeStyle.SUCCESS);
});

it('returns danger if status !== LAST_RUN_SUCCEEDED', () => {
it('returns BadgeStyle.DANGER if status !== LAST_RUN_SUCCEEDED', () => {
expect(wrapper.instance().mapStatusToStyle('anythingelse')).toBe(
'danger'
BadgeStyle.DANGER
);
});
});
Expand Down Expand Up @@ -226,17 +227,18 @@ describe('DashboardPage', () => {
});

it('renders a Flag for last run state', () => {
const mockStyle = BadgeStyle.DANGER;
const mapStatusToStyleSpy = jest
.spyOn(wrapper.instance(), 'mapStatusToStyle')
.mockImplementationOnce(() => 'testStyle');
.mockImplementationOnce(() => mockStyle);
wrapper.instance().forceUpdate();
const element = wrapper.find('.last-run-state').find(Flag);

expect(element.props().text).toBe(props.dashboard.last_run_state);
expect(mapStatusToStyleSpy).toHaveBeenCalledWith(
props.dashboard.last_run_state
);
expect(element.props().labelStyle).toBe('testStyle');
expect(element.props().labelStyle).toBe(mockStyle);
});

it('renders an ImagePreview with correct props', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import TagInput from 'components/common/Tags/TagInput';
import { ResourceType } from 'interfaces';

import { getSourceDisplayName, getSourceIconClass } from 'config/config-utils';
import { BadgeStyle } from 'config/config-types';

import { getLoggingParams } from 'utils/logUtils';

Expand All @@ -47,9 +48,6 @@ import ImagePreview from './ImagePreview';

import './styles.scss';

const STATUS_SUCCESS = 'success';
const STATUS_DANGER = 'danger';

interface DashboardPageState {
uri: string;
}
Expand Down Expand Up @@ -105,11 +103,11 @@ export class DashboardPage extends React.Component<
}
}

mapStatusToStyle = (status: string): string => {
mapStatusToStyle = (status: string): BadgeStyle => {
if (status === LAST_RUN_SUCCEEDED) {
return STATUS_SUCCESS;
return BadgeStyle.SUCCESS;
}
return STATUS_DANGER;
return BadgeStyle.DANGER;
};

renderTabs() {
Expand Down
4 changes: 2 additions & 2 deletions amundsen_application/static/js/components/Feedback/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ import * as Constants from './constants';
import './styles.scss';

export interface FeedbackProps {
content?: React.SFC<any>;
content?: React.FC<any>;
title?: string;
}

interface FeedbackState {
content: React.SFC<any>;
content: React.FC<any>;
feedbackType: FeedbackType;
isOpen: boolean;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,6 @@ describe('mapStateToProps', () => {
});

it('sets lastIndexed on the props', () => {
expect(result.lastIndexed).toEqual(globalState.tableMetadata.lastIndexed);
expect(result.lastIndexed).toEqual(globalState.lastIndexed.lastIndexed);
});
});
Loading

0 comments on commit c7cda63

Please sign in to comment.