Sprint 33: end-of-sprint architecture refactor pass
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
#pragma once
|
||||
// Step 586: Capability Discovery Panels
|
||||
|
||||
#include "ProductizationValidationUtil.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <map>
|
||||
#include <string>
|
||||
@@ -20,8 +22,10 @@ public:
|
||||
std::string* error) {
|
||||
if (!error) return false;
|
||||
error->clear();
|
||||
if (categoryId.empty()) return fail(error, "category_id_missing");
|
||||
if (title.empty()) return fail(error, "category_title_missing");
|
||||
if (!hasRequiredProductIds(categoryId, title)) {
|
||||
if (categoryId.empty()) return fail(error, "category_id_missing");
|
||||
return fail(error, "category_title_missing");
|
||||
}
|
||||
if (categories_.count(categoryId) != 0) return fail(error, "category_duplicate");
|
||||
CapabilityCategory c;
|
||||
c.categoryId = categoryId;
|
||||
|
||||
18
editor/src/ProductizationValidationUtil.h
Normal file
18
editor/src/ProductizationValidationUtil.h
Normal file
@@ -0,0 +1,18 @@
|
||||
#pragma once
|
||||
// Sprint 33 refactor: shared productization validation helpers
|
||||
|
||||
#include <string>
|
||||
|
||||
inline bool hasRequiredProductIds(const std::string& a, const std::string& b) {
|
||||
return !a.empty() && !b.empty();
|
||||
}
|
||||
|
||||
inline bool isValidHexColor7(const std::string& c) {
|
||||
if (c.size() != 7 || c[0] != '#') return false;
|
||||
for (size_t i = 1; i < c.size(); ++i) {
|
||||
const char x = c[i];
|
||||
const bool hex = (x >= '0' && x <= '9') || (x >= 'a' && x <= 'f') || (x >= 'A' && x <= 'F');
|
||||
if (!hex) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
#pragma once
|
||||
// Step 584: Value-Forward Onboarding Flow
|
||||
|
||||
#include "ProductizationValidationUtil.h"
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
@@ -33,7 +35,7 @@ public:
|
||||
std::string* error) {
|
||||
if (!state || !error) return false;
|
||||
error->clear();
|
||||
if (profileId.empty()) {
|
||||
if (!hasRequiredProductIds(profileId, "profile")) {
|
||||
*error = "profile_id_missing";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#pragma once
|
||||
// Step 585: Workflow Visualization 2.0
|
||||
|
||||
#include "ProductizationValidationUtil.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <map>
|
||||
#include <string>
|
||||
@@ -40,9 +42,11 @@ public:
|
||||
std::string* error) {
|
||||
if (!graph || !error) return false;
|
||||
error->clear();
|
||||
if (node.nodeId.empty()) return fail(error, "node_id_missing");
|
||||
if (node.label.empty()) return fail(error, "node_label_missing");
|
||||
if (!isValidColor(node.accentColorHex)) return fail(error, "node_color_invalid");
|
||||
if (!hasRequiredProductIds(node.nodeId, node.label)) {
|
||||
if (node.nodeId.empty()) return fail(error, "node_id_missing");
|
||||
return fail(error, "node_label_missing");
|
||||
}
|
||||
if (!isValidHexColor7(node.accentColorHex)) return fail(error, "node_color_invalid");
|
||||
if (findNode(*graph, node.nodeId) != nullptr) return fail(error, "node_duplicate");
|
||||
graph->nodes.push_back(node);
|
||||
return true;
|
||||
@@ -94,16 +98,6 @@ private:
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool isValidColor(const std::string& c) {
|
||||
if (c.size() != 7 || c[0] != '#') return false;
|
||||
for (size_t i = 1; i < c.size(); ++i) {
|
||||
const char x = c[i];
|
||||
const bool hex = (x >= '0' && x <= '9') || (x >= 'a' && x <= 'f') || (x >= 'A' && x <= 'F');
|
||||
if (!hex) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static const WorkflowNodeVisual* findNode(const WorkflowVisualizationGraph& graph,
|
||||
const std::string& nodeId) {
|
||||
for (const auto& node : graph.nodes) if (node.nodeId == nodeId) return &node;
|
||||
|
||||
Reference in New Issue
Block a user