Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix Version not upgrade after click version#1637 #257

Merged
merged 1 commit into from
Jan 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions src/Routes/Tables/Algorithms/Tabs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ import { VersionsTable } from './Versions';
import usePath from './../usePath';

const AlgorithmsTabs = ({ algorithm }) => {
const [isCheckForceStopAlgorithms, setIsCheckForceStopAlgorithms] = useState(
false
);
const { tabKey: activeKey, goTo } = usePath();
const setActiveKey = useCallback(tab => goTo.overview({ nextTabKey: tab }), [
goTo,
Expand All @@ -28,7 +25,8 @@ const AlgorithmsTabs = ({ algorithm }) => {
name,
version,
applyVersionCallback
) =>
) => {
let isForce = false;
Modal.confirm({
title: 'WARNING : Version not upgrade',
content: (
Expand All @@ -38,7 +36,7 @@ const AlgorithmsTabs = ({ algorithm }) => {
</div>
<Checkbox
onClick={e => {
setIsCheckForceStopAlgorithms(e.target.checked);
isForce = e.target.checked;
}}>
Stop running algorithms.
</Checkbox>
Expand All @@ -49,9 +47,12 @@ const AlgorithmsTabs = ({ algorithm }) => {
cancelText: 'Cancel',
onCancel() {},
onOk() {
applyVersionCallback({ name, version, isCheckForceStopAlgorithms });
setTimeout(() => {
applyVersionCallback({ name, version, force: isForce });
}, 100);
},
});
};

const { dataSource, onApply, onDelete, fetch } = useVersions({
algorithmName: algorithm.name,
Expand Down
2 changes: 1 addition & 1 deletion src/Routes/Tables/Algorithms/columns.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const Name = (name, record) => (
{name}{' '}
{record?.errors?.includes(errorsCode.NOT_LAST_VERSION_ALGORITHM) && (
<WarningOutlined
title="Warning : Not last version algorithm"
title="Warning : Set algorithm's current version to the newly built"
style={{ color: 'red', fontSize: '15px' }}
/>
)}
Expand Down
3 changes: 2 additions & 1 deletion src/hooks/useVersions.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const useVersions = ({ algorithmName, confirmPopupForceVersion, isFetch }) => {
})
.catch(errorNotification);

const applyVersion = ({ name, version, force = false }) =>
const applyVersion = ({ name, version, force }) => {
client
.post(`/versions/algorithms/apply`, { name, version, force })
.catch(error => {
Expand All @@ -40,6 +40,7 @@ const useVersions = ({ algorithmName, confirmPopupForceVersion, isFetch }) => {
applyVersion
);
});
};

useEffect(() => {
if (isFetch) {
Expand Down