mirror of https://github.com/kubevela/velaux.git
Compare commits
1 Commits
Author | SHA1 | Date |
---|---|---|
|
5ef1a137c4 |
|
@ -391,7 +391,8 @@ a {
|
||||||
.next-btn {
|
.next-btn {
|
||||||
display: block;
|
display: block;
|
||||||
flex: none !important;
|
flex: none !important;
|
||||||
width: 100px !important;
|
width: auto !important;
|
||||||
|
min-width: 100px !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { Dialog, Message } from '@b-design/ui';
|
import { Button, Dialog, Message } from '@b-design/ui';
|
||||||
import type { ApplicationCompareResponse } from '../../interface/application';
|
import type { ApplicationCompareResponse } from '../../interface/application';
|
||||||
import './index.less';
|
import './index.less';
|
||||||
import { DiffEditor } from '../DiffEditor';
|
import { DiffEditor } from '../DiffEditor';
|
||||||
|
@ -11,17 +11,26 @@ type ApplicationDiffProps = {
|
||||||
targetName: string;
|
targetName: string;
|
||||||
compare: ApplicationCompareResponse;
|
compare: ApplicationCompareResponse;
|
||||||
onClose: () => void;
|
onClose: () => void;
|
||||||
|
rollback2Revision?: () => void;
|
||||||
id?: string;
|
id?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const ApplicationDiff = (props: ApplicationDiffProps) => {
|
export const ApplicationDiff = (props: ApplicationDiffProps) => {
|
||||||
const { baseName, targetName, compare } = props;
|
const { baseName, targetName, compare, rollback2Revision } = props;
|
||||||
const container = 'revision' + baseName + targetName;
|
const container = 'revision' + baseName + targetName;
|
||||||
return (
|
return (
|
||||||
<Dialog
|
<Dialog
|
||||||
className={'commonDialog application-diff'}
|
className={'commonDialog application-diff'}
|
||||||
isFullScreen={true}
|
isFullScreen={true}
|
||||||
footer={<div />}
|
footer={
|
||||||
|
<div>
|
||||||
|
<If condition={compare.isDiff && rollback2Revision}>
|
||||||
|
<Button type="primary" onClick={rollback2Revision}>
|
||||||
|
Rollback To Revision
|
||||||
|
</Button>
|
||||||
|
</If>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
id={props.id}
|
id={props.id}
|
||||||
visible={true}
|
visible={true}
|
||||||
onClose={props.onClose}
|
onClose={props.onClose}
|
||||||
|
|
|
@ -32,6 +32,7 @@ import PipelineListPage from '../../pages/PipelineListPage';
|
||||||
import ApplicationWorkflowStudio from '../../pages/ApplicationWorkflowStudio';
|
import ApplicationWorkflowStudio from '../../pages/ApplicationWorkflowStudio';
|
||||||
import PipelineStudio from '../../pages/PipelineStudio';
|
import PipelineStudio from '../../pages/PipelineStudio';
|
||||||
import ProjectPipelines from '../../pages/ProjectPipelines';
|
import ProjectPipelines from '../../pages/ProjectPipelines';
|
||||||
|
import ApplicationEnvRoute from '../../pages/ApplicationEnvRoute';
|
||||||
|
|
||||||
export default function Content() {
|
export default function Content() {
|
||||||
return (
|
return (
|
||||||
|
@ -73,6 +74,17 @@ export default function Content() {
|
||||||
);
|
);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
<Route
|
||||||
|
exact
|
||||||
|
path="/applications/:appName/envbinding"
|
||||||
|
render={(props: any) => {
|
||||||
|
return (
|
||||||
|
<ApplicationLayout {...props}>
|
||||||
|
<ApplicationEnvRoute {...props} />;
|
||||||
|
</ApplicationLayout>
|
||||||
|
);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
<Route
|
<Route
|
||||||
exact
|
exact
|
||||||
path="/applications/:appName/envbinding/:envName"
|
path="/applications/:appName/envbinding/:envName"
|
||||||
|
|
|
@ -58,6 +58,7 @@ type State = {
|
||||||
loading: boolean;
|
loading: boolean;
|
||||||
status: 'disabled' | 'enabled' | 'enabling' | 'suspend' | 'disabling' | '';
|
status: 'disabled' | 'enabled' | 'enabling' | 'suspend' | 'disabling' | '';
|
||||||
statusLoading: boolean;
|
statusLoading: boolean;
|
||||||
|
enableLoading?: boolean;
|
||||||
upgradeLoading: boolean;
|
upgradeLoading: boolean;
|
||||||
args?: any;
|
args?: any;
|
||||||
addonsStatus?: ApplicationStatus;
|
addonsStatus?: ApplicationStatus;
|
||||||
|
@ -251,7 +252,7 @@ class AddonDetailDialog extends React.Component<Props, State> {
|
||||||
Message.warning(i18n.t('Please firstly select at least one cluster.'));
|
Message.warning(i18n.t('Please firstly select at least one cluster.'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.setState({ statusLoading: true }, () => {
|
this.setState({ statusLoading: true, enableLoading: true }, () => {
|
||||||
if (this.state.version) {
|
if (this.state.version) {
|
||||||
const params: EnableAddonRequest = {
|
const params: EnableAddonRequest = {
|
||||||
name: this.props.addonName,
|
name: this.props.addonName,
|
||||||
|
@ -262,9 +263,13 @@ class AddonDetailDialog extends React.Component<Props, State> {
|
||||||
if (this.state.addonDetailInfo?.deployTo?.runtimeCluster) {
|
if (this.state.addonDetailInfo?.deployTo?.runtimeCluster) {
|
||||||
params.clusters = this.state.clusters;
|
params.clusters = this.state.clusters;
|
||||||
}
|
}
|
||||||
enableAddon(params).then(() => {
|
enableAddon(params)
|
||||||
this.loadAddonStatus();
|
.then(() => {
|
||||||
});
|
this.loadAddonStatus();
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
this.setState({ enableLoading: false });
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -311,6 +316,7 @@ class AddonDetailDialog extends React.Component<Props, State> {
|
||||||
status,
|
status,
|
||||||
statusLoading,
|
statusLoading,
|
||||||
upgradeLoading,
|
upgradeLoading,
|
||||||
|
enableLoading,
|
||||||
addonsStatus,
|
addonsStatus,
|
||||||
showStatusVisible,
|
showStatusVisible,
|
||||||
version,
|
version,
|
||||||
|
@ -390,7 +396,7 @@ class AddonDetailDialog extends React.Component<Props, State> {
|
||||||
project={''}
|
project={''}
|
||||||
>
|
>
|
||||||
<Button
|
<Button
|
||||||
loading={status === 'enabling'}
|
loading={status === 'enabling' || enableLoading}
|
||||||
type="primary"
|
type="primary"
|
||||||
onClick={this.onEnable}
|
onClick={this.onEnable}
|
||||||
style={{ marginLeft: '16px' }}
|
style={{ marginLeft: '16px' }}
|
||||||
|
@ -462,7 +468,7 @@ class AddonDetailDialog extends React.Component<Props, State> {
|
||||||
{`${i18n.t('Addon status is ')}${addonsStatus?.status || 'Init'}`}
|
{`${i18n.t('Addon status is ')}${addonsStatus?.status || 'Init'}`}
|
||||||
<Link
|
<Link
|
||||||
style={{ marginLeft: '16px' }}
|
style={{ marginLeft: '16px' }}
|
||||||
to={`/applications/addon-${addonDetailInfo?.name}/envbinding/system/workflow`}
|
to={`/applications/addon-${addonDetailInfo?.name}/envbinding`}
|
||||||
>
|
>
|
||||||
<Translation>Check the details</Translation>
|
<Translation>Check the details</Translation>
|
||||||
</Link>
|
</Link>
|
||||||
|
|
|
@ -57,8 +57,8 @@ class ComponentsList extends Component<Props> {
|
||||||
<div className="list-warper">
|
<div className="list-warper">
|
||||||
<div className="box">
|
<div className="box">
|
||||||
{(components || []).map((item: ApplicationComponentBase) => (
|
{(components || []).map((item: ApplicationComponentBase) => (
|
||||||
<Row wrap={true} className="box-item">
|
<Row key={item.name} wrap={true} className="box-item">
|
||||||
<Col span={24} key={item.name}>
|
<Col span={24}>
|
||||||
<Card locale={locale().Card} contentHeight="auto">
|
<Card locale={locale().Card} contentHeight="auto">
|
||||||
<div className="components-list-nav">
|
<div className="components-list-nav">
|
||||||
<div
|
<div
|
||||||
|
|
|
@ -135,8 +135,8 @@ class TriggerList extends Component<Props, State> {
|
||||||
<div className="list-warper">
|
<div className="list-warper">
|
||||||
<div className="box">
|
<div className="box">
|
||||||
{(triggers || []).map((item: Trigger) => (
|
{(triggers || []).map((item: Trigger) => (
|
||||||
<Row wrap={true} className="box-item">
|
<Row wrap={true} key={item.type} className="box-item">
|
||||||
<Col span={24} key={item.type}>
|
<Col span={24}>
|
||||||
<Card free={true} style={{ padding: '16px' }} locale={locale().Card}>
|
<Card free={true} style={{ padding: '16px' }} locale={locale().Card}>
|
||||||
<div className="trigger-list-nav">
|
<div className="trigger-list-nav">
|
||||||
<div className="trigger-list-title">
|
<div className="trigger-list-title">
|
||||||
|
|
|
@ -578,6 +578,7 @@ class ApplicationConfig extends Component<Props, State> {
|
||||||
if (applicationDetail?.labels) {
|
if (applicationDetail?.labels) {
|
||||||
return (
|
return (
|
||||||
<Tag
|
<Tag
|
||||||
|
key={key}
|
||||||
style={{ margin: '4px' }}
|
style={{ margin: '4px' }}
|
||||||
color="blue"
|
color="blue"
|
||||||
>{`${key}=${applicationDetail?.labels[key]}`}</Tag>
|
>{`${key}=${applicationDetail?.labels[key]}`}</Tag>
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
import { Loading } from '@b-design/ui';
|
||||||
|
import { connect } from 'dva';
|
||||||
|
import { routerRedux } from 'dva/router';
|
||||||
|
import React, { useEffect } from 'react';
|
||||||
|
import type { Dispatch } from 'redux';
|
||||||
|
import { getApplicationEnvbinding } from '../../api/application';
|
||||||
|
|
||||||
|
const EnvRoute = (props: { match: { params: { appName: string } }; dispatch: Dispatch<any> }) => {
|
||||||
|
useEffect(() => {
|
||||||
|
getApplicationEnvbinding({ appName: props.match.params.appName }).then((res) => {
|
||||||
|
if (res && Array.isArray(res.envBindings) && res.envBindings.length > 0) {
|
||||||
|
props.dispatch(
|
||||||
|
routerRedux.push(
|
||||||
|
`/applications/${props.match.params.appName}/envbinding/${res.envBindings[0].name}/workflow`,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
props.dispatch(routerRedux.push(`/applications/${props.match.params.appName}`));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
return <Loading visible={true} />;
|
||||||
|
};
|
||||||
|
|
||||||
|
export default connect()(EnvRoute);
|
|
@ -32,6 +32,7 @@ type Props = {
|
||||||
|
|
||||||
type State = {
|
type State = {
|
||||||
compare?: ApplicationCompareResponse;
|
compare?: ApplicationCompareResponse;
|
||||||
|
revision?: ApplicationRevision;
|
||||||
visibleApplicationDiff: boolean;
|
visibleApplicationDiff: boolean;
|
||||||
diffMode: 'latest' | 'cluster';
|
diffMode: 'latest' | 'cluster';
|
||||||
};
|
};
|
||||||
|
@ -80,22 +81,27 @@ class TableList extends Component<Props, State> {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
loadChanges = (revision: string, mode: 'latest' | 'cluster') => {
|
loadChanges = (revision: ApplicationRevision, mode: 'latest' | 'cluster') => {
|
||||||
const { applicationDetail } = this.props;
|
const { applicationDetail } = this.props;
|
||||||
if (!revision || !applicationDetail) {
|
if (!revision || !applicationDetail) {
|
||||||
this.setState({ compare: undefined });
|
this.setState({ compare: undefined });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let params: ApplicationCompareRequest = {
|
let params: ApplicationCompareRequest = {
|
||||||
compareRevisionWithLatest: { revision: revision },
|
compareRevisionWithLatest: { revision: revision.version },
|
||||||
};
|
};
|
||||||
if (mode === 'cluster') {
|
if (mode === 'cluster') {
|
||||||
params = {
|
params = {
|
||||||
compareRevisionWithRunning: { revision: revision },
|
compareRevisionWithRunning: { revision: revision.version },
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
compareApplication(applicationDetail?.name, params).then((res: ApplicationCompareResponse) => {
|
compareApplication(applicationDetail?.name, params).then((res: ApplicationCompareResponse) => {
|
||||||
this.setState({ compare: res, visibleApplicationDiff: true, diffMode: mode });
|
this.setState({
|
||||||
|
revision: revision,
|
||||||
|
compare: res,
|
||||||
|
visibleApplicationDiff: true,
|
||||||
|
diffMode: mode,
|
||||||
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -223,14 +229,14 @@ class TableList extends Component<Props, State> {
|
||||||
<Menu>
|
<Menu>
|
||||||
<Menu.Item
|
<Menu.Item
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
this.loadChanges(record.version, 'cluster');
|
this.loadChanges(record, 'cluster');
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Translation>Diff With Deployed Application</Translation>
|
<Translation>Diff With Deployed Application</Translation>
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
<Menu.Item
|
<Menu.Item
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
this.loadChanges(record.version, 'latest');
|
this.loadChanges(record, 'latest');
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Translation>Diff With Latest Configuration</Translation>
|
<Translation>Diff With Latest Configuration</Translation>
|
||||||
|
@ -271,7 +277,7 @@ class TableList extends Component<Props, State> {
|
||||||
const { Column } = Table;
|
const { Column } = Table;
|
||||||
const columns = this.getColumns();
|
const columns = this.getColumns();
|
||||||
const { list } = this.props;
|
const { list } = this.props;
|
||||||
const { visibleApplicationDiff, compare, diffMode } = this.state;
|
const { visibleApplicationDiff, compare, diffMode, revision } = this.state;
|
||||||
const baseName = 'Current Revision';
|
const baseName = 'Current Revision';
|
||||||
let targetName = 'Latest Application Configuration';
|
let targetName = 'Latest Application Configuration';
|
||||||
if (diffMode == 'cluster') {
|
if (diffMode == 'cluster') {
|
||||||
|
@ -298,8 +304,19 @@ class TableList extends Component<Props, State> {
|
||||||
{compare && (
|
{compare && (
|
||||||
<ApplicationDiff
|
<ApplicationDiff
|
||||||
onClose={() => {
|
onClose={() => {
|
||||||
this.setState({ visibleApplicationDiff: false, compare: undefined });
|
this.setState({
|
||||||
|
visibleApplicationDiff: false,
|
||||||
|
compare: undefined,
|
||||||
|
revision: undefined,
|
||||||
|
});
|
||||||
}}
|
}}
|
||||||
|
rollback2Revision={
|
||||||
|
diffMode === 'cluster' && revision
|
||||||
|
? () => {
|
||||||
|
this.onRollback(revision);
|
||||||
|
}
|
||||||
|
: undefined
|
||||||
|
}
|
||||||
baseName={baseName}
|
baseName={baseName}
|
||||||
targetName={targetName}
|
targetName={targetName}
|
||||||
compare={compare}
|
compare={compare}
|
||||||
|
|
|
@ -44,6 +44,7 @@ class TableList extends Component<Props> {
|
||||||
key: 'name',
|
key: 'name',
|
||||||
title: <Translation>Name(Alias)</Translation>,
|
title: <Translation>Name(Alias)</Translation>,
|
||||||
dataIndex: 'name',
|
dataIndex: 'name',
|
||||||
|
width: '150px',
|
||||||
cell: (v: string, i: number, env: Env) => {
|
cell: (v: string, i: number, env: Env) => {
|
||||||
return (
|
return (
|
||||||
<a
|
<a
|
||||||
|
@ -60,6 +61,7 @@ class TableList extends Component<Props> {
|
||||||
key: 'project',
|
key: 'project',
|
||||||
title: <Translation>Project</Translation>,
|
title: <Translation>Project</Translation>,
|
||||||
dataIndex: 'project',
|
dataIndex: 'project',
|
||||||
|
width: '100px',
|
||||||
cell: (v: Project) => {
|
cell: (v: Project) => {
|
||||||
if (v && v.name) {
|
if (v && v.name) {
|
||||||
return <Link to={`/projects/${v.name}/summary`}>{v.alias || v.name}</Link>;
|
return <Link to={`/projects/${v.name}/summary`}>{v.alias || v.name}</Link>;
|
||||||
|
@ -72,6 +74,7 @@ class TableList extends Component<Props> {
|
||||||
key: 'namespace',
|
key: 'namespace',
|
||||||
title: <Translation>Namespace</Translation>,
|
title: <Translation>Namespace</Translation>,
|
||||||
dataIndex: 'namespace',
|
dataIndex: 'namespace',
|
||||||
|
width: '100px',
|
||||||
cell: (v: string) => {
|
cell: (v: string) => {
|
||||||
return <span>{v}</span>;
|
return <span>{v}</span>;
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue