Skip to content

Commit

Permalink
Prod rebase (#16)
Browse files Browse the repository at this point in the history
* build(deps): bump @kong-ui-public/copy-uuid from 0.3.15 to 0.6.0 (Kong#170)

Bumps [@kong-ui-public/copy-uuid](https://github.com/Kong/public-ui-components/tree/HEAD/packages/core/copy-uuid) from 0.3.15 to 0.6.0.
- [Release notes](https://github.com/Kong/public-ui-components/releases)
- [Changelog](https://github.com/Kong/public-ui-components/blob/main/packages/core/copy-uuid/CHANGELOG.md)
- [Commits](https://github.com/Kong/public-ui-components/commits/@kong-ui-public/copy-uuid@0.6.0/packages/core/copy-uuid)

---
updated-dependencies:
- dependency-name: "@kong-ui-public/copy-uuid"
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* build(deps): bump @kong/kongponents from 8.98.0 to 8.99.0 (Kong#174)

Bumps [@kong/kongponents](https://github.com/Kong/kongponents) from 8.98.0 to 8.99.0.
- [Release notes](https://github.com/Kong/kongponents/releases)
- [Changelog](https://github.com/Kong/kongponents/blob/main/CHANGELOG.md)
- [Commits](Kong/kongponents@v8.98.0...v8.99.0)

---
updated-dependencies:
- dependency-name: "@kong/kongponents"
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(ci): add lint and type check as required for tests (Kong#176)

* ci: use semantic-release to generate releases and changelog (Kong#175)

* ci: check PR title instead of commits (Kong#178)

* style(login): update styling of sso button on login view (Kong#179)

* build(deps): bump @kong/kong-auth-elements from 2.1.0 to 2.7.1 (Kong#183)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* build(deps): bump @kong-ui-public/copy-uuid from 0.6.0 to 0.7.5 (Kong#188)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* build(deps): bump @kong-ui-public/document-viewer from 0.9.0 to 0.10.5 (Kong#189)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* build(deps): bump @kong-ui-public/spec-renderer from 0.10.0 to 0.11.6 (Kong#190)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* build(deps): bump @kong/kongponents from 8.99.0 to 8.116.2 (Kong#187)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(ci): update sync-changes.yml to use proper bot token (Kong#191)

* fix(auth): update package to fix register request payload (Kong#192)

* build(deps): bump eslint-plugin-vue from 9.15.0 to 9.16.1 (Kong#186)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* style: fix css variables for document viewer (Kong#193)

* build(deps): bump eslint from 8.45.0 to 8.46.0 (Kong#180)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* feat: improve empty states for spec / doc rendering (Kong#194)

* chore: update readme for domain clarification (Kong#195)

* feat: add check for meta.public for public routes (Kong#196)

* chore(deps): bump portal sdk to 2.1 (Kong#201)

* fix: update variable names for document viewer (Kong#203)

* feat(app-analytics): expose SDK for application analytics (Kong#204)

* build(deps): bump @kong/kong-auth-elements from 2.7.2 to 2.8.0 (Kong#199)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* docs: add information to readme regarding public directory (Kong#205)

* build(deps): bump @kong-ui-public/copy-uuid from 0.7.5 to 1.1.5 (Kong#206)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* build(deps): bump @typescript-eslint/parser from 5.61.0 to 5.62.0 (Kong#156)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* build(deps): bump eslint-plugin-import from 2.27.5 to 2.28.0 (Kong#185)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* refactor: dont query catalog if switching views (Kong#208)

* refactor: redirect to 404 when spec is not found (Kong#215)

* feat(vitals): migrate contextual analytics from monolith [MA-1788] (Kong#133)

* fix(analytics): port over the contextual analytics spec (Kong#216)

* Add netlify.toml

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Devon Langendoerfer <devon.langendoerfer@konghq.com>
Co-authored-by: Andrew Wylde <andrew.wylde@konghq.com>
Co-authored-by: David Ma <40131297+davidma415@users.noreply.github.com>
Co-authored-by: Mike Swierenga <mike.swierenga@konghq.com>
Co-authored-by: Mihai <103061463+mihai-peteu@users.noreply.github.com>
  • Loading branch information
7 people authored Aug 21, 2023
1 parent 2f55fcc commit 8cc7256
Show file tree
Hide file tree
Showing 51 changed files with 5,141 additions and 449 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/check-pr-title.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Check PR title

on:
pull_request_target:
types:
- opened
- reopened
- edited
- synchronize

jobs:
lint:
runs-on: ubuntu-latest
permissions:
statuses: write
steps:
- uses: aslafy-z/conventional-pr-title-action@v3
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ jobs:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: wagoid/commitlint-github-action@v5
- name: Check unpinned versions
run: ./.github/scripts/pin-version
- name: node modules cache
Expand All @@ -32,6 +31,7 @@ jobs:
tests:
name: Tests
runs-on: ubuntu-latest
needs: code-quality
strategy:
fail-fast: false
matrix:
Expand Down
22 changes: 22 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Semantic Release
on:
workflow_dispatch:
jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Semantic Release
env:
GITHUB_TOKEN: ${{ secrets.GHA_TEAM_DEVX_KONG_BOT_PAT }}
run: npx semantic-release
23 changes: 23 additions & 0 deletions .github/workflows/sync-changes.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Sync Changes From Release Tag
on:
release:
types: published
jobs:
merge:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: release
fetch-depth: 0
token: ${{ secrets.GHA_TEAM_DEVX_KONG_BOT_PAT }}
- name: Override release branch with changes from release tag
shell: bash
env:
GH_TOKEN: ${{ secrets.GHA_TEAM_DEVX_KONG_BOT_PAT }}
run: |
git config --global user.email "team-devx+github-bot@konghq.com"
git config --global user.name "team-devx"
git reset --hard ${{ github.event.release.tag_name }}
git push --force-with-lease origin release
45 changes: 45 additions & 0 deletions .releaserc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"branches": ["main"],
"tagFormat": "${version}",
"plugins": [
["@semantic-release/commit-analyzer", {
"preset": "conventionalcommits",
"releaseRules": [
{ "breaking": true, "release": "major" },
{ "revert": true, "release": "patch" },
{ "type": "build", "release": "patch" },
{ "type": "chore", "release": "patch" },
{ "type": "docs", "release": "patch" },
{ "type": "feat", "release": "minor" },
{ "type": "fix", "release": "patch" },
{ "type": "perf", "release": "patch" },
{ "type": "refactor", "release": "patch" }
]
}],
["@semantic-release/release-notes-generator", {
"preset": "conventionalcommits",
"presetConfig": {
"types": [
{ "type": "build", "section": "Build", "hidden": false },
{ "type": "chore", "section": "Chores", "hidden": false },
{ "type": "ci", "section": "CI/CD", "hidden": false },
{ "type": "docs", "section": "Docs", "hidden": false },
{ "type": "feat", "section": "Features", "hidden": false },
{ "type": "fix", "section": "Bug Fixes", "hidden": false },
{ "type": "perf", "section": "Performance", "hidden": false },
{ "type": "refactor", "section": "Refactor", "hidden": false },
{ "type": "style", "section": "Code Style", "hidden": false },
{ "type": "test", "section": "Tests", "hidden": false }
]
}
}],
"@semantic-release/github",
["@semantic-release/git", {
"assets": ["CHANGELOG.md", "package.json", "yarn.lock"],
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
}],
"@semantic-release/changelog"
],
"successComment": false
}

93 changes: 71 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@
![License](https://img.shields.io/badge/License-Apache%202.0-blue?style=flat-square)

![Twitter Follow](https://img.shields.io/twitter/follow/thekonginc?style=social)

# Konnect Dev Portal Client

This repo is an [open source][oss-url] reference implementation of a Konnect Developer Portal Client leveraging the [Konnect Developer Portal Client API][portal-api-url] and [JavaScript SDK][javscript-sdk-url].

The [Konnect Dev Portal][konnect-docs-url] is a web application for developers to locate, access, and consume API services. The Dev Portal enables developers to browse and search API documentation, test API endpoints, and manage their own credentials.
The [Konnect Dev Portal][konnect-docs-url] is a web application for developers to locate, access, and consume API services. The Dev Portal enables developers to browse and search API documentation, test API endpoints, and manage their own credentials.

In [Kong Konnect][kong-konnect-register-url], you have two hosting options for the Dev Portal web user interface: a cloud hosted Dev Portal with Konnect or a self-hosted, open source Dev Portal powered by Konnect APIs.

Expand All @@ -29,17 +30,50 @@ With those benefits in mind, there _is_ the hosting cost to deploy this single p

## Getting started

### Prerequisites:
### Using the Project: Best Practices

### Branches

1. **Main Branch (`main`)**: The `main` branch serves as the default branch, and all commits and pull requests should be directed here. It represents the latest version of the project.

2. **Release Branch (`release`)**: The `release` branch includes all the changes from the `main` branch, but its latest commit will always correspond to the latest release tag.

### Choosing the Right Branch

When contributing or using the project, it is essential to understand which branch best suits your needs:

1. **For Contributors**:

* If you want to contribute any new features or bug fixes, please create a new branch based on the `main` branch. Name your branch descriptively ([see the branch naming conventions](#branch-naming-conventions) - Open a pull request to merge your changes into the `main` branch. This allows the maintainers to review your code before merging it into the default branch.

2. **For Users Who Want Frequent Updates**:

* If you prefer to use the latest development version of the project, you should use the `main` branch directly, either in your fork or as a submodule of your project.

3. **For Users Who Want Stable Releases**:

* Use the `release` branch if you prefer less-frequent updates. - The `release` branch provides a production-ready version of the project at each tagged release. - It is recommended to keep your fork of the repository updated with the latest changes from the `release` branch.

### Staying Updated

Whether you are contributing or using the project, staying updated is crucial:

* Regularly fetch and pull changes from the `main` branch to your local repository. This ensures that your work is based on the most recent codebase.
* If you are using the `release` branch, merge the latest changes from `main` into your fork periodically to keep it up-to-date with the latest releases.

By following these guidelines, both contributors and users can efficiently collaborate on and use the project, ensuring a smooth and productive development experience for everyone involved.

### Prerequisites

* Kong Konnect account
* You can Start a Free trial at: [konghq.com][kong-konnect-register-url]
* Documentation for Kong Konnect is available at: [docs.konghq.com][konnect-docs-url]
* You can Start a Free trial at: [konghq.com][kong-konnect-register-url]
* Documentation for Kong Konnect is available at: [docs.konghq.com][konnect-docs-url]
* Yarn [^1.22.x][yarn-install-url]

Install dependencies

```sh
yarn
yarn install --frozen-lockfile
```

Create local .env file
Expand All @@ -48,7 +82,7 @@ Create local .env file
cp .env.example .env
```

Set `VITE_PORTAL_API_URL` value in your current environment i.e .env file or local environment, this should match either the Kong supplied portal URL ending in `portal.konghq.com` or the [custom Portal URL set in Konnect][custom-dev-portal-url]. Be sure to set the Custom Client domain to match the domain you will be serving the portal out of to avoid CORS issues.
Set `VITE_PORTAL_API_URL` value in your current environment i.e .env file or local environment, this should match either the Kong supplied portal URL ending in `portal.konghq.com` (for local development) or the [custom hosted domain URL set in Konnect][custom-dev-portal-url] (for your deployed environment). Be sure to set the custom self-hosted UI domain to match the domain you will be serving the portal out of to avoid CORS issues.

For Development you can provide any portal API URL, it is proxied by Vite, so you do not need to set the custom client domain.

Expand All @@ -59,10 +93,15 @@ yarn dev #optional --verbose
```

Run tests with

```sh
yarn test:e2e
```

### Public Directory

If you need to store assets (e.g. fonts, images, or icons), you can create a `public` directory at the root level of the repository and Vite will utilize it by default. For more information on when or how to use the public folder, visit [here](https://vitejs.dev/guide/assets.html#the-public-directory).

## Building for production release

Build production bundle '_(dist/)_' for deployment with
Expand All @@ -78,36 +117,46 @@ First and foremost please and comply with the standards outlined in the [CODE_OF

### Committing Changes

Please follow the following branch naming scheme when creating your branch: This repo uses [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/). [Commitizen](https://github.com/commitizen/cz-cli) can be used to help build commit messages.
Please follow the following branch naming scheme when creating your branch: This repo uses [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/). [Commitizen](https://github.com/commitizen/cz-cli) can be used to help build commit messages. Or you can utilize the installed version with any of the following commands:

```sh
yarn commit
```

#### _Note:_
_To disable commit formatting on your fork you can either comment out the contents of the lefthook.yaml file or remove it, as well as uninstall lefthook from the package.json file._
_To disable linting during the `pre-push` git hook (on your fork), you can either comment out the contents of the lefthook.yaml file or remove it, as well as uninstall lefthook from the package.json file._

i.e

```sh
$ rm lefthook.yaml
$ rm lefthook.yaml
$ yarn remove lefthook
```

### Branch naming conventions
### Branch naming conventions

Please follow the following branch naming scheme when creating your branch:

- `feat/foo-bar` for new features
- `fix/foo-bar` for bug fixes
- `test/foo-bar` when the change concerns only the test suite
- `refactor/foo-bar` when refactoring code without any behavior change
- `style/foo-bar` when addressing some style issue
- `docs/foo-bar` for updates to the README.md, this file, or similar documents
* `feat/foo-bar` for new features
* `fix/foo-bar` for bug fixes
* `test/foo-bar` when the change concerns only the test suite
* `refactor/foo-bar` when refactoring code without any behavior change
* `style/foo-bar` when addressing some style issue
* `docs/foo-bar` for updates to the README.md, this file, or similar documents
* `ci/foo-bar` for updates to the GitHub workflows or actions

## Releases

This repo uses [Semantic Release](https://github.com/semantic-release/semantic-release) for automated releases once per week. The release is triggered by a GitHub Action on the `main` branch. The release is based on the commit messages, so please follow the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) specification.

## Join the Community

- Join the Kong discussions at the Kong Nation forum: [https://discuss.konghq.com/](https://discuss.konghq.com/)
- Follow us on Twitter: [https://twitter.com/thekonginc](https://twitter.com/thekonginc)
- Check out the docs: [https://docs.konghq.com/](https://docs.konghq.com/)
- Keep updated on YouTube by subscribing: [https://www.youtube.com/c/KongInc/videos](https://www.youtube.com/c/KongInc/videos)
- Read up on the latest happenings at our blog: [https://konghq.com/blog/](https://konghq.com/blog/)
- Visit our homepage to learn more: [https://konghq.com/](https://konghq.com/)
* Join the Kong discussions at the Kong Nation forum: [https://discuss.konghq.com/](https://discuss.konghq.com/)
* Follow us on Twitter: [https://twitter.com/thekonginc](https://twitter.com/thekonginc)
* Check out the docs: [https://docs.konghq.com/](https://docs.konghq.com/)
* Keep updated on YouTube by subscribing: [https://www.youtube.com/c/KongInc/videos](https://www.youtube.com/c/KongInc/videos)
* Read up on the latest happenings at our blog: [https://konghq.com/blog/](https://konghq.com/blog/)
* Visit our homepage to learn more: [https://konghq.com/](https://konghq.com/)

## License

Expand Down
6 changes: 5 additions & 1 deletion cypress/e2e/fixtures/consts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,8 @@ const defaultContext: PortalContext = {
allowed_time_period: '2022-03-25T13:15:02.104Z'
}

export { versions, product, productVersion, productRegistration, apps, defaultContext }
const productRegistrations: GetRegistrationResponse[] = [
productRegistration
]

export { versions, product, productVersion, productRegistration, productRegistrations, apps, defaultContext }
13 changes: 12 additions & 1 deletion cypress/e2e/specs/api_documentation.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ import documentTreeJSON from '../fixtures/dochub_mocks/documentTree.json'

describe('Api Documentation Page', () => {
beforeEach(() => {
product.document_count = 1
cy.mockPrivatePortal()
cy.mockProduct(product.id)
cy.mockProduct(product.id, product)
cy.mockGetProductDocumentBySlug(product.id, 'bar')
cy.mockGetProductDocuments(product.id)
cy.mockProductOperations()
Expand All @@ -15,6 +16,16 @@ describe('Api Documentation Page', () => {
const PARENT_DOCUMENT_URL = `/docs/${product.id}/${documentTreeJSON[0].slug}`
const CHILD_DOCUMENT_URL = `${PARENT_DOCUMENT_URL}/${documentTreeJSON[0].children[0].slug}`

it('displays empty state when no products', () => {
product.document_count = 0
cy.mockProduct(product.id, product)
cy.mockProductDocumentTree(product.id, { body: [] })
cy.visit(`/docs/${product.id}`)

cy.get('[data-testid="documentation-empty-state"]').should('be.visible')
cy.get('[data-testid="portal-document-viewer"]').should('not.exist')
})

it('displays proper error message when 400', () => {
cy.intercept(
'GET',
Expand Down
5 changes: 3 additions & 2 deletions cypress/e2e/specs/application_registration.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ describe('Application Registration', () => {
cy.mockAppearance()
cy.mockStylesheetCss()
cy.mockStylesheetFont()
cy.mockContextualAnalytics()
})

it('displays empty dashboard for my apps', () => {
Expand Down Expand Up @@ -229,8 +230,8 @@ describe('Application Registration', () => {
mockApplicationWithCredAndReg(apps[0])
// go to application details
cy.get('[data-testid="applications-table"] tbody tr')
.contains(apps[0].name)
.click()
.contains(apps[0].name)
.click()

// use breadcrumb to navigate back to My Apps
cy.get('.k-breadcrumbs .k-breadcrumbs-item a').contains('My Apps').click()
Expand Down
Loading

0 comments on commit 8cc7256

Please sign in to comment.