diff --git a/dashboard/react-table.d.ts b/dashboard/react-table.d.ts index 88519f8a6f..b7a10b4af4 100644 --- a/dashboard/react-table.d.ts +++ b/dashboard/react-table.d.ts @@ -1,121 +1,71 @@ import { - UseColumnOrderInstanceProps, - UseColumnOrderState, - UseExpandedHooks, - UseExpandedInstanceProps, - UseExpandedOptions, - UseExpandedRowProps, - UseExpandedState, - UseFiltersColumnOptions, - UseFiltersColumnProps, - UseFiltersInstanceProps, - UseFiltersOptions, - UseFiltersState, - UseGlobalFiltersColumnOptions, - UseGlobalFiltersInstanceProps, - UseGlobalFiltersOptions, - UseGlobalFiltersState, - UseGroupByCellProps, - UseGroupByColumnOptions, - UseGroupByColumnProps, - UseGroupByHooks, - UseGroupByInstanceProps, - UseGroupByOptions, - UseGroupByRowProps, - UseGroupByState, - UsePaginationInstanceProps, - UsePaginationOptions, - UsePaginationState, - UseResizeColumnsColumnOptions, - UseResizeColumnsColumnProps, - UseResizeColumnsOptions, - UseResizeColumnsState, - UseRowSelectHooks, - UseRowSelectInstanceProps, - UseRowSelectOptions, - UseRowSelectRowProps, - UseRowSelectState, - UseRowStateCellProps, - UseRowStateInstanceProps, - UseRowStateOptions, - UseRowStateRowProps, - UseRowStateState, - UseSortByColumnOptions, - UseSortByColumnProps, - UseSortByHooks, - UseSortByInstanceProps, - UseSortByOptions, - UseSortByState, + type UseColumnOrderInstanceProps, + type UseColumnOrderState, + type UseExpandedHooks, + type UseExpandedInstanceProps, + type UseExpandedOptions, + type UseExpandedRowProps, + type UseExpandedState, + type UseFiltersColumnOptions, + type UseFiltersColumnProps, + type UseFiltersInstanceProps, + type UseFiltersOptions, + type UseFiltersState, + type UseGlobalFiltersColumnOptions, + type UseGlobalFiltersInstanceProps, + type UseGlobalFiltersOptions, + type UseGlobalFiltersState, + type UseGroupByCellProps, + type UseGroupByColumnOptions, + type UseGroupByColumnProps, + type UseGroupByHooks, + type UseGroupByInstanceProps, + type UseGroupByOptions, + type UseGroupByRowProps, + type UseGroupByState, + type UsePaginationInstanceProps, + type UsePaginationOptions, + type UsePaginationState, + type UseResizeColumnsColumnOptions, + type UseResizeColumnsColumnProps, + type UseResizeColumnsOptions, + type UseResizeColumnsState, + type UseRowSelectHooks, + type UseRowSelectInstanceProps, + type UseRowSelectOptions, + type UseRowSelectRowProps, + type UseRowSelectState, + type UseRowStateCellProps, + type UseRowStateInstanceProps, + type UseRowStateOptions, + type UseRowStateRowProps, + type UseRowStateState, + type UseSortByColumnOptions, + type UseSortByColumnProps, + type UseSortByHooks, + type UseSortByInstanceProps, + type UseSortByOptions, + type UseSortByState, } from "react-table"; declare module "react-table" { // take this file as-is, or comment out the sections that don't apply to your plugin configuration - export interface TableOptions< + export type TableOptions< D extends object = {} - > extends UseExpandedOptions, - UseFiltersOptions, - UseGlobalFiltersOptions, - UseGroupByOptions, - UsePaginationOptions, - UseResizeColumnsOptions, - UseRowSelectOptions, - UseRowStateOptions, - UseSortByOptions, - // note that having Record here allows you to add anything to the options, this matches the spirit of the - // underlying js library, but might be cleaner if it's replaced by a more specific type that matches your - // feature set, this is a safe default. - Record {} + > = {} & UseExpandedOptions & UseFiltersOptions & UseGlobalFiltersOptions & UseGroupByOptions & UsePaginationOptions & UseResizeColumnsOptions & UseRowSelectOptions & UseRowStateOptions & UseSortByOptions & Record - export interface Hooks - extends UseExpandedHooks, - UseGroupByHooks, - UseRowSelectHooks, - UseSortByHooks {} + export type Hooks = {} & UseExpandedHooks & UseGroupByHooks & UseRowSelectHooks & UseSortByHooks - export interface TableInstance - extends UseColumnOrderInstanceProps, - UseExpandedInstanceProps, - UseFiltersInstanceProps, - UseGlobalFiltersInstanceProps, - UseGroupByInstanceProps, - UsePaginationInstanceProps, - UseRowSelectInstanceProps, - UseRowStateInstanceProps, - UseSortByInstanceProps {} + export type TableInstance = {} & UseColumnOrderInstanceProps & UseExpandedInstanceProps & UseFiltersInstanceProps & UseGlobalFiltersInstanceProps & UseGroupByInstanceProps & UsePaginationInstanceProps & UseRowSelectInstanceProps & UseRowStateInstanceProps & UseSortByInstanceProps - export interface TableState - extends UseColumnOrderState, - UseExpandedState, - UseFiltersState, - UseGlobalFiltersState, - UseGroupByState, - UsePaginationState, - UseResizeColumnsState, - UseRowSelectState, - UseRowStateState, - UseSortByState {} + export type TableState = {} & UseColumnOrderState & UseExpandedState & UseFiltersState & UseGlobalFiltersState & UseGroupByState & UsePaginationState & UseResizeColumnsState & UseRowSelectState & UseRowStateState & UseSortByState - export interface ColumnInterface - extends UseFiltersColumnOptions, - UseGlobalFiltersColumnOptions, - UseGroupByColumnOptions, - UseResizeColumnsColumnOptions, - UseSortByColumnOptions {} + export type ColumnInterface = {} & UseFiltersColumnOptions & UseGlobalFiltersColumnOptions & UseGroupByColumnOptions & UseResizeColumnsColumnOptions & UseSortByColumnOptions - export interface ColumnInstance - extends UseFiltersColumnProps, - UseGroupByColumnProps, - UseResizeColumnsColumnProps, - UseSortByColumnProps {} + export type ColumnInstance = {} & UseFiltersColumnProps & UseGroupByColumnProps & UseResizeColumnsColumnProps & UseSortByColumnProps - export interface Cell - extends UseGroupByCellProps, - UseRowStateCellProps {} + export type Cell = {} & UseGroupByCellProps & UseRowStateCellProps - export interface Row - extends UseExpandedRowProps, - UseGroupByRowProps, - UseRowSelectRowProps, - UseRowStateRowProps {} + export type Row = {} & UseExpandedRowProps & UseGroupByRowProps & UseRowSelectRowProps & UseRowStateRowProps } diff --git a/dashboard/src/assets/GoogleIcon.tsx b/dashboard/src/assets/GoogleIcon.tsx index 8f11dfd65c..eeb377c7c5 100644 --- a/dashboard/src/assets/GoogleIcon.tsx +++ b/dashboard/src/assets/GoogleIcon.tsx @@ -65,9 +65,9 @@ export default class GHIcon extends Component { { filter="url(#filter-1)" > - + diff --git a/dashboard/src/components/AzureCredentialForm.tsx b/dashboard/src/components/AzureCredentialForm.tsx index ac57e29a07..1333c04291 100644 --- a/dashboard/src/components/AzureCredentialForm.tsx +++ b/dashboard/src/components/AzureCredentialForm.tsx @@ -106,7 +106,7 @@ const AzureCredentialForm: React.FC = ({ goBack, proceed }) => { Follow our documentation to create your service principal and prepare your subscription for use with Porter. - , @@ -162,7 +162,7 @@ const AzureCredentialForm: React.FC = ({ goBack, proceed }) => { /> - + diff --git a/dashboard/src/main/home/app-dashboard/app-view/tabs/Webhooks.tsx b/dashboard/src/main/home/app-dashboard/app-view/tabs/Webhooks.tsx index 1557b9209d..900965744d 100644 --- a/dashboard/src/main/home/app-dashboard/app-view/tabs/Webhooks.tsx +++ b/dashboard/src/main/home/app-dashboard/app-view/tabs/Webhooks.tsx @@ -10,7 +10,7 @@ import Spacer from "components/porter/Spacer"; import Text from "components/porter/Text"; import api from "shared/api"; -import { AppEventWebhook } from "shared/types"; +import { type AppEventWebhook } from "shared/types"; import { url } from "inspector"; type Webhook = { @@ -52,9 +52,9 @@ const Webhooks: React.FC = ({ "", {}, { - projectId: projectId, - deploymentTargetId: deploymentTargetId, - appName: appName, + projectId, + deploymentTargetId, + appName, }, ) .then(({ data: { app_event_webhooks } }) => { @@ -90,9 +90,9 @@ const Webhooks: React.FC = ({ }) }, { - projectId: projectId, - deploymentTargetId: deploymentTargetId, - appName: appName, + projectId, + deploymentTargetId, + appName, }, ) .then(() => { diff --git a/dashboard/src/main/home/app-dashboard/build-settings/BranchSelector.tsx b/dashboard/src/main/home/app-dashboard/build-settings/BranchSelector.tsx index 26d023a628..130fc92ce9 100644 --- a/dashboard/src/main/home/app-dashboard/build-settings/BranchSelector.tsx +++ b/dashboard/src/main/home/app-dashboard/build-settings/BranchSelector.tsx @@ -72,7 +72,7 @@ const BranchSelector: React.FC = ({ return Error loading branches; } - let results = + const results = searchFilter != null ? branches .filter((branch) => { @@ -97,7 +97,7 @@ const BranchSelector: React.FC = ({ setBranch(branch)} + onClick={() => { setBranch(branch); }} > {"branch {branch} diff --git a/dashboard/src/main/home/app-dashboard/build-settings/ProviderSelector.tsx b/dashboard/src/main/home/app-dashboard/build-settings/ProviderSelector.tsx index 79a362d7ca..9b42751b07 100644 --- a/dashboard/src/main/home/app-dashboard/build-settings/ProviderSelector.tsx +++ b/dashboard/src/main/home/app-dashboard/build-settings/ProviderSelector.tsx @@ -3,7 +3,7 @@ import React, { useRef, useState } from "react"; import { useOutsideAlerter } from "shared/hooks/useOutsideAlerter"; import styled from "styled-components"; -interface Props { +type Props = { values: any[]; currentValue: any; onChange: (provider: any) => void; @@ -34,7 +34,7 @@ const ProviderSelector: React.FC = ({ setIsOpen((prev) => !prev)} + onClick={() => { setIsOpen((prev) => !prev); }} > {currentValue?.name || currentValue?.instance_url} diff --git a/dashboard/src/main/home/app-dashboard/build-settings/RepositorySelector.tsx b/dashboard/src/main/home/app-dashboard/build-settings/RepositorySelector.tsx index e2e568ed0f..0a955d7cfb 100644 --- a/dashboard/src/main/home/app-dashboard/build-settings/RepositorySelector.tsx +++ b/dashboard/src/main/home/app-dashboard/build-settings/RepositorySelector.tsx @@ -3,14 +3,14 @@ import styled from "styled-components"; import github from "assets/github-white.png"; import api from "shared/api"; -import { RepoType } from "shared/types"; +import { type RepoType } from "shared/types"; import { Context } from "shared/Context"; import DynamicLink from "components/DynamicLink"; import Loading from "components/Loading"; import SearchBar from "components/SearchBar"; import ProviderSelector from "./ProviderSelector"; -import { PorterApp } from "../types/porterApp"; +import { type PorterApp } from "../types/porterApp"; type Props = { readOnly: boolean; @@ -89,7 +89,7 @@ const RepositorySelector: React.FC = ({ const loadGithubRepos = async (repoId: number) => { try { const res = await api.getGitRepoList< - { FullName: string; Kind: "github" }[] + Array<{ FullName: string; Kind: "github" }> >("", {}, { project_id: currentProject.id, git_repo_id: repoId }); const repos = res.data.map((repo) => ({ ...repo, GHRepoID: repoId })); @@ -97,8 +97,8 @@ const RepositorySelector: React.FC = ({ } catch (error) { } }; - const loadRepos = (provider: any) => { - return loadGithubRepos(provider.installation_id); + const loadRepos = async (provider: any) => { + return await loadGithubRepos(provider.installation_id); }; useEffect(() => { @@ -169,7 +169,7 @@ const RepositorySelector: React.FC = ({ } // show 10 most recently used repos if user hasn't searched anything yet - let results = + const results = searchFilter != null ? repos .filter((repo: RepoType) => { @@ -197,7 +197,7 @@ const RepositorySelector: React.FC = ({ key={i} isSelected={repo.FullName === git_repo_name} lastItem={i === repos.length - 1} - onClick={() => setRepo(repo)} + onClick={() => { setRepo(repo); }} readOnly={readOnly} disabled={false} > diff --git a/dashboard/src/main/home/app-dashboard/expanded-app/DeleteApplicationModal.tsx b/dashboard/src/main/home/app-dashboard/expanded-app/DeleteApplicationModal.tsx index 44d628d02a..95104b50c6 100644 --- a/dashboard/src/main/home/app-dashboard/expanded-app/DeleteApplicationModal.tsx +++ b/dashboard/src/main/home/app-dashboard/expanded-app/DeleteApplicationModal.tsx @@ -35,7 +35,7 @@ const GithubActionModal: React.FC = ({ setDeleteGithubWorkflow(!deleteGithubWorkflow)} + toggleChecked={() => { setDeleteGithubWorkflow(!deleteGithubWorkflow); }} > Upon deletion, open a PR to remove this application's associated CI @@ -57,7 +57,7 @@ const GithubActionModal: React.FC = ({ {renderDeleteGithubWorkflowText()} @@ -220,13 +220,13 @@ const ClusterSettings: React.FC = (props) => { } } - let overrideAWSClusterNameSection = + const overrideAWSClusterNameSection = currentCluster?.aws_integration_id && currentCluster?.aws_integration_id != 0 ? ( setNewAWSClusterID(x)} + setValue={(x: string) => { setNewAWSClusterID(x); }} label="AWS Cluster ID" placeholder="ex: my-awesome-cluster" width="100%" @@ -240,7 +240,7 @@ const ClusterSettings: React.FC = (props) => { setNewClusterName(x)} + setValue={(x: string) => { setNewClusterName(x); }} label="Cluster Name" placeholder="ex: my-awesome-cluster" width="100%" @@ -252,7 +252,7 @@ const ClusterSettings: React.FC = (props) => { ); - let configureUrl = ( + const configureUrl = ( ingressIp: string | undefined, ingressError: DetailedIngressError ) => { @@ -293,7 +293,7 @@ const ClusterSettings: React.FC = (props) => { Enable agent setEnableAgent(!enableAgent)} + toggle={() => { setEnableAgent(!enableAgent); }} checked={enableAgent} /> diff --git a/dashboard/src/main/home/cluster-dashboard/dashboard/ClusterSettingsModal.tsx b/dashboard/src/main/home/cluster-dashboard/dashboard/ClusterSettingsModal.tsx index 70a532c479..dcbde463e2 100644 --- a/dashboard/src/main/home/cluster-dashboard/dashboard/ClusterSettingsModal.tsx +++ b/dashboard/src/main/home/cluster-dashboard/dashboard/ClusterSettingsModal.tsx @@ -50,7 +50,7 @@ const ClusterSettingsModal: React.FC = ({ setCurrentModal(null, null)} + onRequestClose={() => { setCurrentModal(null, null); }} title="Cluster name" > diff --git a/dashboard/src/main/home/cluster-dashboard/dashboard/Metrics.tsx b/dashboard/src/main/home/cluster-dashboard/dashboard/Metrics.tsx index 6ca17c6cf2..4da1931913 100644 --- a/dashboard/src/main/home/cluster-dashboard/dashboard/Metrics.tsx +++ b/dashboard/src/main/home/cluster-dashboard/dashboard/Metrics.tsx @@ -9,9 +9,9 @@ import Placeholder from "components/OldPlaceholder"; import ParentSize from "@visx/responsive/lib/components/ParentSize"; import AreaChart from "../expanded-chart/metrics/AreaChart"; import { - AvailableMetrics, - GenericMetricResponse, - NormalizedMetricsData, + type AvailableMetrics, + type GenericMetricResponse, + type NormalizedMetricsData, } from "../expanded-chart/metrics/types"; import SelectRow from "../../../../components/form-components/SelectRow"; import { MetricNormalizer } from "../expanded-chart/metrics/MetricNormalizer"; @@ -130,13 +130,13 @@ const Metrics: React.FC = () => { if (showMetricsSettings) { return ( <> - setShowMetricsSettings(false)} /> + { setShowMetricsSettings(false); }} /> setSelectedIngress(x)} + setActiveValue={(x: any) => { setSelectedIngress(x); }} options={ingressOptions} width="100%" /> @@ -174,11 +174,11 @@ const Metrics: React.FC = () => { if (dropdownExpanded) { return ( <> - setDropdownExpanded(false)} /> + { setDropdownExpanded(false); }} /> setDropdownExpanded(false)} + onClick={() => { setDropdownExpanded(false); }} > {renderOptionList()} @@ -209,8 +209,8 @@ const Metrics: React.FC = () => { const getMetrics = async () => { try { - let shouldsum = true; - let namespace = "default"; + const shouldsum = true; + const namespace = "default"; // calculate start and end range const d = new Date(); @@ -315,14 +315,14 @@ const Metrics: React.FC = () => {
setDropdownExpanded(!dropdownExpanded)} + onClick={() => { setDropdownExpanded(!dropdownExpanded); }} > {selectedMetricLabel} arrow_drop_down {renderDropdown()} - setShowMetricsSettings(true)}> + { setShowMetricsSettings(true); }}> {renderMetricsSettings()} @@ -342,7 +342,7 @@ const Metrics: React.FC = () => { { value: "1M", label: "1M" }, ]} currentTab={selectedRange} - setCurrentTab={(x: string) => setSelectedRange(x)} + setCurrentTab={(x: string) => { setSelectedRange(x); }} />
diff --git a/dashboard/src/main/home/cluster-dashboard/dashboard/NamespaceList.tsx b/dashboard/src/main/home/cluster-dashboard/dashboard/NamespaceList.tsx index efa74b436c..80b5ae8fac 100644 --- a/dashboard/src/main/home/cluster-dashboard/dashboard/NamespaceList.tsx +++ b/dashboard/src/main/home/cluster-dashboard/dashboard/NamespaceList.tsx @@ -1,7 +1,7 @@ import React, { useContext, useEffect, useMemo, useRef, useState } from "react"; import styled from "styled-components"; import { Context } from "shared/Context"; -import { ClusterType, ProjectType } from "shared/types"; +import { type ClusterType, type ProjectType } from "shared/types"; import { pushFiltered } from "shared/routing"; import { useHistory, useLocation } from "react-router"; import useAuth from "shared/auth/useAuth"; @@ -15,7 +15,7 @@ const useWebsocket = ( const wsRef = useRef(undefined); useEffect(() => { - let protocol = window.location.protocol == "https:" ? "wss" : "ws"; + const protocol = window.location.protocol == "https:" ? "wss" : "ws"; wsRef.current = new WebSocket( `${protocol}://${window.location.host}/api/projects/${currentProject.id}/clusters/${currentCluster.id}/namespace/status` ); @@ -121,12 +121,12 @@ export const NamespaceList: React.FunctionComponent = () => { {isAuthorized("namespace", "", ["get", "create"]) && (