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

feat: Project level audit #776

Open
wants to merge 35 commits into
base: staging
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
4d71126
fix: update isMounted in AuditWrapper
philipjackson Jun 26, 2022
f06c741
fix: append new audit data instead of overwriting
philipjackson Jun 26, 2022
dd1657a
feat: add ProjectAudit.ts
philipjackson Jun 27, 2022
aa47462
feat: migrations / exports
philipjackson Jun 27, 2022
27d55d6
feat: create projectAudit on project creation
philipjackson Jun 28, 2022
d65106d
feat: log image upload
philipjackson Jun 28, 2022
3c41349
feat: log image deletion
philipjackson Jun 28, 2022
5717334
feat: log image assignment
philipjackson Jun 28, 2022
bc54705
feat: log image unassignment
philipjackson Jun 28, 2022
8b7d1fa
feat: log image labels update
philipjackson Jun 28, 2022
0defb59
feat: log invite user
philipjackson Jun 29, 2022
b64e30c
feat: log setDefaultLabels, log setRestrictLabels, log setMultiLabel
philipjackson Jun 29, 2022
7242fd6
feat: log CreateProject
philipjackson Jul 1, 2022
9ec8d2e
feat: logAuditActions function in DominateStore
philipjackson Jul 4, 2022
ba6df67
feat: log createPlugin and updatePlugin
philipjackson Jul 12, 2022
b46a382
feat: log deletePlugin
philipjackson Jul 12, 2022
8b9a61c
refactor: pluggin logging
philipjackson Jul 12, 2022
5105860
feat: pass logPluginCall to CURATE
philipjackson Jul 14, 2022
e5b9ff7
fix: log all new plugins, not just trusted services
philipjackson Jul 16, 2022
8fb5c8c
fix: log all plugin updates, not just trusted services
philipjackson Jul 16, 2022
ee0c8c1
fix: log all plugin deletions, not just trusted services
philipjackson Jul 16, 2022
8773ff7
fix: only log inviteUser in inviteToProject when it's not a plugin in…
philipjackson Jul 16, 2022
f03aa8c
fix: inviteUser -> addUserToProject
philipjackson Jul 18, 2022
23ce572
feat: add TeamAudit.ts
philipjackson Jul 18, 2022
85540f1
fix: create teamAudit if it doesn't exist already
philipjackson Jul 18, 2022
a05e9be
feat: log inviteUser and inviteCollaborator
philipjackson Jul 18, 2022
5eb797e
feat: log inviteAccepted
philipjackson Jul 18, 2022
465494b
refactor: use this.logAuditActions in DominateStore
philipjackson Jul 28, 2022
5c4cba6
refactor: remove user/collaborator invite/accept from ProjectAudit
philipjackson Jul 28, 2022
8ac734c
style: newline
philipjackson Jul 28, 2022
0511894
merge: staging
philipjackson Jul 28, 2022
552aafd
fix: lint errors
philipjackson Jul 28, 2022
253fb67
fix: bump style
philipjackson Jul 28, 2022
50820ac
merge: staging
philipjackson Jul 29, 2022
897d7a8
fix: bump curate
philipjackson Jul 29, 2022
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
2,793 changes: 1,170 additions & 1,623 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"@emotion/styled": "^11.9.3",
"@gliff-ai/annotate": "^6.0.0",
"@gliff-ai/audit": "^4.0.0",
"@gliff-ai/curate": "^7.6.2",
"@gliff-ai/curate": "^7.7.0",
"@gliff-ai/etebase": "^0.44.0",
"@gliff-ai/manage": "^8.0.0",
"@gliff-ai/style": "^16.2.1",
Expand Down
1 change: 1 addition & 0 deletions src/interfaces/Gallery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ interface GalleryMetaV0 extends BaseMeta {
defaultLabels: string[];
restrictLabels: boolean;
multiLabel: boolean;
projectAuditUID: string;
}

// example new interface:
Expand Down
151 changes: 151 additions & 0 deletions src/interfaces/ProjectAudit.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
import { BaseMeta } from "./shared";
import { Plugin } from "@/plugins";

// ----------------------------- META -----------------------------

interface ProjectAuditMetaV0 extends BaseMeta {
meta_version: 0;
content_version: 0;
type: "gliff.projectAudit";
name: string; // should be the same as the project name
createdTime: number;
modifiedTime: number;
deletedTime: number | null;
galleryUID: string;
}

// ----------------------------- CONTENT -----------------------------

interface CreateProjectV0 {
type: "createProject";
projectName: string;
description: string;
}

interface AddUserToProjectV0 {
type: "addUserToProject";
username: string;
}

interface UploadImageV0 {
type: "uploadImage";
imageName: string;
imageUid: string;
}

interface DeleteImageV0 {
type: "deleteImage";
imageName: string;
imageUid: string;
}

interface AssignImageV0 {
type: "assignImage";
imageName: string;
imageUid: string;
assigneeUsername: string;
}

interface UnassignImageV0 {
type: "unassignImage";
imageName: string;
imageUid: string;
assigneeUsername: string;
}

interface UpdateImageLabelsV0 {
type: "updateImageLabels";
imageName: string;
imageUid: string;
labels: string[];
}

interface SetDefaultLabelsV0 {
type: "setDefaultLabels";
defaultLabels: string[];
}

interface SetRestrictLabelsV0 {
type: "setRestrictLabels";
restrictLabels: boolean;
}

interface SetMultiLabelV0 {
type: "setMultiLabel";
multiLabel: boolean;
}

interface SetPluginV0 {
type: "setPlugin";
plugin: {
username?: string; // trusted-service username (i.e., email address)
name: string; // plugin name
type: "Javascript" | "Python" | "AI";
url: string; // base_url for trusted-services and url for plugins
products: "CURATE" | "ANNOTATE" | "ALL";
enabled: boolean;
};
}

interface DeletePluginV0 {
type: "deletePlugin";
plugin: {
username?: string; // trusted-service username (i.e., email address)
name: string; // plugin name
type: "Javascript" | "Python" | "AI";
url: string; // base_url for trusted-services and url for plugins
products: "CURATE" | "ANNOTATE" | "ALL";
enabled: boolean;
};
}

interface CallPluginV0 {
type: "callPlugin";
pluginName: string;
pluginType?: string;
imageUid: string;
imageMetadata?: ({
[index: string]: string | number | boolean | string[] | undefined;
} & {
id?: string;
imageName?: string;
imageLabels?: string[];
filterShow?: boolean;
assignees?: string[];
numberOfDimensions?: "2" | "3";
dimensions?: string;
size?: string;
})[];
}

interface ProjectAuditActionV0 {
action:
| CreateProjectV0
| AddUserToProjectV0
| UploadImageV0
| DeleteImageV0
| AssignImageV0
| UnassignImageV0
| UpdateImageLabelsV0
| SetDefaultLabelsV0
| SetRestrictLabelsV0
| SetMultiLabelV0
| SetPluginV0
| DeletePluginV0
| CallPluginV0;
username: string;
timestamp: number;
}

type ProjectAuditContentV0 = ProjectAuditActionV0[];

const metaMigrations = [];
const contentMigrations = [];

export {
ProjectAuditMetaV0 as ProjectAuditMeta,
ProjectAuditContentV0 as ProjectAuditContent,
ProjectAuditActionV0 as ProjectAuditAction,
metaMigrations as ProjectAuditMetaMigrations,
contentMigrations as ProjectAuditContentMigrations,
};
52 changes: 52 additions & 0 deletions src/interfaces/TeamAudit.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import { BaseMeta } from "./shared";

// ----------------------------- META -----------------------------

interface TeamAuditMetaV0 extends BaseMeta {
meta_version: 0;
content_version: 0;
type: "gliff.teamAudit";
createdTime: number;
modifiedTime: number;
}

// ----------------------------- CONTENT -----------------------------

interface CreateTeamV0 {
type: "createTeam";
ownerName: string;
}

interface InviteUserV0 {
type: "inviteUser";
inviteeUsername: string;
}

interface InviteCollaboratorV0 {
type: "inviteCollaborator";
inviteeUsername: string;
}

interface InviteAcceptedV0 {
type: "inviteAccepted";
inviteeUsername: string;
}

interface TeamAuditActionV0 {
action: CreateTeamV0 | InviteUserV0 | InviteCollaboratorV0 | InviteAcceptedV0;
username: string;
timestamp: number;
}

type TeamAuditContentV0 = TeamAuditActionV0[];

const metaMigrations = [];
const contentMigrations = [];

export {
TeamAuditMetaV0 as TeamAuditMeta,
TeamAuditContentV0 as TeamAuditContent,
TeamAuditActionV0 as TeamAuditAction,
metaMigrations as TeamAuditMetaMigrations,
contentMigrations as TeamAuditContentMigrations,
};
24 changes: 24 additions & 0 deletions src/interfaces/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,20 @@ import {
AuditMetaMigrations,
AuditContentMigrations,
} from "./Audit";
import {
ProjectAuditMeta,
ProjectAuditContent,
ProjectAuditAction,
ProjectAuditMetaMigrations,
ProjectAuditContentMigrations,
} from "./ProjectAudit";
import {
TeamAuditMeta,
TeamAuditContent,
TeamAuditAction,
TeamAuditMetaMigrations,
TeamAuditContentMigrations,
} from "./TeamAudit";
import { FileInfo, BaseMeta, DemoMetadata } from "./shared";

type ImageBitmapBlob = ImageBitmap;
Expand All @@ -38,6 +52,10 @@ migrations["gliff.annotation.meta"] = AnnotationMetaMigrations;
migrations["gliff.annotation.content"] = AnnotationContentMigrations;
migrations["gliff.audit.meta"] = AuditMetaMigrations;
migrations["gliff.audit.content"] = AuditContentMigrations;
migrations["gliff.projectAudit.meta"] = ProjectAuditMetaMigrations;
migrations["gliff.projectAudit.content"] = ProjectAuditContentMigrations;
migrations["gliff.teamAudit.meta"] = TeamAuditMetaMigrations;
migrations["gliff.teamAudit.content"] = TeamAuditContentMigrations;

export type {
BaseMeta,
Expand All @@ -47,6 +65,12 @@ export type {
ImageMeta,
AnnotationMeta,
AuditMeta,
ProjectAuditMeta,
ProjectAuditContent,
ProjectAuditAction,
TeamAuditMeta,
TeamAuditContent,
TeamAuditAction,
FileInfo,
MetaItem,
ImageBitmapBlob,
Expand Down
Loading