Skip to content

Add live status dashboard option to Project #334

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
107 changes: 55 additions & 52 deletions pkg/projects/project.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,33 +12,34 @@ import (
)

type Project struct {
AllowIgnoreChannelRules bool `json:"AllowIgnoreChannelRules,omitempty"`
AutoCreateRelease bool `json:"AutoCreateRelease"`
AutoDeployReleaseOverrides []AutoDeployReleaseOverride `json:"AutoDeployReleaseOverrides,omitempty"`
ClonedFromProjectID string `json:"ClonedFromProjectId,omitempty"`
ConnectivityPolicy *core.ConnectivityPolicy `json:"ProjectConnectivityPolicy,omitempty"`
DefaultGuidedFailureMode string `json:"DefaultGuidedFailureMode,omitempty"`
DefaultToSkipIfAlreadyInstalled bool `json:"DefaultToSkipIfAlreadyInstalled"`
DeploymentChangesTemplate string `json:"DeploymentChangesTemplate,omitempty"`
DeploymentProcessID string `json:"DeploymentProcessId,omitempty"`
Description string `json:"Description,omitempty"`
ExtensionSettings []extensions.ExtensionSettings `json:"ExtensionSettings,omitempty"`
IncludedLibraryVariableSets []string `json:"IncludedLibraryVariableSetIds,omitempty"`
IsDisabled bool `json:"IsDisabled"`
IsDiscreteChannelRelease bool `json:"DiscreteChannelRelease"`
IsVersionControlled bool `json:"IsVersionControlled"`
LifecycleID string `json:"LifecycleId" validate:"required"`
Name string `json:"Name" validate:"required"`
PersistenceSettings PersistenceSettings `json:"PersistenceSettings,omitempty"`
ProjectGroupID string `json:"ProjectGroupId" validate:"required"`
ReleaseCreationStrategy *ReleaseCreationStrategy `json:"ReleaseCreationStrategy,omitempty"`
ReleaseNotesTemplate string `json:"ReleaseNotesTemplate,omitempty"`
Slug string `json:"Slug,omitempty"`
SpaceID string `json:"SpaceId,omitempty"`
Templates []actiontemplates.ActionTemplateParameter `json:"Templates,omitempty"`
TenantedDeploymentMode core.TenantedDeploymentMode `json:"TenantedDeploymentMode,omitempty"`
VariableSetID string `json:"VariableSetId,omitempty"`
VersioningStrategy *VersioningStrategy `json:"VersioningStrategy,omitempty"`
AllowIgnoreChannelRules bool `json:"AllowIgnoreChannelRules,omitempty"`
AutoCreateRelease bool `json:"AutoCreateRelease"`
AutoDeployReleaseOverrides []AutoDeployReleaseOverride `json:"AutoDeployReleaseOverrides,omitempty"`
ClonedFromProjectID string `json:"ClonedFromProjectId,omitempty"`
ConnectivityPolicy *core.ConnectivityPolicy `json:"ProjectConnectivityPolicy,omitempty"`
DefaultGuidedFailureMode string `json:"DefaultGuidedFailureMode,omitempty"`
DefaultToSkipIfAlreadyInstalled bool `json:"DefaultToSkipIfAlreadyInstalled"`
DeploymentChangesTemplate string `json:"DeploymentChangesTemplate,omitempty"`
DeploymentProcessID string `json:"DeploymentProcessId,omitempty"`
Description string `json:"Description,omitempty"`
ExtensionSettings []extensions.ExtensionSettings `json:"ExtensionSettings,omitempty"`
IncludedLibraryVariableSets []string `json:"IncludedLibraryVariableSetIds,omitempty"`
IsDisabled bool `json:"IsDisabled"`
IsDiscreteChannelRelease bool `json:"DiscreteChannelRelease"`
IsVersionControlled bool `json:"IsVersionControlled"`
LifecycleID string `json:"LifecycleId" validate:"required"`
Name string `json:"Name" validate:"required"`
PersistenceSettings PersistenceSettings `json:"PersistenceSettings,omitempty"`
ProjectGroupID string `json:"ProjectGroupId" validate:"required"`
ReleaseCreationStrategy *ReleaseCreationStrategy `json:"ReleaseCreationStrategy,omitempty"`
ReleaseNotesTemplate string `json:"ReleaseNotesTemplate,omitempty"`
Slug string `json:"Slug,omitempty"`
SpaceID string `json:"SpaceId,omitempty"`
Templates []actiontemplates.ActionTemplateParameter `json:"Templates,omitempty"`
TenantedDeploymentMode core.TenantedDeploymentMode `json:"TenantedDeploymentMode,omitempty"`
VariableSetID string `json:"VariableSetId,omitempty"`
VersioningStrategy *VersioningStrategy `json:"VersioningStrategy,omitempty"`
CombineHealthAndSyncStatusInDashboardLiveStatus bool `json:"CombineHealthAndSyncStatusInDashboardLiveStatus"`

resources.Resource
}
Expand Down Expand Up @@ -72,31 +73,32 @@ func NewProject(name string, lifecycleID string, projectGroupID string) *Project
// UnmarshalJSON sets this project to its representation in JSON.
func (p *Project) UnmarshalJSON(data []byte) error {
var fields struct {
AllowIgnoreChannelRules bool `json:"AllowIgnoreChannelRules,omitempty"`
AutoCreateRelease bool `json:"AutoCreateRelease"`
AutoDeployReleaseOverrides []AutoDeployReleaseOverride `json:"AutoDeployReleaseOverrides,omitempty"`
ClonedFromProjectID string `json:"ClonedFromProjectId,omitempty"`
ConnectivityPolicy *core.ConnectivityPolicy `json:"ProjectConnectivityPolicy,omitempty"`
DefaultGuidedFailureMode string `json:"DefaultGuidedFailureMode,omitempty"`
DefaultToSkipIfAlreadyInstalled bool `json:"DefaultToSkipIfAlreadyInstalled"`
DeploymentChangesTemplate string `json:"DeploymentChangesTemplate,omitempty"`
DeploymentProcessID string `json:"DeploymentProcessId,omitempty"`
Description string `json:"Description,omitempty"`
IncludedLibraryVariableSets []string `json:"IncludedLibraryVariableSetIds,omitempty"`
IsDisabled bool `json:"IsDisabled"`
IsDiscreteChannelRelease bool `json:"DiscreteChannelRelease"`
IsVersionControlled bool `json:"IsVersionControlled"`
LifecycleID string `json:"LifecycleId" validate:"required"`
Name string `json:"Name" validate:"required"`
ProjectGroupID string `json:"ProjectGroupId" validate:"required"`
ReleaseCreationStrategy *ReleaseCreationStrategy `json:"ReleaseCreationStrategy,omitempty"`
ReleaseNotesTemplate string `json:"ReleaseNotesTemplate,omitempty"`
Slug string `json:"Slug,omitempty"`
SpaceID string `json:"SpaceId,omitempty"`
Templates []actiontemplates.ActionTemplateParameter `json:"Templates,omitempty"`
TenantedDeploymentMode core.TenantedDeploymentMode `json:"TenantedDeploymentMode,omitempty"`
VariableSetID string `json:"VariableSetId,omitempty"`
VersioningStrategy *VersioningStrategy `json:"VersioningStrategy,omitempty"`
AllowIgnoreChannelRules bool `json:"AllowIgnoreChannelRules,omitempty"`
AutoCreateRelease bool `json:"AutoCreateRelease"`
AutoDeployReleaseOverrides []AutoDeployReleaseOverride `json:"AutoDeployReleaseOverrides,omitempty"`
ClonedFromProjectID string `json:"ClonedFromProjectId,omitempty"`
ConnectivityPolicy *core.ConnectivityPolicy `json:"ProjectConnectivityPolicy,omitempty"`
DefaultGuidedFailureMode string `json:"DefaultGuidedFailureMode,omitempty"`
DefaultToSkipIfAlreadyInstalled bool `json:"DefaultToSkipIfAlreadyInstalled"`
DeploymentChangesTemplate string `json:"DeploymentChangesTemplate,omitempty"`
DeploymentProcessID string `json:"DeploymentProcessId,omitempty"`
Description string `json:"Description,omitempty"`
IncludedLibraryVariableSets []string `json:"IncludedLibraryVariableSetIds,omitempty"`
IsDisabled bool `json:"IsDisabled"`
IsDiscreteChannelRelease bool `json:"DiscreteChannelRelease"`
IsVersionControlled bool `json:"IsVersionControlled"`
LifecycleID string `json:"LifecycleId" validate:"required"`
Name string `json:"Name" validate:"required"`
ProjectGroupID string `json:"ProjectGroupId" validate:"required"`
ReleaseCreationStrategy *ReleaseCreationStrategy `json:"ReleaseCreationStrategy,omitempty"`
ReleaseNotesTemplate string `json:"ReleaseNotesTemplate,omitempty"`
Slug string `json:"Slug,omitempty"`
SpaceID string `json:"SpaceId,omitempty"`
Templates []actiontemplates.ActionTemplateParameter `json:"Templates,omitempty"`
TenantedDeploymentMode core.TenantedDeploymentMode `json:"TenantedDeploymentMode,omitempty"`
VariableSetID string `json:"VariableSetId,omitempty"`
VersioningStrategy *VersioningStrategy `json:"VersioningStrategy,omitempty"`
CombineHealthAndSyncStatusInDashboardLiveStatus bool `json:"CombineHealthAndSyncStatusInDashboardLiveStatus"`
resources.Resource
}

Expand Down Expand Up @@ -136,6 +138,7 @@ func (p *Project) UnmarshalJSON(data []byte) error {
p.VariableSetID = fields.VariableSetID
p.VersioningStrategy = fields.VersioningStrategy
p.Resource = fields.Resource
p.CombineHealthAndSyncStatusInDashboardLiveStatus = fields.CombineHealthAndSyncStatusInDashboardLiveStatus

var project map[string]*json.RawMessage
if err := json.Unmarshal(data, &project); err != nil {
Expand Down
6 changes: 4 additions & 2 deletions test/resources/project_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ func TestProjectMarshalJSON(t *testing.T) {
"IsDisabled": false,
"DiscreteChannelRelease": false,
"IsVersionControlled": false,
"ProjectConnectivityPolicy":{"AllowDeploymentsToNoTargets":false,"ExcludeUnhealthyTargets":false}
"ProjectConnectivityPolicy":{"AllowDeploymentsToNoTargets":false,"ExcludeUnhealthyTargets":false},
"CombineHealthAndSyncStatusInDashboardLiveStatus": false
}`, lifecycleID, name, projectGroupID)

project := projects.NewProject(name, lifecycleID, projectGroupID)
Expand Down Expand Up @@ -68,7 +69,8 @@ func TestProjectMarshalJSON(t *testing.T) {
"DefaultToSkipIfAlreadyInstalled": false,
"IsDisabled": false,
"DiscreteChannelRelease": false,
"IsVersionControlled": false
"IsVersionControlled": false,
"CombineHealthAndSyncStatusInDashboardLiveStatus": false
}`, lifecycleID, name, connectivityPolicyAsJSON, projectGroupID)

jsonassert.New(t).Assertf(string(projectAsJSON), expectedJson)
Expand Down
Loading