Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin' into by/cta-over-20k-annual-cus…
Browse files Browse the repository at this point in the history
…tomers
  • Loading branch information
Bianca Yang committed Jan 3, 2024
2 parents e25c0e0 + cb97d1b commit d799c26
Show file tree
Hide file tree
Showing 2,286 changed files with 3,087 additions and 5,061 deletions.
22 changes: 2 additions & 20 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,8 @@ module.exports = {
},
{
name: 'antd',
importNames: ['Tooltip'],
message: 'Please use Tooltip from @posthog/lemon-ui instead.',
},
{
name: 'antd',
importNames: ['Alert'],
message: 'Please use LemonBanner from @posthog/lemon-ui instead.',
importNames: ['Card', 'Col', 'Row', 'Alert', 'Tooltip'],
message: 'please use the Lemon equivalent instead',
},
],
},
Expand All @@ -141,23 +136,10 @@ module.exports = {
'warn',
{
forbid: [
{
element: 'Row',
message:
'use flex utility classes instead, e.g. <Row align="middle"> could be <div className="flex items-center">',
},
{
element: 'Col',
message: 'use flex utility classes instead - most of the time can simply be a plain <div>',
},
{
element: 'Divider',
message: 'use <LemonDivider> instead',
},
{
element: 'Card',
message: 'use utility classes instead',
},
{
element: 'Button',
message: 'use <LemonButton> instead',
Expand Down
7 changes: 3 additions & 4 deletions .github/actions/run-backend-tests/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,11 @@ runs:
run: echo "127.0.0.1 kafka" | sudo tee -a /etc/hosts

- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python-version }}
cache: pip
cache-dependency-path: '**/requirements*.txt'
token: ${{ inputs.token }}

- name: Determine if hogql-parser has changed compared to master
Expand Down Expand Up @@ -85,9 +87,6 @@ runs:
with:
custom_cache_key_element: v2

- uses: syphar/restore-pip-download-cache@v1
if: steps.cache-backend-tests.outputs.cache-hit != 'true'

- name: Install Python dependencies
if: steps.cache-backend-tests.outputs.cache-hit != 'true'
shell: bash
Expand Down
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: weekly
7 changes: 3 additions & 4 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,16 @@ jobs:
docker compose -f docker-compose.dev.yml up -d
- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: 3.10.10
cache: 'pip'
cache-dependency-path: '**/requirements*.txt'
token: ${{ secrets.POSTHOG_BOT_GITHUB_TOKEN }}

- uses: syphar/restore-virtualenv@v1
id: cache-benchmark-tests

- uses: syphar/restore-pip-download-cache@v1
if: steps.cache-benchmark-tests.outputs.cache-hit != 'true'

- name: Install SAML (python3-saml) dependencies
shell: bash
run: |
Expand Down
21 changes: 9 additions & 12 deletions .github/workflows/ci-backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,19 +103,18 @@ jobs:
fetch-depth: 1

- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: 3.10.10
cache: 'pip'
cache-dependency-path: '**/requirements*.txt'
token: ${{ secrets.POSTHOG_BOT_GITHUB_TOKEN }}

- uses: syphar/restore-virtualenv@v1
id: cache-backend-tests
with:
custom_cache_key_element: v2-

- uses: syphar/restore-pip-download-cache@v1
if: steps.cache-backend-tests.outputs.cache-hit != 'true'

- name: Install SAML (python3-saml) dependencies
run: |
sudo apt-get update
Expand Down Expand Up @@ -181,19 +180,18 @@ jobs:
docker compose -f docker-compose.dev.yml up -d
- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: 3.10.10
cache: 'pip'
cache-dependency-path: '**/requirements*.txt'
token: ${{ secrets.POSTHOG_BOT_GITHUB_TOKEN }}

- uses: syphar/restore-virtualenv@v1
id: cache-backend-tests
with:
custom_cache_key_element: v1-

- uses: syphar/restore-pip-download-cache@v1
if: steps.cache-backend-tests.outputs.cache-hit != 'true'

- name: Install SAML (python3-saml) dependencies
run: |
sudo apt-get update
Expand Down Expand Up @@ -325,19 +323,18 @@ jobs:
docker compose -f docker-compose.dev.yml up -d
- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: 3.10.10
cache: 'pip'
cache-dependency-path: '**/requirements*.txt'
token: ${{ secrets.POSTHOG_BOT_GITHUB_TOKEN }}

- uses: syphar/restore-virtualenv@v1
id: cache-backend-tests
with:
custom_cache_key_element: v2-

- uses: syphar/restore-pip-download-cache@v1
if: steps.cache-backend-tests.outputs.cache-hit != 'true'

- name: Install SAML (python3-saml) dependencies
run: |
sudo apt-get update
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/ci-hobby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ jobs:
with:
python-version: '3.8'
cache: 'pip' # caching pip dependencies
cache-dependency-path: '**/requirements*.txt'
token: ${{ secrets.POSTHOG_BOT_GITHUB_TOKEN }}
- name: Get python deps
run: pip install python-digitalocean==1.17.0 requests==2.28.1
Expand Down
14 changes: 6 additions & 8 deletions .github/workflows/ci-plugin-server.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,11 @@ jobs:

- name: Set up Python
if: needs.changes.outputs.plugin-server == 'true'
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: 3.10.10
cache: 'pip'
cache-dependency-path: '**/requirements*.txt'
token: ${{ secrets.POSTHOG_BOT_GITHUB_TOKEN }}

- uses: syphar/restore-virtualenv@v1
Expand All @@ -126,9 +128,6 @@ jobs:
with:
custom_cache_key_element: v1-

- uses: syphar/restore-pip-download-cache@v1
if: needs.changes.outputs.plugin-server == 'true' && steps.cache-backend-tests.outputs.cache-hit != 'true'

- name: Install SAML (python3-saml) dependencies
if: needs.changes.outputs.plugin-server == 'true'
run: |
Expand Down Expand Up @@ -213,19 +212,18 @@ jobs:
run: echo "127.0.0.1 kafka" | sudo tee -a /etc/hosts

- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: 3.10.10
cache: 'pip'
cache-dependency-path: '**/requirements*.txt'
token: ${{ secrets.POSTHOG_BOT_GITHUB_TOKEN }}

- uses: syphar/restore-virtualenv@v1
id: cache-backend-tests
with:
custom_cache_key_element: v1-

- uses: syphar/restore-pip-download-cache@v1
if: steps.cache-backend-tests.outputs.cache-hit != 'true'

- name: Install SAML (python3-saml) dependencies
run: |
sudo apt-get update
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/container-images-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,15 @@ jobs:
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1

- name: Login to Amazon ECR
id: aws-ecr
uses: aws-actions/amazon-ecr-login@v1
uses: aws-actions/amazon-ecr-login@v2

- name: Build and push container image
id: build
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pr-cleanup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ jobs:
- name: Checkout
uses: actions/checkout@v3

- uses: aws-actions/configure-aws-credentials@v1
- uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: us-east-1
role-to-assume: arn:aws:iam::169684386827:role/github-terraform-infra-role
role-duration-seconds: 3600

- name: Login to Amazon ECR
id: aws-ecr
uses: aws-actions/amazon-ecr-login@v1
uses: aws-actions/amazon-ecr-login@v2

- name: connect to tailscale
uses: tailscale/github-action@8b804aa882ac3429b804a2a22f9803a2101a0db9
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pr-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- uses: aws-actions/configure-aws-credentials@v1
- uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: us-east-1
role-to-assume: arn:aws:iam::169684386827:role/github-terraform-infra-role
Expand All @@ -53,7 +53,7 @@ jobs:

- name: Login to Amazon ECR
id: aws-ecr
uses: aws-actions/amazon-ecr-login@v1
uses: aws-actions/amazon-ecr-login@v2

- name: Build and push PR test image
id: build-unit
Expand Down
34 changes: 5 additions & 29 deletions .storybook/decorators/withTheme.tsx
Original file line number Diff line number Diff line change
@@ -1,40 +1,16 @@
import type { Decorator } from '@storybook/react'

import { FEATURE_FLAGS } from 'lib/constants'

/** Global story decorator that is used by the theming control to
* switch between themes.
*/
export const withTheme: Decorator = (Story, context) => {
const theme = context.globals.theme

// set the body class
const actualClassState = document.body.classList.contains('posthog-3000')
const desiredClassState = theme !== 'legacy'

if (actualClassState !== desiredClassState) {
if (desiredClassState) {
document.body.classList.add('posthog-3000')
} else {
document.body.classList.remove('posthog-3000')
}
}

// set the feature flag
const actualFeatureFlagState = window.POSTHOG_APP_CONTEXT!.persisted_feature_flags?.includes(
FEATURE_FLAGS.POSTHOG_3000
)
const desiredFeatureFlagState = theme !== 'legacy'

if (actualFeatureFlagState !== desiredFeatureFlagState) {
const currentFlags = window.POSTHOG_APP_CONTEXT!.persisted_feature_flags || []
if (desiredFeatureFlagState) {
window.POSTHOG_APP_CONTEXT!.persisted_feature_flags = [...currentFlags, FEATURE_FLAGS.POSTHOG_3000]
} else {
window.POSTHOG_APP_CONTEXT!.persisted_feature_flags = currentFlags.filter(
(f) => f !== FEATURE_FLAGS.POSTHOG_3000
)
}
// set the body class. unfortunately this doesn't work on the initial render,
// meaning we need to toggle the theme one time for it to work. won't fix
// this, since we're removing the body class soon enough.
if (!document.body.classList.contains('posthog-3000')) {
document.body.classList.add('posthog-3000')
}

// set the theme
Expand Down
3 changes: 1 addition & 2 deletions .storybook/preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,10 @@ const preview: Preview = {
globalTypes: {
theme: {
description: '',
defaultValue: 'legacy',
defaultValue: 'light',
toolbar: {
title: 'Theme',
items: [
{ value: 'legacy', icon: 'faceneutral', title: 'Legacy' },
{ value: 'light', icon: 'sun', title: 'Light' },
{ value: 'dark', icon: 'moon', title: 'Dark' },
],
Expand Down
7 changes: 2 additions & 5 deletions .storybook/storybook.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,13 @@
.ant-modal-wrap {
z-index: 1050 !important;
}

.ant-select-dropdown,
.ant-picker-dropdown {
z-index: 1060 !important;
}

.ant-tooltip {
z-index: 1060 !important;
}
}

// allow taking screenshots of a scene's main content without overlapping top bar
.TopBar {
position: relative !important;
}
Loading

0 comments on commit d799c26

Please sign in to comment.