-
Notifications
You must be signed in to change notification settings - Fork 243
Application Deletion will show what will be deleted #278
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
Conversation
d14ea39
to
c32b030
Compare
@containscafeine @kadel , review needed :) |
So, we need to see this before asking for the confirmation, not after that. $ ocdev application delete app5
Are you sure you want to delete the application: app5? [y/N] y
Component nodejs will be deleted:
This component is not externally exposed
This component used storage and it will be removed
Component nodejs2 will be deleted:
This component is not externally exposed
This component used storage and it will be removed
Component nodejs3 will be deleted:
This component is not externally exposed
This component used storage and it will be removed
Component nodejs4 will be deleted:
This component is not externally exposed
This component used storage and it will be removed
Component nodejs5 will be deleted:
This component is not externally exposed
This component used storage and it will be removed
Deleted application: app5 |
Also, my nodejs component did not use any storage, it should not the message. |
@containscafeine when I run,
I didn't get this |
I have updated code in such way that it will show information before confirmation |
cmd/utils.go
Outdated
"github.com/redhat-developer/ocdev/pkg/url" | ||
) | ||
|
||
func printRequiredInfo(appName string, client *occlient.Client) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This output is specific to delete operation. It might be good to indicate that in the function name
How about printDeleteAppInfo
also in all other functions, we are taking client
as the first argument, it would be good to stick to that convention
and comment for that function wouldn't hurt either ;-)
@kadel @containscafeine one more review needed :) |
cmd/utils.go
Outdated
if len(appUrl) != 0 { | ||
fmt.Println("This component is externally exposed, and the URL will be removed") | ||
} else { | ||
fmt.Println("This component is not externally exposed") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it might be better to not show anything. To make it consistent with how we display storage.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
cmd/application.go
Outdated
@@ -94,6 +94,11 @@ var applicationDeleteCmd = &cobra.Command{ | |||
if applicationForceDeleteFlag { | |||
confirmDeletion = "y" | |||
} else { | |||
err := printDeleteAppInfo(client, appName) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be before the if statement
cmd/utils.go
Outdated
func printDeleteAppInfo(client *occlient.Client, appName string) error { | ||
componentList, err := component.List(client) | ||
if err != nil { | ||
return err |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's wrap the error
cmd/utils.go
Outdated
fmt.Println("Component", cmpnt.Name, "will be deleted:") | ||
appUrl, err := url.List(client, cmpnt.Name, appName) | ||
if err != nil { | ||
return err |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wrap
cmd/utils.go
Outdated
fmt.Println("This component is not externally exposed") | ||
|
||
} | ||
appStore, _ := storage.List(client, &occlient.VolumeConfig{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are we ignoring the error here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch @containscafeine
cmd/utils.go
Outdated
fmt.Println("This component is not externally exposed") | ||
|
||
} | ||
appStore, _ := storage.List(client, &occlient.VolumeConfig{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch @containscafeine
2899b71
to
bc611b1
Compare
@kadel done with requested changes |
cmd/application.go
Outdated
@@ -75,6 +75,13 @@ var applicationDeleteCmd = &cobra.Command{ | |||
appName := args[0] | |||
var confirmDeletion string | |||
|
|||
// Print App Information which will be deleted | |||
err := printDeleteAppInfo(client, appName) | |||
if err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can replace with
checkError(err, "")
cmd/utils.go
Outdated
if len(appUrl) != 0 { | ||
fmt.Println("This component is externally exposed, and the URL will be removed") | ||
} | ||
appStore, err := storage.List(client, &occlient.VolumeConfig{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#295 changes storage.List
, should we wait for that PR?
Or changing this will be handled in #295
#295 is already big PR, so it might make sense to wait for it.
What do you think @surajnarwade @containscafeine ?
currently this is blocked on #295 |
blocked on #287 |
6736e56
to
133df8d
Compare
// Project | ||
currentProject := project.GetCurrent(client) | ||
// Print App Information which will be deleted | ||
err := printDeleteAppInfo(client, appName, currentProject) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this reuse functions from #287?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Text content is different, so I created separate function for this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To get component information, I am reusing the function,
https://github.com/redhat-developer/odo/pull/278/files#diff-b4695c7b6902e27273329af6261b0c73R19
@surajnarwade how about -
|
cmd/utils.go
Outdated
fmt.Println("Component", cmpnt.Name, "will be deleted:") | ||
|
||
if len(componentURL) != 0 { | ||
fmt.Println("This component is externally exposed, and the URL will be removed") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we add two spaces to the beginning of the line to indicate that this is related to the component mentioned above?
cmd/utils.go
Outdated
} | ||
|
||
for _, store := range appStore { | ||
fmt.Println("This Component uses storage", store.Name, "of size", store.Size, "will be removed") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we add two spaces to the beginning of the line to indicate that this is related to the component mentioned above?
cmd/utils.go
Outdated
if err != nil { | ||
return errors.Wrap(err, "unable to get component description") | ||
} | ||
fmt.Println("Component", cmpnt.Name, "will be deleted:") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ":" looks strange when the component doesn't have any URLs or storages.
▶ odo app delete app
Component backend will be deleted:
Component frontend will be deleted:
This component is externally exposed, and the URL will be removed
Are you sure you want to delete the application: app? [y/N]
This looks better:
▶ odo app delete app
Component backend will be deleted.
Component frontend will be deleted.
This component is externally exposed, and the URL will be removed
Are you sure you want to delete the application: app? [y/N]
fc69ace
to
dfb0b7d
Compare
ping @containscafeine |
Fixes #204