Skip to content

Commit

Permalink
Merge branch 'master' of github.com:scalableminds/webknossos into rea…
Browse files Browse the repository at this point in the history
…ct-task-create

* 'master' of github.com:scalableminds/webknossos: (167 commits)
  Enable interpolation setting in volume mode (#2089)
  allow admins to administrate datasets
  fix compilation
  update libs
  remove jsRoutes from tests
  apply PR feedback (#1957)
  removed github conf
  fixed lint
  make flow happy
  fix merge conflicts in frontend
  Changed schema after tests #2055
  merge master. TODO: fix flow errors, test volume fallback layer
  remove obsolete version field from annotation (only tracings are versioned now)
  Further implementation of PR review advices #2055
  Implemented first part of review comments #2055
  remove obsolete todo
  log time for the user who sent the updates, not for the annotation owner
  use new libs version
  update libs version
  disable e2e tests
  ...
  • Loading branch information
hotzenklotz committed Nov 3, 2017
2 parents 073657f + b7b91b3 commit a86af13
Show file tree
Hide file tree
Showing 233 changed files with 13,061 additions and 22,809 deletions.
6 changes: 3 additions & 3 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ wrap(repo: "scalableminds/webknossos") {
sh "docker-compose run frontend-linting"
sh "docker-compose run frontend-flow"
sh "docker-compose run frontend-tests"
retry (3) {
sh "docker-compose run e2e-tests"
}
// retry (3) {
// sh "docker-compose run e2e-tests"
// }
sh """
DOCKER_TAG=${env.BRANCH_NAME}__${env.BUILD_NUMBER} docker-compose up webknossos &
sleep 10
Expand Down
4 changes: 2 additions & 2 deletions app/Global.scala
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ object Global extends GlobalSettings with LazyLogging{
InitialData.insert(conf)
}

CleanUpService.register("deletion of expired dataTokens", DataToken.expirationTime){
DataTokenDAO.removeExpiredTokens()(GlobalAccessContext).map(r => s"deleted ${r.n}")
CleanUpService.register("deletion of expired dataTokens", UserToken.expirationTime) {
UserTokenDAO.removeExpiredTokens()(GlobalAccessContext).map(r => s"deleted ${r.n}")
}

CleanUpService.register("deletion of openAssignments with zero instances", OpenAssignment.pruningInterval) {
Expand Down
55 changes: 39 additions & 16 deletions app/assets/javascripts/admin/admin_rest_api.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,35 @@ export async function deleteProject(projectName: string): Promise<void> {
});
}

// ### Do with userToken

let tokenRequestPromise;
function requestUserToken(): Promise<string> {
if (tokenRequestPromise) {
return tokenRequestPromise;
}

tokenRequestPromise = Request.receiveJSON("/api/userToken/generate").then(tokenObj => {
tokenRequestPromise = null;
return tokenObj.token;
});

return tokenRequestPromise;
}

let tokenPromise;
export async function doWithToken<T>(fn: (token: string) => Promise<T>): Promise<*> {
if (!tokenPromise) tokenPromise = requestUserToken();
return tokenPromise.then(fn).catch(error => {
if (error.status === 403) {
console.warn("Token expired. Requesting new token...");
tokenPromise = requestUserToken();
return doWithToken(fn);
}
throw error;
});
}

export async function createProject(project: APIProjectType): Promise<APIProjectType> {
const transformedProject = Object.assign({}, project, {
expectedTime: Utils.minutesToMilliseconds(project.expectedTime),
Expand Down Expand Up @@ -282,29 +311,22 @@ export async function getTasks(queryObject: QueryObjectType): Promise<Array<APIT
}

// TODO fix return types
export async function createTask(task: NewTaskType): Promise<*> {
return Request.sendJSONReceiveJSON("/api/tasks?type=default", {
data: task,
export async function createTasks(tasks: Array<NewTaskType>): Promise<Array<*>> {
return Request.sendJSONReceiveJSON("/api/tasks", {
data: tasks,
});
}

// TODO fix return types
export async function createTaskFromNML(task: NewTaskType): Promise<*> {
return Request.sendMultipartFormReceiveJSON("/api/tasks?type=nml", {
return Request.sendMultipartFormReceiveJSON("/api/tasks/createFromFile", {
data: {
nmlFile: task.nmlFile,
formJSON: JSON.stringify(task),
},
});
}

// TODO fix return types
export async function createTasksFromBulk(tasks: Array<NewTaskType>): Promise<*> {
return Request.sendJSONReceiveJSON("/api/tasks?type=bulk", {
data: tasks,
});
}

export async function getTask(taskId: string): Promise<APITaskType> {
const task = await Request.receiveJSON(`/api/tasks/${taskId}`);
return transformTask(task);
Expand Down Expand Up @@ -361,11 +383,12 @@ export async function addNDStoreDataset(
}

export async function addDataset(datatsetConfig: DatasetConfigType): Promise<APIAnnotationType> {
const response = await Request.receiveJSON("/api/dataToken/generate");
return Request.sendMultipartFormReceiveJSON(`/data/datasets?token=${response.token}`, {
data: datatsetConfig,
host: datatsetConfig.datastore,
});
return doWithToken(token =>
Request.sendMultipartFormReceiveJSON(`/data/datasets?token=${token}`, {
data: datatsetConfig,
host: datatsetConfig.datastore,
}),
);
}

// #### Datastores
Expand Down
154 changes: 95 additions & 59 deletions app/assets/javascripts/admin/api_flow_types.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* api_flow_types.js
* @flow
*/
import type { SkeletonTracingStatsType } from "oxalis/model/accessors/skeletontracing_accessor";
import type { Vector3, Vector6 } from "oxalis/constants";
import type { DataLayerType, SettingsType, BoundingBoxObjectType } from "oxalis/store";

Expand All @@ -19,6 +20,7 @@ export type APIDataStoreType = {
+name: string,
+url: string,
+typ: "webknossos-store" | "nd-store",
+accessToken?: string,
};

export type APIDatasetType = {
Expand All @@ -27,13 +29,20 @@ export type APIDatasetType = {
+dataStore: APIDataStoreType,
+sourceType: "wkw" | "knossos",
+owningTeam: "Connectomics department",
};

export type APIDatasetType = {
+allowedTeams: Array<string>,
+isActive: boolean,
+accessToken: null,
+isPublic: boolean,
+description: ?string,
+created: number,
+dataSource: APIDataSourceType,
+dataStore: APIDataStoreType,
+description: ?string,
+isActive: boolean,
+isEditable: boolean,
+isPublic: boolean,
+name: string,
+owningTeam: "Connectomics department",
+sourceType: "wkw" | "knossos",
};

export type APIRoleType = { +name: string };
Expand All @@ -43,7 +52,7 @@ export type APITeamRoleType = {
+role: APIRoleType,
};

type ExperienceMapType = { +[string]: number };
export type ExperienceMapType = { +[string]: number };

export type APIUserType = {
+email: string,
Expand All @@ -66,37 +75,34 @@ export type APITeamType = {
+roles: Array<APIRoleType>,
};

export type APIAnnotationType = {
+version: number,
+user: {
+id: string,
+email: string,
+firstName: string,
+lastName: string,
+isAnonymous: boolean,
+teams: Array<APITeamRoleType>,
},
+modified: string,
+stateLabel: string,
+state: { +isAssigned: boolean, +isFinished: boolean, +isInProgress: boolean },
+id: string,
+name: string,
+typ: string,
+stats: { +numberOfNodes: number, +numberOfEdges: number, +numberOfTrees: number },
+restrictions: {
+allowAccess: boolean,
+allowUpdate: boolean,
+allowFinish: boolean,
+allowDownload: boolean,
},
+formattedHash: string,
+downloadUrl: string,
+contentType: string,
+dataSetName: string,
+tracingTime: null,
+tags: Array<string>,
export type APIRestrictionsType = {
+allowAccess: boolean,
+allowUpdate: boolean,
+allowFinish: boolean,
+allowDownload: boolean,
};

export type APIAllowedModeType = "orthogonal" | "oblique" | "flight" | "volume";

export type APISettingsType = {
+advancedOptionsAllowed: boolean,
+allowedModes: Array<APIAllowedModeType>,
+preferredMode: APIAllowedModeType,
+branchPointsAllowed: boolean,
+somaClickingAllowed: boolean,
};

export const APITracingTypeTracingEnum = {
Explorational: "Explorational",
Task: "Task",
View: "View",
CompoundTask: "CompoundTask",
CompoundProject: "CompoundProject",
CompoundTaskType: "CompoundTaskType",
};

export type APITracingTypeTracingType = $Keys<typeof APITracingTypeTracingEnum>;

export type APITaskTypeType = {
+id: string,
+summary: string,
Expand All @@ -107,30 +113,23 @@ export type APITaskTypeType = {

export type TaskStatusType = { +open: number, +inProgress: number, +completed: number };

export type APITaskWithAnnotationType = {
export type APIScriptType = {
+id: string,
+team: string,
+formattedHash: string,
+projectName: string,
+type: APITaskTypeType,
+dataSet: string,
+editPosition: Vector3,
+editRotation: Vector3,
+boundingBox: null,
+neededExperience: ExperienceMapType,
+created: string,
+status: TaskStatusType,
+script: null,
+tracingTime: null,
+creationInfo: null,
+annotation: APIAnnotationType,
+name: string,
+owner: APIUserType,
+gist: string,
};

export type APIScriptType = {
export type APIProjectType = {
+id: string,
+name: string,
+team: string,
+owner: APIUserType,
+gist: string,
+priority: number,
+paused: boolean,
+expectedTime: number,
+assignmentConfiguration: { location: "webknossos" | "mturk" },
+numberOfOpenAssignments: number,
};

export type APITaskType = {
Expand All @@ -156,16 +155,51 @@ export type APITaskType = {
+directLinks?: Array<string>,
};

export type APIProjectType = {
export type APIAnnotationType = {
+content: {
+id: string,
+typ: string,
},
+dataSetName: string,
+dataStore: APIDataStoreType,
+description: string,
+formattedHash: string,
+modified: string,
+id: string,
+isPublic: boolean,
+name: string,
+restrictions: APIRestrictionsType,
+settings: APISettingsType,
+state: {
+isAssigned: boolean,
+isFinished: boolean,
+isInProgress: boolean,
},
+stats: SkeletonTracingStatsType,
+tags: Array<string>,
+task: APITaskType,
+tracingTime: number,
+typ: APITracingTypeTracingType,
+user?: APIUserType,
};

export type APITaskWithAnnotationType = {
+id: string,
+team: string,
+owner: APIUserType,
+priority: number,
+paused: boolean,
+expectedTime: number,
+assignmentConfiguration: { location: "webknossos" | "mturk" },
+numberOfOpenAssignments: number,
+formattedHash: string,
+projectName: string,
+type: APITaskTypeType,
+dataSet: string,
+editPosition: Vector3,
+editRotation: Vector3,
+boundingBox: null,
+neededExperience: ExperienceMapType,
+created: string,
+status: TaskStatusType,
+script: null,
+tracingTime: null,
+creationInfo: null,
+annotation: APIAnnotationType,
};

export type APIDatastoreType = {
Expand All @@ -187,3 +221,5 @@ export type DatasetConfigType = {
+datastore: string,
+zipFile: File,
};

export default {};
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ class ProjectListView extends React.PureComponent<{}, State> {
render={(__, project: APIProjectType) => (
<span>
<a
href={`/annotations/CompoundProject/${project.name}`}
href={`/annotations/CompoundProject/${project.id}`}
title="View all Finished Tracings"
>
<Icon type="eye-o" />View
Expand Down Expand Up @@ -215,7 +215,7 @@ class ProjectListView extends React.PureComponent<{}, State> {
</div>
)}
<a
href={`/api/projects/${project.name}/download`}
href={`/annotations/CompoundProject/${project.id}/download`}
title="Download all Finished Tracings"
>
<Icon type="download" />Download
Expand Down
Loading

0 comments on commit a86af13

Please sign in to comment.