diff --git a/src/components/Forms/Workload/ContainerSettings/ContainerForm/ContainerSetting/ImageInput/index.jsx b/src/components/Forms/Workload/ContainerSettings/ContainerForm/ContainerSetting/ImageInput/index.jsx index 13207a86261..6b9fe41a913 100644 --- a/src/components/Forms/Workload/ContainerSettings/ContainerForm/ContainerSetting/ImageInput/index.jsx +++ b/src/components/Forms/Workload/ContainerSettings/ContainerForm/ContainerSetting/ImageInput/index.jsx @@ -100,9 +100,10 @@ export default class ImageSearch extends Component { getImageDetail = async ({ image, secret, ...rest }) => { const { namespace, cluster } = this.props - if (!image) { + if (!image || this.isUnMounted) { return } + this.image = image this.setState({ isLoading: true }) @@ -114,16 +115,11 @@ export default class ImageSearch extends Component { secret, }) - if (result) { - const selectedImage = { ...result, ...rest, image } - set(globals, `cache[${image}]`, selectedImage) - if (!isEmpty(selectedImage.exposedPorts)) { - this.setState({ showPortsTips: true }) - } - } + const selectedImage = { ...result, ...rest, image } + set(globals, `cache[${image}]`, selectedImage) - if (this.isUnMounted) { - return + if (!isEmpty(selectedImage.exposedPorts)) { + this.setState({ showPortsTips: true }) } this.setState({ isLoading: false }) diff --git a/src/pages/projects/components/Cards/ImageBuilderLastRun/index.jsx b/src/pages/projects/components/Cards/ImageBuilderLastRun/index.jsx index a30a932530e..d5b86a4c54d 100644 --- a/src/pages/projects/components/Cards/ImageBuilderLastRun/index.jsx +++ b/src/pages/projects/components/Cards/ImageBuilderLastRun/index.jsx @@ -28,7 +28,7 @@ import styles from './index.scss' export default class BuilderInfo extends React.Component { pathAddCluster = (path, cluster) => { const match = path.match(/(\/kapis|api|apis)(.*)/) - return !cluster || cluster === 'default' || isArray(match) + return !cluster || cluster === 'default' || !isArray(match) ? path : `${match[1]}/cluster/${cluster}${match[2]}` } @@ -39,7 +39,7 @@ export default class BuilderInfo extends React.Component { const { cluster } = params const path = get(parseUrl(sourceUrl), 'pathname', `/${sourceUrl}`) const url = this.pathAddCluster(path, cluster) - const downLoadUrl = `${window.location.protocol}/${ + const downLoadUrl = `${window.location.protocol}//${ window.location.host }/b2i_download${url}` diff --git a/src/pages/projects/components/Cards/ImageRunRecord/Item/index.jsx b/src/pages/projects/components/Cards/ImageRunRecord/Item/index.jsx index ecb73ddbcf4..b954a8a7f58 100644 --- a/src/pages/projects/components/Cards/ImageRunRecord/Item/index.jsx +++ b/src/pages/projects/components/Cards/ImageRunRecord/Item/index.jsx @@ -96,7 +96,7 @@ export default class ImageBuilderLastRun extends React.Component { pathAddCluster = (path, cluster) => { const match = path.match(/(\/kapis|api|apis)(.*)/) - return !cluster || cluster === 'default' || isArray(match) + return !cluster || cluster === 'default' || !isArray(match) ? path : `${match[1]}/cluster/${cluster}${match[2]}` } @@ -105,7 +105,7 @@ export default class ImageBuilderLastRun extends React.Component { const { sourceUrl, cluster } = this.props.runDetail const path = get(parseUrl(sourceUrl), 'pathname', `/${sourceUrl}`) const url = this.pathAddCluster(path, cluster) - const downLoadUrl = `${window.location.protocol}/${ + const downLoadUrl = `${window.location.protocol}//${ window.location.host }/b2i_download${url}` window.open(downLoadUrl) @@ -167,7 +167,7 @@ export default class ImageBuilderLastRun extends React.Component { diff --git a/src/pages/projects/components/Cards/ImageRunRecord/index.jsx b/src/pages/projects/components/Cards/ImageRunRecord/index.jsx index a7977d7eb2d..a9855b30631 100644 --- a/src/pages/projects/components/Cards/ImageRunRecord/index.jsx +++ b/src/pages/projects/components/Cards/ImageRunRecord/index.jsx @@ -31,7 +31,6 @@ import { Pagination, Loading, } from '@pitrix/lego-ui' -import { Search, Button } from 'components/Base' import RunItem from './Item' import styles from './index.scss' @@ -116,35 +115,12 @@ export default class RunsCard extends React.Component { }) } - handleRefresh = () => { - const params = this.searchValue ? { name: this.searchValue } : {} - - this.fetchData(params).then(() => { - const { onSearch, onRefresh } = this.props - isEmpty(params) ? onRefresh() : onSearch(this.searchValue) - }) - } - handlePage = page => { this.fetchData({ page }).then(() => { this.props.onPage(page) }) } - renderHeader = () => ( -