Skip to content

Commit

Permalink
Merge branch 'main' of github.com:kyma-project/busola into ui5-migrat…
Browse files Browse the repository at this point in the history
…e-v2
  • Loading branch information
OliwiaGowor committed Jan 21, 2025
2 parents 2bf6dbf + 352950a commit 3ebc8f7
Show file tree
Hide file tree
Showing 26 changed files with 594 additions and 646 deletions.
27 changes: 6 additions & 21 deletions .github/workflows/accessibility-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,9 @@ on:
jobs:
run-accessibility-tests:
runs-on: ubuntu-latest
if: github.event.pull_request.draft == false
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
- name: Install k3d
env:
K3D_URL: https://raw.githubusercontent.com/k3d-io/k3d/main/install.sh
Expand All @@ -29,30 +27,17 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version: 20
- name: setup_busola
- name: Setup busola
shell: bash
run: |
set -e
npm ci
npm run build
npm i -g serve
- name: run_tests
.github/scripts/setup_local_busola.sh
- name: Run tests
shell: bash
env:
ACC_AMP_TOKEN: ${{ secrets.ACC_AMP_TOKEN }}
run: |
k3d kubeconfig get kyma > tests/integration/fixtures/kubeconfig.yaml
export CYPRESS_DOMAIN=http://localhost:3000
serve -s build > busola.log &
pushd backend
npm start > backend.log &
popd
echo "waiting for server to be up..."
while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' "$CYPRESS_DOMAIN")" != "200" ]]; do sleep 5; done
sleep 10
k3d kubeconfig get k3dCluster > tests/integration/fixtures/kubeconfig.yaml
export CYPRESS_DOMAIN=http://localhost:3001
cd tests/integration
npm ci && ACC_AMP_TOKEN=$ACC_AMP_TOKEN npm run "test:accesibility"
- name: Uploads artifacts
Expand Down
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,13 @@ For the information on how to run tests and configure them, go to the [`tests`](

## Deploy Busola in the Kubernetes Cluster

To install Busola in the Kubernetes cluster, run:
To install Busola from release in the Kubernetes cluster set `VERSION` shell environment variable with desired release and run:

```shell
kubectl apply -f https://github.com/kyma-project/busola/releases/download/${VERSION}/busola.yaml
```

To install Busola from main branch in the Kubernetes cluster, run:

```shell
(cd resources && kustomize build base/ | kubectl apply -f- )
Expand Down
63 changes: 63 additions & 0 deletions docs/extensibility/100-jsonata.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Use JSONata Expressions with Resource-Based Extensions

## Scoping

The primary data source of [JSONata](https://docs.jsonata.org/overview.html) expressions changes depending on where it's used. Starting with the root, it contains the whole resource, but whenever it's in a child whose parent has a **source** (in lists and details) or **path** (in forms) parameter, the scope changes to data from that source or path.

Additionally, the scope in arrays changes to the array item.

For example, for this resource:

```yaml
spec:
name: foo
description: bar
items:
- name: item-name
details:
status: ok
```
The following definition has their scope changed as follows:
```yaml
- source: spec.name # top level, scope is the same as a resource

- source: spec # top level, scope is the same as a resource
children:
- source: name # parent has source=spec, therefore this refers to spec.name

- children:
- source: spec.name # As there's no parent source here, the scope is still the resource

- source: spec.items
children:
- source: name # parent data is an array, therefore scope changes to its item - this refers to spec.items[0].name
- source: details.status # refers to spec.items[0].details.status (same as above)
- source: details # this changes scope for its children again
children:
source: status # this refers to spec.items[0].details.status
```
## Common Variables
Common variables are the primary means to bypass the default scoping.
- **\$root** - always contains the reference to the resource, so any JSONata in the example above can always be `$root.spec.name`.
- **\$item** - refers to the most recent array item. When not in an array, it's equal to **\$root**.
- **\$items** - contains an array of references to all parent array items (with the last item being equal to **\$item**).
- **\$value** - when used in a JSONata other than **source** (for example **visibility**, but also other widget-specific formulas), contains the value returned by the source.
- **\$index** - exists in array components, refers to the index of the current item of an array.

### Example

```yaml
- widget: Table
source: spec.rules
visibility: $exists($value)
collapsibleTitle: "'Rule #' & $string($index + 1)"
```

## Data Sources

Whenever data sources are provided, they are available as corresponding variable names. For more information, see [Configure the dataSources Section](90-datasources.md).
87 changes: 87 additions & 0 deletions docs/extensibility/101-preset-functions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# JSONata Preset Functions for Resource-Based Extensions

## canI (resourceGroupAndVersion, resourceKind)

You can use the **canI** function to determine if a user has access rights to list a specified resource. The function comes with the following parameters:

- **resourceGroupAndVersion**: Determines the first part of a resource URL following the pattern: `${resource group}/${resource version}`.
- **resourceKind**: Describes a resource kind.

### Example

```yaml
- path: spec.gateway
name: gateway
visibility: $not($canI('networking.istio.io/v1beta1', 'Gateway'))
```
## compareStrings (first, second)
You can use this function to sort two strings alphabetically. The function comes with the following parameters:
- **first**: Determines the first string to compare.
- **second**: Determines the second string to compare.
### Example
Here is an example from the [ResourceList widget](./50-list-and-details-widgets.md#resourcelist):
```yaml
- widget: ResourceList
source: '$myDeployments()'
name: Example ResourceList Deployments
sort:
- source: '$item.spec.strategy.type'
compareFunction: '$compareStrings($second, $first)'
default: true
```
## matchByLabelSelector (item, selectorPath)
You can use this function to match Pods using a resource selector. The function comes with the following parameters:
- **item**: Describes a Pod to be used.
- **selectorPath**: Defines a path to selector labels from `$root`.

### Example

Example from [dataSources](90-datasources.md).

```yaml
- podSelector:
resource:
kind: Pod
version: v1
filter: '$matchByLabelSelector($item, $root.spec.selector)'
```

## matchEvents (item, kind, name)

You can use this function to match Events using a resource selector. The function comes with the following parameters:

- **item**: Describes an Event to be checked.
- **kind**: Describes the kind of the Event emitting resource.
- **name**: Describes the name of the Event emitting resource.

### Example

```yaml
- widget: EventList
filter: '$matchEvents($item, $root.kind, $root.metadata.name)'
name: events
defaultType: NORMAL
hideInvolvedObjects: true
```

## readableTimestamp (timestamp)

You can use this function to convert time to readable time. The function comes with the following parameters:

- **timestamp**: Defines a timestamp to convert.

### Example

```yaml
- source: '$readableTimestamp($item.lastTransitionTime)'
name: status.conditions.lastTransitionTime
```
37 changes: 37 additions & 0 deletions docs/extensibility/110-presets.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Configure the presets Section

The **presets** section contains a list of objects that define which preset and template are used in the form view. If you specify a preset, it is displayed in the dropdown list along with the **Clear** option. When you select a preset, the form is filled with the values defined in the **value** property.

## Available Parameters

| Parameter | Required | Type | Description |
| ----------- | -------- | ------- | ------------------------------------------------------------------------------------------------ |
| **name** | **Yes** | string | A name to display on the preset's dropdown. |
| **value** | **Yes** | | It contains the fields that are set when you choose the given preset from the list. |
| **default** | No | boolean | If set to `true`, it prefills the form with values defined in **value**. It defaults to `false`. |

## Example

```yaml
- name: template
default: true
value:
metadata:
name: my-name
spec:
description: A set description
- name: preset
value:
metadata:
name: second-one
spec:
data: regex
description: A different description
items:
- name: item-1
value: 10
- name: item-2
value: 11
- name: item-3
value: 5
```
Loading

0 comments on commit 3ebc8f7

Please sign in to comment.