mirror of
https://github.com/argoproj/argo-cd.git
synced 2026-02-20 01:28:45 +01:00
fix: fix typescript compilation errors and add ts validation in lint (#12700)
Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
This commit is contained in:
committed by
GitHub
parent
e18adb5ab3
commit
13258e425f
@@ -6,7 +6,7 @@
|
||||
"start": "webpack-dev-server --config ./src/app/webpack.config.js --mode development",
|
||||
"docker": "./scripts/build_docker.sh",
|
||||
"build": "find ./dist -type f -not -name gitkeep -delete && webpack --config ./src/app/webpack.config.js --mode production",
|
||||
"lint": "tslint -p ./src/app",
|
||||
"lint": "tsc --noEmit --project ./src/app && tslint -p ./src/app",
|
||||
"test": "jest"
|
||||
},
|
||||
"dependencies": {
|
||||
|
||||
@@ -32,13 +32,13 @@ export const ApplicationDeploymentHistory = ({
|
||||
<div className='row application-deployment-history__item' key={info.deployedAt} onClick={() => selectDeployment(index)}>
|
||||
<div className='columns small-3'>
|
||||
<div>
|
||||
<i className='fa fa-clock' /> <span class='show-for-large'>Deployed At:</span>
|
||||
<i className='fa fa-clock' /> <span className='show-for-large'>Deployed At:</span>
|
||||
<br />
|
||||
<Timestamp date={info.deployedAt} />
|
||||
</div>
|
||||
<div>
|
||||
<br />
|
||||
<i className='fa fa-hourglass-half' /> <span class='show-for-large'>Time to deploy:</span>
|
||||
<i className='fa fa-hourglass-half' /> <span className='show-for-large'>Time to deploy:</span>
|
||||
<br />
|
||||
{(info.deployStartedAt && <Duration durationMs={moment(info.deployedAt).diff(moment(info.deployStartedAt)) / 1000} />) || 'Unknown'}
|
||||
</div>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {DropDownMenu, NotificationType, SlidingPanel, Tooltip} from 'argo-ui';
|
||||
import {DropDownMenu, NotificationType, SlidingPanel} from 'argo-ui';
|
||||
import * as classNames from 'classnames';
|
||||
import * as PropTypes from 'prop-types';
|
||||
import * as React from 'react';
|
||||
@@ -30,7 +30,7 @@ import {ApplicationsDetailsAppDropdown} from './application-details-app-dropdown
|
||||
import {useSidebarTarget} from '../../../sidebar/sidebar';
|
||||
|
||||
import './application-details.scss';
|
||||
import {AppViewExtension, ExtensionComponentProps} from '../../../shared/services/extensions-service';
|
||||
import {AppViewExtension} from '../../../shared/services/extensions-service';
|
||||
|
||||
interface ApplicationDetailsState {
|
||||
page: number;
|
||||
@@ -456,7 +456,7 @@ export class ApplicationDetails extends React.Component<RouteComponentProps<{app
|
||||
selectedNodeFullName={this.selectedNodeKey}
|
||||
onNodeClick={fullName => this.selectNode(fullName)}
|
||||
nodeMenu={node =>
|
||||
AppUtils.renderResourceMenu(node, application, tree, this.appContext, this.appChanged, () =>
|
||||
AppUtils.renderResourceMenu(node, application, tree, this.appContext.apis, this.appChanged, () =>
|
||||
this.getApplicationActionMenu(application, false)
|
||||
)
|
||||
}
|
||||
@@ -483,11 +483,11 @@ export class ApplicationDetails extends React.Component<RouteComponentProps<{app
|
||||
app={application}
|
||||
onItemClick={fullName => this.selectNode(fullName)}
|
||||
nodeMenu={node =>
|
||||
AppUtils.renderResourceMenu(node, application, tree, this.appContext, this.appChanged, () =>
|
||||
AppUtils.renderResourceMenu(node, application, tree, this.appContext.apis, this.appChanged, () =>
|
||||
this.getApplicationActionMenu(application, false)
|
||||
)
|
||||
}
|
||||
quickStarts={node => AppUtils.renderResourceButtons(node, application, tree, this.appContext, this.appChanged)}
|
||||
quickStarts={node => AppUtils.renderResourceButtons(node, application, tree, this.appContext.apis, this.appChanged)}
|
||||
/>
|
||||
)) ||
|
||||
(this.state.extensionsMap[pref.view] != null && (
|
||||
@@ -521,7 +521,7 @@ export class ApplicationDetails extends React.Component<RouteComponentProps<{app
|
||||
{...node, root: node},
|
||||
application,
|
||||
tree,
|
||||
this.appContext,
|
||||
this.appContext.apis,
|
||||
this.appChanged,
|
||||
() => this.getApplicationActionMenu(application, false)
|
||||
)
|
||||
@@ -550,7 +550,7 @@ export class ApplicationDetails extends React.Component<RouteComponentProps<{app
|
||||
onNodeClick={fullName => this.selectNode(fullName)}
|
||||
resources={data}
|
||||
nodeMenu={node =>
|
||||
AppUtils.renderResourceMenu({...node, root: node}, application, tree, this.appContext, this.appChanged, () =>
|
||||
AppUtils.renderResourceMenu({...node, root: node}, application, tree, this.appContext.apis, this.appChanged, () =>
|
||||
this.getApplicationActionMenu(application, false)
|
||||
)
|
||||
}
|
||||
@@ -571,7 +571,7 @@ export class ApplicationDetails extends React.Component<RouteComponentProps<{app
|
||||
</SlidingPanel>
|
||||
<ApplicationSyncPanel
|
||||
application={application}
|
||||
hide={() => AppUtils.showDeploy(null, this.appContext)}
|
||||
hide={() => AppUtils.showDeploy(null, this.appContext.apis)}
|
||||
selectedResource={syncResourceKey}
|
||||
/>
|
||||
<SlidingPanel isShown={this.selectedRollbackDeploymentIndex > -1} onClose={() => this.setRollbackPanelVisible(-1)}>
|
||||
@@ -671,7 +671,7 @@ export class ApplicationDetails extends React.Component<RouteComponentProps<{app
|
||||
{
|
||||
iconClassName: 'fa fa-sync',
|
||||
title: <ActionMenuItem actionLabel='Sync' />,
|
||||
action: () => AppUtils.showDeploy('all', this.appContext)
|
||||
action: () => AppUtils.showDeploy('all', this.appContext.apis)
|
||||
},
|
||||
{
|
||||
iconClassName: 'fa fa-info-circle',
|
||||
|
||||
@@ -246,7 +246,12 @@ export class PodView extends React.Component<PodViewProps> {
|
||||
</React.Fragment>
|
||||
),
|
||||
action: () => {
|
||||
deletePodAction(pod, this.appContext, this.props.app.metadata.name);
|
||||
deletePodAction(
|
||||
pod,
|
||||
this.appContext,
|
||||
this.props.app.metadata.name,
|
||||
this.props.app.metadata.namespace
|
||||
);
|
||||
}
|
||||
}
|
||||
]}
|
||||
|
||||
@@ -1,19 +1,7 @@
|
||||
import {AutocompleteField, DropDownMenu, ErrorNotification, FormField, FormSelect, HelpIcon, NotificationType} from 'argo-ui';
|
||||
import * as React from 'react';
|
||||
import {FormApi, Text} from 'react-form';
|
||||
import {
|
||||
ARGO_WARNING_COLOR,
|
||||
Cluster,
|
||||
DataLoader,
|
||||
EditablePanel,
|
||||
EditablePanelItem,
|
||||
Expandable,
|
||||
MapInputField,
|
||||
NumberField,
|
||||
Repo,
|
||||
Revision,
|
||||
RevisionHelpIcon
|
||||
} from '../../../shared/components';
|
||||
import {Cluster, DataLoader, EditablePanel, EditablePanelItem, Expandable, MapInputField, NumberField, Repo, Revision, RevisionHelpIcon} from '../../../shared/components';
|
||||
import {BadgePanel, Spinner} from '../../../shared/components';
|
||||
import {Consumer, ContextApis} from '../../../shared/context';
|
||||
import * as models from '../../../shared/models';
|
||||
|
||||
@@ -324,7 +324,7 @@ export const ResourceDetails = (props: ResourceDetailsProps) => {
|
||||
<i className='fa fa-ellipsis-v' />
|
||||
</button>
|
||||
)}>
|
||||
{() => AppUtils.renderResourceActionMenu(selectedNode, application, tree, {apis: appContext})}
|
||||
{() => AppUtils.renderResourceActionMenu(selectedNode, application, appContext)}
|
||||
</DropDown>
|
||||
</div>
|
||||
<Tabs
|
||||
|
||||
@@ -21,7 +21,7 @@ export interface NodeId {
|
||||
namespace: string;
|
||||
name: string;
|
||||
group: string;
|
||||
createdAt?: appModels.Time;
|
||||
createdAt?: models.Time;
|
||||
}
|
||||
|
||||
type ActionMenuItem = MenuItem & {disabled?: boolean; tooltip?: string};
|
||||
@@ -261,8 +261,8 @@ export const ComparisonStatusIcon = ({
|
||||
);
|
||||
};
|
||||
|
||||
export function showDeploy(resource: string, appContext: AppContext) {
|
||||
appContext.apis.navigation.goto('.', {deploy: resource}, {replace: true});
|
||||
export function showDeploy(resource: string, apis: ContextApis) {
|
||||
apis.navigation.goto('.', {deploy: resource}, {replace: true});
|
||||
}
|
||||
|
||||
export function findChildPod(node: appModels.ResourceNode, tree: appModels.ApplicationTree): appModels.ResourceNode {
|
||||
@@ -395,7 +395,7 @@ export const deletePopup = async (ctx: ContextApis, resource: ResourceTreeNode,
|
||||
);
|
||||
};
|
||||
|
||||
function getResourceActionsMenuItems(resource: ResourceTreeNode, metadata: models.Metadata, appContext: AppContext): Observable<ActionMenuItem[]> {
|
||||
function getResourceActionsMenuItems(resource: ResourceTreeNode, metadata: models.ObjectMeta, apis: ContextApis): Promise<ActionMenuItem[]> {
|
||||
return services.applications
|
||||
.getResourceActions(metadata.name, metadata.namespace, resource)
|
||||
.then(actions => {
|
||||
@@ -406,15 +406,12 @@ function getResourceActionsMenuItems(resource: ResourceTreeNode, metadata: model
|
||||
disabled: !!action.disabled,
|
||||
action: async () => {
|
||||
try {
|
||||
const confirmed = await appContext.apis.popup.confirm(
|
||||
`Execute '${action.name}' action?`,
|
||||
`Are you sure you want to execute '${action.name}' action?`
|
||||
);
|
||||
const confirmed = await apis.popup.confirm(`Execute '${action.name}' action?`, `Are you sure you want to execute '${action.name}' action?`);
|
||||
if (confirmed) {
|
||||
await services.applications.runResourceAction(metadata.name, metadata.namespace, resource, action.name);
|
||||
}
|
||||
} catch (e) {
|
||||
appContext.apis.notifications.show({
|
||||
apis.notifications.show({
|
||||
content: <ErrorNotification title='Unable to execute resource action' e={e} />,
|
||||
type: NotificationType.Error
|
||||
});
|
||||
@@ -430,7 +427,7 @@ function getActionItems(
|
||||
resource: ResourceTreeNode,
|
||||
application: appModels.Application,
|
||||
tree: appModels.ApplicationTree,
|
||||
appContext: AppContext,
|
||||
apis: ContextApis,
|
||||
appChanged: BehaviorSubject<appModels.Application>,
|
||||
isQuickStart: boolean
|
||||
): Observable<ActionMenuItem[]> {
|
||||
@@ -440,7 +437,7 @@ function getActionItems(
|
||||
{
|
||||
title: 'Sync',
|
||||
iconClassName: 'fa fa-sync',
|
||||
action: () => showDeploy(nodeKey(resource), appContext)
|
||||
action: () => showDeploy(nodeKey(resource), apis)
|
||||
}
|
||||
]) ||
|
||||
[]),
|
||||
@@ -448,7 +445,7 @@ function getActionItems(
|
||||
title: 'Delete',
|
||||
iconClassName: 'fa fa-times-circle',
|
||||
action: async () => {
|
||||
return deletePopup(appContext.apis, resource, application, appChanged);
|
||||
return deletePopup(apis, resource, application, appChanged);
|
||||
}
|
||||
}
|
||||
];
|
||||
@@ -456,7 +453,7 @@ function getActionItems(
|
||||
items.unshift({
|
||||
title: 'Details',
|
||||
iconClassName: 'fa fa-info-circle',
|
||||
action: () => appContext.apis.navigation.goto('.', {node: nodeKey(resource)})
|
||||
action: () => apis.navigation.goto('.', {node: nodeKey(resource)})
|
||||
});
|
||||
}
|
||||
|
||||
@@ -464,7 +461,7 @@ function getActionItems(
|
||||
items.push({
|
||||
title: 'Logs',
|
||||
iconClassName: 'fa fa-align-left',
|
||||
action: () => appContext.apis.navigation.goto('.', {node: nodeKey(resource), tab: 'logs'}, {replace: true})
|
||||
action: () => apis.navigation.goto('.', {node: nodeKey(resource), tab: 'logs'}, {replace: true})
|
||||
});
|
||||
}
|
||||
|
||||
@@ -481,7 +478,7 @@ function getActionItems(
|
||||
{
|
||||
title: 'Exec',
|
||||
iconClassName: 'fa fa-terminal',
|
||||
action: async () => appContext.apis.navigation.goto('.', {node: nodeKey(resource), tab: 'exec'}, {replace: true})
|
||||
action: async () => apis.navigation.goto('.', {node: nodeKey(resource), tab: 'exec'}, {replace: true})
|
||||
} as MenuItem
|
||||
];
|
||||
}
|
||||
@@ -489,7 +486,7 @@ function getActionItems(
|
||||
})
|
||||
.catch(() => [] as MenuItem[]);
|
||||
|
||||
const resourceActions = getResourceActionsMenuItems(resource, application.metadata, appContext);
|
||||
const resourceActions = getResourceActionsMenuItems(resource, application.metadata, apis);
|
||||
|
||||
const links = services.applications
|
||||
.getResourceLinks(application.metadata.name, application.metadata.namespace, resource)
|
||||
@@ -518,7 +515,7 @@ export function renderResourceMenu(
|
||||
resource: ResourceTreeNode,
|
||||
application: appModels.Application,
|
||||
tree: appModels.ApplicationTree,
|
||||
appContext: AppContext,
|
||||
apis: ContextApis,
|
||||
appChanged: BehaviorSubject<appModels.Application>,
|
||||
getApplicationActionMenu: () => any
|
||||
): React.ReactNode {
|
||||
@@ -527,7 +524,7 @@ export function renderResourceMenu(
|
||||
if (isAppNode(resource) && resource.name === application.metadata.name) {
|
||||
menuItems = from([getApplicationActionMenu()]);
|
||||
} else {
|
||||
menuItems = getActionItems(resource, application, tree, appContext, appChanged, false);
|
||||
menuItems = getActionItems(resource, application, tree, apis, appChanged, false);
|
||||
}
|
||||
return (
|
||||
<DataLoader load={() => menuItems}>
|
||||
@@ -563,8 +560,8 @@ export function renderResourceMenu(
|
||||
);
|
||||
}
|
||||
|
||||
export function renderResourceActionMenu(resource: ResourceTreeNode, application: appModels.Application, tree: appModels.ApplicationTree, appContext: AppContext): React.ReactNode {
|
||||
const menuItems = getResourceActionsMenuItems(resource, application.metadata, appContext);
|
||||
export function renderResourceActionMenu(resource: ResourceTreeNode, application: appModels.Application, apis: ContextApis): React.ReactNode {
|
||||
const menuItems = getResourceActionsMenuItems(resource, application.metadata, apis);
|
||||
|
||||
return (
|
||||
<DataLoader load={() => menuItems}>
|
||||
@@ -594,11 +591,11 @@ export function renderResourceButtons(
|
||||
resource: ResourceTreeNode,
|
||||
application: appModels.Application,
|
||||
tree: appModels.ApplicationTree,
|
||||
appContext: AppContext,
|
||||
apis: ContextApis,
|
||||
appChanged: BehaviorSubject<appModels.Application>
|
||||
): React.ReactNode {
|
||||
let menuItems: Observable<ActionMenuItem[]>;
|
||||
menuItems = getActionItems(resource, application, tree, appContext, appChanged, true);
|
||||
menuItems = getActionItems(resource, application, tree, apis, appChanged, true);
|
||||
return (
|
||||
<DataLoader load={() => menuItems}>
|
||||
{items => (
|
||||
|
||||
@@ -35,7 +35,7 @@ export interface NewHTTPSRepoParams {
|
||||
enableLfs: boolean;
|
||||
proxy: string;
|
||||
project?: string;
|
||||
forceHttpBasicAuth: boolean;
|
||||
forceHttpBasicAuth?: boolean;
|
||||
}
|
||||
|
||||
interface NewGitHubAppRepoParams {
|
||||
|
||||
@@ -46,5 +46,5 @@ export const services: Services = {
|
||||
notification: new NotificationService()
|
||||
};
|
||||
|
||||
export {ProjectRoleParams, CreateJWTTokenParams, DeleteJWTTokenParams, JWTTokenResponse} from './projects-service';
|
||||
export * from './projects-service';
|
||||
export * from './view-preferences-service';
|
||||
|
||||
@@ -41,7 +41,7 @@ export class RepositoriesService {
|
||||
enableLfs: boolean;
|
||||
proxy: string;
|
||||
project?: string;
|
||||
forceHttpBasicAuth: boolean;
|
||||
forceHttpBasicAuth?: boolean;
|
||||
}): Promise<models.Repository> {
|
||||
return requests
|
||||
.post('/repositories')
|
||||
|
||||
@@ -91,7 +91,7 @@ export interface ViewPreferences {
|
||||
appDetails: AppDetailsPreferences;
|
||||
appList: AppsListPreferences;
|
||||
pageSizes: {[key: string]: number};
|
||||
sortOptions: {[key: string]: string};
|
||||
sortOptions?: {[key: string]: string};
|
||||
hideBannerContent: string;
|
||||
hideSidebar: boolean;
|
||||
position: string;
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
"target": "es5",
|
||||
"jsx": "react",
|
||||
"experimentalDecorators": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"noUnusedLocals": true,
|
||||
"declaration": false,
|
||||
"lib": [
|
||||
|
||||
@@ -4,7 +4,6 @@ const MonacoWebpackPlugin = require('monaco-editor-webpack-plugin');
|
||||
const CopyWebpackPlugin = require('copy-webpack-plugin');
|
||||
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
||||
const webpack = require('webpack');
|
||||
const path = require('path');
|
||||
|
||||
const isProd = process.env.NODE_ENV === 'production';
|
||||
|
||||
@@ -28,9 +27,9 @@ const config = {
|
||||
alias: { react: require.resolve('react') },
|
||||
fallback: { fs: false }
|
||||
},
|
||||
ignoreWarnings: [
|
||||
(warning) => true,
|
||||
],
|
||||
ignoreWarnings: [{
|
||||
module: new RegExp('/node_modules/argo-ui/.*')
|
||||
}],
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user