Skip to content

Commit 34d849a

Browse files
authored
Add live status dashboard option to Project (#334)
* Add live status dashboard option to Project Signed-off-by: Eddy Moulton <[email protected]> * Fix test * Fix test --------- Signed-off-by: Eddy Moulton <[email protected]>
1 parent c0d22e0 commit 34d849a

File tree

3 files changed

+61
-55
lines changed

3 files changed

+61
-55
lines changed

pkg/projects/project.go

Lines changed: 55 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -12,33 +12,34 @@ import (
1212
)
1313

1414
type Project struct {
15-
AllowIgnoreChannelRules bool `json:"AllowIgnoreChannelRules,omitempty"`
16-
AutoCreateRelease bool `json:"AutoCreateRelease"`
17-
AutoDeployReleaseOverrides []AutoDeployReleaseOverride `json:"AutoDeployReleaseOverrides,omitempty"`
18-
ClonedFromProjectID string `json:"ClonedFromProjectId,omitempty"`
19-
ConnectivityPolicy *core.ConnectivityPolicy `json:"ProjectConnectivityPolicy,omitempty"`
20-
DefaultGuidedFailureMode string `json:"DefaultGuidedFailureMode,omitempty"`
21-
DefaultToSkipIfAlreadyInstalled bool `json:"DefaultToSkipIfAlreadyInstalled"`
22-
DeploymentChangesTemplate string `json:"DeploymentChangesTemplate,omitempty"`
23-
DeploymentProcessID string `json:"DeploymentProcessId,omitempty"`
24-
Description string `json:"Description,omitempty"`
25-
ExtensionSettings []extensions.ExtensionSettings `json:"ExtensionSettings,omitempty"`
26-
IncludedLibraryVariableSets []string `json:"IncludedLibraryVariableSetIds,omitempty"`
27-
IsDisabled bool `json:"IsDisabled"`
28-
IsDiscreteChannelRelease bool `json:"DiscreteChannelRelease"`
29-
IsVersionControlled bool `json:"IsVersionControlled"`
30-
LifecycleID string `json:"LifecycleId" validate:"required"`
31-
Name string `json:"Name" validate:"required"`
32-
PersistenceSettings PersistenceSettings `json:"PersistenceSettings,omitempty"`
33-
ProjectGroupID string `json:"ProjectGroupId" validate:"required"`
34-
ReleaseCreationStrategy *ReleaseCreationStrategy `json:"ReleaseCreationStrategy,omitempty"`
35-
ReleaseNotesTemplate string `json:"ReleaseNotesTemplate,omitempty"`
36-
Slug string `json:"Slug,omitempty"`
37-
SpaceID string `json:"SpaceId,omitempty"`
38-
Templates []actiontemplates.ActionTemplateParameter `json:"Templates,omitempty"`
39-
TenantedDeploymentMode core.TenantedDeploymentMode `json:"TenantedDeploymentMode,omitempty"`
40-
VariableSetID string `json:"VariableSetId,omitempty"`
41-
VersioningStrategy *VersioningStrategy `json:"VersioningStrategy,omitempty"`
15+
AllowIgnoreChannelRules bool `json:"AllowIgnoreChannelRules,omitempty"`
16+
AutoCreateRelease bool `json:"AutoCreateRelease"`
17+
AutoDeployReleaseOverrides []AutoDeployReleaseOverride `json:"AutoDeployReleaseOverrides,omitempty"`
18+
ClonedFromProjectID string `json:"ClonedFromProjectId,omitempty"`
19+
ConnectivityPolicy *core.ConnectivityPolicy `json:"ProjectConnectivityPolicy,omitempty"`
20+
DefaultGuidedFailureMode string `json:"DefaultGuidedFailureMode,omitempty"`
21+
DefaultToSkipIfAlreadyInstalled bool `json:"DefaultToSkipIfAlreadyInstalled"`
22+
DeploymentChangesTemplate string `json:"DeploymentChangesTemplate,omitempty"`
23+
DeploymentProcessID string `json:"DeploymentProcessId,omitempty"`
24+
Description string `json:"Description,omitempty"`
25+
ExtensionSettings []extensions.ExtensionSettings `json:"ExtensionSettings,omitempty"`
26+
IncludedLibraryVariableSets []string `json:"IncludedLibraryVariableSetIds,omitempty"`
27+
IsDisabled bool `json:"IsDisabled"`
28+
IsDiscreteChannelRelease bool `json:"DiscreteChannelRelease"`
29+
IsVersionControlled bool `json:"IsVersionControlled"`
30+
LifecycleID string `json:"LifecycleId" validate:"required"`
31+
Name string `json:"Name" validate:"required"`
32+
PersistenceSettings PersistenceSettings `json:"PersistenceSettings,omitempty"`
33+
ProjectGroupID string `json:"ProjectGroupId" validate:"required"`
34+
ReleaseCreationStrategy *ReleaseCreationStrategy `json:"ReleaseCreationStrategy,omitempty"`
35+
ReleaseNotesTemplate string `json:"ReleaseNotesTemplate,omitempty"`
36+
Slug string `json:"Slug,omitempty"`
37+
SpaceID string `json:"SpaceId,omitempty"`
38+
Templates []actiontemplates.ActionTemplateParameter `json:"Templates,omitempty"`
39+
TenantedDeploymentMode core.TenantedDeploymentMode `json:"TenantedDeploymentMode,omitempty"`
40+
VariableSetID string `json:"VariableSetId,omitempty"`
41+
VersioningStrategy *VersioningStrategy `json:"VersioningStrategy,omitempty"`
42+
CombineHealthAndSyncStatusInDashboardLiveStatus bool `json:"CombineHealthAndSyncStatusInDashboardLiveStatus"`
4243

4344
resources.Resource
4445
}
@@ -72,31 +73,32 @@ func NewProject(name string, lifecycleID string, projectGroupID string) *Project
7273
// UnmarshalJSON sets this project to its representation in JSON.
7374
func (p *Project) UnmarshalJSON(data []byte) error {
7475
var fields struct {
75-
AllowIgnoreChannelRules bool `json:"AllowIgnoreChannelRules,omitempty"`
76-
AutoCreateRelease bool `json:"AutoCreateRelease"`
77-
AutoDeployReleaseOverrides []AutoDeployReleaseOverride `json:"AutoDeployReleaseOverrides,omitempty"`
78-
ClonedFromProjectID string `json:"ClonedFromProjectId,omitempty"`
79-
ConnectivityPolicy *core.ConnectivityPolicy `json:"ProjectConnectivityPolicy,omitempty"`
80-
DefaultGuidedFailureMode string `json:"DefaultGuidedFailureMode,omitempty"`
81-
DefaultToSkipIfAlreadyInstalled bool `json:"DefaultToSkipIfAlreadyInstalled"`
82-
DeploymentChangesTemplate string `json:"DeploymentChangesTemplate,omitempty"`
83-
DeploymentProcessID string `json:"DeploymentProcessId,omitempty"`
84-
Description string `json:"Description,omitempty"`
85-
IncludedLibraryVariableSets []string `json:"IncludedLibraryVariableSetIds,omitempty"`
86-
IsDisabled bool `json:"IsDisabled"`
87-
IsDiscreteChannelRelease bool `json:"DiscreteChannelRelease"`
88-
IsVersionControlled bool `json:"IsVersionControlled"`
89-
LifecycleID string `json:"LifecycleId" validate:"required"`
90-
Name string `json:"Name" validate:"required"`
91-
ProjectGroupID string `json:"ProjectGroupId" validate:"required"`
92-
ReleaseCreationStrategy *ReleaseCreationStrategy `json:"ReleaseCreationStrategy,omitempty"`
93-
ReleaseNotesTemplate string `json:"ReleaseNotesTemplate,omitempty"`
94-
Slug string `json:"Slug,omitempty"`
95-
SpaceID string `json:"SpaceId,omitempty"`
96-
Templates []actiontemplates.ActionTemplateParameter `json:"Templates,omitempty"`
97-
TenantedDeploymentMode core.TenantedDeploymentMode `json:"TenantedDeploymentMode,omitempty"`
98-
VariableSetID string `json:"VariableSetId,omitempty"`
99-
VersioningStrategy *VersioningStrategy `json:"VersioningStrategy,omitempty"`
76+
AllowIgnoreChannelRules bool `json:"AllowIgnoreChannelRules,omitempty"`
77+
AutoCreateRelease bool `json:"AutoCreateRelease"`
78+
AutoDeployReleaseOverrides []AutoDeployReleaseOverride `json:"AutoDeployReleaseOverrides,omitempty"`
79+
ClonedFromProjectID string `json:"ClonedFromProjectId,omitempty"`
80+
ConnectivityPolicy *core.ConnectivityPolicy `json:"ProjectConnectivityPolicy,omitempty"`
81+
DefaultGuidedFailureMode string `json:"DefaultGuidedFailureMode,omitempty"`
82+
DefaultToSkipIfAlreadyInstalled bool `json:"DefaultToSkipIfAlreadyInstalled"`
83+
DeploymentChangesTemplate string `json:"DeploymentChangesTemplate,omitempty"`
84+
DeploymentProcessID string `json:"DeploymentProcessId,omitempty"`
85+
Description string `json:"Description,omitempty"`
86+
IncludedLibraryVariableSets []string `json:"IncludedLibraryVariableSetIds,omitempty"`
87+
IsDisabled bool `json:"IsDisabled"`
88+
IsDiscreteChannelRelease bool `json:"DiscreteChannelRelease"`
89+
IsVersionControlled bool `json:"IsVersionControlled"`
90+
LifecycleID string `json:"LifecycleId" validate:"required"`
91+
Name string `json:"Name" validate:"required"`
92+
ProjectGroupID string `json:"ProjectGroupId" validate:"required"`
93+
ReleaseCreationStrategy *ReleaseCreationStrategy `json:"ReleaseCreationStrategy,omitempty"`
94+
ReleaseNotesTemplate string `json:"ReleaseNotesTemplate,omitempty"`
95+
Slug string `json:"Slug,omitempty"`
96+
SpaceID string `json:"SpaceId,omitempty"`
97+
Templates []actiontemplates.ActionTemplateParameter `json:"Templates,omitempty"`
98+
TenantedDeploymentMode core.TenantedDeploymentMode `json:"TenantedDeploymentMode,omitempty"`
99+
VariableSetID string `json:"VariableSetId,omitempty"`
100+
VersioningStrategy *VersioningStrategy `json:"VersioningStrategy,omitempty"`
101+
CombineHealthAndSyncStatusInDashboardLiveStatus bool `json:"CombineHealthAndSyncStatusInDashboardLiveStatus"`
100102
resources.Resource
101103
}
102104

@@ -136,6 +138,7 @@ func (p *Project) UnmarshalJSON(data []byte) error {
136138
p.VariableSetID = fields.VariableSetID
137139
p.VersioningStrategy = fields.VersioningStrategy
138140
p.Resource = fields.Resource
141+
p.CombineHealthAndSyncStatusInDashboardLiveStatus = fields.CombineHealthAndSyncStatusInDashboardLiveStatus
139142

140143
var project map[string]*json.RawMessage
141144
if err := json.Unmarshal(data, &project); err != nil {

pkg/projects/project_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ func TestProjectExtensionSettingsAsJSON(t *testing.T) {
4848
"IsVersionControlled": false,
4949
"LifecycleId": "%s",
5050
"Name": "%s",
51-
"ProjectGroupId": "%s"
51+
"ProjectGroupId": "%s",
52+
"CombineHealthAndSyncStatusInDashboardLiveStatus": false
5253
}`,
5354
extensions.JiraServiceManagementExtensionID,
5455
jsmConnectionID,

test/resources/project_test.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ func TestProjectMarshalJSON(t *testing.T) {
4040
"IsDisabled": false,
4141
"DiscreteChannelRelease": false,
4242
"IsVersionControlled": false,
43-
"ProjectConnectivityPolicy":{"AllowDeploymentsToNoTargets":false,"ExcludeUnhealthyTargets":false}
43+
"ProjectConnectivityPolicy":{"AllowDeploymentsToNoTargets":false,"ExcludeUnhealthyTargets":false},
44+
"CombineHealthAndSyncStatusInDashboardLiveStatus": false
4445
}`, lifecycleID, name, projectGroupID)
4546

4647
project := projects.NewProject(name, lifecycleID, projectGroupID)
@@ -68,7 +69,8 @@ func TestProjectMarshalJSON(t *testing.T) {
6869
"DefaultToSkipIfAlreadyInstalled": false,
6970
"IsDisabled": false,
7071
"DiscreteChannelRelease": false,
71-
"IsVersionControlled": false
72+
"IsVersionControlled": false,
73+
"CombineHealthAndSyncStatusInDashboardLiveStatus": false
7274
}`, lifecycleID, name, connectivityPolicyAsJSON, projectGroupID)
7375

7476
jsonassert.New(t).Assertf(string(projectAsJSON), expectedJson)

0 commit comments

Comments
 (0)