Skip to content

Commit

Permalink
tst
Browse files Browse the repository at this point in the history
  • Loading branch information
PMazarovich committed Aug 7, 2023
1 parent 5a69e67 commit 5d0cc15
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 36 deletions.
2 changes: 1 addition & 1 deletion cvat-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"@types/lodash": "^4.14.191",
"axios": "^0.27.2",
"browser-or-node": "^2.0.0",
"cvat-data": "link:./../cvat-data",
"cvat-data": "./../cvat-data",
"detect-browser": "^5.2.1",
"error-stack-parser": "^2.0.2",
"form-data": "^4.0.0",
Expand Down
13 changes: 13 additions & 0 deletions cvat-core/src/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -744,8 +744,21 @@ export class Task extends Session {
data.progress = {
completedJobs: initialData?.jobs?.completed || 0,
totalJobs: initialData?.jobs?.count || 0,
validationJobs: 0,
annotationJobs: 0
};

console.log("initial data")
console.log(initialData)
if (Array.isArray(initialData.jobs)) {
console.log("INITIAL JOB")
for (const job of initialData.jobs) {
console.log(job)
if (job.stage === 'validation') data.progress.validationJobs += 1;
if (job.stage === 'annotation') data.progress.annotationJobs += 1;
}
}

data.files = Object.freeze({
server_files: [],
client_files: [],
Expand Down
42 changes: 8 additions & 34 deletions cvat-ui/src/components/tasks-page/task-item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,52 +79,26 @@ class TaskItemComponent extends React.PureComponent<TaskItemProps & RouteCompone
// Count number of jobs and performed jobs
const numOfJobs = taskInstance.progress.totalJobs;
const numOfCompleted = taskInstance.progress.completedJobs;
const numOfValidation = taskInstance.progress.validationJobs;
const numOfAnnotation = taskInstance.progress.annotationJobs;

// Progress appearance depends on number of jobs
let progressColor = null;
let progressText = null;
if (numOfCompleted && numOfCompleted === numOfJobs) {
progressColor = 'cvat-task-completed-progress';
progressText = (
<Text strong className={progressColor}>
Completed
</Text>
);
} else if (numOfCompleted) {
progressColor = 'cvat-task-progress-progress';
progressText = (
<Text strong className={progressColor}>
In Progress
</Text>
);
} else {
progressColor = 'cvat-task-pending-progress';
progressText = (
<Text strong className={progressColor}>
Pending
</Text>
);
}
const jobsProgress = ((numOfCompleted + numOfValidation) * 100) / numOfJobs;

const jobsProgress = numOfCompleted / numOfJobs;
return (
<Col span={6}>
<Row justify='space-between' align='top'>
<Col>
<svg height='8' width='8' className={progressColor}>
<circle cx='4' cy='4' r='4' strokeWidth='0' />
</svg>
{progressText}
</Col>
<Col>
<Text type='secondary'>{`${numOfCompleted} of ${numOfJobs} jobs`}</Text>
<Text type='secondary'>{`Completed: ${numOfCompleted} Validation: ${numOfValidation} Annotation: ${numOfAnnotation}`}</Text>
</Col>
</Row>
<Row>
<Col span={24}>
<Progress
className={`${progressColor} cvat-task-progress`}
percent={jobsProgress * 100}
percent={jobsProgress}
success={{
percent: (numOfCompleted * 100) / numOfJobs,
}}
strokeColor='#1890FF'
showInfo={false}
strokeWidth={5}
Expand Down
3 changes: 2 additions & 1 deletion cvat/apps/engine/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -780,7 +780,7 @@ class TaskViewSet(viewsets.GenericViewSet, mixins.ListModelMixin,
'tracker_link': 'bug_tracker',
}
search_fields = (
'project_name', 'name', 'owner', 'status', 'assignee',
'project_name', 'name', 'owner', 'stage', 'assignee',
'subset', 'mode', 'dimension', 'tracker_link'
)
filter_fields = list(search_fields) + ['id', 'project_id', 'updated_date']
Expand Down Expand Up @@ -1164,6 +1164,7 @@ def upload_finished(self, request):
@action(detail=True, methods=['OPTIONS', 'POST', 'GET'], url_path=r'data/?$',
parser_classes=_UPLOAD_PARSER_CLASSES)
def data(self, request, pk):
# todo HERE WE ARE
self._object = self.get_object() # call check_object_permissions as well
if request.method == 'POST' or request.method == 'OPTIONS':
task_data = self._object.data
Expand Down
4 changes: 4 additions & 0 deletions cvat/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -700,3 +700,7 @@ class CVAT_QUEUES(Enum):
ASSET_MAX_COUNT_PER_GUIDE = 10

SMOKESCREEN_ENABLED = True
CORS_ALLOW_CREDENTIALS = True
CSRF_TRUSTED_ORIGINS = ['http://localhost:8080', 'http://localhost:3000']
CORS_ORIGIN_WHITELIST = ['http://localhost:8080', 'http://localhost:3000']
CORS_REPLACE_HTTPS_REFERER = True

0 comments on commit 5d0cc15

Please sign in to comment.