Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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 changes: 2 additions & 0 deletions label_studio/io_storages/redis/form_layout.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,7 @@ ImportStorage:
label: "Tasks - Treat each JSON or JSONL file as a task definition (one or more tasks per file)"

ExportStorage:
- columnCount: 1
fields: *redis_title
- columnCount: 2
fields: *redis_params
6 changes: 4 additions & 2 deletions label_studio/io_storages/redis/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def can_resolve_url(self, url):

def iter_objects(self):
client = self.get_client()
path = str(self.path)
path = str(self.path or "")
for key in client.keys(path + '*'):
yield key

Expand Down Expand Up @@ -135,8 +135,10 @@ def save_annotation(self, annotation):
logger.debug(f'Creating new object on {self.__class__.__name__} Storage {self} for annotation {annotation}')
ser_annotation = self._get_serialized_data(annotation)

# get key that identifies this object in storage
# get key that identifies this object in storage, prepend path prefix if set
key = RedisExportStorageLink.get_key(annotation)
if self.path:
key = str(self.path).rstrip('/') + '/' + key

# put object into storage
client.set(key, json.dumps(ser_annotation))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,14 @@ export const redisProvider: ProviderConfig = {
schema: z.string().default("6379"),
},
{
name: "prefix",
name: "path",
type: "text",
label: "Bucket prefix",
placeholder: "path/to/files",
schema: z.string().optional().default(""),
target: "export",
},
],
layout: [{ fields: ["host", "port", "db", "password"] }, { fields: ["prefix"] }],
layout: [{ fields: ["host", "port", "db", "password"] }, { fields: ["path"] }],
};

export default redisProvider;
8 changes: 4 additions & 4 deletions web/libs/datamanager/src/stores/AppStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -576,13 +576,13 @@ export const AppStore = types

self.viewsStore.fetchColumns();

const requests = [self.fetchProject()];

// Only fetch all users if not disabled globally
// Fetch users before tabs so annotator/reviewer references in task data can be resolved.
if (!isFF(FF_DISABLE_GLOBAL_USER_FETCHING)) {
requests.push(self.fetchUsers());
yield self.fetchUsers();
}

const requests = [self.fetchProject()];

if (!isLabelStream || (self.project?.show_annotation_history && task)) {
if (self.SDK.settings?.onlyVirtualTabs && self.project?.show_annotation_history && !task) {
requests.push(
Expand Down
24 changes: 14 additions & 10 deletions web/libs/datamanager/src/stores/Assignee.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ import { User } from "./Users";
import { StringOrNumberID } from "./types";
import { FF_DISABLE_GLOBAL_USER_FETCHING, isFF } from "../utils/feature-flags";

// Use safeReference so that unresolved user IDs (race condition during initial load)
// return undefined instead of throwing an MST error.
const userSafeReference = types.safeReference(User);

// Create a union type that can handle both user references and direct user objects
const UserOrReference = types.union({
dispatcher: (snapshot) => {
Expand All @@ -11,11 +15,11 @@ const UserOrReference = types.union({
return User;
}
// Otherwise, it's a reference to a user ID
return types.reference(User);
return userSafeReference;
},
cases: {
[User.name]: User,
reference: types.reference(User),
reference: userSafeReference,
},
});

Expand All @@ -29,28 +33,28 @@ export const Assignee = types
})
.views((self) => ({
get firstName() {
return self.user.firstName;
return self.user?.firstName ?? "";
},
get lastName() {
return self.user.lastName;
return self.user?.lastName ?? "";
},
get username() {
return self.user.username;
return self.user?.username ?? "";
},
get email() {
return self.user.email;
return self.user?.email ?? "";
},
get lastActivity() {
return self.user.lastActivity;
return self.user?.lastActivity ?? "";
},
get avatar() {
return self.user.avatar;
return self.user?.avatar ?? null;
},
get initials() {
return self.user.initials;
return self.user?.initials ?? "";
},
get fullName() {
return self.user.fullName;
return self.user?.fullName ?? "";
},
}))
.preProcessSnapshot((sn) => {
Expand Down
Loading