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

Projects #2255

Merged
merged 76 commits into from
Nov 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
806ec8c
init server changes
ActiveChooN Sep 28, 2020
58dfeb5
init cvat-core implementation
ActiveChooN Sep 28, 2020
e1672f9
Added projects page in cvat-ui
ActiveChooN Sep 28, 2020
22f9335
Fixed label serializer
ActiveChooN Sep 29, 2020
a21dbec
moved bugtracker to separated component
ActiveChooN Sep 29, 2020
ceb0ca9
Added project page
ActiveChooN Sep 29, 2020
5612955
wip on creating task in projects
ActiveChooN Sep 30, 2020
1138d4d
Added optional chaining plugin
ActiveChooN Sep 30, 2020
1ae57ba
Added CHANGELOG.md
ActiveChooN Sep 30, 2020
9c47386
Merge remote-tracking branch 'origin/develop' into dk/projects
ActiveChooN Sep 30, 2020
7404beb
Merge branch 'dk/babel-optional-chaining' into dk/projects
ActiveChooN Sep 30, 2020
3db94bd
wip
ActiveChooN Oct 2, 2020
9fe1143
Fixed task creation
ActiveChooN Oct 4, 2020
53c0962
Merge remote-tracking branch 'origin/develop' into dk/projects
ActiveChooN Oct 4, 2020
23fe77d
Added project preview image
ActiveChooN Oct 5, 2020
802f4ad
Merge remote-tracking branch 'origin/develop' into dk/projects
ActiveChooN Oct 5, 2020
b92e5bd
Added project logger
ActiveChooN Oct 5, 2020
64c8da7
codacy fixes
ActiveChooN Oct 5, 2020
8a44f62
Added search field
ActiveChooN Oct 6, 2020
6466fd2
Fixed codacy issues
ActiveChooN Oct 7, 2020
8fe5d0e
wip on project search
ActiveChooN Oct 9, 2020
2595a28
Fixed project selection
ActiveChooN Oct 11, 2020
bc9b982
autodeleting not completed search field
ActiveChooN Oct 12, 2020
3327418
Merge branch 'develop' into dk/projects
ActiveChooN Oct 12, 2020
0c11947
trying to fix tests
ActiveChooN Oct 15, 2020
8677dbd
Fix tests 1944, case 2.
dvkruchinin Oct 16, 2020
69725dc
Fixed serializer
ActiveChooN Oct 16, 2020
5e5202a
Another serializer fix
ActiveChooN Oct 16, 2020
7172826
Added UI test lauch from launch.json
ActiveChooN Oct 16, 2020
91e9966
Merge branch 'develop' into dk/projects
ActiveChooN Oct 16, 2020
dfe2988
Apply comments
dvkruchinin Oct 16, 2020
0ade695
Merge branch 'dk/projects' into dkru/fix-tests-dk-projects
dvkruchinin Oct 18, 2020
b530fc4
Merge pull request #2328 from dvkruchinin/dkru/fix-tests-dk-projects
ActiveChooN Oct 18, 2020
9d27d86
Fixed API tests
ActiveChooN Oct 18, 2020
3804f61
Fixed codacy issues
ActiveChooN Oct 18, 2020
38a598e
Fixed codacy issues
ActiveChooN Oct 18, 2020
d05e495
Added API tests for projects
ActiveChooN Oct 19, 2020
7658fe0
Added tests for cvat-core
ActiveChooN Oct 20, 2020
158fa5e
added assignee, fixed tasks usage
ActiveChooN Oct 22, 2020
20d2b56
added projects restriction config
ActiveChooN Oct 23, 2020
761a8ee
Merge remote-tracking branch 'origin/develop' into dk/projects
ActiveChooN Oct 23, 2020
bccb57e
Fixed issue
ActiveChooN Oct 23, 2020
64889e3
Fixed migrations
ActiveChooN Oct 23, 2020
cc1dde2
Added CHANGELOG and node packages versions
ActiveChooN Oct 23, 2020
2028be8
Merge remote-tracking branch 'upstream/develop' into dkru/resolve-con…
Oct 23, 2020
9cf0e4a
Tests adaptation.
Oct 23, 2020
002f797
Checkout "tests/" from #2352. Some fix.
Oct 24, 2020
bb23e51
Some fix. Changing the comment attribute for copyright.
Oct 24, 2020
718289e
Fixed task loading
ActiveChooN Oct 26, 2020
0de8e8d
Merge remote-tracking branch 'upstream/dk/projects' into dkru/resolve…
Oct 26, 2020
b816aa8
Merge pull request #2351 from dvkruchinin/dkru/resolve-conflicts-dk_p…
ActiveChooN Oct 26, 2020
6e90a16
Merge remote-tracking branch 'origin/develop' into dk/projects
ActiveChooN Oct 27, 2020
b8f0e8c
Merge branch 'develop' into dk/projects
ActiveChooN Oct 29, 2020
b075bdc
Merge branch 'develop' into dk/projects
ActiveChooN Nov 2, 2020
5f8601f
Fixed issues
ActiveChooN Nov 2, 2020
7d6ac6d
Merge branch 'develop' into dk/projects
Nov 6, 2020
d88580b
Removed onSave param
ActiveChooN Nov 9, 2020
403be60
Added label set validator restriction
ActiveChooN Nov 10, 2020
e217769
Fixed sereal issues
ActiveChooN Nov 12, 2020
5517b99
Merge remote-tracking branch 'origin/develop' into dk/projects
ActiveChooN Nov 12, 2020
741f164
Reverted prettified files
ActiveChooN Nov 12, 2020
1981e45
Fixed strange alignment
ActiveChooN Nov 12, 2020
7cc21ec
Reverted another prettified files
ActiveChooN Nov 12, 2020
7ba269e
Fixed PR issues
ActiveChooN Nov 13, 2020
7560b19
Merge remote-tracking branch 'origin/develop' into dk/projects
ActiveChooN Nov 16, 2020
8d14075
Fixed PR issues and tests
ActiveChooN Nov 16, 2020
f1788f9
Fixed UI tests
ActiveChooN Nov 17, 2020
819a0de
Fixed PR issues
ActiveChooN Nov 18, 2020
f2de2c5
Fixed project cvat-core assignee
ActiveChooN Nov 18, 2020
a16161d
Merge remote-tracking branch 'origin/develop' into dk/projects
ActiveChooN Nov 19, 2020
cbf218f
Fixed project actions
ActiveChooN Nov 19, 2020
9ef3cde
Fixed mixins
ActiveChooN Nov 19, 2020
3127d07
Merge remote-tracking branch 'origin/develop' into dk/projects
ActiveChooN Nov 19, 2020
578d2bb
Reverted task mixins
ActiveChooN Nov 19, 2020
92f9b4d
Merge remote-tracking branch 'origin/develop' into dk/projects
ActiveChooN Nov 23, 2020
8d82660
Update CHANGELOG.md
Nov 25, 2020
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
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,7 @@ yarn-debug.log*
yarn-error.log*

.DS_Store

#Ignore Cypress tests temp files
/tests/cypress/fixtures
/tests/cypress/screenshots
15 changes: 15 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,21 @@
},
"smartStep": true,
},
{
"type": "node",
"request": "launch",
"name": "ui.js: test",
"cwd": "${workspaceRoot}/tests",
"runtimeExecutable": "${workspaceRoot}/tests/node_modules/.bin/cypress",
"args": [
"run",
"--headless",
"--browser",
"chrome"
],
"outputCapture": "std",
"console": "internalConsole"
},
{
"name": "server: django",
"type": "python",
Expand Down
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

-
- Added basic projects implementation (<https://github.com/openvinotoolkit/cvat/pull/2255>)


### Changed

Expand Down
1 change: 1 addition & 0 deletions cvat-canvas/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
webpack.config.js
1 change: 1 addition & 0 deletions cvat-core/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
webpack.config.js
58 changes: 54 additions & 4 deletions cvat-core/src/api-implementation.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
const { AnnotationFormats } = require('./annotation-formats');
const { ArgumentError } = require('./exceptions');
const { Task } = require('./session');
const { Project } = require('./project');

function implementAPI(cvat) {
cvat.plugins.list.implementation = PluginRegistry.list;
Expand Down Expand Up @@ -100,6 +101,11 @@
return result;
};

cvat.server.installedApps.implementation = async () => {
const result = await serverProxy.server.installedApps();
return result;
};

cvat.users.get.implementation = async (filter) => {
checkFilter(filter, {
id: isInteger,
Expand Down Expand Up @@ -163,6 +169,7 @@
cvat.tasks.get.implementation = async (filter) => {
checkFilter(filter, {
page: isInteger,
projectId: isInteger,
ActiveChooN marked this conversation as resolved.
Show resolved Hide resolved
name: isString,
id: isInteger,
owner: isString,
Expand All @@ -184,8 +191,15 @@
}
}

if (
'projectId' in filter
&& (('page' in filter && Object.keys(filter).length > 2) || Object.keys(filter).length > 2)
) {
throw new ArgumentError('Do not use the filter field "projectId" with other');
}

const searchParams = new URLSearchParams();
for (const field of ['name', 'owner', 'assignee', 'search', 'status', 'mode', 'id', 'page']) {
for (const field of ['name', 'owner', 'assignee', 'search', 'status', 'mode', 'id', 'page', 'projectId']) {
if (Object.prototype.hasOwnProperty.call(filter, field)) {
searchParams.set(field, filter[field]);
}
Expand All @@ -199,11 +213,47 @@
return tasks;
};

cvat.server.installedApps.implementation = async () => {
const result = await serverProxy.server.installedApps();
return result;
cvat.projects.get.implementation = async (filter) => {
checkFilter(filter, {
id: isInteger,
page: isInteger,
name: isString,
assignee: isString,
owner: isString,
search: isString,
status: isEnum.bind(TaskStatus),
});

if ('search' in filter && Object.keys(filter).length > 1) {
if (!('page' in filter && Object.keys(filter).length === 2)) {
throw new ArgumentError('Do not use the filter field "search" with others');
}
}

if ('id' in filter && Object.keys(filter).length > 1) {
if (!('page' in filter && Object.keys(filter).length === 2)) {
throw new ArgumentError('Do not use the filter field "id" with others');
}
}

const searchParams = new URLSearchParams();
for (const field of ['name', 'assignee', 'owner', 'search', 'status', 'id', 'page']) {
if (Object.prototype.hasOwnProperty.call(filter, field)) {
searchParams.set(field, filter[field]);
}
}

const projectsData = await serverProxy.projects.get(searchParams.toString());
// prettier-ignore
const projects = projectsData.map((project) => new Project(project));

projects.count = projectsData.count;

return projects;
};

cvat.projects.searchNames.implementation = async (search, limit) => serverProxy.projects.searchNames(search, limit);

return cvat;
}

Expand Down
60 changes: 59 additions & 1 deletion cvat-core/src/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ function build() {
const ObjectState = require('./object-state');
const Statistics = require('./statistics');
const { Job, Task } = require('./session');
const { Project } = require('./project');
const { Attribute, Label } = require('./labels');
const MLModel = require('./ml-model');

Expand Down Expand Up @@ -274,6 +275,60 @@ function build() {
return result;
},
},
/**
* Namespace is used for getting projects
* @namespace projects
* @memberof module:API.cvat
*/
projects: {
/**
* @typedef {Object} ProjectFilter
* @property {string} name Check if name contains this value
* @property {module:API.cvat.enums.ProjectStatus} status
* Check if status contains this value
* @property {integer} id Check if id equals this value
* @property {integer} page Get specific page
* (default REST API returns 20 projects per request.
* In order to get more, it is need to specify next page)
* @property {string} owner Check if owner user contains this value
* @property {string} search Combined search of contains among all fields
* @global
*/

/**
* Method returns list of projects corresponding to a filter
* @method get
* @async
* @memberof module:API.cvat.projects
* @param {ProjectFilter} [filter={}] project filter
* @returns {module:API.cvat.classes.Project[]}
* @throws {module:API.cvat.exceptions.PluginError}
* @throws {module:API.cvat.exceptions.ServerError}
*/
async get(filter = {}) {
const result = await PluginRegistry.apiWrapper(cvat.projects.get, filter);
return result;
},

/**
* Method returns list of project names with project ids
* corresponding to a search phrase
* used for autocomplete field
* @method searchNames
* @async
* @memberof module:API.cvat.projects
* @param {string} [search = ''] search phrase
* @param {number} [limit = 10] number of returning project names
* @returns {module:API.cvat.classes.Project[]}
* @throws {module:API.cvat.exceptions.PluginError}
* @throws {module:API.cvat.exceptions.ServerError}
*
*/
async searchNames(search = '', limit = 10) {
const result = await PluginRegistry.apiWrapper(cvat.projects.searchNames, search, limit);
return result;
},
},
/**
* Namespace is used for getting tasks
* @namespace tasks
Expand All @@ -291,6 +346,7 @@ function build() {
* @property {integer} page Get specific page
* (default REST API returns 20 tasks per request.
* In order to get more, it is need to specify next page)
* @property {integer} projectId Check if project_id field contains this value
* @property {string} owner Check if owner user contains this value
* @property {string} assignee Check if assigneed contains this value
* @property {string} search Combined search of contains among all fields
Expand Down Expand Up @@ -717,8 +773,9 @@ function build() {
* @memberof module:API.cvat
*/
classes: {
Task,
User,
Project,
Task,
Job,
Log,
Attribute,
Expand All @@ -730,6 +787,7 @@ function build() {
};

cvat.server = Object.freeze(cvat.server);
cvat.projects = Object.freeze(cvat.projects);
cvat.tasks = Object.freeze(cvat.tasks);
cvat.jobs = Object.freeze(cvat.jobs);
cvat.users = Object.freeze(cvat.users);
Expand Down
Loading