Skip to content

Commit

Permalink
Merge pull request #172 from anjanaw/dev
Browse files Browse the repository at this point in the history
retain test
  • Loading branch information
anjanaw authored Jan 22, 2024
2 parents c8e698e + 00fd780 commit 1d5a70e
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/pages/designuser/usecases/Create.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
api_dataset_upload,
api_delete,
api_get,
api_retain,
api_get_casestructure,
api_get_model_instance_count,
api_get_model_prediction,
Expand Down Expand Up @@ -669,6 +670,18 @@ const Create: React.FC<Params> = (props) => {
defaultChecked={usecase.published}
checked={usecase.published}
/>
<Button
type="primary"
style={{ margin: '0 1rem' }}
onClick={async () => {
console.log('Retain Started!');
await api_retain(usecase._id || '');
}}
htmlType="button"
icon={<SaveOutlined />}
>
Retain
</Button>
<Button
type="primary"
style={{ margin: '0 1rem' }}
Expand Down
21 changes: 21 additions & 0 deletions src/services/isee/usecases.ts
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,27 @@ export async function api_persona_query_set_default(
}
}

export async function api_retain(usecaseId: string) {
if (!usecaseId) return usecaseId;

try {
const data = await fetch(`${BASE_URL}/cbr/${usecaseId}/retain`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'x-access-token': getToken(),
},
});
const result = await data.json();
if (result.message) {
message.error("Case retain Failed! Make sure you have a completed the use case.")
return []
};
return result;
} catch (error) {
return [];
}
}

export async function api_usecase_analytics(usecaseId: string | undefined, version: string | undefined) {
if (!usecaseId || !version) return usecaseId;
Expand Down

0 comments on commit 1d5a70e

Please sign in to comment.