Skip to content

Commit

Permalink
Merge pull request #10875 from linode/staging
Browse files Browse the repository at this point in the history
Release v1.127.0 - staging → master
  • Loading branch information
abailly-akamai authored Sep 3, 2024
2 parents d9a6838 + cb5267e commit 825d82c
Show file tree
Hide file tree
Showing 204 changed files with 6,171 additions and 2,663 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ lib
# editor configuration
.vscode
.idea
**/*.iml

# misc
.DS_Store
Expand Down
2 changes: 0 additions & 2 deletions docs/development-guide/01-repository-structure.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@ A few notable directories in the root level of the manager package:
- end-to-end tests
- **/e2e**
- old end-to-end tests [deprecated]
- **/patches**
- patches applied to dependencies via patch-package
- **/public**
- assets, fonts, HTML, and third-party JS
- **/scripts**
Expand Down
28 changes: 15 additions & 13 deletions docs/development-guide/08-testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,24 +199,26 @@ These environment variables are used by Cloud Manager's UI tests to override reg
| `CY_TEST_REGION` | ID of region to test (as used by Linode APIv4). | `us-east` | Unset; regions are selected at random |
###### Run Splitting
These environment variables facilitate splitting the Cypress run between multiple runners without the use of any third party services. This can be useful for improving Cypress test performance in some circumstances.
These environment variables facilitate splitting the Cypress run between multiple runners without the use of any third party services. This can be useful for improving Cypress test performance in some circumstances. For additional performance gains, an optional test weights file can be specified using `CY_TEST_SPLIT_RUN_WEIGHTS` (see `CY_TEST_GENWEIGHTS` to generate test weights).
| Environment Variable | Description | Example | Default |
|---------------------------|--------------------------------------------|----------------|----------------------------|
| `CY_TEST_SPLIT_RUN` | Enable run splitting | `1` | Unset; disabled by default |
| `CY_TEST_SPLIT_RUN_INDEX` | Numeric index for each Cypress test runner | `1`, `2`, etc. | Unset |
| `CY_TEST_SPLIT_RUN_TOTAL` | Total number of runners for the tests | `2` | Unset |
| Environment Variable | Description | Example | Default |
|-----------------------------|--------------------------------------------|------------------|----------------------------|
| `CY_TEST_SPLIT_RUN` | Enable run splitting | `1` | Unset; disabled by default |
| `CY_TEST_SPLIT_RUN_INDEX` | Numeric index for each Cypress test runner | `1`, `2`, etc. | Unset |
| `CY_TEST_SPLIT_RUN_TOTAL` | Total number of runners for the tests | `2` | Unset |
| `CY_TEST_SPLIT_RUN_WEIGHTS` | Path to test weights file | `./weights.json` | Unset; disabled by default |
###### Development, Logging, and Reporting
Environment variables related to Cypress logging and reporting, as well as report generation.
| Environment Variable | Description | Example | Default |
|---------------------------------|-----------------------------------------------|-----------|----------------------------|
| `CY_TEST_USER_REPORT` | Log test account information when tests begin | `1` | Unset; disabled by default |
| `CY_TEST_JUNIT_REPORT` | Enable JUnit reporting | `1` | Unset; disabled by default |
| `CY_TEST_DISABLE_FILE_WATCHING` | Disable file watching in Cypress UI | `1` | Unset; disabled by default |
| `CY_TEST_DISABLE_RETRIES` | Disable test retries on failure in CI | `1` | Unset; disabled by default |
| `CY_TEST_FAIL_ON_MANAGED` | Fail affected tests when Managed is enabled | `1` | Unset; disabled by default |
| Environment Variable | Description | Example | Default |
|---------------------------------|----------------------------------------------------|------------------|----------------------------|
| `CY_TEST_USER_REPORT` | Log test account information when tests begin | `1` | Unset; disabled by default |
| `CY_TEST_JUNIT_REPORT` | Enable JUnit reporting | `1` | Unset; disabled by default |
| `CY_TEST_DISABLE_FILE_WATCHING` | Disable file watching in Cypress UI | `1` | Unset; disabled by default |
| `CY_TEST_DISABLE_RETRIES` | Disable test retries on failure in CI | `1` | Unset; disabled by default |
| `CY_TEST_FAIL_ON_MANAGED` | Fail affected tests when Managed is enabled | `1` | Unset; disabled by default |
| `CY_TEST_GENWEIGHTS` | Generate and output test weights to the given path | `./weights.json` | Unset; disabled by default |
### Writing End-to-End Tests
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"devDependencies": {
"husky": "^3.0.1",
"npm-run-all": "^4.1.5",
"patch-package": "^7.0.0",
"postinstall": "^0.6.0",
"typescript": "^5.4.5"
},
Expand All @@ -19,7 +18,6 @@
"cost-of-modules": "yarn global add cost-of-modules && cost-of-modules --less --no-install --include-dev",
"install:all": "yarn install --frozen-lockfile",
"upgrade:sdk": "yarn workspace @linode/api-v4 version --no-git-tag-version --no-commit-hooks && yarn workspace linode-manager upgrade @linode/api-v4",
"postinstall": "echo \"Skipping Patching: yarn workspaces run postinstall && patch-package\"",
"build:sdk": "yarn workspace @linode/api-v4 build",
"build:validation": "yarn workspace @linode/validation build",
"build": "yarn build:validation && yarn build:sdk && yarn workspace linode-manager build",
Expand Down Expand Up @@ -49,6 +47,7 @@
"docs": "bunx [email protected] dev docs"
},
"resolutions": {
"braces": "^3.0.3",
"@babel/traverse": "^7.23.3",
"minimist": "^1.2.3",
"yargs-parser": "^21.1.1",
Expand Down
18 changes: 18 additions & 0 deletions packages/api-v4/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
## [2024-09-03] - v0.125.0


### Added:

- Managed Databases V2 capability and types ([#10786](https://github.com/linode/manager/pull/10786))

### Changed:

- Deprecate `getClusters` ([#10801](https://github.com/linode/manager/pull/10801))
- Increase block storage max volume size to 16TB ([#10865](https://github.com/linode/manager/pull/10865))

### Upcoming Features:

- Update `AclpConfig` type ([#10769](https://github.com/linode/manager/pull/10769))
- Add service types and `getCloudPulseServiceTypes` request ([#10805](https://github.com/linode/manager/pull/10805))


## [2024-08-19] - v0.124.0

### Added:
Expand Down
8 changes: 4 additions & 4 deletions 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.124.0",
"version": "0.125.0",
"homepage": "https://github.com/linode/manager/tree/develop/packages/api-v4",
"bugs": {
"url": "https://github.com/linode/manager/issues"
Expand Down Expand Up @@ -41,7 +41,7 @@
"unpkg": "./lib/index.global.js",
"dependencies": {
"@linode/validation": "*",
"axios": "~1.6.8",
"axios": "~1.7.4",
"ipaddr.js": "^2.0.0",
"yup": "^0.32.9"
},
Expand All @@ -64,9 +64,9 @@
"eslint": "^6.8.0",
"eslint-plugin-ramda": "^2.5.1",
"eslint-plugin-sonarjs": "^0.5.0",
"lint-staged": "^13.2.2",
"lint-staged": "^15.2.9",
"prettier": "~2.2.1",
"tsup": "^7.2.0",
"tsup": "^8.2.4",
"vitest": "^1.6.0"
},
"lint-staged": {
Expand Down
1 change: 1 addition & 0 deletions packages/api-v4/src/account/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ export type AccountCapability =
| 'LKE HA Control Planes'
| 'Machine Images'
| 'Managed Databases'
| 'Managed Databases V2'
| 'NodeBalancers'
| 'Object Storage Access Key Regions'
| 'Object Storage Endpoint Types'
Expand Down
8 changes: 6 additions & 2 deletions packages/api-v4/src/cloudpulse/dashboards.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,13 @@ import { Dashboard } from './types';
import { API_ROOT } from 'src/constants';

// Returns the list of all the dashboards available
export const getDashboards = () =>
export const getDashboards = (serviceType: string) =>
Request<ResourcePage<Dashboard>>(
setURL(`${API_ROOT}/monitor/services/linode/dashboards`),
setURL(
`${API_ROOT}/monitor/services/${encodeURIComponent(
serviceType
)}/dashboards`
),
setMethod('GET')
);

Expand Down
14 changes: 13 additions & 1 deletion packages/api-v4/src/cloudpulse/services.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import { API_ROOT } from 'src/constants';
import Request, { setData, setMethod, setURL } from '../request';
import { JWEToken, JWETokenPayLoad, MetricDefinitions } from './types';
import {
JWEToken,
JWETokenPayLoad,
MetricDefinitions,
ServiceTypesList,
} from './types';
import { ResourcePage as Page } from 'src/types';

export const getMetricDefinitionsByServiceType = (serviceType: string) => {
Expand All @@ -22,3 +27,10 @@ export const getJWEToken = (data: JWETokenPayLoad, serviceType: string) =>
setMethod('POST'),
setData(data)
);

// Returns the list of service types available
export const getCloudPulseServiceTypes = () =>
Request<ServiceTypesList>(
setURL(`${API_ROOT}/monitor/services`),
setMethod('GET')
);
30 changes: 23 additions & 7 deletions packages/api-v4/src/cloudpulse/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,21 @@ export interface Filters {
value: string;
}

// Define the type for filter values
type FilterValue =
| number
| string
| string[]
| number[]
| WidgetFilterValue
| undefined;

type WidgetFilterValue = { [key: string]: AclpWidget };

export interface AclpConfig {
dashboardId: number;
interval: string;
region: string;
resources: string[];
timeDuration: string;
widgets: { [label: string]: AclpWidget };
// we maintain only the filters selected in the preferences for latest selected dashboard
[key: string]: FilterValue;
widgets?: WidgetFilterValue;
}

export interface AclpWidget {
Expand Down Expand Up @@ -95,7 +103,7 @@ export interface CloudPulseMetricsRequest {
group_by: string;
relative_time_duration: TimeDuration;
time_granularity: TimeGranularity | undefined;
resource_id: number[];
resource_ids: number[];
}

export interface CloudPulseMetricsResponse {
Expand All @@ -116,3 +124,11 @@ export interface CloudPulseMetricsList {
metric: { [resourceName: string]: string };
values: [number, string][];
}

export interface ServiceTypes {
service_type: string;
}

export interface ServiceTypesList {
data: ServiceTypes[];
}
2 changes: 1 addition & 1 deletion packages/api-v4/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ export const BETA_API_ROOT = API_ROOT + 'beta';
// Value from 1-4 reflecting a minimum score from zxcvbn
export const MINIMUM_PASSWORD_STRENGTH = 4;

export const MAX_VOLUME_SIZE = 10240;
export const MAX_VOLUME_SIZE = 16384;
4 changes: 3 additions & 1 deletion packages/api-v4/src/databases/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,11 @@ export interface DatabaseInstance {
* A key/value object where the key is an IP address and the value is a member type.
*/
members: Record<string, MemberType>;
platform?: string;
}

export type ClusterSize = 1 | 3;
export type ClusterSize = 1 | 2 | 3;

type ReadonlyCount = 0 | 2;

export type MySQLReplicationType = 'none' | 'semi_synch' | 'asynch';
Expand Down
6 changes: 3 additions & 3 deletions packages/api-v4/src/object-storage/clusters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import { Filter, Params, ResourcePage as Page } from '../types';
import { ObjectStorageCluster } from './types';

/**
* getClusters
*
* Gets a list of available clusters
* @deprecated This method returns legacy clusterId values representing regions
* used in older API versions. It is maintained for backward compatibility only.
* Please use the "getRegions" endpoint instead for up-to-date information.
*/
export const getClusters = (params?: Params, filters?: Filter) =>
Request<Page<ObjectStorageCluster>>(
Expand Down
1 change: 1 addition & 0 deletions packages/api-v4/src/regions/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export type Capabilities =
| 'Kubernetes'
| 'Linodes'
| 'Managed Databases'
| 'Managed Databases V2'
| 'Metadata'
| 'NodeBalancers'
| 'Object Storage'
Expand Down
13 changes: 12 additions & 1 deletion packages/manager/.storybook/main.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import type { StorybookConfig } from '@storybook/react-vite';
import { mergeConfig } from 'vite';
import { getReactDocgenTSFileGlobs } from './utils';

const typeScriptFileGlobs = getReactDocgenTSFileGlobs();

const config: StorybookConfig = {
stories: [
Expand All @@ -22,6 +25,11 @@ const config: StorybookConfig = {
},
typescript: {
reactDocgenTypescriptOptions: {
// Speeds up Storybook build time
compilerOptions: {
allowSyntheticDefaultImports: false,
esModuleInterop: false,
},
// makes union prop types like variant and size appear as select controls
shouldExtractLiteralValuesFromEnum: true,
// makes string and boolean types that can be undefined appear as inputs and switches
Expand All @@ -31,8 +39,11 @@ const config: StorybookConfig = {
prop.parent
? !/node_modules\/(?!@mui)/.test(prop.parent.fileName)
: true,
// Only compile files that have stories for faster local development performance
include: /(development|test)/i.test(process.env.NODE_ENV ?? '')
? typeScriptFileGlobs
: undefined,
},

reactDocgen: 'react-docgen-typescript',
},
docs: {
Expand Down
9 changes: 8 additions & 1 deletion packages/manager/.storybook/preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,14 @@ const preview: Preview = {
options: {
storySort: {
method: 'alphabetical',
order: ['Intro', 'Core Styles', 'Components', 'Features'],
order: [
'Intro',
'Design System',
'Icons',
'Foundations',
'Components',
'Features',
],
},
},
viewport: {
Expand Down
27 changes: 27 additions & 0 deletions packages/manager/.storybook/utils.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { getReactDocgenTSFileGlobs } from './utils';

describe('getReactDocgenTSFileGlobs', () => {
const typeScriptFileGlobs = getReactDocgenTSFileGlobs();
it('should return component and feature globs for storybook files', () => {
expect(
typeScriptFileGlobs.some(
(file) => file === 'src/components/Button/**/*.{ts,tsx}'
)
).toBe(true);
expect(
typeScriptFileGlobs.some(
(file) => file === 'src/components/Paper.{ts,tsx}'
)
).toBe(true);
expect(
typeScriptFileGlobs.some(
(file) => file === 'src/features/TopMenu/**/*.{ts,tsx}'
)
).toBe(true);
expect(
typeScriptFileGlobs.some(
(file) => file === 'src/features/Longview/**/*.{ts,tsx}'
)
).toBe(false);
});
});
28 changes: 28 additions & 0 deletions packages/manager/.storybook/utils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import globby from 'globby';

const PATTERN = 'src/**/*.stories.tsx';

/**
* Find all storybook files, then return the glob containing the parent component/feature.
* To be used in main.ts to tell react-docgen-typescript which files to compile.
* https://github.com/linode/manager/pull/10762
*
* Example: src/components/Button/Button.stories.tsx -> src/components/Button/**\/*.{ts,tsx}
*/
export const getReactDocgenTSFileGlobs = () => {
const filesWithStories = globby.sync(PATTERN);
const files: string[] = [];

filesWithStories.forEach((file) => {
const execArr = /(src\/(components|features)\/[a-zA-Z]*(.|\/))/.exec(file);
if (execArr) {
const isDirectory = execArr[3] === '/';
const fileBlob = `${execArr[0]}${isDirectory ? '**/*.' : ''}{ts,tsx}`;
if (!files.includes(fileBlob)) {
files.push(fileBlob);
}
}
});

return files;
};
Loading

0 comments on commit 825d82c

Please sign in to comment.