##// END OF EJS Templates
Use correct product ID when creating an event
trabillard -
r1287:74e2e6e57838
parent child
Show More
@@ -27,6 +27,8 public:
27 static const QString NAME_DATA_KEY;
27 static const QString NAME_DATA_KEY;
28 /// Key associated with the plugin of the item
28 /// Key associated with the plugin of the item
29 static const QString PLUGIN_DATA_KEY;
29 static const QString PLUGIN_DATA_KEY;
30 /// Key associated with a unique id of the plugin
31 static const QString ID_DATA_KEY;
30
32
31 explicit DataSourceItem(DataSourceItemType type, const QString &name);
33 explicit DataSourceItem(DataSourceItemType type, const QString &name);
32 explicit DataSourceItem(DataSourceItemType type, QVariantHash data = {});
34 explicit DataSourceItem(DataSourceItemType type, QVariantHash data = {});
@@ -6,6 +6,7
6
6
7 const QString DataSourceItem::NAME_DATA_KEY = QStringLiteral("name");
7 const QString DataSourceItem::NAME_DATA_KEY = QStringLiteral("name");
8 const QString DataSourceItem::PLUGIN_DATA_KEY = QStringLiteral("plugin");
8 const QString DataSourceItem::PLUGIN_DATA_KEY = QStringLiteral("plugin");
9 const QString DataSourceItem::ID_DATA_KEY = QStringLiteral("uuid");
9
10
10 struct DataSourceItem::DataSourceItemPrivate {
11 struct DataSourceItem::DataSourceItemPrivate {
11 explicit DataSourceItemPrivate(DataSourceItemType type, QVariantHash data)
12 explicit DataSourceItemPrivate(DataSourceItemType type, QVariantHash data)
@@ -2,6 +2,7
2
2
3 #include <Actions/ActionsGuiController.h>
3 #include <Actions/ActionsGuiController.h>
4 #include <Catalogue/CatalogueController.h>
4 #include <Catalogue/CatalogueController.h>
5 #include <DataSource/DataSourceItem.h>
5 #include <SqpApplication.h>
6 #include <SqpApplication.h>
6 #include <Variable/Variable.h>
7 #include <Variable/Variable.h>
7 #include <Visualization/VisualizationGraphWidget.h>
8 #include <Visualization/VisualizationGraphWidget.h>
@@ -50,7 +51,8 struct CatalogueActionManager::CatalogueActionManagerPrivate {
50 eventProduct->setTStart(zoneRange.m_TStart);
51 eventProduct->setTStart(zoneRange.m_TStart);
51 eventProduct->setTEnd(zoneRange.m_TEnd);
52 eventProduct->setTEnd(zoneRange.m_TEnd);
52
53
53 eventProduct->setProductId(var->metadata().value("id", "TODO").toString()); // todo
54 eventProduct->setProductId(
55 var->metadata().value(DataSourceItem::ID_DATA_KEY, "UnknownID").toString());
54
56
55 productList.push_back(*eventProduct);
57 productList.push_back(*eventProduct);
56 }
58 }
@@ -37,6 +37,7 void associateActions(DataSourceItem &item, const QUuid &dataSourceUid)
37 auto actionLabel = QObject::tr(
37 auto actionLabel = QObject::tr(
38 itemType == DataSourceItemType::PRODUCT ? "Load %1 product" : "Load %1 component");
38 itemType == DataSourceItemType::PRODUCT ? "Load %1 product" : "Load %1 component");
39 addLoadAction(actionLabel.arg(item.name()));
39 addLoadAction(actionLabel.arg(item.name()));
40 item.setData(DataSourceItem::ID_DATA_KEY, item.data(AMDA_XML_ID_KEY));
40 }
41 }
41
42
42 auto count = item.childCount();
43 auto count = item.childCount();
@@ -28,6 +28,7 std::unique_ptr<DataSourceItem> createProductItem(const QVariantHash &data,
28
28
29 // Adds plugin name to product metadata
29 // Adds plugin name to product metadata
30 result->setData(DataSourceItem::PLUGIN_DATA_KEY, DATA_SOURCE_NAME);
30 result->setData(DataSourceItem::PLUGIN_DATA_KEY, DATA_SOURCE_NAME);
31 result->setData(DataSourceItem::ID_DATA_KEY, data.value(DataSourceItem::NAME_DATA_KEY));
31
32
32 auto productName = data.value(DataSourceItem::NAME_DATA_KEY).toString();
33 auto productName = data.value(DataSourceItem::NAME_DATA_KEY).toString();
33
34
General Comments 3
Under Review
author

Auto status change to "Under Review"

Approved
author

Status change > Approved

You need to be logged in to leave comments. Login now