Skip to content

Commit cd57da7

Browse files
authored
Add codeblock count to status updates (#269)
Adds codeblock count to status updates for usage in headlamp
1 parent db35ea4 commit cd57da7

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

internal/engine/environments/azure.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ type AzureStep struct {
2727
type AzureDeploymentStatus struct {
2828
Steps []AzureStep `json:"steps"`
2929
CurrentStep int `json:"currentStep"`
30+
CurrentCodeBlock int `json:"currentCodeBlock"`
3031
Status string `json:"status"`
3132
ResourceURIs []string `json:"resourceURIs"`
3233
Error string `json:"error"`
@@ -38,6 +39,7 @@ func NewAzureDeploymentStatus() AzureDeploymentStatus {
3839
return AzureDeploymentStatus{
3940
Steps: []AzureStep{},
4041
CurrentStep: 0,
42+
CurrentCodeBlock: 0,
4143
Status: "Executing",
4244
ResourceURIs: []string{},
4345
Error: "",

internal/engine/interactive/interactive.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -341,10 +341,12 @@ func (model InteractiveModeModel) Update(message tea.Msg) (tea.Model, tea.Cmd) {
341341
nextCodeBlockState := model.codeBlockState[model.currentCodeBlock]
342342

343343
if codeBlockState.StepName != nextCodeBlockState.StepName {
344-
logging.GlobalLogger.Debugf("Step name has changed, incrementing step for Azure")
344+
logging.GlobalLogger.Debugf("Step name has changed, incrementing step & resetting codeblock count for Azure")
345345
model.azureStatus.CurrentStep++
346+
model.azureStatus.CurrentCodeBlock = 0
346347
} else {
347-
logging.GlobalLogger.Debugf("Step name has not changed, not incrementing step for Azure")
348+
logging.GlobalLogger.Debugf("Step name has not changed, incrementing codeblock count for azure.")
349+
model.azureStatus.CurrentCodeBlock++
348350
}
349351

350352
model.stepsToBeExecuted--

0 commit comments

Comments
 (0)