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 = () => ( -
- -
-
-
- ) - renderContent() { const { data, isLoading } = this.store.list @@ -198,11 +174,10 @@ export default class RunsCard extends React.Component { } render() { - const { className, hideHeader, hideFooter } = this.props + const { className, hideFooter } = this.props return (
- {!hideHeader && this.renderHeader()} {this.renderContent()} {!hideFooter && this.renderFooter()}
diff --git a/src/pages/projects/containers/ImageBuilder/Detail/index.jsx b/src/pages/projects/containers/ImageBuilder/Detail/index.jsx index a40e3d01575..2768389fae0 100644 --- a/src/pages/projects/containers/ImageBuilder/Detail/index.jsx +++ b/src/pages/projects/containers/ImageBuilder/Detail/index.jsx @@ -148,7 +148,7 @@ export default class ImageBuilderDetail extends React.Component { const sourceUrl = get(spec, 'config.sourceUrl', '') 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/stores/container.js b/src/stores/container.js index f20bd5b7443..28df3b78e29 100644 --- a/src/stores/container.js +++ b/src/stores/container.js @@ -158,7 +158,7 @@ export default class ContainerStore { ) if (get(result, 'status', 'succeeded') !== 'succeeded') { - return null + return { status: 'failed' } } return ObjectMapper.imageBlob(result) diff --git a/src/stores/s2i/run.js b/src/stores/s2i/run.js index 629639e0ddf..033d78118a6 100644 --- a/src/stores/s2i/run.js +++ b/src/stores/s2i/run.js @@ -228,8 +228,7 @@ export default class S2irunStore extends Base { } } this.logData.isLoading = true - const namespace = get(logURL.match(/namespaces\/([\w-/]*)\?/), '1') - + const namespace = get(logURL.match(/namespaces\/([\w-/.]*)*\?/), '1') if (!this.containerName) { const podsDetail = await request.get( `api/v1${this.getPath({ namespace, cluster })}`