From 600512df8a8f9ad8360931488cbb254be75a9ddf Mon Sep 17 00:00:00 2001 From: Banks Nussman Date: Wed, 4 Dec 2024 15:49:58 -0500 Subject: [PATCH] sort imports with eslint --- packages/manager/cypress.config.ts | 81 ++++++++--------- .../cypress/component/poc/beta-chip.spec.tsx | 5 +- .../component/poc/region-select.spec.tsx | 79 ++++++++--------- packages/manager/cypress/support/api/lke.ts | 11 ++- .../manager/cypress/support/api/longview.ts | 2 + .../manager/cypress/support/api/managed.ts | 2 + .../cypress/support/api/nodebalancers.ts | 4 +- packages/manager/cypress/support/api/tags.ts | 3 +- .../manager/cypress/support/api/volumes.ts | 7 +- .../cypress/support/constants/databases.ts | 87 ++++++++++--------- .../support/constants/user-permissions.ts | 32 +++---- packages/manager/cypress/support/e2e.ts | 2 +- packages/manager/cypress/support/index.d.ts | 84 +++++++++--------- .../cypress/support/intercepts/configs.ts | 3 +- .../cypress/support/intercepts/databases.ts | 11 +-- .../support/intercepts/feature-flags.ts | 4 +- .../cypress/support/intercepts/images.ts | 2 +- .../cypress/support/intercepts/longview.ts | 5 +- .../cypress/support/intercepts/support.ts | 4 +- .../cypress/support/plugins/fetch-account.ts | 9 +- .../support/plugins/post-run-cleanup.ts | 19 ++-- .../cypress/support/plugins/split-run.ts | 15 ++-- .../support/plugins/test-tagging-info.ts | 5 +- .../cypress/support/setup/defer-command.ts | 3 +- .../cypress/support/setup/login-command.ts | 5 +- .../support/setup/mock-account-request.ts | 3 +- .../cypress/support/ui/autocomplete.ts | 4 +- .../manager/cypress/support/util/cleanup.ts | 6 +- .../manager/cypress/support/util/kernels.ts | 3 +- .../manager/cypress/support/util/polling.ts | 20 ++--- .../manager/cypress/support/util/regions.ts | 16 ++-- packages/manager/cypress/support/util/tag.ts | 13 +-- packages/manager/src/MainContent.tsx | 2 +- .../CheckoutBar/DisplaySectionList.tsx | 2 +- .../EntityHeader/EntityHeader.test.tsx | 4 +- .../EntityIcon/EntityIcon.stories.tsx | 2 +- .../MultipleIPInput/MultipleIPInput.test.tsx | 5 +- .../DeletePaymentMethodDialog.tsx | 7 +- .../PaymentMethodRow/PaymentMethodRow.tsx | 3 +- .../src/components/PrimaryNav/PrimaryNav.tsx | 8 +- .../components/RegionSelect/RegionSelect.tsx | 2 +- .../TransferDisplay/TransferDisplay.test.tsx | 4 +- .../src/containers/profile.container.ts | 7 +- .../containers/withQueryClient.container.tsx | 4 +- .../src/factories/accountAgreements.ts | 3 +- .../src/factories/accountAvailability.ts | 4 +- .../manager/src/factories/accountLogin.ts | 3 +- .../src/factories/accountMaintenance.ts | 4 +- .../manager/src/factories/accountOAuth.ts | 3 +- .../manager/src/factories/accountPayment.ts | 3 +- .../src/factories/accountPermissions.ts | 15 ++-- .../manager/src/factories/accountResources.ts | 9 +- .../manager/src/factories/accountSettings.ts | 3 +- .../manager/src/factories/accountUsers.ts | 3 +- packages/manager/src/factories/betas.ts | 16 ++-- packages/manager/src/factories/billing.ts | 7 +- packages/manager/src/factories/config.ts | 3 +- packages/manager/src/factories/disk.ts | 3 +- packages/manager/src/factories/domain.ts | 7 +- .../manager/src/factories/entityTransfers.ts | 10 ++- packages/manager/src/factories/events.ts | 6 +- packages/manager/src/factories/grants.ts | 3 +- packages/manager/src/factories/images.ts | 3 +- packages/manager/src/factories/kernels.ts | 13 +-- .../factories/linodeConfigInterfaceFactory.ts | 3 +- .../manager/src/factories/linodeConfigs.ts | 4 +- .../manager/src/factories/longviewClient.ts | 3 +- .../manager/src/factories/longviewDisks.ts | 44 +++++----- .../manager/src/factories/longviewProcess.ts | 2 +- .../manager/src/factories/longviewResponse.ts | 19 ++-- .../manager/src/factories/longviewService.ts | 2 +- .../src/factories/longviewSubscription.ts | 5 +- .../src/factories/longviewTopProcesses.ts | 2 +- packages/manager/src/factories/managed.ts | 5 +- packages/manager/src/factories/networking.ts | 3 +- .../manager/src/factories/notification.ts | 6 +- packages/manager/src/factories/oauth.ts | 3 +- packages/manager/src/factories/profile.ts | 5 +- .../manager/src/factories/promotionalOffer.ts | 2 +- packages/manager/src/factories/statusPage.ts | 5 +- packages/manager/src/factories/subnets.ts | 5 +- packages/manager/src/factories/support.ts | 6 +- packages/manager/src/factories/tags.ts | 3 +- .../manager/src/factories/userPermissions.ts | 3 +- packages/manager/src/factories/vlans.ts | 3 +- packages/manager/src/factories/vpcs.ts | 3 +- .../Account/Agreements/withAgreements.ts | 7 +- .../features/Backups/BackupDrawer.test.tsx | 25 +++--- .../DatabaseCreateAccessControls.test.tsx | 12 ++- .../legacy/DatabaseBackupTableBody.tsx | 5 +- .../DatabaseMonitor/DatabaseMonitor.test.tsx | 2 + .../DatabaseMonitor/DatabaseMonitor.tsx | 4 +- ...abaseSettingsSuspendClusterDialog.test.tsx | 16 ++-- .../DatabaseSettingsUpgradeVersionDialog.tsx | 2 +- .../DatabaseLanding/DatabaseLandingTable.tsx | 9 +- .../features/Domains/DomainRecords.styles.ts | 13 +-- .../Rules/FirewallRuleDrawer.types.ts | 2 +- .../Rules/FirewallRuleTable.tsx | 2 +- .../features/IAM/Users/UserDetailsLanding.tsx | 8 +- .../manager/src/features/IAM/Users/Users.tsx | 5 +- .../Images/ImagesLanding/ImagesActionMenu.tsx | 7 +- .../ClusterList/KubernetesClusterRow.tsx | 3 +- .../Linodes/CloneLanding/Configs.test.tsx | 1 + .../Linodes/CloneLanding/Disks.test.tsx | 1 + .../Linodes/CloneLanding/utilities.ts | 6 +- .../LinodeBackup/ScheduleSettings.test.tsx | 8 +- .../LinodeIPAddresses.test.ts | 6 +- .../NetworkingSummaryPanel.tsx | 2 +- .../LinodeSettings/KernelSelect.test.tsx | 9 +- .../MigrateLinode/MigrationPricing.test.tsx | 5 +- .../ActiveConnections.test.tsx | 1 + .../DetailTabs/Apache/ApacheGraphs.tsx | 5 +- .../DetailTabs/Disks/Graphs.test.tsx | 1 + .../DetailTabs/IconSection.styles.tsx | 5 +- .../DetailTabs/Installation.tsx | 4 +- .../DetailTabs/LongviewDetailOverview.tsx | 15 ++-- .../OverviewGraphs/OverviewGraphs.tsx | 22 ++--- .../Processes/ProcessesTable.test.tsx | 1 + .../LongviewClientInstructions.tsx | 12 +-- .../LongviewLanding/LongviewClientRow.tsx | 18 ++-- .../LongviewLanding/LongviewLanding.tsx | 20 ++--- .../DashboardCard.styles.tsx | 2 +- .../ManagedDashboardCard.styles.tsx | 2 +- .../Managed/Monitors/IssueDay.styles.tsx | 2 +- .../Managed/Monitors/MonitorTable.styles.tsx | 2 +- .../Managed/SSHAccess/SSHAccessTable.tsx | 5 +- .../PlacementGroupsDeleteModal.test.tsx | 6 +- .../features/StackScripts/StackScripts.tsx | 2 +- .../TabbedReply/ReplyActions.tsx | 2 +- .../features/VPCs/VPCLanding/VPCLanding.tsx | 14 +-- .../src/features/VPCs/VPCLanding/VPCRow.tsx | 11 +-- packages/manager/src/hooks/useOrder.test.tsx | 4 +- .../manager/src/hooks/useUnassignLinode.ts | 2 +- .../manager/src/mocks/utilities/events.ts | 1 + packages/manager/src/queries/iam/iam.ts | 15 ++-- .../src/queries/networking/networking.ts | 2 +- .../src/queries/resources/resources.ts | 5 +- packages/manager/src/store/index.ts | 18 ++-- .../manager/src/utilities/betaUtils.test.ts | 41 +++++---- packages/manager/vite.config.ts | 4 +- 140 files changed, 696 insertions(+), 564 deletions(-) diff --git a/packages/manager/cypress.config.ts b/packages/manager/cypress.config.ts index 83903ec697c..429f8c2ce8c 100644 --- a/packages/manager/cypress.config.ts +++ b/packages/manager/cypress.config.ts @@ -1,24 +1,25 @@ /* eslint-disable no-console */ import { defineConfig } from 'cypress'; + import { setupPlugins } from './cypress/support/plugins'; +import { configureApi } from './cypress/support/plugins/configure-api'; import { configureBrowser } from './cypress/support/plugins/configure-browser'; import { configureFileWatching } from './cypress/support/plugins/configure-file-watching'; import { configureTestSuite } from './cypress/support/plugins/configure-test-suite'; import { discardPassedTestRecordings } from './cypress/support/plugins/discard-passed-test-recordings'; +import { featureFlagOverrides } from './cypress/support/plugins/feature-flag-override'; +import { fetchAccount } from './cypress/support/plugins/fetch-account'; +import { fetchLinodeRegions } from './cypress/support/plugins/fetch-linode-regions'; +import { generateTestWeights } from './cypress/support/plugins/generate-weights'; +import { enableJunitReport } from './cypress/support/plugins/junit-report'; import { loadEnvironmentConfig } from './cypress/support/plugins/load-env-config'; import { nodeVersionCheck } from './cypress/support/plugins/node-version-check'; +import { postRunCleanup } from './cypress/support/plugins/post-run-cleanup'; import { regionOverrideCheck } from './cypress/support/plugins/region-override-check'; -import { vitePreprocess } from './cypress/support/plugins/vite-preprocessor'; -import { configureApi } from './cypress/support/plugins/configure-api'; -import { fetchAccount } from './cypress/support/plugins/fetch-account'; -import { fetchLinodeRegions } from './cypress/support/plugins/fetch-linode-regions'; import { splitCypressRun } from './cypress/support/plugins/split-run'; -import { enableJunitReport } from './cypress/support/plugins/junit-report'; -import { generateTestWeights } from './cypress/support/plugins/generate-weights'; import { logTestTagInfo } from './cypress/support/plugins/test-tagging-info'; +import { vitePreprocess } from './cypress/support/plugins/vite-preprocessor'; import cypressViteConfig from './cypress/vite.config'; -import { featureFlagOverrides } from './cypress/support/plugins/feature-flag-override'; -import { postRunCleanup } from './cypress/support/plugins/post-run-cleanup'; /** * Exports a Cypress configuration object. @@ -26,41 +27,16 @@ import { postRunCleanup } from './cypress/support/plugins/post-run-cleanup'; * {@link https://docs.cypress.io/guides/references/configuration#Options | Cypress configuration documentation} */ export default defineConfig({ - trashAssetsBeforeRuns: false, - // Browser configuration. chromeWebSecurity: false, - viewportWidth: 1440, - viewportHeight: 900, - - // Timeouts. - requestTimeout: 30000, - responseTimeout: 80000, - defaultCommandTimeout: 80000, - pageLoadTimeout: 60000, - - // Recording and test troubleshooting. - projectId: '5rhsif', - screenshotOnRunFailure: true, - video: true, - - // Only retry test when running via CI. - retries: process.env['CI'] && !process.env['CY_TEST_DISABLE_RETRIES'] ? 2 : 0, - - experimentalMemoryManagement: true, component: { devServer: { - framework: 'react', bundler: 'vite', + framework: 'react', viteConfig: cypressViteConfig, }, indexHtmlFile: './cypress/support/component/index.html', - supportFile: './cypress/support/component/setup.tsx', - specPattern: './cypress/component/**/*.spec.tsx', - viewportWidth: 500, - viewportHeight: 500, - setupNodeEvents(on, config) { return setupPlugins(on, config, [ loadEnvironmentConfig, @@ -68,18 +44,20 @@ export default defineConfig({ enableJunitReport('Component', true), ]); }, - }, + specPattern: './cypress/component/**/*.spec.tsx', + supportFile: './cypress/support/component/setup.tsx', + viewportHeight: 500, + viewportWidth: 500, + }, + defaultCommandTimeout: 80000, e2e: { - experimentalRunAllSpecs: true, - // This can be overridden using `CYPRESS_BASE_URL`. baseUrl: 'http://localhost:3000', - // This is overridden when `CY_TEST_SUITE` is defined. - // See `cypress/support/plugins/configure-test-suite.ts`. - specPattern: 'cypress/e2e/core/**/*.spec.{ts,tsx}', + experimentalRunAllSpecs: true, + // This is overridden when `CY_TEST_SUITE` is defined. setupNodeEvents(on, config) { return setupPlugins(on, config, [ loadEnvironmentConfig, @@ -101,5 +79,28 @@ export default defineConfig({ postRunCleanup, ]); }, + + // See `cypress/support/plugins/configure-test-suite.ts`. + specPattern: 'cypress/e2e/core/**/*.spec.{ts,tsx}', }, + + experimentalMemoryManagement: true, + pageLoadTimeout: 60000, + // Recording and test troubleshooting. + projectId: '5rhsif', + // Timeouts. + requestTimeout: 30000, + + responseTimeout: 80000, + // Only retry test when running via CI. + retries: process.env['CI'] && !process.env['CY_TEST_DISABLE_RETRIES'] ? 2 : 0, + screenshotOnRunFailure: true, + + trashAssetsBeforeRuns: false, + + video: true, + + viewportHeight: 900, + + viewportWidth: 1440, }); diff --git a/packages/manager/cypress/component/poc/beta-chip.spec.tsx b/packages/manager/cypress/component/poc/beta-chip.spec.tsx index 962e9ccf2b4..58641a6e63b 100644 --- a/packages/manager/cypress/component/poc/beta-chip.spec.tsx +++ b/packages/manager/cypress/component/poc/beta-chip.spec.tsx @@ -1,7 +1,8 @@ import * as React from 'react'; -import { BetaChip } from 'src/components/BetaChip/BetaChip'; -import { componentTests, visualTests } from 'support/util/components'; import { checkComponentA11y } from 'support/util/accessibility'; +import { componentTests, visualTests } from 'support/util/components'; + +import { BetaChip } from 'src/components/BetaChip/BetaChip'; componentTests('BetaChip', () => { visualTests((mount) => { diff --git a/packages/manager/cypress/component/poc/region-select.spec.tsx b/packages/manager/cypress/component/poc/region-select.spec.tsx index e15411dece2..656d5dacaf3 100644 --- a/packages/manager/cypress/component/poc/region-select.spec.tsx +++ b/packages/manager/cypress/component/poc/region-select.spec.tsx @@ -1,11 +1,12 @@ import * as React from 'react'; -import { RegionSelect } from 'src/components/RegionSelect/RegionSelect'; -import { componentTests, visualTests } from 'support/util/components'; -import { checkComponentA11y } from 'support/util/accessibility'; -import { accountAvailabilityFactory, regionFactory } from 'src/factories'; -import { ui } from 'support/ui'; import { mockGetAccountAvailability } from 'support/intercepts/account'; +import { ui } from 'support/ui'; +import { checkComponentA11y } from 'support/util/accessibility'; import { createSpy } from 'support/util/components'; +import { componentTests, visualTests } from 'support/util/components'; + +import { RegionSelect } from 'src/components/RegionSelect/RegionSelect'; +import { accountAvailabilityFactory, regionFactory } from 'src/factories'; componentTests('RegionSelect', (mount) => { beforeEach(() => { @@ -24,10 +25,10 @@ componentTests('RegionSelect', (mount) => { mount( {}} + regions={[region]} + value={undefined} /> ); @@ -52,10 +53,10 @@ componentTests('RegionSelect', (mount) => { mount( {}} + regions={[region]} + value={undefined} /> ); @@ -81,10 +82,10 @@ componentTests('RegionSelect', (mount) => { mount( {}} + regions={[region]} + value={undefined} /> ); @@ -110,10 +111,10 @@ componentTests('RegionSelect', (mount) => { <> Other Element {}} + regions={[region]} + value={undefined} /> ); @@ -143,10 +144,10 @@ componentTests('RegionSelect', (mount) => { it('can select a region initially', () => { mount( {}} + regions={regions} + value={undefined} /> ); @@ -177,10 +178,10 @@ componentTests('RegionSelect', (mount) => { it('can change region selection', () => { mount( {}} + regions={regions} + value={regionToPreselect.id} /> ); @@ -212,10 +213,10 @@ componentTests('RegionSelect', (mount) => { it('can clear region selection', () => { mount( {}} + regions={regions} + value={regionToSelect.id} /> ); @@ -238,11 +239,11 @@ componentTests('RegionSelect', (mount) => { it('cannot clear region selection when clearable is disabled', () => { mount( {}} + regions={regions} + value={regionToSelect.id} /> ); @@ -258,10 +259,10 @@ componentTests('RegionSelect', (mount) => { it('cannot clear region selection when no region is selected', () => { mount( {}} + regions={regions} + value={undefined} /> ); @@ -275,10 +276,10 @@ componentTests('RegionSelect', (mount) => { const spyFn = createSpy(() => {}, 'changeSpy'); mount( ); @@ -299,10 +300,10 @@ componentTests('RegionSelect', (mount) => { const spyFn = createSpy(() => {}, 'changeSpy'); mount( ); @@ -343,10 +344,10 @@ componentTests('RegionSelect', (mount) => { // TODO Remove `dcGetWell` flag override when feature flag is removed from codebase. mount( {}} + regions={regions} + value={undefined} />, { dcGetWell: true, @@ -377,10 +378,10 @@ componentTests('RegionSelect', (mount) => { it('only lists regions with the specified capability', () => { mount( {}} + regions={regions} + value={undefined} /> ); @@ -406,10 +407,10 @@ componentTests('RegionSelect', (mount) => { it('lists all regions when no capability is specified', () => { mount( {}} + regions={regions} + value={undefined} /> ); @@ -436,10 +437,10 @@ componentTests('RegionSelect', (mount) => { it('passes aXe check when menu is closed without an item selected', () => { mount( {}} + regions={regions} + value={undefined} /> ); checkComponentA11y(); @@ -448,10 +449,10 @@ componentTests('RegionSelect', (mount) => { it('passes aXe check when menu is closed with an item selected', () => { mount( {}} + regions={regions} + value={selectedRegion.id} /> ); checkComponentA11y(); @@ -460,10 +461,10 @@ componentTests('RegionSelect', (mount) => { it('passes aXe check when menu is open', () => { mount( {}} + regions={regions} + value={selectedRegion.id} /> ); diff --git a/packages/manager/cypress/support/api/lke.ts b/packages/manager/cypress/support/api/lke.ts index 14ed8339749..dc2743b5316 100644 --- a/packages/manager/cypress/support/api/lke.ts +++ b/packages/manager/cypress/support/api/lke.ts @@ -1,17 +1,20 @@ import { - KubeNodePoolResponse, - KubernetesCluster, - PoolNodeResponse, deleteKubernetesCluster, getKubernetesClusters, getNodePools, } from '@linode/api-v4'; +import { DateTime } from 'luxon'; import { pageSize } from 'support/constants/api'; import { depaginate } from 'support/util/paginate'; -import { DateTime } from 'luxon'; import { isTestLabel } from './common'; +import type { + KubeNodePoolResponse, + KubernetesCluster, + PoolNodeResponse, +} from '@linode/api-v4'; + /** * Describes an LKE plan as shown in Cloud Manager. */ diff --git a/packages/manager/cypress/support/api/longview.ts b/packages/manager/cypress/support/api/longview.ts index 703ff8102b5..578e7329815 100644 --- a/packages/manager/cypress/support/api/longview.ts +++ b/packages/manager/cypress/support/api/longview.ts @@ -1,7 +1,9 @@ import { deleteLongviewClient, getLongviewClients } from '@linode/api-v4'; import { oauthToken, pageSize } from 'support/constants/api'; import { depaginate } from 'support/util/paginate'; + import { apiCheckErrors, isTestLabel } from './common'; + import type { LongviewClient } from '@linode/api-v4'; /** diff --git a/packages/manager/cypress/support/api/managed.ts b/packages/manager/cypress/support/api/managed.ts index 0cc8e5569ab..ff4d4d9744f 100644 --- a/packages/manager/cypress/support/api/managed.ts +++ b/packages/manager/cypress/support/api/managed.ts @@ -4,7 +4,9 @@ import { mockGetAccountSettings } from 'support/intercepts/account'; import { skip } from 'support/util/skip'; + import { accountSettingsFactory } from 'src/factories/accountSettings'; + import type { AccountSettings } from '@linode/api-v4'; // / Account object with Managed enabled for mocking API requests. diff --git a/packages/manager/cypress/support/api/nodebalancers.ts b/packages/manager/cypress/support/api/nodebalancers.ts index 37ff6c420d2..27a86c0f48f 100644 --- a/packages/manager/cypress/support/api/nodebalancers.ts +++ b/packages/manager/cypress/support/api/nodebalancers.ts @@ -5,8 +5,10 @@ import { depaginate } from 'support/util/paginate'; import { randomLabel } from 'support/util/random'; import { chooseRegion } from 'support/util/regions'; -import { isTestLabel } from './common'; import { nodeBalancerFactory } from 'src/factories'; + +import { isTestLabel } from './common'; + import type { NodeBalancer } from '@linode/api-v4'; export const makeNodeBalCreateReq = (nodeBal: NodeBalancer) => { diff --git a/packages/manager/cypress/support/api/tags.ts b/packages/manager/cypress/support/api/tags.ts index df740874f6c..37365d8d425 100644 --- a/packages/manager/cypress/support/api/tags.ts +++ b/packages/manager/cypress/support/api/tags.ts @@ -1,9 +1,10 @@ import { deleteTag, getTags } from '@linode/api-v4/lib/tags'; -import { Tag } from '@linode/api-v4'; import { pageSize } from 'support/constants/api'; import { entityTag } from 'support/constants/cypress'; import { depaginate } from 'support/util/paginate'; +import type { Tag } from '@linode/api-v4'; + /** * Delete all tags whose labels are prefixed "cy-test-". * diff --git a/packages/manager/cypress/support/api/volumes.ts b/packages/manager/cypress/support/api/volumes.ts index a52e4784f13..727318f7880 100644 --- a/packages/manager/cypress/support/api/volumes.ts +++ b/packages/manager/cypress/support/api/volumes.ts @@ -1,8 +1,11 @@ -import { Volume, deleteVolume, detachVolume, getVolumes } from '@linode/api-v4'; +import { deleteVolume, detachVolume, getVolumes } from '@linode/api-v4'; import { pageSize } from 'support/constants/api'; +import { SimpleBackoffMethod, attemptWithBackoff } from 'support/util/backoff'; import { depaginate } from 'support/util/paginate'; + import { isTestLabel } from './common'; -import { attemptWithBackoff, SimpleBackoffMethod } from 'support/util/backoff'; + +import type { Volume } from '@linode/api-v4'; /** * Delete all Volumes whose labels are prefixed "cy-test-". diff --git a/packages/manager/cypress/support/constants/databases.ts b/packages/manager/cypress/support/constants/databases.ts index e463f331750..3084cad83ce 100644 --- a/packages/manager/cypress/support/constants/databases.ts +++ b/packages/manager/cypress/support/constants/databases.ts @@ -1,13 +1,14 @@ +import { databaseEngineFactory, databaseTypeFactory } from '@src/factories'; +import { randomLabel } from 'support/util/random'; +import { chooseRegion } from 'support/util/regions'; + import type { ClusterSize, - Engine, - Region, DatabaseEngine, DatabaseType, + Engine, + Region, } from '@linode/api-v4'; -import { randomLabel } from 'support/util/random'; -import { chooseRegion } from 'support/util/regions'; -import { databaseEngineFactory, databaseTypeFactory } from '@src/factories'; export interface databaseClusterConfiguration { clusterSize: ClusterSize; @@ -24,19 +25,19 @@ export interface databaseClusterConfiguration { */ export const mockDatabaseEngineTypes: DatabaseEngine[] = [ databaseEngineFactory.build({ + deprecated: false, engine: 'mysql', version: '5', - deprecated: false, }), databaseEngineFactory.build({ + deprecated: false, engine: 'mysql', version: '8', - deprecated: false, }), databaseEngineFactory.build({ + deprecated: false, engine: 'postgresql', version: '13', - deprecated: false, }), ]; @@ -45,7 +46,7 @@ export const mockDatabaseEngineTypes: DatabaseEngine[] = [ export const mockDatabaseNodeTypes: DatabaseType[] = [ databaseTypeFactory.build({ class: 'nanode', - id: 'g6-nanode-1', + disk: 25600, engines: { mysql: [ { @@ -58,14 +59,14 @@ export const mockDatabaseNodeTypes: DatabaseType[] = [ }, ], }, + id: 'g6-nanode-1', + label: 'Nanode 1 GB', memory: 1024, - disk: 25600, vcpus: 1, - label: 'Nanode 1 GB', }), databaseTypeFactory.build({ class: 'dedicated', - id: 'g6-dedicated-2', + disk: 81920, engines: { mysql: [ { @@ -78,14 +79,14 @@ export const mockDatabaseNodeTypes: DatabaseType[] = [ }, ], }, + id: 'g6-dedicated-2', + label: 'Dedicated 4 GB', memory: 4096, - disk: 81920, vcpus: 2, - label: 'Dedicated 4 GB', }), databaseTypeFactory.build({ class: 'dedicated', - id: 'g6-dedicated-4', + disk: 163840, engines: { mysql: [ { @@ -98,14 +99,14 @@ export const mockDatabaseNodeTypes: DatabaseType[] = [ }, ], }, + id: 'g6-dedicated-4', + label: 'Dedicated 8 GB', memory: 8192, - disk: 163840, vcpus: 4, - label: 'Dedicated 8 GB', }), databaseTypeFactory.build({ class: 'dedicated', - id: 'g6-dedicated-8', + disk: 327680, engines: { mysql: [ { @@ -118,14 +119,14 @@ export const mockDatabaseNodeTypes: DatabaseType[] = [ }, ], }, + id: 'g6-dedicated-8', + label: 'Dedicated 16 GB', memory: 16384, - disk: 327680, vcpus: 6, - label: 'Dedicated 16 GB', }), databaseTypeFactory.build({ class: 'dedicated', - id: 'g6-dedicated-16', + disk: 655360, engines: { mysql: [ { @@ -137,14 +138,14 @@ export const mockDatabaseNodeTypes: DatabaseType[] = [ }, ], }, + id: 'g6-dedicated-16', + label: 'Dedicated 32 GB', memory: 32768, - disk: 655360, vcpus: 8, - label: 'Dedicated 32 GB', }), databaseTypeFactory.build({ class: 'dedicated', - id: 'g6-dedicated-32', + disk: 1310720, engines: { mysql: [ { @@ -157,14 +158,14 @@ export const mockDatabaseNodeTypes: DatabaseType[] = [ }, ], }, + id: 'g6-dedicated-32', + label: 'Dedicated 64 GB', memory: 65536, - disk: 1310720, vcpus: 16, - label: 'Dedicated 64 GB', }), databaseTypeFactory.build({ class: 'dedicated', - id: 'g6-dedicated-48', + disk: 1966080, engines: { mysql: [ { @@ -177,14 +178,14 @@ export const mockDatabaseNodeTypes: DatabaseType[] = [ }, ], }, + id: 'g6-dedicated-48', + label: 'Dedicated 96 GB', memory: 98304, - disk: 1966080, vcpus: 20, - label: 'Dedicated 96 GB', }), databaseTypeFactory.build({ class: 'standard', - id: 'g6-standard-1', + disk: 51200, engines: { mysql: [ { @@ -197,14 +198,14 @@ export const mockDatabaseNodeTypes: DatabaseType[] = [ }, ], }, - disk: 51200, + id: 'g6-standard-1', label: 'Linode 2 GB', memory: 2048, vcpus: 1, }), databaseTypeFactory.build({ class: 'standard', - id: 'g6-standard-2', + disk: 81920, engines: { mysql: [ { @@ -217,14 +218,14 @@ export const mockDatabaseNodeTypes: DatabaseType[] = [ }, ], }, - disk: 81920, + id: 'g6-standard-2', label: 'Linode 4 GB', memory: 4096, vcpus: 2, }), databaseTypeFactory.build({ class: 'standard', - id: 'g6-standard-4', + disk: 163840, engines: { mysql: [ { @@ -237,14 +238,14 @@ export const mockDatabaseNodeTypes: DatabaseType[] = [ }, ], }, - disk: 163840, + id: 'g6-standard-4', label: 'Linode 8 GB', memory: 8192, vcpus: 4, }), databaseTypeFactory.build({ class: 'standard', - id: 'g6-standard-6', + disk: 327680, engines: { mysql: [ { @@ -257,14 +258,14 @@ export const mockDatabaseNodeTypes: DatabaseType[] = [ }, ], }, - disk: 327680, + id: 'g6-standard-6', label: 'Linode 16 GB', memory: 16384, vcpus: 6, }), databaseTypeFactory.build({ class: 'standard', - id: 'g6-standard-8', + disk: 655360, engines: { mysql: [ { @@ -277,14 +278,14 @@ export const mockDatabaseNodeTypes: DatabaseType[] = [ }, ], }, - disk: 655360, + id: 'g6-standard-8', label: 'Linode 32 GB', memory: 32768, vcpus: 8, }), databaseTypeFactory.build({ class: 'standard', - id: 'g6-standard-16', + disk: 1310720, engines: { mysql: [ { @@ -297,14 +298,14 @@ export const mockDatabaseNodeTypes: DatabaseType[] = [ }, ], }, - disk: 1310720, + id: 'g6-standard-16', label: 'Linode 64 GB', memory: 65536, vcpus: 16, }), databaseTypeFactory.build({ class: 'standard', - id: 'g6-standard-20', + disk: 1966080, engines: { mysql: [ { @@ -317,7 +318,7 @@ export const mockDatabaseNodeTypes: DatabaseType[] = [ }, ], }, - disk: 1966080, + id: 'g6-standard-20', label: 'Linode 96 GB', memory: 98304, vcpus: 20, diff --git a/packages/manager/cypress/support/constants/user-permissions.ts b/packages/manager/cypress/support/constants/user-permissions.ts index 462f1033fa7..383f2acf244 100644 --- a/packages/manager/cypress/support/constants/user-permissions.ts +++ b/packages/manager/cypress/support/constants/user-permissions.ts @@ -1,15 +1,28 @@ import { randomLabel } from 'support/util/random'; + import { grantFactory, grantsFactory } from 'src/factories/grants'; + import type { Grants } from '@linode/api-v4'; /** * User permission grants with all permissions restricted. */ export const userPermissionsGrants: Grants = grantsFactory.build({ + database: grantFactory.buildList(1, { + label: randomLabel(), + permissions: null, + }), + domain: grantFactory.buildList(1, { + label: randomLabel(), + permissions: null, + }), + firewall: grantFactory.buildList(1, { + label: randomLabel(), + permissions: null, + }), global: { account_access: null, - cancel_account: false, - child_account_access: false, + add_databases: false, add_domains: false, add_firewalls: false, add_images: false, @@ -17,23 +30,12 @@ export const userPermissionsGrants: Grants = grantsFactory.build({ add_longview: false, add_nodebalancers: false, add_stackscripts: false, - add_databases: false, add_volumes: false, add_vpcs: false, + cancel_account: false, + child_account_access: false, longview_subscription: false, }, - database: grantFactory.buildList(1, { - label: randomLabel(), - permissions: null, - }), - domain: grantFactory.buildList(1, { - label: randomLabel(), - permissions: null, - }), - firewall: grantFactory.buildList(1, { - label: randomLabel(), - permissions: null, - }), image: grantFactory.buildList(1, { label: randomLabel(), permissions: null }), linode: grantFactory.buildList(1, { label: randomLabel(), diff --git a/packages/manager/cypress/support/e2e.ts b/packages/manager/cypress/support/e2e.ts index 5996d3d71aa..0bb3512524a 100644 --- a/packages/manager/cypress/support/e2e.ts +++ b/packages/manager/cypress/support/e2e.ts @@ -60,9 +60,9 @@ chai.use(function (chai, utils) { // Test setup. import { deleteInternalHeader } from './setup/delete-internal-header'; -import { mockFeatureFlagRequests } from './setup/mock-feature-flags-request'; import { mockFeatureFlagClientstream } from './setup/feature-flag-clientstream'; import { mockAccountRequest } from './setup/mock-account-request'; +import { mockFeatureFlagRequests } from './setup/mock-feature-flags-request'; import { trackApiRequests } from './setup/request-tracking'; trackApiRequests(); diff --git a/packages/manager/cypress/support/index.d.ts b/packages/manager/cypress/support/index.d.ts index eb5eb156ae5..333793456b1 100644 --- a/packages/manager/cypress/support/index.d.ts +++ b/packages/manager/cypress/support/index.d.ts @@ -1,6 +1,6 @@ -import type { mount } from 'cypress/react18'; -import { Labelable } from './commands'; +import type { Labelable } from './commands'; import type { LinodeVisitOptions } from './login.ts'; +import type { mount } from 'cypress/react18'; import type { TestTag } from 'support/util/tag'; declare global { @@ -10,6 +10,18 @@ declare global { } interface Chainable { + /** + * Adds tags for the given runnable. + * + * If tags have already been set (e.g. using a hook), this method will add + * the given tags in addition the tags that have already been set. + * + * Alias for `addTag()` in `support/util/tag.ts`. + * + * @param tags - Test tags. + */ + addTag(...tags: TestTag[]): void; + /** * Custom command to select DOM element by data-cy attribute. * @example cy.dataCy('greeting') @@ -28,31 +40,6 @@ declare global { | string ): Chainable<>; - /** - * Custom command to select DOM element by data-cy attribute. - * @example cy.dataCy('greeting') - */ - visitWithLogin( - url: string, - linodeOptions?: LinodeVisitOptions, - cypressOptions?: Partial - ): Chainable; - - /** - * Assigns a random page visit ID to the current page. - * - * Used to determine whether navigation has occurred later. - * - * @example - * // After initial call to `cy.visit()` or `cy.visitWithLogin()`: - * cy.trackPageVisit().as('pageVisit'); - * // Later in the tests, to assert that navigation has occurred: - * cy.expectNewPageVisit('@pageVisit'); - * - * @returns Cypress chainable that yields the random page visit ID. - */ - trackPageVisit(): Chainable; - /** * Asserts that a browser page visit (e.g. navigation or reload) has occurred. * @@ -68,6 +55,18 @@ declare global { */ expectNewPageVisit(alias: string): Chainable<>; + /** + * Mount a React component via `cypress/react`. + */ + mount: typeof mount; + + /** + * Internal Cypress command to retrieve test state. + * + * @param state - Cypress internal state to retrieve. + */ + state(state?: string): any; + /** * Sets tags for the current runnable. * @@ -78,28 +77,29 @@ declare global { tag(...tags: TestTag[]): void; /** - * Adds tags for the given runnable. - * - * If tags have already been set (e.g. using a hook), this method will add - * the given tags in addition the tags that have already been set. + * Assigns a random page visit ID to the current page. * - * Alias for `addTag()` in `support/util/tag.ts`. + * Used to determine whether navigation has occurred later. * - * @param tags - Test tags. - */ - addTag(...tags: TestTag[]): void; - - /** - * Internal Cypress command to retrieve test state. + * @example + * // After initial call to `cy.visit()` or `cy.visitWithLogin()`: + * cy.trackPageVisit().as('pageVisit'); + * // Later in the tests, to assert that navigation has occurred: + * cy.expectNewPageVisit('@pageVisit'); * - * @param state - Cypress internal state to retrieve. + * @returns Cypress chainable that yields the random page visit ID. */ - state(state?: string): any; + trackPageVisit(): Chainable; /** - * Mount a React component via `cypress/react`. + * Custom command to select DOM element by data-cy attribute. + * @example cy.dataCy('greeting') */ - mount: typeof mount; + visitWithLogin( + url: string, + linodeOptions?: LinodeVisitOptions, + cypressOptions?: Partial + ): Chainable; } } } diff --git a/packages/manager/cypress/support/intercepts/configs.ts b/packages/manager/cypress/support/intercepts/configs.ts index ca54fe8b6d5..1a7c41be87f 100644 --- a/packages/manager/cypress/support/intercepts/configs.ts +++ b/packages/manager/cypress/support/intercepts/configs.ts @@ -4,9 +4,10 @@ import { apiMatcher } from 'support/util/intercepts'; import { paginateResponse } from 'support/util/paginate'; -import { Config } from '@linode/api-v4'; import { makeResponse } from 'support/util/response'; +import type { Config } from '@linode/api-v4'; + /** * Intercepts GET request to fetch all configs for a given linode. * diff --git a/packages/manager/cypress/support/intercepts/databases.ts b/packages/manager/cypress/support/intercepts/databases.ts index 3f2c28fccb9..1c52746b664 100644 --- a/packages/manager/cypress/support/intercepts/databases.ts +++ b/packages/manager/cypress/support/intercepts/databases.ts @@ -2,17 +2,18 @@ * @file Cypress intercepts and mocks for Cloud Manager DBaaS operations. */ +import { makeErrorResponse } from 'support/util/errors'; +import { apiMatcher } from 'support/util/intercepts'; +import { paginateResponse } from 'support/util/paginate'; +import { randomString } from 'support/util/random'; +import { makeResponse } from 'support/util/response'; + import type { Database, DatabaseCredentials, DatabaseEngine, DatabaseType, } from '@linode/api-v4'; -import { makeErrorResponse } from 'support/util/errors'; -import { apiMatcher } from 'support/util/intercepts'; -import { paginateResponse } from 'support/util/paginate'; -import { makeResponse } from 'support/util/response'; -import { randomString } from 'support/util/random'; /** * Default message to use when performing operations on provisioning DBs. diff --git a/packages/manager/cypress/support/intercepts/feature-flags.ts b/packages/manager/cypress/support/intercepts/feature-flags.ts index d77ab55f531..be825b4b3bf 100644 --- a/packages/manager/cypress/support/intercepts/feature-flags.ts +++ b/packages/manager/cypress/support/intercepts/feature-flags.ts @@ -2,11 +2,11 @@ * @file Cypress intercepts and mocks for Cloud Manager feature flags. */ -import { getResponseDataFromMockData } from 'support/util/feature-flags'; import { - launchDarklyUrlPattern, launchDarklyClientstreamPattern, + launchDarklyUrlPattern, } from 'support/constants/feature-flags'; +import { getResponseDataFromMockData } from 'support/util/feature-flags'; import type { FeatureFlagMockData } from 'support/util/feature-flags'; diff --git a/packages/manager/cypress/support/intercepts/images.ts b/packages/manager/cypress/support/intercepts/images.ts index c9cdbd7c2f7..7046b4f2592 100644 --- a/packages/manager/cypress/support/intercepts/images.ts +++ b/packages/manager/cypress/support/intercepts/images.ts @@ -5,9 +5,9 @@ import { apiMatcher } from 'support/util/intercepts'; import { paginateResponse } from 'support/util/paginate'; import { getFilters } from 'support/util/request'; +import { makeResponse } from 'support/util/response'; import type { Image } from '@linode/api-v4'; -import { makeResponse } from 'support/util/response'; /** * Intercepts POST request to create a machine image and mocks the response. diff --git a/packages/manager/cypress/support/intercepts/longview.ts b/packages/manager/cypress/support/intercepts/longview.ts index 60ee3e6d0b8..aa36c73d3f6 100644 --- a/packages/manager/cypress/support/intercepts/longview.ts +++ b/packages/manager/cypress/support/intercepts/longview.ts @@ -1,7 +1,8 @@ import { apiMatcher } from 'support/util/intercepts'; import { paginateResponse } from 'support/util/paginate'; import { makeResponse } from 'support/util/response'; -import { LongviewClient, ActiveLongviewPlan } from '@linode/api-v4'; + +import type { ActiveLongviewPlan, LongviewClient } from '@linode/api-v4'; import type { LongviewAction, LongviewResponse, @@ -32,8 +33,8 @@ export const mockFetchLongviewStatus = ( ): Cypress.Chainable => { return cy.intercept( { - url: 'https://longview.linode.com/fetch', method: 'POST', + url: 'https://longview.linode.com/fetch', }, async (req) => { const payload = req.body; diff --git a/packages/manager/cypress/support/intercepts/support.ts b/packages/manager/cypress/support/intercepts/support.ts index 4b55900a614..d049cfe0074 100644 --- a/packages/manager/cypress/support/intercepts/support.ts +++ b/packages/manager/cypress/support/intercepts/support.ts @@ -3,10 +3,10 @@ */ import { apiMatcher } from 'support/util/intercepts'; -import { makeResponse } from 'support/util/response'; import { paginateResponse } from 'support/util/paginate'; +import { makeResponse } from 'support/util/response'; -import type { SupportTicket, SupportReply } from '@linode/api-v4'; +import type { SupportReply, SupportTicket } from '@linode/api-v4'; /** * Intercepts request to open a support ticket and mocks response. diff --git a/packages/manager/cypress/support/plugins/fetch-account.ts b/packages/manager/cypress/support/plugins/fetch-account.ts index 0262c5d3f16..30bdf1ef313 100644 --- a/packages/manager/cypress/support/plugins/fetch-account.ts +++ b/packages/manager/cypress/support/plugins/fetch-account.ts @@ -1,8 +1,8 @@ -import type { CypressPlugin } from './plugin'; -import { resolve, join } from 'path'; import { getAccountInfo, getAccountSettings, getProfile } from '@linode/api-v4'; import { readFileSync } from 'fs'; +import { join, resolve } from 'path'; +import type { CypressPlugin } from './plugin'; import type { Account } from '@linode/api-v4'; /** @@ -42,8 +42,7 @@ export const fetchAccount: CypressPlugin = async (_on, config) => { const cacheData = JSON.parse(cacheJson); if ('account' in cacheData) { - const accountCache = cacheData['account'] as Account; - return accountCache; + return cacheData['account'] as Account; } } catch (e) { // TODO Error message. @@ -59,7 +58,7 @@ export const fetchAccount: CypressPlugin = async (_on, config) => { // Fetch account info, falling back to offline cached data if it is // enabled and available. - let account: undefined | Account = undefined; + let account: Account | undefined = undefined; try { account = await getAccountInfo(); } catch (e) { diff --git a/packages/manager/cypress/support/plugins/post-run-cleanup.ts b/packages/manager/cypress/support/plugins/post-run-cleanup.ts index 6be94af0a30..7f0fcd5148b 100644 --- a/packages/manager/cypress/support/plugins/post-run-cleanup.ts +++ b/packages/manager/cypress/support/plugins/post-run-cleanup.ts @@ -1,16 +1,19 @@ -import { DateTime } from 'luxon'; -import { depaginate } from '../util/paginate'; -import { CypressPlugin } from './plugin'; - import { deleteFirewall, deleteKubernetesCluster, deleteLinode, - Firewall, getFirewalls, getKubernetesClusters, getLinodes, getNodePools, +} from '@linode/api-v4'; +import { DateTime } from 'luxon'; + +import { depaginate } from '../util/paginate'; + +import type { CypressPlugin } from './plugin'; +import type { + Firewall, KubeNodePoolResponse, KubernetesCluster, Linode, @@ -143,10 +146,10 @@ const deleteTestLkeClusters = async () => { * and their corresponding deletion function. */ const resourceCleanUpItems = [ - { name: 'Linodes', cleanUp: deleteTestLinodes }, + { cleanUp: deleteTestLinodes, name: 'Linodes' }, // TODO Remove LKE cluster clean up once M3-8656 is complete because cluster cleanup will no longer be necessary. - { name: 'LKE Clusters', cleanUp: deleteTestLkeClusters }, - { name: 'Firewalls', cleanUp: deleteTestFirewalls }, + { cleanUp: deleteTestLkeClusters, name: 'LKE Clusters' }, + { cleanUp: deleteTestFirewalls, name: 'Firewalls' }, ]; export const postRunCleanup: CypressPlugin = async (on) => { diff --git a/packages/manager/cypress/support/plugins/split-run.ts b/packages/manager/cypress/support/plugins/split-run.ts index eccb6c0e153..570d24733fe 100644 --- a/packages/manager/cypress/support/plugins/split-run.ts +++ b/packages/manager/cypress/support/plugins/split-run.ts @@ -2,10 +2,13 @@ * @file Allows parallelization without Cypress Cloud. */ +import { readFileSync } from 'fs'; import { globSync } from 'glob'; import { resolve } from 'path'; -import { readFileSync } from 'fs'; -import { SpecWeight, SpecWeights, specWeightsSchema } from './generate-weights'; + +import { specWeightsSchema } from './generate-weights'; + +import type { SpecWeight, SpecWeights } from './generate-weights'; import type { CypressPlugin } from './plugin'; /** @@ -28,8 +31,8 @@ interface WeightedRunnerSpecs { export const splitCypressRun: CypressPlugin = (_on, config) => { const { CY_TEST_SPLIT_RUN: splitRunEnabled, - CY_TEST_SPLIT_RUN_TOTAL: splitRunTotalRunners, CY_TEST_SPLIT_RUN_INDEX: splitRunRunnerIndex, + CY_TEST_SPLIT_RUN_TOTAL: splitRunTotalRunners, CY_TEST_SPLIT_RUN_WEIGHTS: splitRunWeightsPath, } = config.env; @@ -136,13 +139,13 @@ export const splitCypressRun: CypressPlugin = (_on, config) => { }; } return { - 'Test Weights': splitRunWeightsPath, - 'Total Test Weight': `${Math.round(totalWeight * 100) / 100}%`, 'Runner Test Weight': `${ Math.round(weightedSpecsForRunner.weight * 100) / 100 }%`, - 'Weighted Specs': weightedSpecs.length, + 'Test Weights': splitRunWeightsPath, + 'Total Test Weight': `${Math.round(totalWeight * 100) / 100}%`, 'Unweighted Specs': unweightedSpecs.length, + 'Weighted Specs': weightedSpecs.length, }; })(); diff --git a/packages/manager/cypress/support/plugins/test-tagging-info.ts b/packages/manager/cypress/support/plugins/test-tagging-info.ts index d44af4245ab..246d89a9b46 100644 --- a/packages/manager/cypress/support/plugins/test-tagging-info.ts +++ b/packages/manager/cypress/support/plugins/test-tagging-info.ts @@ -1,10 +1,11 @@ -import { CypressPlugin } from './plugin'; import { - validateQuery, getHumanReadableQueryRules, getQueryRules, + validateQuery, } from '../util/tag'; +import type { CypressPlugin } from './plugin'; + const envVarName = 'CY_TEST_TAGS'; export const logTestTagInfo: CypressPlugin = (_on, config) => { if (config.env[envVarName]) { diff --git a/packages/manager/cypress/support/setup/defer-command.ts b/packages/manager/cypress/support/setup/defer-command.ts index a667d505030..778cd6a7248 100644 --- a/packages/manager/cypress/support/setup/defer-command.ts +++ b/packages/manager/cypress/support/setup/defer-command.ts @@ -1,6 +1,7 @@ +import { timeout } from 'support/util/backoff'; + import type { APIError } from '@linode/api-v4'; import type { AxiosError } from 'axios'; -import { timeout } from 'support/util/backoff'; type LinodeApiV4Error = { errors: APIError[]; diff --git a/packages/manager/cypress/support/setup/login-command.ts b/packages/manager/cypress/support/setup/login-command.ts index 35b6a151eb4..349e2e5a2db 100644 --- a/packages/manager/cypress/support/setup/login-command.ts +++ b/packages/manager/cypress/support/setup/login-command.ts @@ -1,8 +1,9 @@ -import type { UserPreferences } from '@linode/api-v4'; import { DateTime } from 'luxon'; import { oauthToken } from 'support/constants/api'; import { apiMatcher } from 'support/util/intercepts'; +import type { UserPreferences } from '@linode/api-v4'; + const overrideLocalStorage = ( window: Window, storageOverrides: Record @@ -66,6 +67,7 @@ Cypress.Commands.add( Cypress.on('uncaught:exception', (_err, _runnable) => false); const opt = { + failOnStatusCode: false, onBeforeLoad: (win: Window) => { _loginWithToken(win); if (resolvedLinodeOptions.localStorageOverrides) { @@ -75,7 +77,6 @@ Cypress.Commands.add( ); } }, - failOnStatusCode: false, }; if (resolvedLinodeOptions.preferenceOverrides) { diff --git a/packages/manager/cypress/support/setup/mock-account-request.ts b/packages/manager/cypress/support/setup/mock-account-request.ts index 6818c88b612..f803594e3cf 100644 --- a/packages/manager/cypress/support/setup/mock-account-request.ts +++ b/packages/manager/cypress/support/setup/mock-account-request.ts @@ -1,9 +1,10 @@ /** * @file Mocks Linode APIv4 account request to improve performance. */ -import type { Account } from '@linode/api-v4'; import { mockGetAccount } from 'support/intercepts/account'; +import type { Account } from '@linode/api-v4'; + /** * Mocks the Linode API account info GET request to improve performance. * diff --git a/packages/manager/cypress/support/ui/autocomplete.ts b/packages/manager/cypress/support/ui/autocomplete.ts index ff7f4a318d2..0b84262dd13 100644 --- a/packages/manager/cypress/support/ui/autocomplete.ts +++ b/packages/manager/cypress/support/ui/autocomplete.ts @@ -1,7 +1,7 @@ import { getRegionById, getRegionByLabel } from 'support/util/regions'; -import type { SelectorMatcherOptions } from '@testing-library/cypress'; import type { Region } from '@linode/api-v4'; +import type { SelectorMatcherOptions } from '@testing-library/cypress'; /** * Returns a regular expression object to match against region select items. @@ -61,7 +61,7 @@ export const autocompletePopper = { * Finds an item within an autocomplete popper that has the given title. */ findByTitle: ( - title: string | RegExp, + title: RegExp | string, options?: SelectorMatcherOptions ): Cypress.Chainable => { return ( diff --git a/packages/manager/cypress/support/util/cleanup.ts b/packages/manager/cypress/support/util/cleanup.ts index f9696458e8d..99be52b8d9c 100644 --- a/packages/manager/cypress/support/util/cleanup.ts +++ b/packages/manager/cypress/support/util/cleanup.ts @@ -10,10 +10,10 @@ import { deleteAllTestAccessKeys, deleteAllTestBuckets, } from 'support/api/objectStorage'; +import { deleteAllTestSSHKeys } from 'support/api/profile'; import { deleteAllTestStackScripts } from 'support/api/stackscripts'; import { deleteAllTestTags } from 'support/api/tags'; import { deleteAllTestVolumes } from 'support/api/volumes'; -import { deleteAllTestSSHKeys } from 'support/api/profile'; /** Types of resources that can be cleaned up. */ export type CleanUpResource = @@ -27,8 +27,8 @@ export type CleanUpResource = | 'obj-access-keys' | 'obj-buckets' | 'service-transfers' - | 'stackscripts' | 'ssh-keys' + | 'stackscripts' | 'tags' | 'volumes'; @@ -49,8 +49,8 @@ const cleanUpMap: CleanUpMap = { 'obj-access-keys': () => deleteAllTestAccessKeys(), 'obj-buckets': () => deleteAllTestBuckets(), 'service-transfers': () => cancelAllTestEntityTransfers(), - stackscripts: () => deleteAllTestStackScripts(), 'ssh-keys': () => deleteAllTestSSHKeys(), + stackscripts: () => deleteAllTestStackScripts(), tags: () => deleteAllTestTags(), volumes: () => deleteAllTestVolumes(), }; diff --git a/packages/manager/cypress/support/util/kernels.ts b/packages/manager/cypress/support/util/kernels.ts index 0df35d498ea..74f2c49bbbf 100644 --- a/packages/manager/cypress/support/util/kernels.ts +++ b/packages/manager/cypress/support/util/kernels.ts @@ -3,9 +3,10 @@ */ import { getLinodeKernels } from '@linode/api-v4'; -import { depaginate } from './paginate'; import { pageSize } from 'support/constants/api'; +import { depaginate } from './paginate'; + import type { Kernel } from '@linode/api-v4'; /** diff --git a/packages/manager/cypress/support/util/polling.ts b/packages/manager/cypress/support/util/polling.ts index d188b2b1ba1..9cf92071a33 100644 --- a/packages/manager/cypress/support/util/polling.ts +++ b/packages/manager/cypress/support/util/polling.ts @@ -2,30 +2,30 @@ * @file Utilities for polling APIs and other resources. */ -import type { - Disk, - ImageStatus, - LinodeStatus, - VolumeStatus, -} from '@linode/api-v4'; - -import { pageSize } from 'support/constants/api'; import { getImage, getLinode, getLinodeDisk, - getVolume, getLinodeDisks, + getVolume, } from '@linode/api-v4'; +import { pageSize } from 'support/constants/api'; import { BackoffMethod, - BackoffOptions, FibonacciBackoffMethod, attemptWithBackoff, } from './backoff'; import { depaginate } from './paginate'; +import type { BackoffOptions } from './backoff'; +import type { + Disk, + ImageStatus, + LinodeStatus, + VolumeStatus, +} from '@linode/api-v4'; + /** * Describes a backoff configuration for a poll. This may be a partial BackoffOptions object, * an instance of a BackoffMethod implementation, or undefined. diff --git a/packages/manager/cypress/support/util/regions.ts b/packages/manager/cypress/support/util/regions.ts index 888fd547c46..02ebc33fa22 100644 --- a/packages/manager/cypress/support/util/regions.ts +++ b/packages/manager/cypress/support/util/regions.ts @@ -1,7 +1,9 @@ import { randomItem } from 'support/util/random'; -import { buildArray, shuffleArray } from './arrays'; + import { getNewRegionLabel } from 'src/components/RegionSelect/RegionSelect.utils'; +import { buildArray, shuffleArray } from './arrays'; + import type { Capabilities, Region } from '@linode/api-v4'; /** @@ -31,7 +33,7 @@ export interface ExtendedRegion extends Region { * @returns `true` if `region` is an `ExtendedRegion` instance, `false` otherwise. */ export const isExtendedRegion = ( - region: Region | ExtendedRegion + region: ExtendedRegion | Region ): region is ExtendedRegion => { if ('apiLabel' in region) { return true; @@ -50,13 +52,13 @@ export const isExtendedRegion = ( * @returns `ExtendedRegion` object for `region`. */ export const extendRegion = ( - region: Region | ExtendedRegion + region: ExtendedRegion | Region ): ExtendedRegion => { if (!isExtendedRegion(region)) { return { ...region, - label: getNewRegionLabel(region), apiLabel: region.label, + label: getNewRegionLabel(region), }; } return region; @@ -73,14 +75,14 @@ export const getRegionFromExtendedRegion = ( extendedRegion: ExtendedRegion ): Region => { return { + capabilities: extendedRegion.capabilities, + country: extendedRegion.country, id: extendedRegion.id, label: extendedRegion.apiLabel, - country: extendedRegion.country, - capabilities: extendedRegion.capabilities, placement_group_limits: extendedRegion.placement_group_limits, - status: extendedRegion.status, resolvers: extendedRegion.resolvers, site_type: extendedRegion.site_type, + status: extendedRegion.status, }; }; diff --git a/packages/manager/cypress/support/util/tag.ts b/packages/manager/cypress/support/util/tag.ts index 9be33d52a39..5a418da12f8 100644 --- a/packages/manager/cypress/support/util/tag.ts +++ b/packages/manager/cypress/support/util/tag.ts @@ -1,6 +1,7 @@ -import type { Context } from 'mocha'; import { removeDuplicates } from './arrays'; +import type { Context } from 'mocha'; + const queryRegex = /(?:-|\+)?([^\s]+)/g; /** @@ -16,15 +17,15 @@ export type TestTag = // Describes additional uses for which a test may serve. // For example, a test which creates a Linode end-to-end could be useful for // DC testing purposes even if that is not the primary purpose of the test. + | 'method:e2e' + | 'method:mock' | 'purpose:dcTesting' - | 'purpose:smokeTesting' - | 'purpose:syntheticTesting' // Method-related tags. // Describe the way the tests operate -- either end-to-end using real API requests, // or integration using mocked API requests. - | 'method:e2e' - | 'method:mock'; + | 'purpose:smokeTesting' + | 'purpose:syntheticTesting'; /** * @@ -106,7 +107,7 @@ export const validateQuery = (query: string) => { */ export const getQueryRules = (query: string) => { return (query.match(queryRegex) ?? []).map((rule: string) => { - if (!['-', '+'].includes(rule[0]) || rule.length === 1) { + if (!['+', '-'].includes(rule[0]) || rule.length === 1) { return `+${rule}`; } return rule; diff --git a/packages/manager/src/MainContent.tsx b/packages/manager/src/MainContent.tsx index e0bfc2f2af3..59446f06fe4 100644 --- a/packages/manager/src/MainContent.tsx +++ b/packages/manager/src/MainContent.tsx @@ -30,6 +30,7 @@ import { sessionExpirationContext } from './context/sessionExpirationContext'; import { switchAccountSessionContext } from './context/switchAccountSessionContext'; import { useIsACLPEnabled } from './features/CloudPulse/Utils/utils'; import { useIsDatabasesEnabled } from './features/Databases/utilities'; +import { useIsIAMEnabled } from './features/IAM/Shared/utilities'; import { useIsPlacementGroupsEnabled } from './features/PlacementGroups/utils'; import { useGlobalErrors } from './hooks/useGlobalErrors'; import { useAccountSettings } from './queries/account/settings'; @@ -38,7 +39,6 @@ import { migrationRouter } from './routes'; import type { Theme } from '@mui/material/styles'; import type { AnyRouter } from '@tanstack/react-router'; -import { useIsIAMEnabled } from './features/IAM/Shared/utilities'; const useStyles = makeStyles()((theme: Theme) => ({ activationWrapper: { diff --git a/packages/manager/src/components/CheckoutBar/DisplaySectionList.tsx b/packages/manager/src/components/CheckoutBar/DisplaySectionList.tsx index ad365e380a1..c1f18bb6109 100644 --- a/packages/manager/src/components/CheckoutBar/DisplaySectionList.tsx +++ b/packages/manager/src/components/CheckoutBar/DisplaySectionList.tsx @@ -1,6 +1,6 @@ +import { Divider } from '@linode/ui'; import * as React from 'react'; -import { Divider } from '@linode/ui'; import { DisplaySection } from './DisplaySection'; interface DisplaySectionListProps { diff --git a/packages/manager/src/components/EntityHeader/EntityHeader.test.tsx b/packages/manager/src/components/EntityHeader/EntityHeader.test.tsx index fb71431f560..e523d276d58 100644 --- a/packages/manager/src/components/EntityHeader/EntityHeader.test.tsx +++ b/packages/manager/src/components/EntityHeader/EntityHeader.test.tsx @@ -4,7 +4,7 @@ import { renderWithTheme } from 'src/utilities/testHelpers'; import { EntityHeader } from './EntityHeader'; -import { HeaderProps } from './EntityHeader'; +import type { HeaderProps } from './EntityHeader'; const mockText = 'Hello world'; @@ -15,7 +15,7 @@ const defaultProps: HeaderProps = { describe('EntityHeader', () => { it('should render title with variant when isSummaryView is True', () => { const { getByRole } = renderWithTheme( - + ); const heading = getByRole('heading', { level: 2 }); expect(heading).toBeInTheDocument(); diff --git a/packages/manager/src/components/EntityIcon/EntityIcon.stories.tsx b/packages/manager/src/components/EntityIcon/EntityIcon.stories.tsx index f93191f3f4a..90beb501c17 100644 --- a/packages/manager/src/components/EntityIcon/EntityIcon.stories.tsx +++ b/packages/manager/src/components/EntityIcon/EntityIcon.stories.tsx @@ -1,5 +1,5 @@ -import Grid from '@mui/material/Unstable_Grid2'; import { styled } from '@mui/material/styles'; +import Grid from '@mui/material/Unstable_Grid2'; import React from 'react'; import { EntityIcon } from 'src/components/EntityIcon/EntityIcon'; diff --git a/packages/manager/src/components/MultipleIPInput/MultipleIPInput.test.tsx b/packages/manager/src/components/MultipleIPInput/MultipleIPInput.test.tsx index 06c123078b4..24926405c37 100644 --- a/packages/manager/src/components/MultipleIPInput/MultipleIPInput.test.tsx +++ b/packages/manager/src/components/MultipleIPInput/MultipleIPInput.test.tsx @@ -2,6 +2,7 @@ import { fireEvent } from '@testing-library/react'; import * as React from 'react'; import { renderWithTheme } from 'src/utilities/testHelpers'; + import { MultipleIPInput } from './MultipleIPInput'; const baseProps = { @@ -57,7 +58,7 @@ describe('MultipleIPInput', () => { ...baseProps, ips: [{ address: 'ip1' }, { address: 'ip2' }], }; - const { getByTestId, getByLabelText, getByText } = renderWithTheme( + const { getByLabelText, getByTestId, getByText } = renderWithTheme( ); const ip0 = getByLabelText('domain-transfer-ip-0'); @@ -77,7 +78,7 @@ describe('MultipleIPInput', () => { disabled: true, ips: [{ address: 'ip1' }, { address: 'ip2' }], }; - const { getByTestId, getByLabelText, getByText } = renderWithTheme( + const { getByLabelText, getByTestId, getByText } = renderWithTheme( ); const ip0 = getByLabelText('domain-transfer-ip-0'); diff --git a/packages/manager/src/components/PaymentMethodRow/DeletePaymentMethodDialog.tsx b/packages/manager/src/components/PaymentMethodRow/DeletePaymentMethodDialog.tsx index 98647776f47..be2c52b2318 100644 --- a/packages/manager/src/components/PaymentMethodRow/DeletePaymentMethodDialog.tsx +++ b/packages/manager/src/components/PaymentMethodRow/DeletePaymentMethodDialog.tsx @@ -1,5 +1,4 @@ -import { PaymentMethod } from '@linode/api-v4/lib/account/types'; -import { Theme } from '@mui/material/styles'; +import Grid from '@mui/material/Unstable_Grid2/Grid2'; import * as React from 'react'; import { makeStyles } from 'tss-react/mui'; @@ -7,9 +6,11 @@ import { ConfirmationDialog } from 'src/components/ConfirmationDialog/Confirmati import CreditCard from 'src/features/Billing/BillingPanels/BillingSummary/PaymentDrawer/CreditCard'; import { ActionsPanel } from '../ActionsPanel/ActionsPanel'; -import Grid from '@mui/material/Unstable_Grid2/Grid2'; import { ThirdPartyPayment } from './ThirdPartyPayment'; +import type { PaymentMethod } from '@linode/api-v4/lib/account/types'; +import type { Theme } from '@mui/material/styles'; + export const useStyles = makeStyles()((theme: Theme) => ({ container: { flexWrap: 'nowrap', diff --git a/packages/manager/src/components/PaymentMethodRow/PaymentMethodRow.tsx b/packages/manager/src/components/PaymentMethodRow/PaymentMethodRow.tsx index 84e8075e038..bf347087373 100644 --- a/packages/manager/src/components/PaymentMethodRow/PaymentMethodRow.tsx +++ b/packages/manager/src/components/PaymentMethodRow/PaymentMethodRow.tsx @@ -1,4 +1,4 @@ -import { Box, Paper, Chip } from '@linode/ui'; +import { Box, Chip, Paper } from '@linode/ui'; import { useTheme } from '@mui/material/styles'; import { useSnackbar } from 'notistack'; import * as React from 'react'; @@ -9,6 +9,7 @@ import CreditCard from 'src/features/Billing/BillingPanels/BillingSummary/Paymen import { useMakeDefaultPaymentMethodMutation } from 'src/queries/account/payment'; import { ThirdPartyPayment } from './ThirdPartyPayment'; + import type { PaymentMethod } from '@linode/api-v4/lib/account/types'; import type { Action } from 'src/components/ActionMenu/ActionMenu'; diff --git a/packages/manager/src/components/PrimaryNav/PrimaryNav.tsx b/packages/manager/src/components/PrimaryNav/PrimaryNav.tsx index f968da8fd05..f73e715310e 100644 --- a/packages/manager/src/components/PrimaryNav/PrimaryNav.tsx +++ b/packages/manager/src/components/PrimaryNav/PrimaryNav.tsx @@ -1,18 +1,19 @@ import { Box } from '@linode/ui'; import Grid from '@mui/material/Unstable_Grid2'; import * as React from 'react'; -import { Link } from 'react-router-dom'; import { useLocation } from 'react-router-dom'; +import { Link } from 'react-router-dom'; import Storage from 'src/assets/icons/entityIcons/bucket.svg'; import Database from 'src/assets/icons/entityIcons/database.svg'; +import IAM from 'src/assets/icons/entityIcons/iam.svg'; import Linode from 'src/assets/icons/entityIcons/linode.svg'; import NodeBalancer from 'src/assets/icons/entityIcons/nodebalancer.svg'; import Longview from 'src/assets/icons/longview.svg'; import More from 'src/assets/icons/more.svg'; -import IAM from 'src/assets/icons/entityIcons/iam.svg'; import { useIsACLPEnabled } from 'src/features/CloudPulse/Utils/utils'; import { useIsDatabasesEnabled } from 'src/features/Databases/utilities'; +import { useIsIAMEnabled } from 'src/features/IAM/Shared/utilities'; import { useIsPlacementGroupsEnabled } from 'src/features/PlacementGroups/utils'; import { useFlags } from 'src/hooks/useFlags'; import { useAccountSettings } from 'src/queries/account/settings'; @@ -32,7 +33,6 @@ import { import { linkIsActive } from './utils'; import type { PrimaryLink as PrimaryLinkType } from './PrimaryLink'; -import { useIsIAMEnabled } from 'src/features/IAM/Shared/utilities'; export type NavEntity = | 'Account' @@ -91,7 +91,7 @@ export const PrimaryNav = (props: PrimaryNavProps) => { const { isPlacementGroupsEnabled } = useIsPlacementGroupsEnabled(); const { isDatabasesEnabled, isDatabasesV2Beta } = useIsDatabasesEnabled(); - const { isIAMEnabled, isIAMBeta } = useIsIAMEnabled(); + const { isIAMBeta, isIAMEnabled } = useIsIAMEnabled(); const { data: preferences } = usePreferences(); const { mutateAsync: updatePreferences } = useMutatePreferences(); diff --git a/packages/manager/src/components/RegionSelect/RegionSelect.tsx b/packages/manager/src/components/RegionSelect/RegionSelect.tsx index c7a6efd3afa..e5b118cf635 100644 --- a/packages/manager/src/components/RegionSelect/RegionSelect.tsx +++ b/packages/manager/src/components/RegionSelect/RegionSelect.tsx @@ -1,7 +1,7 @@ +import { Autocomplete } from '@linode/ui'; import { createFilterOptions } from '@mui/material/Autocomplete'; import * as React from 'react'; -import { Autocomplete } from '@linode/ui'; import { Flag } from 'src/components/Flag'; import { useIsGeckoEnabled } from 'src/components/RegionSelect/RegionSelect.utils'; import { useAllAccountAvailabilitiesQuery } from 'src/queries/account/availability'; diff --git a/packages/manager/src/components/TransferDisplay/TransferDisplay.test.tsx b/packages/manager/src/components/TransferDisplay/TransferDisplay.test.tsx index 91e55b6569c..79044cd590d 100644 --- a/packages/manager/src/components/TransferDisplay/TransferDisplay.test.tsx +++ b/packages/manager/src/components/TransferDisplay/TransferDisplay.test.tsx @@ -2,14 +2,14 @@ import { fireEvent } from '@testing-library/react'; import React from 'react'; import { accountTransferFactory } from 'src/factories/account'; -import { http, HttpResponse, server } from 'src/mocks/testServer'; +import { HttpResponse, http, server } from 'src/mocks/testServer'; import { renderWithTheme } from 'src/utilities/testHelpers'; -import { TransferDisplay } from './TransferDisplay'; import { TRANSFER_DISPLAY_BUTTON, TRANSFER_DISPLAY_GENERAL_POOL, } from './constants'; +import { TransferDisplay } from './TransferDisplay'; import type { TransferDataOptions } from './utils'; diff --git a/packages/manager/src/containers/profile.container.ts b/packages/manager/src/containers/profile.container.ts index 0ba0c0d0b29..44e540d2029 100644 --- a/packages/manager/src/containers/profile.container.ts +++ b/packages/manager/src/containers/profile.container.ts @@ -1,10 +1,11 @@ -import { Grants, Profile } from '@linode/api-v4/lib'; -import { APIError } from '@linode/api-v4/lib/types'; import * as React from 'react'; -import { UseQueryResult } from '@tanstack/react-query'; import { useGrants, useProfile } from 'src/queries/profile/profile'; +import type { Grants, Profile } from '@linode/api-v4/lib'; +import type { APIError } from '@linode/api-v4/lib/types'; +import type { UseQueryResult } from '@tanstack/react-query'; + export interface WithProfileProps { grants: UseQueryResult; profile: UseQueryResult; diff --git a/packages/manager/src/containers/withQueryClient.container.tsx b/packages/manager/src/containers/withQueryClient.container.tsx index 06a70807e3b..68cc446af97 100644 --- a/packages/manager/src/containers/withQueryClient.container.tsx +++ b/packages/manager/src/containers/withQueryClient.container.tsx @@ -1,5 +1,7 @@ +import { useQueryClient } from '@tanstack/react-query'; import React from 'react'; -import { QueryClient, useQueryClient } from '@tanstack/react-query'; + +import type { QueryClient } from '@tanstack/react-query'; export interface WithQueryClientProps { queryClient: QueryClient; diff --git a/packages/manager/src/factories/accountAgreements.ts b/packages/manager/src/factories/accountAgreements.ts index e14f1db920f..e90336cafec 100644 --- a/packages/manager/src/factories/accountAgreements.ts +++ b/packages/manager/src/factories/accountAgreements.ts @@ -1,6 +1,7 @@ -import { Agreements } from '@linode/api-v4/lib/account'; import Factory from 'src/factories/factoryProxy'; +import type { Agreements } from '@linode/api-v4/lib/account'; + export const accountAgreementsFactory = Factory.Sync.makeFactory({ eu_model: false, privacy_policy: true, diff --git a/packages/manager/src/factories/accountAvailability.ts b/packages/manager/src/factories/accountAvailability.ts index 3196a439674..c935cb09011 100644 --- a/packages/manager/src/factories/accountAvailability.ts +++ b/packages/manager/src/factories/accountAvailability.ts @@ -1,8 +1,8 @@ -import { AccountAvailability } from '@linode/api-v4'; import Factory from 'src/factories/factoryProxy'; - import { pickRandom } from 'src/utilities/random'; +import type { AccountAvailability } from '@linode/api-v4'; + export const accountAvailabilityFactory = Factory.Sync.makeFactory( { region: pickRandom(['us-mia', 'ap-south', 'ap-northeast']), diff --git a/packages/manager/src/factories/accountLogin.ts b/packages/manager/src/factories/accountLogin.ts index e4f36ab9cce..9fe55df146f 100644 --- a/packages/manager/src/factories/accountLogin.ts +++ b/packages/manager/src/factories/accountLogin.ts @@ -1,6 +1,7 @@ -import { AccountLogin } from '@linode/api-v4'; import Factory from 'src/factories/factoryProxy'; +import type { AccountLogin } from '@linode/api-v4'; + export const accountLoginFactory = Factory.Sync.makeFactory({ datetime: '2021-05-21T14:27:51', id: Factory.each((id) => id), diff --git a/packages/manager/src/factories/accountMaintenance.ts b/packages/manager/src/factories/accountMaintenance.ts index 987769b936a..c128881a7e9 100644 --- a/packages/manager/src/factories/accountMaintenance.ts +++ b/packages/manager/src/factories/accountMaintenance.ts @@ -1,8 +1,8 @@ -import { AccountMaintenance } from '@linode/api-v4/lib/account/types'; import Factory from 'src/factories/factoryProxy'; - import { pickRandom, randomDate } from 'src/utilities/random'; +import type { AccountMaintenance } from '@linode/api-v4/lib/account/types'; + export const accountMaintenanceFactory = Factory.Sync.makeFactory( { entity: Factory.each((id) => diff --git a/packages/manager/src/factories/accountOAuth.ts b/packages/manager/src/factories/accountOAuth.ts index 37c380efea6..a05807bbc43 100644 --- a/packages/manager/src/factories/accountOAuth.ts +++ b/packages/manager/src/factories/accountOAuth.ts @@ -1,6 +1,7 @@ -import { OAuthClient } from '@linode/api-v4'; import Factory from 'src/factories/factoryProxy'; +import type { OAuthClient } from '@linode/api-v4'; + export const oauthClientFactory = Factory.Sync.makeFactory({ id: Factory.each((id) => String(id)), label: Factory.each((id) => `oauth-client-${id}`), diff --git a/packages/manager/src/factories/accountPayment.ts b/packages/manager/src/factories/accountPayment.ts index 844613a1367..87105322162 100644 --- a/packages/manager/src/factories/accountPayment.ts +++ b/packages/manager/src/factories/accountPayment.ts @@ -1,6 +1,7 @@ -import { PaymentMethod } from '@linode/api-v4'; import Factory from 'src/factories/factoryProxy'; +import type { PaymentMethod } from '@linode/api-v4'; + export const paymentMethodFactory = Factory.Sync.makeFactory({ created: '2021-05-21T14:27:51', data: { diff --git a/packages/manager/src/factories/accountPermissions.ts b/packages/manager/src/factories/accountPermissions.ts index 70d1d56bf88..eaa5086c436 100644 --- a/packages/manager/src/factories/accountPermissions.ts +++ b/packages/manager/src/factories/accountPermissions.ts @@ -1,6 +1,7 @@ -import { IamAccountPermissions } from '@linode/api-v4'; import Factory from 'src/factories/factoryProxy'; +import type { IamAccountPermissions } from '@linode/api-v4'; + export const accountPermissionsFactory = Factory.Sync.makeFactory( { account_access: [ @@ -8,9 +9,9 @@ export const accountPermissionsFactory = Factory.Sync.makeFactory( [ { resource_type: 'linode', resources: [ { - name: 'debian-us-123', id: 12345678, + name: 'debian-us-123', }, { - name: 'linode-uk-123', id: 23456789, + name: 'linode-uk-123', }, ], }, @@ -20,8 +21,8 @@ export const accountResourcesFactory = Factory.Sync.makeFactory( { backups_enabled: false, diff --git a/packages/manager/src/factories/accountUsers.ts b/packages/manager/src/factories/accountUsers.ts index 49e8e968db1..1633114c032 100644 --- a/packages/manager/src/factories/accountUsers.ts +++ b/packages/manager/src/factories/accountUsers.ts @@ -1,6 +1,7 @@ -import { User } from '@linode/api-v4'; import Factory from 'src/factories/factoryProxy'; +import type { User } from '@linode/api-v4'; + export const accountUserFactory = Factory.Sync.makeFactory({ email: 'support@linode.com', last_login: null, diff --git a/packages/manager/src/factories/betas.ts b/packages/manager/src/factories/betas.ts index 80041895527..b8f1a80975f 100644 --- a/packages/manager/src/factories/betas.ts +++ b/packages/manager/src/factories/betas.ts @@ -1,20 +1,22 @@ -import { Beta, AccountBeta } from '@linode/api-v4'; -import Factory from 'src/factories/factoryProxy'; import { DateTime } from 'luxon'; +import Factory from 'src/factories/factoryProxy'; + +import type { AccountBeta, Beta } from '@linode/api-v4'; + export const betaFactory = Factory.Sync.makeFactory({ + description: + 'Aliquam erat volutpat. Nunc eleifend leo vitae magna. In id erat non orci commodo lobortis. Proin neque massa, cursus ut, gravida ut, lobortis eget, lacus. Sed diam. Praesent fermentum tempor tellus. Nullam tempus. Mauris ac felis vel velit tristique imperdiet. Donec at pede. Etiam vel neque nec dui dignissim bibendum. Vivamus id enim. Phasellus neque orci, porta a, aliquet quis, semper a, massa. Phasellus purus. Pellentesque tristique imperdiet tortor. Nam euismod tellus id erat.', id: Factory.each((i) => `beta-${i}`), label: Factory.each((i) => `Beta ${i}`), started: DateTime.now().toISO(), - description: - 'Aliquam erat volutpat. Nunc eleifend leo vitae magna. In id erat non orci commodo lobortis. Proin neque massa, cursus ut, gravida ut, lobortis eget, lacus. Sed diam. Praesent fermentum tempor tellus. Nullam tempus. Mauris ac felis vel velit tristique imperdiet. Donec at pede. Etiam vel neque nec dui dignissim bibendum. Vivamus id enim. Phasellus neque orci, porta a, aliquet quis, semper a, massa. Phasellus purus. Pellentesque tristique imperdiet tortor. Nam euismod tellus id erat.', }); export const accountBetaFactory = Factory.Sync.makeFactory({ - id: Factory.each((i) => `beta-${i}`), - label: Factory.each((i) => `Account Beta ${i}`), - started: DateTime.now().toISO(), description: 'Aliquam erat volutpat. Nunc eleifend leo vitae magna. In id erat non orci commodo lobortis. Proin neque massa, cursus ut, gravida ut, lobortis eget, lacus. Sed diam. Praesent fermentum tempor tellus. Nullam tempus. Mauris ac felis vel velit tristique imperdiet. Donec at pede. Etiam vel neque nec dui dignissim bibendum. Vivamus id enim. Phasellus neque orci, porta a, aliquet quis, semper a, massa. Phasellus purus. Pellentesque tristique imperdiet tortor. Nam euismod tellus id erat.', enrolled: DateTime.now().toISO(), + id: Factory.each((i) => `beta-${i}`), + label: Factory.each((i) => `Account Beta ${i}`), + started: DateTime.now().toISO(), }); diff --git a/packages/manager/src/factories/billing.ts b/packages/manager/src/factories/billing.ts index f14b7e80c97..32423b4baca 100644 --- a/packages/manager/src/factories/billing.ts +++ b/packages/manager/src/factories/billing.ts @@ -1,11 +1,12 @@ -import { +import Factory from 'src/factories/factoryProxy'; + +import type { Invoice, InvoiceItem, Payment, PaymentResponse, } from '@linode/api-v4/lib/account'; -import { APIWarning } from '@linode/api-v4/lib/types'; -import Factory from 'src/factories/factoryProxy'; +import type { APIWarning } from '@linode/api-v4/lib/types'; export const invoiceItemFactory = Factory.Sync.makeFactory({ amount: 5, diff --git a/packages/manager/src/factories/config.ts b/packages/manager/src/factories/config.ts index 72199f914f1..e553ab69997 100644 --- a/packages/manager/src/factories/config.ts +++ b/packages/manager/src/factories/config.ts @@ -1,6 +1,7 @@ -import { Config } from '@linode/api-v4/lib/linodes/types'; import Factory from 'src/factories/factoryProxy'; +import type { Config } from '@linode/api-v4/lib/linodes/types'; + export const configFactory = Factory.Sync.makeFactory({ comments: '', created: '2020-01-01', diff --git a/packages/manager/src/factories/disk.ts b/packages/manager/src/factories/disk.ts index 0ee25de8cea..46d062f5d10 100644 --- a/packages/manager/src/factories/disk.ts +++ b/packages/manager/src/factories/disk.ts @@ -1,6 +1,7 @@ -import { Disk } from '@linode/api-v4/lib/linodes/types'; import Factory from 'src/factories/factoryProxy'; +import type { Disk } from '@linode/api-v4/lib/linodes/types'; + export const linodeDiskFactory = Factory.Sync.makeFactory({ created: '2018-01-01', disk_encryption: 'enabled', diff --git a/packages/manager/src/factories/domain.ts b/packages/manager/src/factories/domain.ts index 3244d825b7f..c7241c5ba02 100644 --- a/packages/manager/src/factories/domain.ts +++ b/packages/manager/src/factories/domain.ts @@ -1,10 +1,11 @@ -import { +import Factory from 'src/factories/factoryProxy'; + +import type { CreateDomainPayload, Domain, DomainRecord, ZoneFile, } from '@linode/api-v4/lib/domains/types'; -import Factory from 'src/factories/factoryProxy'; export const domainFactory = Factory.Sync.makeFactory({ axfr_ips: [], @@ -47,9 +48,9 @@ export const domainZoneFileFactory = Factory.Sync.makeFactory({ export const createDomainPayloadFactory = Factory.Sync.makeFactory( { domain: Factory.each((id) => `domain-${id}`), - type: 'master', master_ips: [], soa_email: 'admin@example.com', tags: [], + type: 'master', } ); diff --git a/packages/manager/src/factories/entityTransfers.ts b/packages/manager/src/factories/entityTransfers.ts index a785fbf0c45..a7654222ea1 100644 --- a/packages/manager/src/factories/entityTransfers.ts +++ b/packages/manager/src/factories/entityTransfers.ts @@ -1,10 +1,12 @@ -import { +import { DateTime } from 'luxon'; +import { v4 } from 'uuid'; + +import Factory from 'src/factories/factoryProxy'; + +import type { EntityTransfer, TransferEntities, } from '@linode/api-v4/lib/entity-transfers/types'; -import Factory from 'src/factories/factoryProxy'; -import { DateTime } from 'luxon'; -import { v4 } from 'uuid'; export const transferEntitiesFactory = Factory.Sync.makeFactory( { diff --git a/packages/manager/src/factories/events.ts b/packages/manager/src/factories/events.ts index f0dd62292bb..d4acb533289 100644 --- a/packages/manager/src/factories/events.ts +++ b/packages/manager/src/factories/events.ts @@ -1,7 +1,9 @@ -import { Entity, Event } from '@linode/api-v4/lib/account/types'; -import Factory from 'src/factories/factoryProxy'; import { DateTime } from 'luxon'; +import Factory from 'src/factories/factoryProxy'; + +import type { Entity, Event } from '@linode/api-v4/lib/account/types'; + export const entityFactory = Factory.Sync.makeFactory({ id: Factory.each((id) => id), label: Factory.each((i) => `event-entity-${i}`), diff --git a/packages/manager/src/factories/grants.ts b/packages/manager/src/factories/grants.ts index b641263ca03..953e02b703a 100644 --- a/packages/manager/src/factories/grants.ts +++ b/packages/manager/src/factories/grants.ts @@ -1,6 +1,7 @@ -import { Grant, Grants } from '@linode/api-v4/lib/account'; import Factory from 'src/factories/factoryProxy'; +import type { Grant, Grants } from '@linode/api-v4/lib/account'; + export const grantFactory = Factory.Sync.makeFactory({ id: Factory.each((i) => i), label: Factory.each((i) => `entity-${i}`), diff --git a/packages/manager/src/factories/images.ts b/packages/manager/src/factories/images.ts index 85255aacb17..28a439cfd46 100644 --- a/packages/manager/src/factories/images.ts +++ b/packages/manager/src/factories/images.ts @@ -1,6 +1,7 @@ -import { Image } from '@linode/api-v4/lib/images/types'; import Factory from 'src/factories/factoryProxy'; +import type { Image } from '@linode/api-v4/lib/images/types'; + export const imageFactory = Factory.Sync.makeFactory({ capabilities: [], created: new Date().toISOString(), diff --git a/packages/manager/src/factories/kernels.ts b/packages/manager/src/factories/kernels.ts index ad1f0418993..246400fac77 100644 --- a/packages/manager/src/factories/kernels.ts +++ b/packages/manager/src/factories/kernels.ts @@ -1,13 +1,14 @@ -import { Kernel } from '@linode/api-v4'; import Factory from 'src/factories/factoryProxy'; +import type { Kernel } from '@linode/api-v4'; + export const kernelFactory = Factory.Sync.makeFactory({ + architecture: 'x86_64', + built: '2009-10-26T04:00:00', + deprecated: false, id: Factory.each((i) => `kernel-${i}`), - label: Factory.each((i) => `kernel-${i}`), - version: '1.0.0', kvm: true, - architecture: 'x86_64', + label: Factory.each((i) => `kernel-${i}`), pvops: false, - deprecated: false, - built: '2009-10-26T04:00:00', + version: '1.0.0', }); diff --git a/packages/manager/src/factories/linodeConfigInterfaceFactory.ts b/packages/manager/src/factories/linodeConfigInterfaceFactory.ts index 4f041afec55..ce6d4aedd42 100644 --- a/packages/manager/src/factories/linodeConfigInterfaceFactory.ts +++ b/packages/manager/src/factories/linodeConfigInterfaceFactory.ts @@ -1,6 +1,7 @@ -import { Interface } from '@linode/api-v4/lib/linodes/types'; import Factory from 'src/factories/factoryProxy'; +import type { Interface } from '@linode/api-v4/lib/linodes/types'; + export const LinodeConfigInterfaceFactory = Factory.Sync.makeFactory( { active: false, diff --git a/packages/manager/src/factories/linodeConfigs.ts b/packages/manager/src/factories/linodeConfigs.ts index 08c64f8f2d9..aa5e00ac024 100644 --- a/packages/manager/src/factories/linodeConfigs.ts +++ b/packages/manager/src/factories/linodeConfigs.ts @@ -1,11 +1,11 @@ -import { Config } from '@linode/api-v4/lib/linodes/types'; import Factory from 'src/factories/factoryProxy'; - import { LinodeConfigInterfaceFactory, LinodeConfigInterfaceFactoryWithVPC, } from 'src/factories/linodeConfigInterfaceFactory'; +import type { Config } from '@linode/api-v4/lib/linodes/types'; + const generateRandomId = () => Math.floor(Math.random() * 10000); const publicInterface = LinodeConfigInterfaceFactory.build({ diff --git a/packages/manager/src/factories/longviewClient.ts b/packages/manager/src/factories/longviewClient.ts index f146da0e0c5..e5f6cb239e1 100644 --- a/packages/manager/src/factories/longviewClient.ts +++ b/packages/manager/src/factories/longviewClient.ts @@ -1,6 +1,7 @@ -import { Apps, LongviewClient } from '@linode/api-v4/lib/longview'; import Factory from 'src/factories/factoryProxy'; +import type { Apps, LongviewClient } from '@linode/api-v4/lib/longview'; + export const longviewAppsFactory = Factory.Sync.makeFactory({ apache: false, mysql: false, diff --git a/packages/manager/src/factories/longviewDisks.ts b/packages/manager/src/factories/longviewDisks.ts index ea43a79a5ac..5e10bd4223c 100644 --- a/packages/manager/src/factories/longviewDisks.ts +++ b/packages/manager/src/factories/longviewDisks.ts @@ -1,16 +1,16 @@ import Factory from 'src/factories/factoryProxy'; -import { - Disk, - LongviewDisk, - LongviewCPU, +import type { CPU, - LongviewSystemInfo, - LongviewNetworkInterface, + Disk, InboundOutboundNetwork, - LongviewNetwork, - LongviewMemory, + LongviewCPU, + LongviewDisk, LongviewLoad, + LongviewMemory, + LongviewNetwork, + LongviewNetworkInterface, + LongviewSystemInfo, Uptime, } from 'src/features/Longview/request.types'; @@ -38,25 +38,25 @@ export const diskFactory = Factory.Sync.makeFactory({ childof: 0, children: 0, dm: 0, - isswap: 0, - mounted: 1, - reads: [mockStats[0]], - write_bytes: [mockStats[1]], - writes: [mockStats[2]], fs: { - total: [mockStats[3]], + free: [mockStats[6]], ifree: [mockStats[4]], itotal: [mockStats[5]], path: '/', - free: [mockStats[6]], + total: [mockStats[3]], }, + isswap: 0, + mounted: 1, read_bytes: [mockStats[0]], + reads: [mockStats[0]], + write_bytes: [mockStats[1]], + writes: [mockStats[2]], }); export const cpuFactory = Factory.Sync.makeFactory({ system: [mockStats[7]], - wait: [mockStats[8]], user: [mockStats[9]], + wait: [mockStats[8]], }); export const longviewDiskFactory = Factory.Sync.makeFactory({ @@ -117,15 +117,15 @@ export const longviewNetworkFactory = Factory.Sync.makeFactory( export const LongviewMemoryFactory = Factory.Sync.makeFactory({ Memory: { - swap: { - free: [mockStats[12]], - used: [mockStats[0]], - }, real: { - used: [mockStats[13]], - free: [mockStats[14]], buffers: [mockStats[15]], cache: [mockStats[16]], + free: [mockStats[14]], + used: [mockStats[13]], + }, + swap: { + free: [mockStats[12]], + used: [mockStats[0]], }, }, }); diff --git a/packages/manager/src/factories/longviewProcess.ts b/packages/manager/src/factories/longviewProcess.ts index cc465b690f1..07844624566 100644 --- a/packages/manager/src/factories/longviewProcess.ts +++ b/packages/manager/src/factories/longviewProcess.ts @@ -1,6 +1,6 @@ import Factory from 'src/factories/factoryProxy'; -import { +import type { LongviewProcesses, ProcessStats, } from 'src/features/Longview/request.types'; diff --git a/packages/manager/src/factories/longviewResponse.ts b/packages/manager/src/factories/longviewResponse.ts index 427b3809c5d..23617f4cbf0 100644 --- a/packages/manager/src/factories/longviewResponse.ts +++ b/packages/manager/src/factories/longviewResponse.ts @@ -1,18 +1,21 @@ import Factory from 'src/factories/factoryProxy'; -import { LongviewResponse } from 'src/features/Longview/request.types'; -import { AllData, LongviewPackage } from 'src/features/Longview/request.types'; - import { - longviewDiskFactory, - longviewCPUFactory, - longviewSysInfoFactory, - longviewNetworkFactory, - LongviewMemoryFactory, LongviewLoadFactory, + LongviewMemoryFactory, UptimeFactory, + longviewCPUFactory, + longviewDiskFactory, + longviewNetworkFactory, + longviewSysInfoFactory, } from './longviewDisks'; +import type { LongviewResponse } from 'src/features/Longview/request.types'; +import type { + AllData, + LongviewPackage, +} from 'src/features/Longview/request.types'; + const longviewResponseData = () => { const diskData = longviewDiskFactory.build(); const cpuData = longviewCPUFactory.build(); diff --git a/packages/manager/src/factories/longviewService.ts b/packages/manager/src/factories/longviewService.ts index fbc8978a36e..4bfbe06d3d7 100644 --- a/packages/manager/src/factories/longviewService.ts +++ b/packages/manager/src/factories/longviewService.ts @@ -1,6 +1,6 @@ import Factory from 'src/factories/factoryProxy'; -import { +import type { LongviewPort, LongviewPortsResponse, LongviewService, diff --git a/packages/manager/src/factories/longviewSubscription.ts b/packages/manager/src/factories/longviewSubscription.ts index 6e63fe5bf35..5740f76bcbc 100644 --- a/packages/manager/src/factories/longviewSubscription.ts +++ b/packages/manager/src/factories/longviewSubscription.ts @@ -1,8 +1,9 @@ -import { +import Factory from 'src/factories/factoryProxy'; + +import type { ActiveLongviewPlan, LongviewSubscription, } from '@linode/api-v4/lib/longview/types'; -import Factory from 'src/factories/factoryProxy'; export const longviewSubscriptionFactory = Factory.Sync.makeFactory( { diff --git a/packages/manager/src/factories/longviewTopProcesses.ts b/packages/manager/src/factories/longviewTopProcesses.ts index 22cd669ce31..9b42edd2df6 100644 --- a/packages/manager/src/factories/longviewTopProcesses.ts +++ b/packages/manager/src/factories/longviewTopProcesses.ts @@ -1,6 +1,6 @@ import Factory from 'src/factories/factoryProxy'; -import { +import type { LongviewTopProcesses, TopProcess, } from 'src/features/Longview/request.types'; diff --git a/packages/manager/src/factories/managed.ts b/packages/manager/src/factories/managed.ts index daceda4dabf..a18cafac329 100644 --- a/packages/manager/src/factories/managed.ts +++ b/packages/manager/src/factories/managed.ts @@ -1,4 +1,6 @@ -import { +import Factory from 'src/factories/factoryProxy'; + +import type { DataSeries, ManagedContact, ManagedCredential, @@ -9,7 +11,6 @@ import { ManagedServiceMonitor, ManagedStats, } from '@linode/api-v4/lib/managed/types'; -import Factory from 'src/factories/factoryProxy'; export const contactFactory = Factory.Sync.makeFactory({ email: Factory.each((i) => `john.doe.${i}@example.com`), diff --git a/packages/manager/src/factories/networking.ts b/packages/manager/src/factories/networking.ts index 74a29840383..8661b1daf91 100644 --- a/packages/manager/src/factories/networking.ts +++ b/packages/manager/src/factories/networking.ts @@ -1,6 +1,7 @@ -import { IPAddress } from '@linode/api-v4/lib/networking'; import Factory from 'src/factories/factoryProxy'; +import type { IPAddress } from '@linode/api-v4/lib/networking'; + export const ipAddressFactory = Factory.Sync.makeFactory({ address: Factory.each((id) => `192.168.1.${id}`), gateway: Factory.each((id) => `192.168.1.${id + 1}`), diff --git a/packages/manager/src/factories/notification.ts b/packages/manager/src/factories/notification.ts index 16f59842c5c..6525ac9ba2a 100644 --- a/packages/manager/src/factories/notification.ts +++ b/packages/manager/src/factories/notification.ts @@ -1,7 +1,9 @@ -import { Entity, Notification } from '@linode/api-v4/lib/account'; -import Factory from 'src/factories/factoryProxy'; import { DateTime } from 'luxon'; +import Factory from 'src/factories/factoryProxy'; + +import type { Entity, Notification } from '@linode/api-v4/lib/account'; + const generateEntity = ( id: number, url: string = 'linode/instances' diff --git a/packages/manager/src/factories/oauth.ts b/packages/manager/src/factories/oauth.ts index e2151eb62d5..de52af7b31e 100644 --- a/packages/manager/src/factories/oauth.ts +++ b/packages/manager/src/factories/oauth.ts @@ -1,6 +1,7 @@ -import { Token } from '@linode/api-v4/lib/profile/types'; import Factory from 'src/factories/factoryProxy'; +import type { Token } from '@linode/api-v4/lib/profile/types'; + export const appTokenFactory = Factory.Sync.makeFactory({ created: '2020-01-01T12:00:00', expiry: null, diff --git a/packages/manager/src/factories/profile.ts b/packages/manager/src/factories/profile.ts index b16a34dc49e..63500d74644 100644 --- a/packages/manager/src/factories/profile.ts +++ b/packages/manager/src/factories/profile.ts @@ -1,10 +1,11 @@ -import { +import Factory from 'src/factories/factoryProxy'; + +import type { Profile, SSHKey, SecurityQuestionsData, UserPreferences, } from '@linode/api-v4/lib/profile'; -import Factory from 'src/factories/factoryProxy'; export const profileFactory = Factory.Sync.makeFactory({ authentication_type: 'password', diff --git a/packages/manager/src/factories/promotionalOffer.ts b/packages/manager/src/factories/promotionalOffer.ts index e401266b511..735b02a8ed4 100644 --- a/packages/manager/src/factories/promotionalOffer.ts +++ b/packages/manager/src/factories/promotionalOffer.ts @@ -1,6 +1,6 @@ import Factory from 'src/factories/factoryProxy'; -import { PromotionalOffer } from 'src/featureFlags'; +import type { PromotionalOffer } from 'src/featureFlags'; export const promotionalOfferFactory = Factory.Sync.makeFactory( { diff --git a/packages/manager/src/factories/statusPage.ts b/packages/manager/src/factories/statusPage.ts index f485eee7069..613e2bf799a 100644 --- a/packages/manager/src/factories/statusPage.ts +++ b/packages/manager/src/factories/statusPage.ts @@ -1,7 +1,8 @@ -import Factory from 'src/factories/factoryProxy'; import { v4 } from 'uuid'; -import { +import Factory from 'src/factories/factoryProxy'; + +import type { Incident, IncidentPage, IncidentResponse, diff --git a/packages/manager/src/factories/subnets.ts b/packages/manager/src/factories/subnets.ts index 3b0f4e7f145..c2c611b4de5 100644 --- a/packages/manager/src/factories/subnets.ts +++ b/packages/manager/src/factories/subnets.ts @@ -1,8 +1,9 @@ -import { +import Factory from 'src/factories/factoryProxy'; + +import type { Subnet, SubnetAssignedLinodeData, } from '@linode/api-v4/lib/vpcs/types'; -import Factory from 'src/factories/factoryProxy'; // NOTE: Changing to fixed array length for the interfaces and linodes fields of the // subnetAssignedLinodeDataFactory and subnetFactory respectively -- see [M3-7227] for more details diff --git a/packages/manager/src/factories/support.ts b/packages/manager/src/factories/support.ts index 7fddfe1f36e..18ce245315b 100644 --- a/packages/manager/src/factories/support.ts +++ b/packages/manager/src/factories/support.ts @@ -1,6 +1,10 @@ -import { SupportReply, SupportTicket } from '@linode/api-v4/lib/support/types'; import Factory from 'src/factories/factoryProxy'; +import type { + SupportReply, + SupportTicket, +} from '@linode/api-v4/lib/support/types'; + export const supportTicketFactory = Factory.Sync.makeFactory({ attachments: [], closable: false, diff --git a/packages/manager/src/factories/tags.ts b/packages/manager/src/factories/tags.ts index 07fc150d870..de16850b7d6 100644 --- a/packages/manager/src/factories/tags.ts +++ b/packages/manager/src/factories/tags.ts @@ -1,6 +1,7 @@ -import { Tag } from '@linode/api-v4/lib/tags/types'; import Factory from 'src/factories/factoryProxy'; +import type { Tag } from '@linode/api-v4/lib/tags/types'; + export const tagFactory = Factory.Sync.makeFactory({ label: Factory.each((id) => `tag-${id + 1}`), }); diff --git a/packages/manager/src/factories/userPermissions.ts b/packages/manager/src/factories/userPermissions.ts index eadd1c31b79..abee90a1932 100644 --- a/packages/manager/src/factories/userPermissions.ts +++ b/packages/manager/src/factories/userPermissions.ts @@ -1,6 +1,7 @@ -import { IamUserPermissions } from '@linode/api-v4'; import Factory from 'src/factories/factoryProxy'; +import type { IamUserPermissions } from '@linode/api-v4'; + export const userPermissionsFactory = Factory.Sync.makeFactory( { account_access: [ diff --git a/packages/manager/src/factories/vlans.ts b/packages/manager/src/factories/vlans.ts index 0ee8708c553..88cb4f46796 100644 --- a/packages/manager/src/factories/vlans.ts +++ b/packages/manager/src/factories/vlans.ts @@ -1,6 +1,7 @@ -import { VLAN } from '@linode/api-v4/lib/vlans/types'; import Factory from 'src/factories/factoryProxy'; +import type { VLAN } from '@linode/api-v4/lib/vlans/types'; + export const VLANFactory = Factory.Sync.makeFactory({ cidr_block: '10.0.0.0/24', created: '2020-10-01T00:00:00', diff --git a/packages/manager/src/factories/vpcs.ts b/packages/manager/src/factories/vpcs.ts index 5584639f695..caaf57c1e07 100644 --- a/packages/manager/src/factories/vpcs.ts +++ b/packages/manager/src/factories/vpcs.ts @@ -1,6 +1,7 @@ -import { VPC } from '@linode/api-v4/lib/vpcs/types'; import Factory from 'src/factories/factoryProxy'; +import type { VPC } from '@linode/api-v4/lib/vpcs/types'; + export const vpcFactory = Factory.Sync.makeFactory({ created: '2023-07-12T16:08:53', description: '', diff --git a/packages/manager/src/features/Account/Agreements/withAgreements.ts b/packages/manager/src/features/Account/Agreements/withAgreements.ts index 46ffaa5af00..82fc4fd135e 100644 --- a/packages/manager/src/features/Account/Agreements/withAgreements.ts +++ b/packages/manager/src/features/Account/Agreements/withAgreements.ts @@ -1,10 +1,11 @@ -import { Agreements } from '@linode/api-v4/lib'; -import { APIError } from '@linode/api-v4/lib/types'; import * as React from 'react'; -import { UseQueryResult } from '@tanstack/react-query'; import { useAccountAgreements } from 'src/queries/account/agreements'; +import type { Agreements } from '@linode/api-v4/lib'; +import type { APIError } from '@linode/api-v4/lib/types'; +import type { UseQueryResult } from '@tanstack/react-query'; + export interface AgreementsProps { agreements: UseQueryResult; } diff --git a/packages/manager/src/features/Backups/BackupDrawer.test.tsx b/packages/manager/src/features/Backups/BackupDrawer.test.tsx index 26eeecebc10..21e6f5da565 100644 --- a/packages/manager/src/features/Backups/BackupDrawer.test.tsx +++ b/packages/manager/src/features/Backups/BackupDrawer.test.tsx @@ -1,4 +1,5 @@ import * as React from 'react'; + import { accountSettingsFactory, linodeFactory, @@ -9,6 +10,9 @@ import { renderWithTheme } from 'src/utilities/testHelpers'; import { BackupDrawer } from './BackupDrawer'; const queryMocks = vi.hoisted(() => ({ + useAccountSettings: vi.fn().mockReturnValue({ + data: undefined, + }), useAllLinodesQuery: vi.fn().mockReturnValue({ data: undefined, }), @@ -18,9 +22,6 @@ const queryMocks = vi.hoisted(() => ({ useTypeQuery: vi.fn().mockReturnValue({ data: undefined, }), - useAccountSettings: vi.fn().mockReturnValue({ - data: undefined, - }), })); vi.mock('src/queries/linodes/linodes', async () => { @@ -51,8 +52,6 @@ vi.mock('src/queries/accountSettings', async () => { describe('BackupDrawer', () => { beforeEach(() => { const mockType = typeFactory.build({ - id: 'mock-linode-type', - label: 'Mock Linode Type', addons: { backups: { price: { @@ -68,6 +67,8 @@ describe('BackupDrawer', () => { ], }, }, + id: 'mock-linode-type', + label: 'Mock Linode Type', }); queryMocks.useAccountSettings.mockReturnValue({ data: accountSettingsFactory.build({ @@ -87,20 +88,20 @@ describe('BackupDrawer', () => { queryMocks.useAllLinodesQuery.mockReturnValue({ data: [ linodeFactory.build({ + backups: { enabled: false }, region: 'es-mad', type: 'mock-linode-type', - backups: { enabled: false }, }), ...linodeFactory.buildList(5, { + backups: { enabled: false }, region: 'us-east', type: 'mock-linode-type', - backups: { enabled: false }, }), ], }); const { findByText } = renderWithTheme( - + ); expect(await findByText('Total for 6 Linodes:')).toBeVisible(); expect(await findByText('$12.50')).toBeVisible(); @@ -110,15 +111,15 @@ describe('BackupDrawer', () => { queryMocks.useAllLinodesQuery.mockReturnValue({ data: [ linodeFactory.build({ + backups: { enabled: false }, region: 'es-mad', type: 'mock-linode-type', - backups: { enabled: false }, }), ], }); const { findByText } = renderWithTheme( - + ); expect(await findByText('Total for 1 Linode:')).toBeVisible(); expect(await findByText('$0.00')).toBeVisible(); @@ -134,7 +135,7 @@ describe('BackupDrawer', () => { }); const { findByText } = renderWithTheme( - + ); expect(await findByText('Total for 1 Linode:')).toBeVisible(); expect(await findByText('$--.--')).toBeVisible(); @@ -156,7 +157,7 @@ describe('BackupDrawer', () => { }); const { findByText, queryByText } = renderWithTheme( - + ); // Confirm that Linodes without backups are listed in table. /* eslint-disable no-await-in-loop */ diff --git a/packages/manager/src/features/Databases/DatabaseCreate/DatabaseCreateAccessControls.test.tsx b/packages/manager/src/features/Databases/DatabaseCreate/DatabaseCreateAccessControls.test.tsx index 879986492c9..52c5bef848b 100644 --- a/packages/manager/src/features/Databases/DatabaseCreate/DatabaseCreateAccessControls.test.tsx +++ b/packages/manager/src/features/Databases/DatabaseCreate/DatabaseCreateAccessControls.test.tsx @@ -1,8 +1,12 @@ import { fireEvent } from '@testing-library/react'; import React from 'react'; + import { renderWithTheme } from 'src/utilities/testHelpers'; + +import { useIsDatabasesEnabled } from '../utilities'; import { DatabaseCreateAccessControls } from './DatabaseCreateAccessControls'; -import { IsDatabasesEnabled, useIsDatabasesEnabled } from '../utilities'; + +import type { IsDatabasesEnabled } from '../utilities'; vi.mock('src/features/Databases/utilities'); @@ -17,7 +21,7 @@ describe('DatabaseCreateAccessControls', () => { } as IsDatabasesEnabled); const ips = [{ address: '' }]; - const { container, getAllByText, getAllByTestId } = renderWithTheme( + const { container, getAllByTestId, getAllByText } = renderWithTheme( {}} @@ -52,7 +56,7 @@ describe('DatabaseCreateAccessControls', () => { { address: '2.2.2.2' }, { address: '3.3.3.3/128' }, ]; - const { container, getAllByText, getAllByTestId } = renderWithTheme( + const { container, getAllByTestId, getAllByText } = renderWithTheme( {}} @@ -83,7 +87,7 @@ describe('DatabaseCreateAccessControls', () => { } as IsDatabasesEnabled); const ips = [{ address: '1.1.1.1/32' }]; - const { container, getAllByText, getAllByTestId } = renderWithTheme( + const { container, getAllByTestId, getAllByText } = renderWithTheme( {}} diff --git a/packages/manager/src/features/Databases/DatabaseDetail/DatabaseBackups/legacy/DatabaseBackupTableBody.tsx b/packages/manager/src/features/Databases/DatabaseDetail/DatabaseBackups/legacy/DatabaseBackupTableBody.tsx index 6f7ee8ebaad..52cf1e04c0a 100644 --- a/packages/manager/src/features/Databases/DatabaseDetail/DatabaseBackups/legacy/DatabaseBackupTableBody.tsx +++ b/packages/manager/src/features/Databases/DatabaseDetail/DatabaseBackups/legacy/DatabaseBackupTableBody.tsx @@ -1,10 +1,13 @@ -import { APIError, DatabaseBackup, ResourcePage } from '@linode/api-v4'; import React from 'react'; + import { TableRowEmpty } from 'src/components/TableRowEmpty/TableRowEmpty'; import { TableRowError } from 'src/components/TableRowError/TableRowError'; import { TableRowLoading } from 'src/components/TableRowLoading/TableRowLoading'; + import { BackupTableRow } from './DatabaseBackupTableRow'; +import type { APIError, DatabaseBackup, ResourcePage } from '@linode/api-v4'; + interface Props { backups?: ResourcePage; backupsError: APIError[] | null; diff --git a/packages/manager/src/features/Databases/DatabaseDetail/DatabaseMonitor/DatabaseMonitor.test.tsx b/packages/manager/src/features/Databases/DatabaseDetail/DatabaseMonitor/DatabaseMonitor.test.tsx index ec6c413ebb5..8675b07865f 100644 --- a/packages/manager/src/features/Databases/DatabaseDetail/DatabaseMonitor/DatabaseMonitor.test.tsx +++ b/packages/manager/src/features/Databases/DatabaseDetail/DatabaseMonitor/DatabaseMonitor.test.tsx @@ -1,7 +1,9 @@ import { waitForElementToBeRemoved } from '@testing-library/react'; import * as React from 'react'; + import { databaseFactory } from 'src/factories'; import { mockMatchMedia, renderWithTheme } from 'src/utilities/testHelpers'; + import { DatabaseMonitor } from './DatabaseMonitor'; const loadingTestId = 'circle-progress'; diff --git a/packages/manager/src/features/Databases/DatabaseDetail/DatabaseMonitor/DatabaseMonitor.tsx b/packages/manager/src/features/Databases/DatabaseDetail/DatabaseMonitor/DatabaseMonitor.tsx index 5a255785977..7f696fc2d0b 100644 --- a/packages/manager/src/features/Databases/DatabaseDetail/DatabaseMonitor/DatabaseMonitor.tsx +++ b/packages/manager/src/features/Databases/DatabaseDetail/DatabaseMonitor/DatabaseMonitor.tsx @@ -1,6 +1,8 @@ import * as React from 'react'; + import { CloudPulseDashboardWithFilters } from 'src/features/CloudPulse/Dashboard/CloudPulseDashboardWithFilters'; -import { Database } from '@linode/api-v4'; + +import type { Database } from '@linode/api-v4'; interface Props { database: Database; diff --git a/packages/manager/src/features/Databases/DatabaseDetail/DatabaseSettings/DatabaseSettingsSuspendClusterDialog.test.tsx b/packages/manager/src/features/Databases/DatabaseDetail/DatabaseSettings/DatabaseSettingsSuspendClusterDialog.test.tsx index 6904bdc83b3..7d5656d765b 100644 --- a/packages/manager/src/features/Databases/DatabaseDetail/DatabaseSettings/DatabaseSettingsSuspendClusterDialog.test.tsx +++ b/packages/manager/src/features/Databases/DatabaseDetail/DatabaseSettings/DatabaseSettingsSuspendClusterDialog.test.tsx @@ -1,14 +1,14 @@ import { waitFor } from '@testing-library/react'; +import userEvent from '@testing-library/user-event'; import * as React from 'react'; + +import { HttpResponse, http, server } from 'src/mocks/testServer'; import { renderWithTheme } from 'src/utilities/testHelpers'; -import { - DatabaseSettingsSuspendClusterDialog, - SuspendDialogProps, -} from './DatabaseSettingsSuspendClusterDialog'; -import { Engine } from '@linode/api-v4'; -import userEvent from '@testing-library/user-event'; -import { http, HttpResponse, server } from 'src/mocks/testServer'; +import { DatabaseSettingsSuspendClusterDialog } from './DatabaseSettingsSuspendClusterDialog'; + +import type { SuspendDialogProps } from './DatabaseSettingsSuspendClusterDialog'; +import type { Engine } from '@linode/api-v4'; const mockEngine: Engine = 'mysql'; const mockLabel = 'database-1'; @@ -57,7 +57,7 @@ describe('DatabaseSettingsSuspendClusterDialog', () => { return HttpResponse.json({}); }) ); - const { getByText, getByRole } = renderWithTheme( + const { getByRole, getByText } = renderWithTheme( ); const confirmationCheckbox = getByRole('checkbox') as HTMLInputElement; diff --git a/packages/manager/src/features/Databases/DatabaseDetail/DatabaseSettings/DatabaseSettingsUpgradeVersionDialog.tsx b/packages/manager/src/features/Databases/DatabaseDetail/DatabaseSettings/DatabaseSettingsUpgradeVersionDialog.tsx index 325b9c00309..dc36c0d54ee 100644 --- a/packages/manager/src/features/Databases/DatabaseDetail/DatabaseSettings/DatabaseSettingsUpgradeVersionDialog.tsx +++ b/packages/manager/src/features/Databases/DatabaseDetail/DatabaseSettings/DatabaseSettingsUpgradeVersionDialog.tsx @@ -1,10 +1,10 @@ +import { Autocomplete } from '@linode/ui'; import { FormControl, Notice, Typography } from '@linode/ui'; import { useTheme } from '@mui/material'; import { useSnackbar } from 'notistack'; import * as React from 'react'; import { ActionsPanel } from 'src/components/ActionsPanel/ActionsPanel'; -import { Autocomplete } from '@linode/ui'; import { ConfirmationDialog } from 'src/components/ConfirmationDialog/ConfirmationDialog'; import { DATABASE_ENGINE_MAP, diff --git a/packages/manager/src/features/Databases/DatabaseLanding/DatabaseLandingTable.tsx b/packages/manager/src/features/Databases/DatabaseLanding/DatabaseLandingTable.tsx index 6ebf42f0ff4..1b0dccaac28 100644 --- a/packages/manager/src/features/Databases/DatabaseLanding/DatabaseLandingTable.tsx +++ b/packages/manager/src/features/Databases/DatabaseLanding/DatabaseLandingTable.tsx @@ -18,9 +18,10 @@ import { useIsDatabasesEnabled } from 'src/features/Databases/utilities'; import { usePagination } from 'src/hooks/usePagination'; import { useInProgressEvents } from 'src/queries/events/events'; +import { DatabaseSettingsSuspendClusterDialog } from '../DatabaseDetail/DatabaseSettings/DatabaseSettingsSuspendClusterDialog'; + import type { DatabaseInstance } from '@linode/api-v4/lib/databases'; import type { Order } from 'src/hooks/useOrder'; -import { DatabaseSettingsSuspendClusterDialog } from '../DatabaseDetail/DatabaseSettings/DatabaseSettingsSuspendClusterDialog'; const preferenceKey = 'databases'; @@ -30,8 +31,8 @@ interface Props { isNewDatabase?: boolean; order: 'asc' | 'desc'; orderBy: string; - showSuspend?: boolean; results: number | undefined; + showSuspend?: boolean; } const DatabaseLandingTable = ({ data, @@ -160,7 +161,7 @@ const DatabaseLandingTable = ({ Created - {isDatabasesV2GA && isNewDatabase && } + {isDatabasesV2GA && isNewDatabase && } @@ -187,7 +188,7 @@ const DatabaseLandingTable = ({ : '' } colSpan={7} - > + /> )} diff --git a/packages/manager/src/features/Domains/DomainRecords.styles.ts b/packages/manager/src/features/Domains/DomainRecords.styles.ts index 93f252e1f65..993632847dd 100644 --- a/packages/manager/src/features/Domains/DomainRecords.styles.ts +++ b/packages/manager/src/features/Domains/DomainRecords.styles.ts @@ -1,12 +1,10 @@ import { styled } from '@mui/material/styles'; import Grid from '@mui/material/Unstable_Grid2'; + import { TableCell } from 'src/components/TableCell'; export const StyledGrid = styled(Grid, { label: 'StyledGrid' })( ({ theme }) => ({ - margin: 0, - marginTop: theme.spacing(2), - width: '100%', '& .MuiGrid-item': { paddingLeft: 0, paddingRight: 0, @@ -16,30 +14,33 @@ export const StyledGrid = styled(Grid, { label: 'StyledGrid' })( marginRight: theme.spacing(), }, }, + margin: 0, + marginTop: theme.spacing(2), [theme.breakpoints.down('md')]: { marginLeft: theme.spacing(), marginRight: theme.spacing(), }, + width: '100%', }) ); export const StyledTableCell = styled(TableCell, { label: 'StyledTabelCell' })( ({ theme }) => ({ - whiteSpace: 'nowrap' as const, - width: 'auto', '& .data': { maxWidth: 300, overflow: 'hidden', textOverflow: 'ellipsis', - whiteSpace: 'nowrap' as const, [theme.breakpoints.up('md')]: { maxWidth: 750, }, + whiteSpace: 'nowrap' as const, }, '&:last-of-type': { display: 'flex', justifyContent: 'flex-end', }, + whiteSpace: 'nowrap' as const, + width: 'auto', }) ); diff --git a/packages/manager/src/features/Firewalls/FirewallDetail/Rules/FirewallRuleDrawer.types.ts b/packages/manager/src/features/Firewalls/FirewallDetail/Rules/FirewallRuleDrawer.types.ts index 6478e546f97..d344e3146ab 100644 --- a/packages/manager/src/features/Firewalls/FirewallDetail/Rules/FirewallRuleDrawer.types.ts +++ b/packages/manager/src/features/Firewalls/FirewallDetail/Rules/FirewallRuleDrawer.types.ts @@ -1,3 +1,4 @@ +import type { FirewallOptionItem } from '../../shared'; import type { ExtendedFirewallRule } from './firewallRuleEditor'; import type { Category, FirewallRuleError } from './shared'; import type { @@ -5,7 +6,6 @@ import type { FirewallRuleType, } from '@linode/api-v4/lib/firewalls'; import type { FormikProps } from 'formik'; -import { FirewallOptionItem } from '../../shared'; import type { ExtendedIP } from 'src/utilities/ipUtils'; export type FirewallRuleDrawerMode = 'create' | 'edit'; diff --git a/packages/manager/src/features/Firewalls/FirewallDetail/Rules/FirewallRuleTable.tsx b/packages/manager/src/features/Firewalls/FirewallDetail/Rules/FirewallRuleTable.tsx index d827cc3e86d..dbe67573df4 100644 --- a/packages/manager/src/features/Firewalls/FirewallDetail/Rules/FirewallRuleTable.tsx +++ b/packages/manager/src/features/Firewalls/FirewallDetail/Rules/FirewallRuleTable.tsx @@ -14,6 +14,7 @@ import { verticalListSortingStrategy, } from '@dnd-kit/sortable'; import { CSS } from '@dnd-kit/utilities'; +import { Autocomplete } from '@linode/ui'; import { Box, Typography } from '@linode/ui'; import { useTheme } from '@mui/material/styles'; import useMediaQuery from '@mui/material/useMediaQuery'; @@ -21,7 +22,6 @@ import { prop, uniqBy } from 'ramda'; import * as React from 'react'; import Undo from 'src/assets/icons/undo.svg'; -import { Autocomplete } from '@linode/ui'; import { Hidden } from 'src/components/Hidden'; import { MaskableText } from 'src/components/MaskableText/MaskableText'; import { Table } from 'src/components/Table'; diff --git a/packages/manager/src/features/IAM/Users/UserDetailsLanding.tsx b/packages/manager/src/features/IAM/Users/UserDetailsLanding.tsx index 5e89e1f9908..f82bf3170ec 100644 --- a/packages/manager/src/features/IAM/Users/UserDetailsLanding.tsx +++ b/packages/manager/src/features/IAM/Users/UserDetailsLanding.tsx @@ -1,15 +1,17 @@ import React from 'react'; import { + matchPath, useHistory, useLocation, useParams, - matchPath, } from 'react-router-dom'; + import { LandingHeader } from 'src/components/LandingHeader'; import { SafeTabPanel } from 'src/components/Tabs/SafeTabPanel'; import { TabLinkList } from 'src/components/Tabs/TabLinkList'; import { TabPanels } from 'src/components/Tabs/TabPanels'; import { Tabs } from 'src/components/Tabs/Tabs'; + import { IAM_LABEL } from '../Shared/constants'; export const UserDetailsLanding = () => { @@ -37,11 +39,9 @@ export const UserDetailsLanding = () => { }; const getDefaultTabIndex = () => { - const tabChoice = tabs.findIndex((tab) => + return tabs.findIndex((tab) => Boolean(matchPath(tab.routeName, { path: location.pathname })) ); - - return tabChoice; }; let idx = 0; diff --git a/packages/manager/src/features/IAM/Users/Users.tsx b/packages/manager/src/features/IAM/Users/Users.tsx index e2fd573d1cf..16b16335ff6 100644 --- a/packages/manager/src/features/IAM/Users/Users.tsx +++ b/packages/manager/src/features/IAM/Users/Users.tsx @@ -1,8 +1,11 @@ import React from 'react'; import { useHistory } from 'react-router-dom'; -import { Action, ActionMenu } from 'src/components/ActionMenu/ActionMenu'; + +import { ActionMenu } from 'src/components/ActionMenu/ActionMenu'; import { useProfile } from 'src/queries/profile/profile'; +import type { Action } from 'src/components/ActionMenu/ActionMenu'; + export const UsersLanding = () => { const history = useHistory(); const { data: profile } = useProfile(); diff --git a/packages/manager/src/features/Images/ImagesLanding/ImagesActionMenu.tsx b/packages/manager/src/features/Images/ImagesLanding/ImagesActionMenu.tsx index b664da0917d..2c7596824d9 100644 --- a/packages/manager/src/features/Images/ImagesLanding/ImagesActionMenu.tsx +++ b/packages/manager/src/features/Images/ImagesLanding/ImagesActionMenu.tsx @@ -1,14 +1,15 @@ import * as React from 'react'; import { ActionMenu } from 'src/components/ActionMenu/ActionMenu'; - -import type { Event, Image, ImageStatus } from '@linode/api-v4'; -import type { Action } from 'src/components/ActionMenu/ActionMenu'; import { getRestrictedResourceText } from 'src/features/Account/utils'; import { useIsResourceRestricted } from 'src/hooks/useIsResourceRestricted'; import { useRestrictedGlobalGrantCheck } from 'src/hooks/useRestrictedGlobalGrantCheck'; + import { useImageAndLinodeGrantCheck } from '../utils'; +import type { Event, Image, ImageStatus } from '@linode/api-v4'; +import type { Action } from 'src/components/ActionMenu/ActionMenu'; + export interface Handlers { onCancelFailed?: (imageID: string) => void; onDelete?: (label: string, imageID: string, status?: ImageStatus) => void; diff --git a/packages/manager/src/features/Kubernetes/ClusterList/KubernetesClusterRow.tsx b/packages/manager/src/features/Kubernetes/ClusterList/KubernetesClusterRow.tsx index 9678d59721f..ab13265f195 100644 --- a/packages/manager/src/features/Kubernetes/ClusterList/KubernetesClusterRow.tsx +++ b/packages/manager/src/features/Kubernetes/ClusterList/KubernetesClusterRow.tsx @@ -1,5 +1,4 @@ import { Chip } from '@linode/ui'; -import { KubeNodePoolResponse, KubernetesCluster } from '@linode/api-v4'; import Grid from '@mui/material/Unstable_Grid2'; import * as React from 'react'; import { Link } from 'react-router-dom'; @@ -23,6 +22,8 @@ import { } from '../kubeUtils'; import { ClusterActionMenu } from './ClusterActionMenu'; +import type { KubeNodePoolResponse, KubernetesCluster } from '@linode/api-v4'; + const useStyles = makeStyles()(() => ({ clusterRow: { '&:before': { diff --git a/packages/manager/src/features/Linodes/CloneLanding/Configs.test.tsx b/packages/manager/src/features/Linodes/CloneLanding/Configs.test.tsx index 54d5b9cb9a5..d4b685c3976 100644 --- a/packages/manager/src/features/Linodes/CloneLanding/Configs.test.tsx +++ b/packages/manager/src/features/Linodes/CloneLanding/Configs.test.tsx @@ -5,6 +5,7 @@ import { linodeConfigs } from 'src/__data__/linodeConfigs'; import { wrapWithTheme } from 'src/utilities/testHelpers'; import { Configs } from './Configs'; + import type { ConfigsProps } from './Configs'; const mockHandleSelect = vi.fn(); diff --git a/packages/manager/src/features/Linodes/CloneLanding/Disks.test.tsx b/packages/manager/src/features/Linodes/CloneLanding/Disks.test.tsx index dc55a90af9e..fe1f0b3c4bb 100644 --- a/packages/manager/src/features/Linodes/CloneLanding/Disks.test.tsx +++ b/packages/manager/src/features/Linodes/CloneLanding/Disks.test.tsx @@ -5,6 +5,7 @@ import { extDisk3, swapDisk } from 'src/__data__/disks'; import { wrapWithTheme } from 'src/utilities/testHelpers'; import { Disks } from './Disks'; + import type { DisksProps } from './Disks'; const disks = [extDisk3, swapDisk]; diff --git a/packages/manager/src/features/Linodes/CloneLanding/utilities.ts b/packages/manager/src/features/Linodes/CloneLanding/utilities.ts index 93c527223b4..d1b2a19d42b 100644 --- a/packages/manager/src/features/Linodes/CloneLanding/utilities.ts +++ b/packages/manager/src/features/Linodes/CloneLanding/utilities.ts @@ -1,10 +1,12 @@ -import { Config, Devices, Disk } from '@linode/api-v4/lib/linodes'; -import { APIError } from '@linode/api-v4/lib/types'; import produce from 'immer'; import { DateTime } from 'luxon'; import { append, compose, flatten, keys, map, pickBy, uniqBy } from 'ramda'; + import { isDiskDevice } from '../LinodesDetail/LinodeConfigs/ConfigRow'; +import type { Config, Devices, Disk } from '@linode/api-v4/lib/linodes'; +import type { APIError } from '@linode/api-v4/lib/types'; + /** * TYPES */ diff --git a/packages/manager/src/features/Linodes/LinodesDetail/LinodeBackup/ScheduleSettings.test.tsx b/packages/manager/src/features/Linodes/LinodesDetail/LinodeBackup/ScheduleSettings.test.tsx index 59b4d5826e2..1b4ecefb663 100644 --- a/packages/manager/src/features/Linodes/LinodesDetail/LinodeBackup/ScheduleSettings.test.tsx +++ b/packages/manager/src/features/Linodes/LinodesDetail/LinodeBackup/ScheduleSettings.test.tsx @@ -1,7 +1,7 @@ +import { userEvent } from '@testing-library/user-event'; import { Settings } from 'luxon'; import * as React from 'react'; -import { userEvent } from '@testing-library/user-event'; import { profileFactory } from 'src/factories'; import { linodeFactory } from 'src/factories/linodes'; import { HttpResponse, http, server } from 'src/mocks/testServer'; @@ -50,7 +50,7 @@ describe('ScheduleSettings', () => { }) ); - const { getByPlaceholderText, findByText } = renderWithTheme( + const { findByText, getByPlaceholderText } = renderWithTheme( ); @@ -96,7 +96,7 @@ describe('ScheduleSettings', () => { // Mock that today's date is May 25th, 2018 so that it is daylight savings time Settings.now = () => new Date(2018, 4, 25).valueOf(); - const { getByPlaceholderText, findByText } = renderWithTheme( + const { findByText, getByPlaceholderText } = renderWithTheme( ); @@ -143,7 +143,7 @@ describe('ScheduleSettings', () => { // Mock that today's date is Nov 7th, 2023 so that it is *not* daylight savings time Settings.now = () => new Date(2023, 11, 7).valueOf(); - const { getByPlaceholderText, findByText } = renderWithTheme( + const { findByText, getByPlaceholderText } = renderWithTheme( ); diff --git a/packages/manager/src/features/Linodes/LinodesDetail/LinodeNetworking/LinodeIPAddresses.test.ts b/packages/manager/src/features/Linodes/LinodesDetail/LinodeNetworking/LinodeIPAddresses.test.ts index 4eeefcb9e3e..89dd9c04de8 100644 --- a/packages/manager/src/features/Linodes/LinodesDetail/LinodeNetworking/LinodeIPAddresses.test.ts +++ b/packages/manager/src/features/Linodes/LinodesDetail/LinodeNetworking/LinodeIPAddresses.test.ts @@ -1,9 +1,9 @@ -import { LinodeIPsResponse } from '@linode/api-v4/lib/linodes'; - import { ipAddressFactory } from 'src/factories/networking'; -import { listIPv6InRange } from './LinodeIPAddressRow'; import { createType, ipResponseToDisplayRows } from './LinodeIPAddresses'; +import { listIPv6InRange } from './LinodeIPAddressRow'; + +import type { LinodeIPsResponse } from '@linode/api-v4/lib/linodes'; describe('listIPv6InRange utility function', () => { const ipv4List = ipAddressFactory.buildList(4); diff --git a/packages/manager/src/features/Linodes/LinodesDetail/LinodeNetworking/NetworkingSummaryPanel/NetworkingSummaryPanel.tsx b/packages/manager/src/features/Linodes/LinodesDetail/LinodeNetworking/NetworkingSummaryPanel/NetworkingSummaryPanel.tsx index d08415cd49c..3cb70764448 100644 --- a/packages/manager/src/features/Linodes/LinodesDetail/LinodeNetworking/NetworkingSummaryPanel/NetworkingSummaryPanel.tsx +++ b/packages/manager/src/features/Linodes/LinodesDetail/LinodeNetworking/NetworkingSummaryPanel/NetworkingSummaryPanel.tsx @@ -1,8 +1,8 @@ +import { Paper } from '@linode/ui'; import { styled, useTheme } from '@mui/material/styles'; import Grid from '@mui/material/Unstable_Grid2'; import * as React from 'react'; -import { Paper } from '@linode/ui'; import { useIsGeckoEnabled } from 'src/components/RegionSelect/RegionSelect.utils'; import { useLinodeQuery } from 'src/queries/linodes/linodes'; diff --git a/packages/manager/src/features/Linodes/LinodesDetail/LinodeSettings/KernelSelect.test.tsx b/packages/manager/src/features/Linodes/LinodesDetail/LinodeSettings/KernelSelect.test.tsx index 9079ee9a481..fc74c18fb57 100644 --- a/packages/manager/src/features/Linodes/LinodesDetail/LinodeSettings/KernelSelect.test.tsx +++ b/packages/manager/src/features/Linodes/LinodesDetail/LinodeSettings/KernelSelect.test.tsx @@ -1,29 +1,30 @@ import { screen } from '@testing-library/react'; import { userEvent } from '@testing-library/user-event'; import * as React from 'react'; -import { kernelFactory } from 'src/factories/kernels'; +import { kernelFactory } from 'src/factories/kernels'; import { renderWithTheme } from 'src/utilities/testHelpers'; import { KernelSelect, - KernelSelectProps, kernelsToGroupedItems, sortCurrentKernels, } from './KernelSelect'; +import type { KernelSelectProps } from './KernelSelect'; + const kernels = [ kernelFactory.build({ id: 'linode/grub2', label: 'GRUB 2' }), kernelFactory.build({ id: 'linode/grub-legacy', label: 'GRUB (Legacy)' }), kernelFactory.build({ + architecture: 'x86_64', id: 'linode/latest-64bit', label: 'Latest 64 bit', - architecture: 'x86_64', }), kernelFactory.build({ + architecture: 'i386', id: 'linode/latest-32bit', label: 'Latest 32 bit', - architecture: 'i386', }), kernelFactory.build({ id: 'linode/direct-disk', label: 'Direct Disk' }), ]; diff --git a/packages/manager/src/features/Linodes/MigrateLinode/MigrationPricing.test.tsx b/packages/manager/src/features/Linodes/MigrateLinode/MigrationPricing.test.tsx index c632327861d..66ae205873d 100644 --- a/packages/manager/src/features/Linodes/MigrateLinode/MigrationPricing.test.tsx +++ b/packages/manager/src/features/Linodes/MigrateLinode/MigrationPricing.test.tsx @@ -1,16 +1,17 @@ import * as React from 'react'; + import { renderWithTheme } from 'src/utilities/testHelpers'; import { MigrationPricing } from './MigrationPricing'; const backupPricesNull = { - monthly: null, hourly: null, + monthly: null, }; const backupPricesZero = { - monthly: 0, hourly: 0, + monthly: 0, }; const backupPricesRegular = { diff --git a/packages/manager/src/features/Longview/LongviewDetail/DetailTabs/ActiveConnections/ActiveConnections.test.tsx b/packages/manager/src/features/Longview/LongviewDetail/DetailTabs/ActiveConnections/ActiveConnections.test.tsx index 186ed33aff8..198f283ed09 100644 --- a/packages/manager/src/features/Longview/LongviewDetail/DetailTabs/ActiveConnections/ActiveConnections.test.tsx +++ b/packages/manager/src/features/Longview/LongviewDetail/DetailTabs/ActiveConnections/ActiveConnections.test.tsx @@ -4,6 +4,7 @@ import { longviewPortFactory } from 'src/factories/longviewService'; import { renderWithTheme } from 'src/utilities/testHelpers'; import { ActiveConnections } from './ActiveConnections'; + import type { TableProps } from './ActiveConnections'; const mockConnections = longviewPortFactory.buildList(10); diff --git a/packages/manager/src/features/Longview/LongviewDetail/DetailTabs/Apache/ApacheGraphs.tsx b/packages/manager/src/features/Longview/LongviewDetail/DetailTabs/Apache/ApacheGraphs.tsx index 23003a9d17e..ba959f1a470 100644 --- a/packages/manager/src/features/Longview/LongviewDetail/DetailTabs/Apache/ApacheGraphs.tsx +++ b/packages/manager/src/features/Longview/LongviewDetail/DetailTabs/Apache/ApacheGraphs.tsx @@ -1,5 +1,5 @@ -import Grid from '@mui/material/Unstable_Grid2'; import { useTheme } from '@mui/material/styles'; +import Grid from '@mui/material/Unstable_Grid2'; import * as React from 'react'; import { LongviewLineGraph } from 'src/components/LongviewLineGraph/LongviewLineGraph'; @@ -11,7 +11,6 @@ import { } from 'src/features/Longview/shared/utilities'; import { roundTo } from 'src/utilities/roundTo'; -import { ApacheResponse, LongviewProcesses } from '../../../request.types'; import { convertData } from '../../../shared/formatters'; import { StyledItemGrid, @@ -20,6 +19,8 @@ import { } from '../CommonStyles.styles'; import { ProcessGraphs } from '../ProcessGraphs'; +import type { ApacheResponse, LongviewProcesses } from '../../../request.types'; + interface Props { data?: ApacheResponse; end: number; diff --git a/packages/manager/src/features/Longview/LongviewDetail/DetailTabs/Disks/Graphs.test.tsx b/packages/manager/src/features/Longview/LongviewDetail/DetailTabs/Disks/Graphs.test.tsx index 821e0339fe8..a761b0045ac 100644 --- a/packages/manager/src/features/Longview/LongviewDetail/DetailTabs/Disks/Graphs.test.tsx +++ b/packages/manager/src/features/Longview/LongviewDetail/DetailTabs/Disks/Graphs.test.tsx @@ -3,6 +3,7 @@ import * as React from 'react'; import { renderWithTheme } from 'src/utilities/testHelpers'; import { Graphs } from './Graphs'; + import type { GraphProps } from './Graphs'; const baseProps: GraphProps = { diff --git a/packages/manager/src/features/Longview/LongviewDetail/DetailTabs/IconSection.styles.tsx b/packages/manager/src/features/Longview/LongviewDetail/DetailTabs/IconSection.styles.tsx index de916377ca2..64f1c8bd1cb 100644 --- a/packages/manager/src/features/Longview/LongviewDetail/DetailTabs/IconSection.styles.tsx +++ b/packages/manager/src/features/Longview/LongviewDetail/DetailTabs/IconSection.styles.tsx @@ -1,7 +1,10 @@ -import { styled, SxProps } from '@mui/material/styles'; +import { styled } from '@mui/material/styles'; import Grid from '@mui/material/Unstable_Grid2/Grid2'; + import { IconTextLink } from 'src/components/IconTextLink/IconTextLink'; +import type { SxProps } from '@mui/material/styles'; + const sxGrid: SxProps = { boxSizing: 'border-box', display: 'flex', diff --git a/packages/manager/src/features/Longview/LongviewDetail/DetailTabs/Installation.tsx b/packages/manager/src/features/Longview/LongviewDetail/DetailTabs/Installation.tsx index 87c04c222c7..54844184b40 100644 --- a/packages/manager/src/features/Longview/LongviewDetail/DetailTabs/Installation.tsx +++ b/packages/manager/src/features/Longview/LongviewDetail/DetailTabs/Installation.tsx @@ -1,7 +1,7 @@ +import { Paper } from '@linode/ui'; import * as React from 'react'; import { DocumentTitleSegment } from 'src/components/DocumentTitle'; -import { Paper } from '@linode/ui'; import { InstallationInstructions } from '../../shared/InstallationInstructions'; @@ -15,10 +15,10 @@ const Installation = (props: Props) => { <> ({ padding: theme.spacing(3), })} + data-testid="longview-clients" > { justifyContent="space-between" spacing={4} > - + - + - + - + - + @@ -119,11 +119,11 @@ const StyledTimeRangeSelect = styled(TimeRangeSelect, { const StyledGrid = styled(Grid, { label: 'StyledGrid' })(({ theme }) => ({ alignItems: 'center', + boxSizing: 'border-box', display: 'flex', flexDirection: 'row', justifyContent: 'space-between', marginBottom: theme.spacing(1.25), - boxSizing: 'border-box', })); const itemSpacing = { diff --git a/packages/manager/src/features/Longview/LongviewDetail/DetailTabs/Processes/ProcessesTable.test.tsx b/packages/manager/src/features/Longview/LongviewDetail/DetailTabs/Processes/ProcessesTable.test.tsx index b70650ae963..54e91fc8df5 100644 --- a/packages/manager/src/features/Longview/LongviewDetail/DetailTabs/Processes/ProcessesTable.test.tsx +++ b/packages/manager/src/features/Longview/LongviewDetail/DetailTabs/Processes/ProcessesTable.test.tsx @@ -5,6 +5,7 @@ import { renderWithTheme } from 'src/utilities/testHelpers'; import { extendData } from './ProcessesLanding'; import { ProcessesTable } from './ProcessesTable'; + import type { ProcessesTableProps } from './ProcessesTable'; const mockSetSelectedRow = vi.fn(); diff --git a/packages/manager/src/features/Longview/LongviewLanding/LongviewClientInstructions.tsx b/packages/manager/src/features/Longview/LongviewLanding/LongviewClientInstructions.tsx index c6dc3c1bd19..0dc4ef09345 100644 --- a/packages/manager/src/features/Longview/LongviewLanding/LongviewClientInstructions.tsx +++ b/packages/manager/src/features/Longview/LongviewLanding/LongviewClientInstructions.tsx @@ -1,16 +1,18 @@ -import Grid from '@mui/material/Unstable_Grid2/Grid2'; +import { Paper } from '@linode/ui'; import { useTheme } from '@mui/material/styles'; +import Grid from '@mui/material/Unstable_Grid2/Grid2'; import * as React from 'react'; import { EditableEntityLabel } from 'src/components/EditableEntityLabel/EditableEntityLabel'; -import { Paper } from '@linode/ui'; -import { DispatchProps } from 'src/containers/longview.container'; import { getAPIErrorOrDefault } from 'src/utilities/errorUtils'; import { InstallationInstructions } from '../shared/InstallationInstructions'; -import { ActionHandlers, LongviewActionMenu } from './LongviewActionMenu'; +import { LongviewActionMenu } from './LongviewActionMenu'; import { RestrictedUserLabel } from './RestrictedUserLabel'; +import type { ActionHandlers } from './LongviewActionMenu'; +import type { DispatchProps } from 'src/containers/longview.container'; + interface Props extends ActionHandlers { clientAPIKey: string; clientID: number; @@ -62,7 +64,7 @@ export const LongviewClientInstructions = (props: Props) => { container data-testid="installation" > - + {userCanModifyClient ? ( { return ( <> { resourceType: 'Longview Clients', }), }} + createButtonText="Add Client" + disabledCreateButton={isLongviewCreationRestricted} + docsLink="https://techdocs.akamai.com/cloud-computing/docs/getting-started-with-longview" + entity="Client" + loading={newClientLoading} + onButtonClick={handleAddClient} + removeCrumbX={1} + title="Longview" /> ({ diff --git a/packages/manager/src/features/Managed/ManagedDashboardCard/ManagedDashboardCard.styles.tsx b/packages/manager/src/features/Managed/ManagedDashboardCard/ManagedDashboardCard.styles.tsx index a2e60077e06..1b9c1412deb 100644 --- a/packages/manager/src/features/Managed/ManagedDashboardCard/ManagedDashboardCard.styles.tsx +++ b/packages/manager/src/features/Managed/ManagedDashboardCard/ManagedDashboardCard.styles.tsx @@ -1,5 +1,5 @@ -import Grid from '@mui/material/Unstable_Grid2'; import { styled } from '@mui/material/styles'; +import Grid from '@mui/material/Unstable_Grid2'; import DashboardCard from './DashboardCard'; diff --git a/packages/manager/src/features/Managed/Monitors/IssueDay.styles.tsx b/packages/manager/src/features/Managed/Monitors/IssueDay.styles.tsx index f23fedc9ff4..bd42181337d 100644 --- a/packages/manager/src/features/Managed/Monitors/IssueDay.styles.tsx +++ b/packages/manager/src/features/Managed/Monitors/IssueDay.styles.tsx @@ -1,5 +1,5 @@ -import Grid from '@mui/material/Unstable_Grid2'; import { styled } from '@mui/material/styles'; +import Grid from '@mui/material/Unstable_Grid2'; import { Link } from 'react-router-dom'; import { DateTimeDisplay } from 'src/components/DateTimeDisplay'; diff --git a/packages/manager/src/features/Managed/Monitors/MonitorTable.styles.tsx b/packages/manager/src/features/Managed/Monitors/MonitorTable.styles.tsx index dc25249bca3..72bfd7a136a 100644 --- a/packages/manager/src/features/Managed/Monitors/MonitorTable.styles.tsx +++ b/packages/manager/src/features/Managed/Monitors/MonitorTable.styles.tsx @@ -1,5 +1,5 @@ -import Grid from '@mui/material/Unstable_Grid2'; import { styled } from '@mui/material/styles'; +import Grid from '@mui/material/Unstable_Grid2'; import { TableRow } from 'src/components/TableRow'; import { TableSortCell } from 'src/components/TableSortCell'; diff --git a/packages/manager/src/features/Managed/SSHAccess/SSHAccessTable.tsx b/packages/manager/src/features/Managed/SSHAccess/SSHAccessTable.tsx index cd5b4002534..8fa15589850 100644 --- a/packages/manager/src/features/Managed/SSHAccess/SSHAccessTable.tsx +++ b/packages/manager/src/features/Managed/SSHAccess/SSHAccessTable.tsx @@ -1,4 +1,3 @@ -import { ManagedLinodeSetting } from '@linode/api-v4/lib/managed'; import produce from 'immer'; import * as React from 'react'; @@ -15,10 +14,12 @@ import { TableSortCell } from 'src/components/TableSortCell'; import { useOpenClose } from 'src/hooks/useOpenClose'; import { useAllLinodeSettingsQuery } from 'src/queries/managed/managed'; +import { DEFAULTS } from './common'; import EditSSHAccessDrawer from './EditSSHAccessDrawer'; import { StyledDiv } from './SSHAccessTable.styles'; import SSHAccessTableContent from './SSHAccessTableContent'; -import { DEFAULTS } from './common'; + +import type { ManagedLinodeSetting } from '@linode/api-v4/lib/managed'; const SSHAccessTable = () => { const { data: settings, error, isLoading } = useAllLinodeSettingsQuery(); diff --git a/packages/manager/src/features/PlacementGroups/PlacementGroupsDeleteModal.test.tsx b/packages/manager/src/features/PlacementGroups/PlacementGroupsDeleteModal.test.tsx index 601c7960893..5cc86ba357b 100644 --- a/packages/manager/src/features/PlacementGroups/PlacementGroupsDeleteModal.test.tsx +++ b/packages/manager/src/features/PlacementGroups/PlacementGroupsDeleteModal.test.tsx @@ -1,6 +1,6 @@ +import { userEvent } from '@testing-library/user-event'; import * as React from 'react'; -import { userEvent } from '@testing-library/user-event'; import { linodeFactory, placementGroupFactory } from 'src/factories'; import { renderWithTheme } from 'src/utilities/testHelpers'; @@ -40,7 +40,6 @@ describe('PlacementGroupsDeleteModal', () => { }), ]} selectedPlacementGroup={placementGroupFactory.build({ - placement_group_type: 'anti_affinity:local', id: 1, label: 'PG-to-delete', members: [ @@ -49,6 +48,7 @@ describe('PlacementGroupsDeleteModal', () => { linode_id: 1, }, ], + placement_group_type: 'anti_affinity:local', region: 'us-east', })} disableUnassignButton={false} @@ -84,10 +84,10 @@ describe('PlacementGroupsDeleteModal', () => { }), ]} selectedPlacementGroup={placementGroupFactory.build({ - placement_group_type: 'anti_affinity:local', id: 1, label: 'PG-to-delete', members: [], + placement_group_type: 'anti_affinity:local', })} disableUnassignButton={false} /> diff --git a/packages/manager/src/features/StackScripts/StackScripts.tsx b/packages/manager/src/features/StackScripts/StackScripts.tsx index be474eadca9..99a689889ee 100644 --- a/packages/manager/src/features/StackScripts/StackScripts.tsx +++ b/packages/manager/src/features/StackScripts/StackScripts.tsx @@ -7,8 +7,8 @@ import { useLocation, useRouteMatch, } from 'react-router-dom'; -import { ProductInformationBanner } from 'src/components/ProductInformationBanner/ProductInformationBanner'; +import { ProductInformationBanner } from 'src/components/ProductInformationBanner/ProductInformationBanner'; import { SuspenseLoader } from 'src/components/SuspenseLoader'; const StackScriptsDetail = React.lazy(() => import('./StackScriptsDetail')); diff --git a/packages/manager/src/features/Support/SupportTicketDetail/TabbedReply/ReplyActions.tsx b/packages/manager/src/features/Support/SupportTicketDetail/TabbedReply/ReplyActions.tsx index 4358ace95a5..c3ab00b3dda 100644 --- a/packages/manager/src/features/Support/SupportTicketDetail/TabbedReply/ReplyActions.tsx +++ b/packages/manager/src/features/Support/SupportTicketDetail/TabbedReply/ReplyActions.tsx @@ -1,5 +1,5 @@ -import { makeStyles } from 'tss-react/mui'; import * as React from 'react'; +import { makeStyles } from 'tss-react/mui'; import { ActionsPanel } from 'src/components/ActionsPanel/ActionsPanel'; diff --git a/packages/manager/src/features/VPCs/VPCLanding/VPCLanding.tsx b/packages/manager/src/features/VPCs/VPCLanding/VPCLanding.tsx index d9761248f12..1e0291d288a 100644 --- a/packages/manager/src/features/VPCs/VPCLanding/VPCLanding.tsx +++ b/packages/manager/src/features/VPCs/VPCLanding/VPCLanding.tsx @@ -1,8 +1,8 @@ +import { CircleProgress } from '@linode/ui'; import { createLazyRoute } from '@tanstack/react-router'; import * as React from 'react'; import { useHistory } from 'react-router-dom'; -import { CircleProgress } from '@linode/ui'; import { ErrorState } from 'src/components/ErrorState/ErrorState'; import { Hidden } from 'src/components/Hidden'; import { LandingHeader } from 'src/components/LandingHeader'; @@ -13,13 +13,13 @@ import { TableCell } from 'src/components/TableCell'; import { TableHead } from 'src/components/TableHead'; import { TableRow } from 'src/components/TableRow'; import { TableSortCell } from 'src/components/TableSortCell'; +import { getRestrictedResourceText } from 'src/features/Account/utils'; import { VPC_DOCS_LINK, VPC_LABEL } from 'src/features/VPCs/constants'; import { useOrder } from 'src/hooks/useOrder'; import { usePagination } from 'src/hooks/usePagination'; import { useRestrictedGlobalGrantCheck } from 'src/hooks/useRestrictedGlobalGrantCheck'; import { useVPCsQuery } from 'src/queries/vpcs/vpcs'; import { getAPIErrorOrDefault } from 'src/utilities/errorUtils'; -import { getRestrictedResourceText } from 'src/features/Account/utils'; import { VPCDeleteDialog } from './VPCDeleteDialog'; import { VPCEditDrawer } from './VPCEditDrawer'; @@ -100,10 +100,6 @@ const VPCLanding = () => { return ( <> { resourceType: 'VPCs', }), }} + createButtonText="Create VPC" disabledCreateButton={isVPCCreationRestricted} + docsLink={VPC_DOCS_LINK} + onButtonClick={createVPC} + title={VPC_LABEL} /> @@ -148,7 +148,7 @@ const VPCLanding = () => { Linodes - + diff --git a/packages/manager/src/features/VPCs/VPCLanding/VPCRow.tsx b/packages/manager/src/features/VPCs/VPCLanding/VPCRow.tsx index bd19d361b96..4c3ad378561 100644 --- a/packages/manager/src/features/VPCs/VPCLanding/VPCRow.tsx +++ b/packages/manager/src/features/VPCs/VPCLanding/VPCRow.tsx @@ -1,15 +1,16 @@ -import { VPC } from '@linode/api-v4/lib/vpcs/types'; import * as React from 'react'; import { Link } from 'react-router-dom'; -import { Action } from 'src/components/ActionMenu/ActionMenu'; import { Hidden } from 'src/components/Hidden'; import { InlineMenuAction } from 'src/components/InlineMenuAction/InlineMenuAction'; import { TableCell } from 'src/components/TableCell'; import { TableRow } from 'src/components/TableRow'; -import { useRegionsQuery } from 'src/queries/regions/regions'; import { getRestrictedResourceText } from 'src/features/Account/utils'; import { useIsResourceRestricted } from 'src/hooks/useIsResourceRestricted'; +import { useRegionsQuery } from 'src/queries/regions/regions'; + +import type { VPC } from '@linode/api-v4/lib/vpcs/types'; +import type { Action } from 'src/components/ActionMenu/ActionMenu'; interface Props { handleDeleteVPC: () => void; @@ -35,9 +36,9 @@ export const VPCRow = ({ handleDeleteVPC, handleEditVPC, vpc }: Props) => { const actions: Action[] = [ { + disabled: isVPCReadOnly, onClick: handleEditVPC, title: 'Edit', - disabled: isVPCReadOnly, tooltip: isVPCReadOnly ? getRestrictedResourceText({ action: 'edit', @@ -47,9 +48,9 @@ export const VPCRow = ({ handleDeleteVPC, handleEditVPC, vpc }: Props) => { : undefined, }, { + disabled: isVPCReadOnly, onClick: handleDeleteVPC, title: 'Delete', - disabled: isVPCReadOnly, tooltip: isVPCReadOnly ? getRestrictedResourceText({ action: 'delete', diff --git a/packages/manager/src/hooks/useOrder.test.tsx b/packages/manager/src/hooks/useOrder.test.tsx index 4451588aa48..4a2e3931af8 100644 --- a/packages/manager/src/hooks/useOrder.test.tsx +++ b/packages/manager/src/hooks/useOrder.test.tsx @@ -1,12 +1,14 @@ import { act, renderHook, waitFor } from '@testing-library/react'; + import { HttpResponse, http, server } from 'src/mocks/testServer'; import { queryClientFactory } from 'src/queries/base'; import { usePreferences } from 'src/queries/profile/preferences'; -import { OrderSet } from 'src/types/ManagerPreferences'; import { wrapWithTheme } from 'src/utilities/testHelpers'; import { useOrder } from './useOrder'; +import type { OrderSet } from 'src/types/ManagerPreferences'; + // Default for Sorting const defaultOrder: OrderSet = { order: 'asc', diff --git a/packages/manager/src/hooks/useUnassignLinode.ts b/packages/manager/src/hooks/useUnassignLinode.ts index 4660acdadc7..4a86e4f7810 100644 --- a/packages/manager/src/hooks/useUnassignLinode.ts +++ b/packages/manager/src/hooks/useUnassignLinode.ts @@ -2,13 +2,13 @@ import { deleteLinodeConfigInterface } from '@linode/api-v4'; import { useQueryClient } from '@tanstack/react-query'; import * as React from 'react'; +import { linodeQueries } from 'src/queries/linodes/linodes'; import { vpcQueries } from 'src/queries/vpcs/vpcs'; import type { APIError, DeleteLinodeConfigInterfacePayload, } from '@linode/api-v4'; -import { linodeQueries } from 'src/queries/linodes/linodes'; interface IdsForUnassignLinode extends DeleteLinodeConfigInterfacePayload { vpcId: number; diff --git a/packages/manager/src/mocks/utilities/events.ts b/packages/manager/src/mocks/utilities/events.ts index 5c8b24a4286..02254773c3e 100644 --- a/packages/manager/src/mocks/utilities/events.ts +++ b/packages/manager/src/mocks/utilities/events.ts @@ -1,4 +1,5 @@ import { eventFactory } from 'src/factories'; + import { mswDB } from '../indexedDB'; import type { Event } from '@linode/api-v4'; diff --git a/packages/manager/src/queries/iam/iam.ts b/packages/manager/src/queries/iam/iam.ts index f3a16356f97..7312376439a 100644 --- a/packages/manager/src/queries/iam/iam.ts +++ b/packages/manager/src/queries/iam/iam.ts @@ -1,12 +1,15 @@ -import { - APIError, - IamUserPermissions, - IamAccountPermissions, -} from '@linode/api-v4'; -import { iamQueries } from './queries'; import { useQuery } from '@tanstack/react-query'; + import { useProfile } from 'src/queries/profile/profile'; + import { queryPresets } from '../base'; +import { iamQueries } from './queries'; + +import type { + APIError, + IamAccountPermissions, + IamUserPermissions, +} from '@linode/api-v4'; export const useAccountUserPermissions = (username: string) => { return useQuery( diff --git a/packages/manager/src/queries/networking/networking.ts b/packages/manager/src/queries/networking/networking.ts index c8e83859de2..0c25c4f1984 100644 --- a/packages/manager/src/queries/networking/networking.ts +++ b/packages/manager/src/queries/networking/networking.ts @@ -6,6 +6,7 @@ import { useQuery, useQueryClient, } from '@tanstack/react-query'; +import { useMemo } from 'react'; import { linodeQueries } from '../linodes/linodes'; import { getAllIPv6Ranges, getAllIps } from './requests'; @@ -19,7 +20,6 @@ import type { IPRangeInformation, Params, } from '@linode/api-v4'; -import { useMemo } from 'react'; export const networkingQueries = createQueryKeys('networking', { ips: (params: Params = {}, filter: Filter = {}) => ({ diff --git a/packages/manager/src/queries/resources/resources.ts b/packages/manager/src/queries/resources/resources.ts index acb53e60b51..09be9b860d8 100644 --- a/packages/manager/src/queries/resources/resources.ts +++ b/packages/manager/src/queries/resources/resources.ts @@ -1,9 +1,12 @@ -import { IamAccountResource, APIError } from '@linode/api-v4'; import { useQuery } from '@tanstack/react-query'; + import { useProfile } from 'src/queries/profile/profile'; + import { queryPresets } from '../base'; import { resourcesQueries } from './queries'; +import type { APIError, IamAccountResource } from '@linode/api-v4'; + export const useAccountResources = () => { const { data: profile } = useProfile(); diff --git a/packages/manager/src/store/index.ts b/packages/manager/src/store/index.ts index 66b6be90e1a..2e2cb12ed76 100644 --- a/packages/manager/src/store/index.ts +++ b/packages/manager/src/store/index.ts @@ -1,31 +1,33 @@ -import { Store, applyMiddleware, combineReducers, createStore } from 'redux'; +import { applyMiddleware, combineReducers, createStore } from 'redux'; +import thunk from 'redux-thunk'; -import { State as AuthState } from 'src/store/authentication'; import authentication, { defaultState as authenticationDefaultState, } from 'src/store/authentication/authentication.reducer'; import globalErrors, { - State as GlobalErrorState, defaultState as defaultGlobalErrorState, } from 'src/store/globalErrors'; import longview, { - State as LongviewState, defaultState as defaultLongviewState, } from 'src/store/longview/longview.reducer'; import longviewStats, { - State as LongviewStatsState, defaultState as defaultLongviewStatsState, } from 'src/store/longviewStats/longviewStats.reducer'; import mockFeatureFlags, { - MockFeatureFlagState, defaultMockFeatureFlagState, } from './mockFeatureFlags'; import pendingUpload, { - State as PendingUploadState, defaultState as pendingUploadState, } from './pendingUpload'; -import thunk from 'redux-thunk'; + +import type { MockFeatureFlagState } from './mockFeatureFlags'; +import type { State as PendingUploadState } from './pendingUpload'; +import type { Store } from 'redux'; +import type { State as AuthState } from 'src/store/authentication'; +import type { State as GlobalErrorState } from 'src/store/globalErrors'; +import type { State as LongviewState } from 'src/store/longview/longview.reducer'; +import type { State as LongviewStatsState } from 'src/store/longviewStats/longviewStats.reducer'; export interface ApplicationState { authentication: AuthState; diff --git a/packages/manager/src/utilities/betaUtils.test.ts b/packages/manager/src/utilities/betaUtils.test.ts index 6546aa1a28c..18d1525bff8 100644 --- a/packages/manager/src/utilities/betaUtils.test.ts +++ b/packages/manager/src/utilities/betaUtils.test.ts @@ -1,50 +1,49 @@ import { DateTime } from 'luxon'; import { accountBetaFactory, betaFactory } from '../factories'; - import { - hasStarted, canEnd, - willEnd, - willStart, + getBetaStatus, hasEnded, + hasStarted, isCustomerEnrolled, wasCustomerEnrolled, - getBetaStatus, + willEnd, + willStart, } from './betaUtils'; const generateTestBetas = () => ({ - activeNeverEndingBeta: betaFactory.build({ - started: DateTime.now().minus({ days: 30 }).toISO(), - }), - activeWithEndedBeta: betaFactory.build({ - started: DateTime.now().minus({ days: 30 }).toISO(), + activeAccountBeta: accountBetaFactory.build({ ended: DateTime.now().plus({ days: 30 }).toISO(), + started: DateTime.now().minus({ days: 30 }).toISO(), }), activeBeta: betaFactory.build({ started: DateTime.now().minus({ days: 30 }).toISO(), }), - activeAccountBeta: accountBetaFactory.build({ + activeNeverEndingAccountBeta: accountBetaFactory.build(), + activeNeverEndingBeta: betaFactory.build({ started: DateTime.now().minus({ days: 30 }).toISO(), + }), + activeWithEndedBeta: betaFactory.build({ ended: DateTime.now().plus({ days: 30 }).toISO(), + started: DateTime.now().minus({ days: 30 }).toISO(), }), - expiredBeta: betaFactory.build({ - started: DateTime.now().minus({ days: 60 }).toISO(), + expiredAccountBeta: accountBetaFactory.build({ ended: DateTime.now().minus({ days: 30 }).toISO(), + started: DateTime.now().minus({ days: 60 }).toISO(), }), - futureBeta: betaFactory.build({ - started: DateTime.now().plus({ days: 30 }).toISO(), - ended: DateTime.now().plus({ days: 60 }).toISO(), + expiredBeta: betaFactory.build({ + ended: DateTime.now().minus({ days: 30 }).toISO(), + started: DateTime.now().minus({ days: 60 }).toISO(), }), futureAccountBeta: accountBetaFactory.build({ - started: DateTime.now().plus({ days: 30 }).toISO(), ended: DateTime.now().plus({ days: 60 }).toISO(), + started: DateTime.now().plus({ days: 30 }).toISO(), }), - expiredAccountBeta: accountBetaFactory.build({ - started: DateTime.now().minus({ days: 60 }).toISO(), - ended: DateTime.now().minus({ days: 30 }).toISO(), + futureBeta: betaFactory.build({ + ended: DateTime.now().plus({ days: 60 }).toISO(), + started: DateTime.now().plus({ days: 30 }).toISO(), }), - activeNeverEndingAccountBeta: accountBetaFactory.build(), }); let betas: ReturnType; diff --git a/packages/manager/vite.config.ts b/packages/manager/vite.config.ts index 4b1d85d1f14..a0ed3f20a15 100644 --- a/packages/manager/vite.config.ts +++ b/packages/manager/vite.config.ts @@ -1,7 +1,7 @@ import react from '@vitejs/plugin-react-swc'; +import { URL } from 'url'; import svgr from 'vite-plugin-svgr'; import { defineConfig } from 'vitest/config'; -import { URL } from 'url'; // ESM-friendly alternative to `__dirname`. const DIRNAME = new URL('.', import.meta.url).pathname; @@ -35,9 +35,9 @@ export default defineConfig({ 'src/**/*.utils.{js,jsx,ts,tsx}', ], }, - pool: 'forks', environment: 'jsdom', globals: true, + pool: 'forks', setupFiles: './src/testSetup.ts', }, });