Skip to content
This repository has been archived by the owner on Jan 8, 2025. It is now read-only.

Commit

Permalink
Merge branch 'main' into ValtteriSavonen/add-new-event-banner-system
Browse files Browse the repository at this point in the history
  • Loading branch information
TuukkaIkius committed Dec 12, 2023
2 parents 65d0a4b + c2e6e18 commit 42db9fd
Show file tree
Hide file tree
Showing 60 changed files with 9,357 additions and 7,087 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/dependency-review.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ jobs:
uses: gravitational/shared-workflows/.github/workflows/dependency-review.yaml@main
permissions:
contents: read
with:
allow-dependencies-licenses: 'pkg:npm/%40inkeep/widgets, pkg:npm/domain-browser'
116 changes: 59 additions & 57 deletions .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
@@ -1,58 +1,60 @@
name: Playwright Tests
on: [deployment_status]
jobs:
test:
timeout-minutes: 60
runs-on: ubuntu-latest
if: github.event.deployment_status.state == 'success'
# TODO fix docs/issues/376

# name: Playwright Tests
# on: [deployment_status]
# jobs:
# test:
# timeout-minutes: 60
# runs-on: ubuntu-latest
# if: github.event.deployment_status.state == 'success'

strategy:
matrix:
shard: ["1/3", "2/3", "3/3"]
steps:
- uses: actions/checkout@v2
- id: nvm
name: Read .nvmrc
run: echo "::set-output name=NVMRC;$(cat .nvmrc)"
- uses: actions/setup-node@v2
with:
node-version: '${{ steps.nvm.outputs.NVMRC }}'
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Cache yarn cache
uses: actions/[email protected]
id: cache-yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-${{ steps.nvm.ouputs.NVMRC }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-${{ steps.nvm.ouputs.NVMRC }}-yarn-${{ hashFiles('**/yarn.lock') }}
${{ runner.os }}-${{ steps.nvm.ouputs.NVMRC }}-yarn-
- name: Cache node_modules
id: cache-node-modules
uses: actions/cache@v2
with:
path: node_modules
key: ${{ runner.os }}-${{ steps.nvm.ouputs.NVMRC }}-nodemodules-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-${{ steps.nvm.ouputs.NVMRC }}-nodemodules-${{ hashFiles('**/yarn.lock') }}
${{ runner.os }}-${{ steps.nvm.ouputs.NVMRC }}-nodemodules-
- run: yarn
if: |
steps.cache-yarn-cache.outputs.cache-hit != 'true' ||
steps.cache-node-modules.outputs.cache-hit != 'true'
- name: Install Playwright Browsers
run: npx playwright install --with-deps
- name: Run Playwright tests
env:
PLAYWRIGHT_TEST_BASE_URL: ${{ github.event.deployment_status.target_url }}
run: yarn playwright test --shard=${{ matrix.shard }}
- name: Build Storybook, serve and run tests
run: yarn storybook:test-ci
- uses: actions/upload-artifact@v2
if: always()
with:
name: playwright-report
path: playwright-report/
retention-days: 30
# strategy:
# matrix:
# shard: ["1/3", "2/3", "3/3"]
# steps:
# - uses: actions/checkout@v2
# - id: nvm
# name: Read .nvmrc
# run: echo "::set-output name=NVMRC;$(cat .nvmrc)"
# - uses: actions/setup-node@v2
# with:
# node-version: '${{ steps.nvm.outputs.NVMRC }}'
# - name: Get yarn cache directory path
# id: yarn-cache-dir-path
# run: echo "::set-output name=dir::$(yarn cache dir)"
# - name: Cache yarn cache
# uses: actions/[email protected]
# id: cache-yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
# with:
# path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
# key: ${{ runner.os }}-${{ steps.nvm.ouputs.NVMRC }}-yarn-${{ hashFiles('**/yarn.lock') }}
# restore-keys: |
# ${{ runner.os }}-${{ steps.nvm.ouputs.NVMRC }}-yarn-${{ hashFiles('**/yarn.lock') }}
# ${{ runner.os }}-${{ steps.nvm.ouputs.NVMRC }}-yarn-
# - name: Cache node_modules
# id: cache-node-modules
# uses: actions/cache@v2
# with:
# path: node_modules
# key: ${{ runner.os }}-${{ steps.nvm.ouputs.NVMRC }}-nodemodules-${{ hashFiles('**/yarn.lock') }}
# restore-keys: |
# ${{ runner.os }}-${{ steps.nvm.ouputs.NVMRC }}-nodemodules-${{ hashFiles('**/yarn.lock') }}
# ${{ runner.os }}-${{ steps.nvm.ouputs.NVMRC }}-nodemodules-
# - run: yarn
# if: |
# steps.cache-yarn-cache.outputs.cache-hit != 'true' ||
# steps.cache-node-modules.outputs.cache-hit != 'true'
# - name: Install Playwright Browsers
# run: npx playwright install --with-deps
# - name: Run Playwright tests
# env:
# PLAYWRIGHT_TEST_BASE_URL: ${{ github.event.deployment_status.target_url }}
# run: yarn playwright test
# - name: Build Storybook, serve and run tests
# run: yarn storybook:test-ci
# - uses: actions/upload-artifact@v2
# if: always()
# with:
# name: playwright-report
# path: playwright-report/
# retention-days: 30
8 changes: 4 additions & 4 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
[submodule "content/11.x"]
path = content/11.x
url = https://github.com/gravitational/teleport
branch = branch/v11
[submodule "content/12.x"]
path = content/12.x
url = https://github.com/gravitational/teleport
Expand All @@ -13,4 +9,8 @@
[submodule "content/14.x"]
path = content/14.x
url = https://github.com/gravitational/teleport
branch = branch/v14
[submodule "content/15.x"]
path = content/15.x
url = https://github.com/gravitational/teleport
branch = master
16 changes: 2 additions & 14 deletions components/Admonition/Admonition.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import cn from "classnames";
import { useContext, useMemo } from "react";
import { DocsContext, getScopes } from "layouts/DocsPage/context";
import { DocsContext } from "layouts/DocsPage/context";
import styles from "./Admonition.module.css";

const capitalize = (text: string): string =>
Expand All @@ -12,31 +12,19 @@ export interface AdmonitionProps {
type: (typeof types)[number];
title: string;
children: React.ReactNode;
scopeOnly: boolean;
scope?: string | string[];
}

const Admonition = ({
type = "tip",
title,
children,
scopeOnly = false,
scope,
}: AdmonitionProps) => {
const resolvedType = type && types.includes(type) ? type : "tip";
const { scope: currentScope } = useContext(DocsContext);
const scopes = useMemo(() => getScopes(scope), [scope]);
const isInCurrentScope = scopes.includes(currentScope);
const isHidden = scopeOnly && !isInCurrentScope;

return (
<div
className={cn(
styles.wrapper,
isHidden && styles.hidden,
styles[resolvedType]
)}
>
<div className={cn(styles.wrapper, styles[resolvedType])}>
<div className={styles.header}>{title || capitalize(type)}</div>
<div className={styles.body}>{children}</div>
</div>
Expand Down
36 changes: 4 additions & 32 deletions components/Details/Details.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useContext, useEffect, useState, useMemo } from "react";
import { useRouter } from "next/router";
import HeadlessButton from "components/HeadlessButton";
import Icon from "components/Icon";
import { DocsContext, getScopes } from "layouts/DocsPage/context";
import { DocsContext } from "layouts/DocsPage/context";
import { getAnchor } from "utils/url";
import styles from "./Details.module.css";

Expand All @@ -19,54 +19,35 @@ export interface DetailsProps {
scope?: string | string[];
title: string;
opened?: boolean;
scopeOnly: boolean;
min: string;
children: React.ReactNode;
}

export const Details = ({
scope,
scopeOnly = false,
opened = false,
title,
min,
children,
}: DetailsProps) => {
const {
scope: currentScope,
versions: { current, latest },
} = useContext(DocsContext);
const router = useRouter();
const scopes = useMemo(() => getScopes(scope), [scope]);
const [isOpened, setIsOpened] = useState(opened);
const isInCurrentScope = scopes.includes(currentScope);
const detailsId = title ? transformTitleToAnchor(title) : "title";
const anchorInPath = getAnchor(router.asPath);

useEffect(() => {
if (scopes.length) {
setIsOpened(isInCurrentScope);
}
}, [scopes, isInCurrentScope]);

useEffect(() => {
if (anchorInPath === detailsId) {
setIsOpened(true);
}
}, [anchorInPath, detailsId]);

const isCloudAndNotCurrent = scopes.includes("cloud") && current !== latest;
const isHiddenInCurrentScope = scopeOnly && !isInCurrentScope;
const isHidden = isCloudAndNotCurrent || isHiddenInCurrentScope;

return (
<div
className={cn(
styles.wrapper,
isHidden && styles.hidden,
isOpened && styles.opened
)}
id={isHidden ? undefined : detailsId}
className={cn(styles.wrapper, isOpened && styles.opened)}
id={detailsId}
>
<HeadlessButton
onClick={() => setIsOpened((value) => !value)}
Expand All @@ -75,17 +56,8 @@ export const Details = ({
<Icon name="arrow" className={styles.icon} />
<div className={styles.description}>
<div className={styles.title}>{title}</div>
{(scope || min) && (
{min && (
<div className={styles.meta}>
{scopes && (
<div className={styles.scopes}>
{scopes.map((scope) => (
<div className={styles.scope} key={scope}>
{scope}
</div>
))}
</div>
)}
{min && <div className={styles.min}>VERSION {min}+</div>}
</div>
)}
Expand Down
1 change: 0 additions & 1 deletion components/DropdownMenu/DropdownMenu.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
.body {
box-sizing: border-box;
display: block;
padding: 0 0 var(--m-2);
}

.withSubMenus {
Expand Down
8 changes: 8 additions & 0 deletions components/Feedback/Feedback.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import styles from "./Feedback.module.css";
import React, { FormEvent, useState } from "react";
import ButtonPrimary from "components/Button";
import { sendDocsFeedback } from "utils/posthog";
import { filterTextForXSS } from "utils/general";
import Button from "components/Button";
import Image from "next/image";
import ThumbsUp from "./thumbs-up.svg";
Expand Down Expand Up @@ -46,6 +47,13 @@ export default function PageWithJSbasedForm(props) {
url: window.location.pathname, // This will include the current page URL
};

data.comment = filterTextForXSS(data.comment);

// Appending URL to comment for context due to PostHog viewing limitations
if (data.comment !== "") {
data.comment += ` (${data.url})`;
}

await forwardData(data);
setIsSubmitted(true);
};
Expand Down
9 changes: 0 additions & 9 deletions components/Header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@ const Header = () => {
<a href="/" className={styles["logo-link"]}>
<Logo />
</a>
<div className={styles.searchLink}>
<NavSearch testid="mobile-search" aria-details="Search website" />
</div>
<HeadlessButton
onClick={toggleNavigaton}
className={styles.hamburger}
Expand All @@ -63,10 +60,4 @@ const Header = () => {
);
};

export const NavSearch = ({ testid }: { testid: string }) => (
<Link href="https://goteleport.com/search/" data-testid={testid}>
<Magnifier width="24px" height="24px" />
</Link>
);

export default Header;
57 changes: 0 additions & 57 deletions components/Header/HeaderCTA.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -33,60 +33,3 @@
margin-right: var(--m-2);
}
}

.downloadsLink {
text-decoration: none;
font-weight: 700;
font-size: var(--fs-text-md);
color: var(--color-code);
padding-left: 10px;
padding-right: 10px;
@media (--lg-scr) {
padding-left: var(--m-3);
padding-right: var(--m-3);
}
@media (--sm-scr) {
display: none;
}
&:focus,
&:hover {
color: var(--color-dark-purple);
}
}

.searchWrapper {
padding: var(--m-1) var(--m-1) 0 var(--m-2);
@media (--sm-scr) {
display: none;
}
}

.group {
position: relative;
padding-left: var(--m-2);
@media (--sm-scr) {
padding-left: 0;
width: 100%;
}
}

.dropdown {
display: none;
z-index: 3000;

@media (--sm-scr) {
position: relative;
width: 100%;
}

@media (--md-scr) {
position: absolute;
top: var(--m-6);
right: var(--m-2);
min-width: 400px;
}

&.visible {
display: block;
}
}
Loading

0 comments on commit 42db9fd

Please sign in to comment.