Skip to content

Commit

Permalink
uniformity
Browse files Browse the repository at this point in the history
  • Loading branch information
girishramnani committed Nov 19, 2020
1 parent 06597a3 commit c6cf27c
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions pkg/odo/cli/component/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ func (lo *ListOptions) Run() (err error) {

// experimental workflow

devfileComponents := component.ComponentList{}
devfileComponents := []component.Component{}
var selector string
// TODO: wrap this into a component list for docker support
if lo.allAppsFlag {
Expand All @@ -204,11 +204,13 @@ func (lo *ListOptions) Run() (err error) {
currentComponentState := component.StateTypeNotPushed

if lo.KClient != nil {
devfileComponents, err = component.ListDevfileComponents(lo.Client, selector)
devfileComponentsOut, err := component.ListDevfileComponents(lo.Client, selector)
if err != nil {
return err
}
for _, comp := range devfileComponents.Items {

devfileComponents = devfileComponentsOut.Items
for _, comp := range devfileComponents {
if lo.EnvSpecificInfo != nil {
// if we can find a component from the listing from server then the local state is pushed
if lo.EnvSpecificInfo.EnvInfo.MatchComponent(comp.Name, comp.Spec.App, comp.Namespace) {
Expand All @@ -228,7 +230,7 @@ func (lo *ListOptions) Run() (err error) {
comp.Namespace = envinfo.GetNamespace()
comp.Spec.App = envinfo.GetApplication()
comp.Spec.Type = lo.componentType
devfileComponents.Items = append(devfileComponents.Items, comp)
devfileComponents = append(devfileComponents, comp)
}
}

Expand Down Expand Up @@ -274,11 +276,11 @@ func (lo *ListOptions) Run() (err error) {

if !log.IsJSON() {

if len(devfileComponents.Items) != 0 {
if len(devfileComponents) != 0 {
lo.hasDevfileComponents = true
fmt.Fprintln(w, "Devfile Components: ")
fmt.Fprintln(w, "APP", "\t", "NAME", "\t", "PROJECT", "\t", "TYPE", "\t", "STATE")
for _, comp := range devfileComponents.Items {
for _, comp := range devfileComponents {
fmt.Fprintln(w, comp.Spec.App, "\t", comp.Name, "\t", comp.Namespace, "\t", comp.Spec.Type, "\t", comp.Status.State)
}
w.Flush()
Expand All @@ -304,7 +306,7 @@ func (lo *ListOptions) Run() (err error) {
return
}
} else {
combinedComponents := component.GetMachineReadableFormatForCombinedCompList(components, devfileComponents.Items)
combinedComponents := component.GetMachineReadableFormatForCombinedCompList(components, devfileComponents)
machineoutput.OutputSuccess(combinedComponents)
}

Expand Down

0 comments on commit c6cf27c

Please sign in to comment.