Shared space
This commit is contained in:
@@ -114,6 +114,10 @@ abstract class AbstractItem<T extends FlowData> extends FlowData implements Seri
|
||||
@override String getName() {
|
||||
return name ?? "";
|
||||
}
|
||||
|
||||
String getTopic() {
|
||||
return topic;
|
||||
}
|
||||
}
|
||||
|
||||
class Model extends SerializerDeserializer<Model> {
|
||||
@@ -288,6 +292,11 @@ class Containered extends SerializerDeserializer<Containered> {
|
||||
}
|
||||
|
||||
class ProcessingItem extends SerializerDeserializer<ProcessingItem> implements AbstractItem<ProcessingItem> {
|
||||
@override
|
||||
String getTopic() {
|
||||
return topic;
|
||||
}
|
||||
|
||||
ProcessingItem({
|
||||
this.id,
|
||||
this.name,
|
||||
@@ -448,6 +457,11 @@ class ProcessingItem extends SerializerDeserializer<ProcessingItem> implements A
|
||||
}
|
||||
|
||||
class WorkflowItem extends SerializerDeserializer<WorkflowItem> implements AbstractItem<WorkflowItem> {
|
||||
@override
|
||||
String getTopic() {
|
||||
return topic;
|
||||
}
|
||||
|
||||
WorkflowItem({
|
||||
this.id,
|
||||
this.name,
|
||||
@@ -571,6 +585,10 @@ class WorkflowItem extends SerializerDeserializer<WorkflowItem> implements Abstr
|
||||
}
|
||||
|
||||
class DataItem extends SerializerDeserializer<DataItem> implements AbstractItem<DataItem> {
|
||||
@override
|
||||
String getTopic() {
|
||||
return topic;
|
||||
}
|
||||
DataItem({
|
||||
this.id,
|
||||
this.name,
|
||||
@@ -711,6 +729,11 @@ class DataItem extends SerializerDeserializer<DataItem> implements AbstractItem<
|
||||
}
|
||||
|
||||
class ComputeItem extends SerializerDeserializer<ComputeItem> implements AbstractItem<ComputeItem> {
|
||||
@override
|
||||
String getTopic() {
|
||||
return topic;
|
||||
}
|
||||
|
||||
ComputeItem({
|
||||
this.id,
|
||||
this.name,
|
||||
@@ -962,6 +985,11 @@ class RAM extends SerializerDeserializer<RAM> {
|
||||
};
|
||||
}
|
||||
class StorageItem extends SerializerDeserializer<StorageItem> implements AbstractItem<StorageItem> {
|
||||
@override
|
||||
String getTopic() {
|
||||
return topic;
|
||||
}
|
||||
|
||||
StorageItem({
|
||||
this.id,
|
||||
this.name,
|
||||
|
||||
@@ -3,6 +3,48 @@ import 'package:oc_front/models/response.dart';
|
||||
import 'package:oc_front/models/workflow.dart';
|
||||
import 'package:oc_front/models/workspace.dart';
|
||||
|
||||
/*
|
||||
based on :
|
||||
type CollaborativeAreaRule struct {
|
||||
ShareMode string `json:"share_mode,omitempty" bson:"share_mode,omitempty"` // Share is the share of the rule
|
||||
CreatedAt time.Time `json:"created_at,omitempty" bson:"created_at,omitempty"` // CreatedAt is the time the rule was created
|
||||
Creator string `json:"creator,omitempty" bson:"creator,omitempty"` // Creator is the creator of the rule
|
||||
ExploitedBy string `json:"exploited_by,omitempty" bson:"exploited_by,omitempty"` // ExploitedBy is the exploited by of the rule
|
||||
}
|
||||
*/
|
||||
class CollaborativeAreaRule extends SerializerDeserializer<CollaborativeAreaRule> {
|
||||
String? shareMode;
|
||||
DateTime? createdAt;
|
||||
String? creator;
|
||||
String? exploitedBy;
|
||||
|
||||
CollaborativeAreaRule(
|
||||
{this.shareMode,
|
||||
this.createdAt,
|
||||
this.creator,
|
||||
this.exploitedBy,});
|
||||
|
||||
@override
|
||||
CollaborativeAreaRule deserialize(dynamic json) {
|
||||
try { json = json as Map<String, dynamic>;
|
||||
} catch (e) { return CollaborativeAreaRule(); }
|
||||
return CollaborativeAreaRule(
|
||||
shareMode: json.containsKey("share_mode") ? json["share_mode"] : null,
|
||||
createdAt: json.containsKey("created_at") ? DateTime.parse(json["created_at"]) : null,
|
||||
creator: json.containsKey("creator") ? json["creator"] : null,
|
||||
exploitedBy: json.containsKey("exploited_by") ? json["exploited_by"] : null,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Map<String, dynamic> serialize() => {
|
||||
"share_mode": shareMode,
|
||||
"created_at": createdAt?.toIso8601String(),
|
||||
"creator": creator,
|
||||
"exploited_by": exploitedBy,
|
||||
};
|
||||
}
|
||||
|
||||
class CollaborativeArea extends SerializerDeserializer<CollaborativeArea> {
|
||||
String? id;
|
||||
String? name;
|
||||
@@ -14,6 +56,7 @@ class CollaborativeArea extends SerializerDeserializer<CollaborativeArea> {
|
||||
List<Workflow> workflows = [];
|
||||
List<Peer> peers = [];
|
||||
List<Rule> rules = [];
|
||||
CollaborativeAreaRule? rule;
|
||||
|
||||
CollaborativeArea(
|
||||
{this.id,
|
||||
@@ -25,6 +68,7 @@ class CollaborativeArea extends SerializerDeserializer<CollaborativeArea> {
|
||||
this.workspaces = const [],
|
||||
this.workflows = const [],
|
||||
this.peers = const [],
|
||||
this.rule,
|
||||
this.rules = const []});
|
||||
|
||||
@override
|
||||
@@ -32,10 +76,10 @@ class CollaborativeArea extends SerializerDeserializer<CollaborativeArea> {
|
||||
try { json = json as Map<String, dynamic>;
|
||||
} catch (e) { return CollaborativeArea(); }
|
||||
return CollaborativeArea(
|
||||
rule : json.containsKey("collaborative_area") ? CollaborativeAreaRule().deserialize(json["collaborative_area"]) : CollaborativeAreaRule(),
|
||||
id: json.containsKey("id") ? json["id"] : null,
|
||||
name: json.containsKey("name") ? json["name"] : null,
|
||||
description: json.containsKey("description") ? json["description"] : null,
|
||||
creatorID: json.containsKey("peer_id") ? json["peer_id"] : null,
|
||||
version: json.containsKey("version") ? json["version"] : null,
|
||||
attributes: json.containsKey("attributes") ? json["attributes"] : {},
|
||||
workspaces: json.containsKey("shared_workspaces") ? fromListJson(json["shared_workspaces"], Workspace()) : [],
|
||||
@@ -52,6 +96,7 @@ class CollaborativeArea extends SerializerDeserializer<CollaborativeArea> {
|
||||
"creator_id": creatorID,
|
||||
"version": version,
|
||||
"attributes": attributes,
|
||||
"rule": rule?.serialize(),
|
||||
"workspaces": workspaces.map((e) => e.id).toList(),
|
||||
"workflows": workflows.map((e) => e.id).toList(),
|
||||
"peers": peers.map((e) => e.id).toList(),
|
||||
|
||||
Reference in New Issue
Block a user