Skip to content

Commit

Permalink
Merge pull request #1834 from acyed/Pharo13
Browse files Browse the repository at this point in the history
Add Alerts to Iceberg's IceTipNewRepositoryPanel to Inform User of Incomplete Information
  • Loading branch information
Ducasse authored Aug 3, 2024
2 parents 5e982cb + 5049100 commit 7572143
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 22 deletions.
27 changes: 21 additions & 6 deletions Iceberg-TipUI/IceTipGitProviderRepositoryPanel.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -163,12 +163,27 @@ IceTipGitProviderRepositoryPanel >> userNameLabel [

{ #category : 'accessing' }
IceTipGitProviderRepositoryPanel >> validate [

self

self userName isNotEmpty
ifFalse: [
self alert: 'You must enter an owner (e.g. username).'.
^false].

"self
alert: 'You must enter a GitHub owner (e.g. username).'.
assert: self userName isNotEmpty
description: 'You must enter a GitHub owner (e.g. username).'.
self
description: 'You must enter a GitHub owner (e.g. username).'."


self projectName isNotEmpty
ifFalse: [
self alert: 'You must enter a project name.'.
^false].
"self
alert: 'You must enter a GitHub owner (e.g. username).'.
assert: self projectName isNotEmpty
description: 'You must enter a GitHub project name.'.
super validate
description: 'You must enter a GitHub project name.'."

super validate.
^true.
]
22 changes: 12 additions & 10 deletions Iceberg-TipUI/IceTipGitRepositoryPanel.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,16 @@ IceTipGitRepositoryPanel >> validate [

| remoteString |
remoteString := self remoteUrl.
self
assert: remoteString isNotEmpty
description: 'You must enter your project url.'.
self
assert: (IceGitRemote isValidUrl: remoteString)
description: 'The url is incorrect.'.
self
assert: self projectLocation location isNotNil
description:
'Project location must be defined (if it does not exists, it will be created).'
remoteString isNotEmpty ifFalse: [
self alert: 'You must enter your project url.'.
^ false ].
(IceGitRemote isValidUrl: remoteString) ifFalse: [
self alert: 'You must enter your project url.'.
^ false ].

self projectLocation location ifNil: [
self alert:
'Project location must be defined (if it does not exists, it will be created).'.
^ false ].
^ true
]
21 changes: 16 additions & 5 deletions Iceberg-TipUI/IceTipNewRepositoryPanel.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,21 @@ IceTipNewRepositoryPanel >> titleForWindow [
{ #category : 'accessing' }
IceTipNewRepositoryPanel >> validate [

self
assert: self projectNameInputText text isNotEmpty
description: 'You must enter a project name (it will be used also as part of the path).'.
self projectNameInputText text isNotEmpty ifFalse: [
self alert: 'You must enter a project name (it will be used also as part of the path).'.
^ false ].

self projectLocation location isNotNil ifFalse: [
self alert: 'You must enter a project name (it will be used also as part of the path).'.
^ false ].
^true.

"self
assert: self projectNameInputText text isNotEmpty
description:
'You must enter a project name (it will be used also as part of the path).'.
self
assert: self projectLocation location isNotNil
description: 'Project location must be defined (if it does not exists, it will be created).'
assert: self projectLocation location isNotNil
description:
'Project location must be defined (if it does not exists, it will be created).'"
]
13 changes: 12 additions & 1 deletion Iceberg-TipUI/IceTipRegisterRepositoryDialogPresenter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,17 @@ Class {
#tag : 'View-Repository'
}

{ #category : 'actions' }
IceTipRegisterRepositoryDialogPresenter >> accept [

[
self doAccept ifFalse: [ ^ false ].
self closeWindow ]
on: IceError , IceWarning
do: [ :e |
e acceptError: (IceTipInteractiveErrorVisitor newContext: self) ]
]

{ #category : 'accessing' }
IceTipRegisterRepositoryDialogPresenter >> allTypes [

Expand All @@ -37,7 +48,7 @@ IceTipRegisterRepositoryDialogPresenter >> beForCloneOfRepository: aRepository [
IceTipRegisterRepositoryDialogPresenter >> doAccept [

| newRepository |
self selectedType validate.
(self selectedType validate) ifFalse: [^false].
self isEditing ifTrue: [ self selectedType repository: repository ].
newRepository := self selectedType newRepository.
self isEditing ifFalse: [ newRepository register ].
Expand Down

0 comments on commit 7572143

Please sign in to comment.