Skip to content

Commit

Permalink
Merge pull request #10792 from linode/release-v1.126.0
Browse files Browse the repository at this point in the history
Release v1.126.0 - `release` → `staging`
  • Loading branch information
hana-akamai authored Aug 19, 2024
2 parents 740633d + 340743e commit 5733627
Show file tree
Hide file tree
Showing 372 changed files with 9,529 additions and 3,804 deletions.
35 changes: 33 additions & 2 deletions docs/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Feel free to open an issue to report a bug or request a feature.
1. Fork this repository.
2. Clone your fork to your local machine.
3. Create a branch from `develop`, e.g. `$ git checkout develop && git pull && git checkout -b feature/my-feature`.
4. Make your changes, commit them following the standards below, and then push them to your fork.
4. Make your [small, focused](#sizing-a-pull-request) changes, commit them following the standards below, and then push them to your fork.
5. Commit message format standard: `<commit type>: [JIRA-ticket-number] - <description>`

**Commit Types:**
Expand All @@ -27,7 +27,7 @@ Feel free to open an issue to report a bug or request a feature.
**Example:** `feat: [M3-1234] - Allow user to view their login history`

6. Open a pull request against `develop` and make sure the title follows the same format as the commit message.
7. If needed, create a changeset to populate our changelog
7. If needed, create a changeset to populate our changelog.
- If you don't have the Github CLI installed or need to update it (you need GH CLI 2.21.0 or greater),
- install it via `brew`: https://github.com/cli/cli#installation or upgrade with `brew upgrade gh`
- Once installed, run `gh repo set-default` and pick `linode/manager` (only > 2.21.0)
Expand All @@ -37,9 +37,40 @@ Feel free to open an issue to report a bug or request a feature.
- A changeset is optional, but should be included if the PR falls in one of the following categories:<br>
`Added`, `Fixed`, `Changed`, `Removed`, `Tech Stories`, `Tests`, `Upcoming Features`
- Select the changeset category that matches the commit type in your PR title. (Where this isn't a 1:1 match: generally, a `feat` commit type falls under an `Added` change and `refactor` falls under `Tech Stories`.)
- Write your changeset by following our [best practices](#writing-a-changeset).

Two reviews from members of the Cloud Manager team are required before merge. After approval, all pull requests are squash merged.

## Writing a changeset

Follow these best practices to write a good changeset:

- Use a consistent tense in all changeset entries. We have chosen to use **imperative (present)** tense. (This follows established [git commit message best practices](https://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html).)
- Avoid starting a changeset with the verb "Add", "Remove", "Change" or "Fix" when listed under that respective `Added`, `Removed`, `Changed` or `Fixed` section. It is unnecessary repetition.
- For `Fixed` changesets, describe the bug that needed to be fixed, rather than the fix itself. (e.g. say "Missing button labels in action buttons" rather than "Make label prop required for action buttons").
- Begin a changeset with a capital letter, but do not end it with a period; it's not a complete sentence.
- When referencing code, consider adding backticks for readability. (e.g. "Update `updateImageRegions` to accept `UpdateImageRegionsPayload` instead of `regions: string[]`").
- Use the `Upcoming Features` section for ongoing project work that is behind a feature flag. If additional changes are being made that are not feature flagged, add another changeset to describe that work.
- Add changesets for `docs/` documentation changes in the `manager` package, as this is generally best-fit.
- Generally, if the code change is a fix for a previous change that has been merged to `develop` but was never released to production, we don't need to include a changeset.

## Sizing a pull request

A good PR is small.

Examples of ‘small’:

- Changing a docker file
- Updating a dependency ([Example 1](https://github.com/linode/manager/pull/10291), [Example 2](https://github.com/linode/manager/pull/10212))
- Fixing 1 bug ([Example 1](https://github.com/linode/manager/pull/10583), [Example 2](https://github.com/linode/manager/pull/9726))
- Creating 1 new component with unit test coverage ([Example](https://github.com/linode/manager/pull/9520))
- Adding a new util with unit test coverage

Diff size: A good PR is less than 500 changes, closer to [200](https://github.com/google/eng-practices/blob/master/review/developer/small-cls.md).

A good PR does **exactly one thing**, and is clear about what that is in the description.
Break down *additional* things in your PR into multiple PRs (like you would do with tickets).

## Docs

To run the docs development server locally, [install Bun](https://bun.sh/) and start the server: `yarn docs`.
2 changes: 1 addition & 1 deletion docs/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Please specify a release date to guarantee timely review of this PR. If exact da
- [ ] 👀 Doing a self review
- [ ] ❔ Our [contribution guidelines](https://github.com/linode/manager/blob/develop/docs/CONTRIBUTING.md)
- [ ] 🤏 Splitting feature into small PRs
- [ ] ➕ Adding a changeset
- [ ] ➕ Adding a [changeset](https://github.com/linode/manager/blob/develop/docs/CONTRIBUTING.md#writing-a-changeset)
- [ ] 🧪 Providing/Improving test coverage
- [ ] 🔐 Removing all sensitive information from the code and PR description
- [ ] 🚩 Using a feature flag to protect the release
Expand Down
20 changes: 20 additions & 0 deletions docs/tooling/analytics.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,26 @@ Examples
- `sendMarketplaceSearchEvent` fires when selecting a category from the dropdown (`label` is predefined) and clicking the search field (a generic `label` is used).
- `sendBucketCreateEvent` sends the region of the bucket, but does not send the bucket label.

## Writing Form Events

Form events differ from custom events because they track user's journey through a flow and, optionally, branching flows. Form events live in `src/utilities/analytics/formEventAnalytics.ts`. Try to write and export custom events in this file if possible, and import them in the component(s) where they are used.

When tracking a new form flow, work with UX to:

- Determine a `formName` to use across the flow
- Determine what elements of the form to track
- Follow our naming conventions (use our util: `getFormattedStringFromFormEventOptions`)

These are the form events we use:

- `formStart`: To track the beginning of the form at the designated element
- `formInput`: To track any form interaction (click, change, clear) that is not another type of form event; this event is **not** limited to form input fields
- `formStep`: To track the successful completion of a **branching** flow (e.g. submitting in a drawer within a Create page)
- `formSubmit`: To track the successful completion of the **main** flow
- `formError`: To track the unsuccessful completion of the main flow with the errors encountered by the user

See the `LinodeCreateForm` form events as an example.

## Locally Testing Page Views & Custom Events and/or Troubleshooting

1. Set the `REACT_APP_ADOBE_ANALYTICS_URL` environment variable in `.env`.
Expand Down
12 changes: 9 additions & 3 deletions docs/tooling/react-query.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,9 @@ export const useLinodeUpdateMutation = (id: number) => {
mutationFn: (data) => updateLinode(id, data),
onSuccess(linode) {
// Invalidate all paginated pages in the cache.
queryClient.invalidateQueries(linodeQueries.paginated._def);
queryClient.invalidateQueries({
queryKey: linodeQueries.paginated._def
});
// Because we have the updated Linode, we can manually set the cache for the `useLinode` query.
queryClient.setQueryData(linodeQueries.linode(id).queryKey, linode);
},
Expand All @@ -132,7 +134,9 @@ export const useDeleteLinodeMutation = (id: number) => {
mutationFn: () => deleteLinode(id),
onSuccess() {
// Invalidate all paginated pages in the cache.
queryClient.invalidateQueries(linodeQueries.paginated._def);
queryClient.invalidateQueries({
queryKey: linodeQueries.paginated._def
});
// Remove the deleted linode from the cache
queryClient.removeQueries(linodeQueries.linode(id).queryKey);
},
Expand All @@ -145,7 +149,9 @@ export const useCreateLinodeMutation = () => {
mutationFn: createLinode,
onSuccess(linode) {
// Invalidate all paginated pages in the cache. We don't know what page the new Linode will be on.
queryClient.invalidateQueries(linodeQueries.paginated._def);
queryClient.invalidateQueries({
queryKey: linodeQueries.paginated._def
});
// Because we have the new Linode, we can manually set the cache for the `useLinode` query.
queryClient.setQueryData(linodeQueries.linode(id).queryKey, linode);
},
Expand Down
2 changes: 1 addition & 1 deletion packages/api-v4/.changeset/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ You must commit them to the repo so they can be picked up for the changelog gene

This directory get wiped out when running `yarn generate-changelog`.

See `changeset.mjs` for implementation details.
See `changeset.mjs` for implementation details.
16 changes: 16 additions & 0 deletions packages/api-v4/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
## [2024-08-19] - v0.124.0

### Added:

- Firewall template endpoints ([#10770](https://github.com/linode/manager/pull/10770))

### Changed:

- Move `getObjectStorageEndpoints` from `/objects.ts` to `/buckets.ts` ([#10736](https://github.com/linode/manager/pull/10736))

### Upcoming Features:

- Add several CloudPulseMetrics types ([#10710](https://github.com/linode/manager/pull/10710))
- Change JWETokenPayLoad `resource_id` to `resource_ids` ([#10747](https://github.com/linode/manager/pull/10747))
- Add 'Akamai Cloud Pulse' in AccountCapability type interface ([#10768](https://github.com/linode/manager/pull/10768))

## [2024-08-05] - v0.123.0

### Added:
Expand Down
2 changes: 1 addition & 1 deletion packages/api-v4/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@linode/api-v4",
"version": "0.123.0",
"version": "0.124.0",
"homepage": "https://github.com/linode/manager/tree/develop/packages/api-v4",
"bugs": {
"url": "https://github.com/linode/manager/issues"
Expand Down
2 changes: 2 additions & 0 deletions packages/api-v4/src/account/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ export type BillingSource = 'linode' | 'akamai';

export type AccountCapability =
| 'Akamai Cloud Load Balancer'
| 'Akamai Cloud Pulse'
| 'Block Storage'
| 'Block Storage Encryption'
| 'Cloud Firewall'
Expand Down Expand Up @@ -182,6 +183,7 @@ export type GlobalGrantTypes =
| 'add_images'
| 'add_linodes'
| 'add_longview'
| 'add_databases'
| 'add_nodebalancers'
| 'add_stackscripts'
| 'add_volumes'
Expand Down
31 changes: 30 additions & 1 deletion packages/api-v4/src/cloudpulse/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,38 @@ export interface Dimension {
}

export interface JWETokenPayLoad {
resource_id: string[];
resource_ids: number[];
}

export interface JWEToken {
token: string;
}

export interface CloudPulseMetricsRequest {
metric: string;
filters?: Filters[];
aggregate_function: string;
group_by: string;
relative_time_duration: TimeDuration;
time_granularity: TimeGranularity | undefined;
resource_id: number[];
}

export interface CloudPulseMetricsResponse {
data: CloudPulseMetricsResponseData;
isPartial: boolean;
stats: {
series_fetched: number;
};
status: string;
}

export interface CloudPulseMetricsResponseData {
result: CloudPulseMetricsList[];
result_type: string;
}

export interface CloudPulseMetricsList {
metric: { [resourceName: string]: string };
values: [number, string][];
}
34 changes: 32 additions & 2 deletions packages/api-v4/src/firewalls/firewalls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
FirewallDevice,
FirewallDevicePayload,
FirewallRules,
FirewallTemplate,
UpdateFirewallPayload,
} from './types';

Expand Down Expand Up @@ -120,7 +121,7 @@ export const deleteFirewall = (firewallID: number) =>
)
);

// FIREWALL RULES
// #region Firewall Rules

/**
* getFirewallRules
Expand Down Expand Up @@ -160,7 +161,7 @@ export const updateFirewallRules = (firewallID: number, data: FirewallRules) =>
)
);

// DEVICES
// #region Devices

/**
* getFirewallDevices
Expand Down Expand Up @@ -243,3 +244,32 @@ export const deleteFirewallDevice = (firewallID: number, deviceID: number) =>
)}/devices/${encodeURIComponent(deviceID)}`
)
);

// #region Templates

/**
* getTemplates
*
* Returns a paginated list of all firewall templates on this account.
*/
export const getTemplates = () =>
Request<Page<FirewallTemplate>>(
setMethod('GET'),
setURL(`${BETA_API_ROOT}/networking/firewalls/templates`)
);

/**
* getTemplate
*
* Get a specific firewall template by its slug.
*
*/
export const getTemplate = (templateSlug: string) =>
Request<FirewallTemplate>(
setMethod('GET'),
setURL(
`${BETA_API_ROOT}/networking/firewalls/templates/${encodeURIComponent(
templateSlug
)}`
)
);
5 changes: 5 additions & 0 deletions packages/api-v4/src/firewalls/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ export interface FirewallDevice {
entity: FirewallDeviceEntity;
}

export interface FirewallTemplate {
slug: string;
rules: FirewallRules;
}

export interface CreateFirewallPayload {
label?: string;
tags?: string[];
Expand Down
18 changes: 16 additions & 2 deletions packages/api-v4/src/object-storage/buckets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,15 @@ import Request, {
setURL,
setXFilter,
} from '../request';
import { Filter, Params, ResourcePage as Page } from '../types';
import {
import type {
Filter,
Params,
ResourcePage as Page,
RequestOptions,
} from '../types';
import type {
ObjectStorageBucket,
ObjectStorageEndpoint,
UpdateObjectStorageBucketAccessPayload,
ObjectStorageBucketAccess,
CreateObjectStorageBucketPayload,
Expand Down Expand Up @@ -255,3 +261,11 @@ export const updateBucketAccess = (
),
setData(params, UpdateBucketAccessSchema)
);

export const getObjectStorageEndpoints = ({ filter, params }: RequestOptions) =>
Request<Page<ObjectStorageEndpoint>>(
setMethod('GET'),
setURL(`${API_ROOT}/object-storage/endpoints`),
setParams(params),
setXFilter(filter)
);
19 changes: 1 addition & 18 deletions packages/api-v4/src/object-storage/objects.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,13 @@
import { API_ROOT } from '../constants';
import Request, {
setData,
setMethod,
setParams,
setURL,
setXFilter,
} from '../request';
import Request, { setData, setMethod, setURL } from '../request';
import {
ACLType,
ObjectStorageEndpoint,
ObjectStorageObjectACL,
ObjectStorageObjectURL,
GetObjectStorageACLPayload,
CreateObjectStorageObjectURLPayload,
} from './types';

import type { ResourcePage, RequestOptions } from '../types';

/**
* Creates a pre-signed URL to access a single object in a bucket.
* Use it to share, create, or delete objects by using the appropriate
Expand Down Expand Up @@ -82,11 +73,3 @@ export const updateObjectACL = (
),
setData({ acl, name })
);

export const getObjectStorageEndpoints = ({ filter, params }: RequestOptions) =>
Request<ResourcePage<ObjectStorageEndpoint>>(
setMethod('GET'),
setURL(`${API_ROOT}/object-storage/endpoints`),
setParams(params),
setXFilter(filter)
);
Loading

0 comments on commit 5733627

Please sign in to comment.