Skip to content

Commit

Permalink
Merge pull request #150 from lywcc/main
Browse files Browse the repository at this point in the history
fix: fix some bugs on model-service-detail page
  • Loading branch information
Carrotzpc authored Jan 13, 2024
2 parents fcc6617 + 6d15993 commit 09b1b9d
Showing 1 changed file with 76 additions and 8 deletions.
84 changes: 76 additions & 8 deletions src/pages/ModelServiceDetail/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ class ModelServiceDetail$$Page extends React.Component {
isOffFlag: undefined,
loading: false,
okLoading: false,
onAndOffModalVisible: false,
onOrOffLoading: false,
};
}
Expand Down Expand Up @@ -231,7 +232,7 @@ class ModelServiceDetail$$Page extends React.Component {
this.openDelModal();
break;
default:
this.updateWorkerReq();
this.openOnAndOffModal();
break;
}
}
Expand All @@ -249,6 +250,16 @@ class ModelServiceDetail$$Page extends React.Component {
return '-';
}

handleOnOrOffModalCancelClick() {
this.setState({
onAndOffModalVisible: false,
});
}

handleOnOrOffModalOkClick() {
this.updateWorkerReq();
}

initServiceDetailData() {
const { type } = this.getBaseInfo();
this.setState({
Expand All @@ -272,6 +283,12 @@ class ModelServiceDetail$$Page extends React.Component {
});
}

openOnAndOffModal() {
this.setState({
onAndOffModalVisible: true,
});
}

testFunc() {
// console.log('test aliLowcode func');
return <div className="test-aliLowcode-func">{this.state.test}</div>;
Expand Down Expand Up @@ -301,7 +318,14 @@ class ModelServiceDetail$$Page extends React.Component {
this.utils.notification.success({
message: `${label}成功`,
});
setTimeout(this.initServiceDetailData.bind(this), 500);
this.setState(
{
onAndOffModalVisible: false,
},
() => {
setTimeout(this.initServiceDetailData.bind(this), 500);
}
);
} catch (err) {
const description = err?.response?.errors?.[0]?.message || '未知错误';
this.utils.notification.warn({
Expand All @@ -316,7 +340,6 @@ class ModelServiceDetail$$Page extends React.Component {
}

componentDidMount() {
// console.log('did mount');
this.initServiceDetailData();
}

Expand Down Expand Up @@ -359,6 +382,47 @@ class ModelServiceDetail$$Page extends React.Component {
type="warning"
/>
</Modal>
{!!__$$eval(() => this.state.onAndOffModalVisible) && (
<Modal
__component_name="Modal"
cancelButtonProps={{ disabled: false }}
centered={false}
confirmLoading={__$$eval(() => this.state.onOrOffLoading)}
destroyOnClose={true}
forceRender={false}
keyboard={true}
mask={true}
maskClosable={false}
okButtonProps={{ disabled: false }}
onCancel={function () {
return this.handleOnOrOffModalCancelClick.apply(
this,
Array.prototype.slice.call(arguments).concat([])
);
}.bind(this)}
onOk={function () {
return this.handleOnOrOffModalOkClick.apply(
this,
Array.prototype.slice.call(arguments).concat([])
);
}.bind(this)}
open={__$$eval(() => this.state.onAndOffModalVisible)}
title={__$$eval(() => (this.state.isOffFlag ? '上线' : '下线'))}
>
<Alert
__component_name="Alert"
bordered="dashed"
message={__$$eval(
() =>
`确定${this.state.isOffFlag ? '上线' : '下线'} ${
this.state.detail?.displayName
} 模型服务吗?`
)}
showIcon={true}
type="warning"
/>
</Modal>
)}
<Button.Back
__component_name="Button.Back"
style={{ fontSize: '14px', lineHeight: '15px' }}
Expand Down Expand Up @@ -473,7 +537,7 @@ class ModelServiceDetail$$Page extends React.Component {
_unsafe_MixedSetter_children_select: 'StringSetter',
children: '已下线',
id: 'Offline',
type: 'success',
type: 'warning',
},
{
_unsafe_MixedSetter_children_select: 'StringSetter',
Expand Down Expand Up @@ -650,8 +714,9 @@ class ModelServiceDetail$$Page extends React.Component {
children: (
<Typography.Text
__component_name="Typography.Text"
copyable={true}
disabled={false}
ellipsis={true}
ellipsis={false}
strong={false}
style={{ fontSize: '' }}
>
Expand All @@ -671,6 +736,7 @@ class ModelServiceDetail$$Page extends React.Component {
children: (
<Typography.Text
__component_name="Typography.Text"
copyable={false}
disabled={false}
ellipsis={true}
strong={false}
Expand Down Expand Up @@ -736,7 +802,7 @@ class ModelServiceDetail$$Page extends React.Component {
>
{__$$eval(() =>
this.getFullDescribe({
key: 'providerType',
key: 'apiType',
})
)}
</Typography.Text>
Expand Down Expand Up @@ -854,8 +920,9 @@ class ModelServiceDetail$$Page extends React.Component {
children: (
<Typography.Text
__component_name="Typography.Text"
copyable={true}
disabled={false}
ellipsis={true}
ellipsis={false}
strong={false}
style={{ fontSize: '' }}
>
Expand All @@ -877,8 +944,9 @@ class ModelServiceDetail$$Page extends React.Component {
children: (
<Typography.Text
__component_name="Typography.Text"
copyable={true}
disabled={false}
ellipsis={true}
ellipsis={false}
strong={false}
style={{ fontSize: '' }}
>
Expand Down

0 comments on commit 09b1b9d

Please sign in to comment.