@@ -60,6 +60,7 @@ var defVersion = "v1.0.0"
6060
6161// keep
6262type ModelCSV struct {
63+ Status * _model.ModelDefinitionStatus `json:"status,omitempty"`
6364 Registrant string `json:"registrant" csv:"registrant"`
6465 ModelDisplayName string `json:"modelDisplayName" csv:"modelDisplayName"`
6566 Model string `json:"model" csv:"model"`
@@ -174,9 +175,10 @@ func (m *ModelCSV) UpdateModelDefinition(modelDef *_model.ModelDefinition) error
174175 return nil
175176}
176177func (mcv * ModelCSV ) CreateModelDefinition (version , defVersion string ) _model.ModelDefinition {
177- status := entity .Ignored
178- if strings .ToLower (mcv .PublishToRegistry ) == "true" {
179- status = entity .Enabled
178+ var status _model.ModelDefinitionStatus
179+
180+ if strings .ToLower (strings .TrimSpace (mcv .PublishToRegistry )) != "true" {
181+ status = _model .ModelDefinitionStatus (entity .Ignored )
180182 }
181183 var catname category.CategoryDefinition
182184 catname .Name = mcv .Category
@@ -189,7 +191,7 @@ func (mcv *ModelCSV) CreateModelDefinition(version, defVersion string) _model.Mo
189191
190192 SchemaVersion : v1beta1 .ModelSchemaVersion ,
191193 Name : mcv .Model ,
192- Status : _model . ModelDefinitionStatus ( status ) ,
194+ Status : status ,
193195 Registrant : registrant ,
194196 SubCategory : mcv .SubCategory ,
195197 Model : _model.Model {
@@ -533,8 +535,10 @@ func (m ModelCSVHelper) Cleanup() error {
533535}
534536func AssignDefaultsForCompDefs (componentDef * component.ComponentDefinition , modelDef * _model.ModelDefinition ) {
535537 // Assign the status from the model to the component
536- compStatus := component .ComponentDefinitionStatus (modelDef .Status )
537- componentDef .Status = & compStatus
538+ if modelDef .Status != "" && string (modelDef .Status ) != string (entity .Enabled ) {
539+ compStatus := component .ComponentDefinitionStatus (modelDef .Status )
540+ componentDef .Status = & compStatus
541+ }
538542
539543 // Initialize AdditionalProperties and Styles if nil
540544 if componentDef .Metadata .AdditionalProperties == nil {
@@ -1080,10 +1084,8 @@ func InvokeGenerationFromSheetWithOptions(wg *sync.WaitGroup, path string, model
10801084func GenerateDefsForCoreRegistrant (model ModelCSV , ComponentCSVHelper * ComponentCSVHelper , path string , modelName string ) error {
10811085 var version string
10821086 parts := strings .Split (model .SourceURL , "/" )
1083- // Assuming the URL is always of the format "protocol://github.com/owner/repo/tree/definitions/{model-name}/version/components"
1084- // We know the version is the 7th element (0-indexed) in the split URL
10851087 if len (parts ) >= 8 {
1086- version = parts [8 ] // Fetch the version from the expected position
1088+ version = parts [8 ]
10871089 } else {
10881090 return fmt .Errorf ("invalid SourceURL format: %s" , model .SourceURL )
10891091 }
@@ -1135,9 +1137,7 @@ func GenerateDefsForCoreRegistrant(model ModelCSV, ComponentCSVHelper *Component
11351137 Log .Error (ErrUpdateComponent (err , modelName , comp .Component ))
11361138 continue
11371139 }
1138- if _status != nil {
1139- componentDef .Status = _status
1140- }
1140+ componentDef .Status = _status
11411141 componentDef .Model = modelDef
11421142 alreadyExists , err = componentDef .WriteComponentDefinition (compDirPath , "json" )
11431143 if err != nil {
0 commit comments