Skip to content

Commit

Permalink
Removed commit from OP version GUI
Browse files Browse the repository at this point in the history
  • Loading branch information
JanBliznicenko committed Aug 1, 2024
1 parent 64a903c commit 344530f
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 51 deletions.
24 changes: 14 additions & 10 deletions repository/OpenPonk-Core/OPVersion.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,13 @@ Class {

{ #category : 'accessing' }
OPVersion class >> current [

^ current ifNil: [ current := self new ]
]

{ #category : 'instance creation' }
OPVersion class >> current: aVersion [

current := aVersion.
latest := nil.
^ current
Expand All @@ -57,7 +59,7 @@ OPVersion class >> fromRunJson: aRun [
^ self new fromRunJson: aRun
]

{ #category : 'as yet unclassified' }
{ #category : 'fetching' }
OPVersion class >> getRunsOf: aRepositoryName workflowName: aWorkflowName [

^ self runsCache
Expand All @@ -80,7 +82,7 @@ OPVersion class >> latest [
^ latest ifNil: [ latest := self current getOfLatest ]
]

{ #category : 'as yet unclassified' }
{ #category : 'accessing' }
OPVersion class >> ofLastestNightlyOf: aRepositoryName [
^ self
fromRunJson:
Expand All @@ -89,7 +91,7 @@ OPVersion class >> ofLastestNightlyOf: aRepositoryName [
ifNotEmpty: [ :runs | runs first ])
]

{ #category : 'as yet unclassified' }
{ #category : 'accessing' }
OPVersion class >> ofLastestReleaseOf: aRepositoryName [
^ self
fromRunJson:
Expand All @@ -107,7 +109,7 @@ OPVersion class >> reset [
runsCache := nil
]

{ #category : 'as yet unclassified' }
{ #category : 'private' }
OPVersion class >> runsCache [
^ runsCache
ifNil: [ runsCache := TTLCache new timeToLive: 30 minutes ]
Expand All @@ -134,9 +136,11 @@ OPVersion >> < aComparable [

{ #category : 'comparing' }
OPVersion >> = aComparable [
^ self isRelease = aComparable isRelease
and: [ self releaseName = aComparable releaseName
and: [ self isRelease or: [ self commit = aComparable commit ] ] ]

^ self releaseName = aComparable releaseName and: [
self isRelease or: [
self commit = aComparable commit and: [
self buildDate = aComparable buildDate ] ] ]
]

{ #category : 'accessing' }
Expand Down Expand Up @@ -287,9 +291,9 @@ OPVersion >> githubWorkflowRunId: anObject [

{ #category : 'comparing' }
OPVersion >> hash [
self isRelease
ifFalse: [ ^ self commit hash ].
^ self releaseName hash

self isRelease ifTrue: [ ^ self releaseName hash ].
^ self commit hash xor: self buildDate hash
]

{ #category : 'testing' }
Expand Down
2 changes: 1 addition & 1 deletion repository/OpenPonk-Spec/OPUpdater.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,6 @@ OPUpdater >> initializePresenters [
OPUpdater >> initializeWindow: aWindowPresenter [
aWindowPresenter
title: 'OpenPonk version info';
initialExtent: 720 @ 230.
initialExtent: 720 @ 200.
aWindowPresenter windowIcon: OPCoreIcons openponkIcon
]
55 changes: 15 additions & 40 deletions repository/OpenPonk-Spec/OPVersionInfo.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ Class {
'releaseName',
'buildDateLabel',
'buildDate',
'commitLabel',
'commit',
'commitDateLabel',
'commitDate',
'onInfoDownloadBlock'
],
#category : 'OpenPonk-Spec-Dialogs',
Expand All @@ -27,10 +23,6 @@ OPVersionInfo class >> defaultLayout [
add: #releaseName at: 2 @ 1;
add: #buildDateLabel at: 1 @ 2;
add: #buildDate at: 2 @ 2;
add: #commitLabel at: 1 @ 3;
add: #commit at: 2 @ 3;
add: #commitDateLabel at: 1 @ 4;
add: #commitDate at: 2 @ 4;
add: '' at: 1 @ 5 span: 2 @ 1;
yourself
]
Expand All @@ -54,32 +46,22 @@ OPVersionInfo >> initialize [

{ #category : 'initialization' }
OPVersionInfo >> initializePresenters [

| unknownLabel |
releaseNameLabel := self newLabel.
releaseNameLabel label: 'Version: '.
releaseName := self newLink.
buildDateLabel := self newLabel.
buildDateLabel label: 'Build/release date: '.
buildDate := self newLabel.
commitLabel := self newLabel.
commitLabel label: 'Built from commit: '.
commit := self newLink.
commitDateLabel := self newLabel.
commitDateLabel label: 'Commit date: '.
commitDate := self newLabel.
unknownLabel := version canDownloadInfo
ifTrue: [ 'Loading...' ]
ifFalse: [ 'Unknown' ].
version needsDownloadInfo
ifFalse: [ ^ self refreshInfo ].
ifTrue: [ 'Loading...' ]
ifFalse: [ 'Unknown' ].
version needsDownloadInfo ifFalse: [ ^ self refreshInfo ].
releaseName
label: unknownLabel;
url: 'https://openponk.org'.
buildDate label: unknownLabel.
commit
label: unknownLabel;
url: 'https://openponk.org'.
commitDate label: unknownLabel
buildDate label: unknownLabel
]

{ #category : 'enumerating' }
Expand All @@ -90,36 +72,29 @@ OPVersionInfo >> onInfoDownloadDo: aBlock [
ifFalse: aBlock
]

{ #category : 'as yet unclassified' }
{ #category : 'updating' }
OPVersionInfo >> refreshInfo [
version needsDownloadInfo
ifTrue: [ ^ self ].

version needsDownloadInfo ifTrue: [ ^ self ].
releaseName
label: version releaseName;
url:
'https://github.com/OpenPonk/' , version repositoryName
, '/releases/tag/' , version releaseName.
url: 'https://github.com/OpenPonk/' , version repositoryName
, '/releases/tag/' , version releaseName.
buildDate label: version buildDate asStringYMDHM.
commit
label: (version commit asString first: 7);
url:
'https://github.com/OpenPonk/' , version repositoryName , '/commit/'
, version commit asString.
commitDate label: version commitDate asStringYMDHM.
onInfoDownloadBlock value
]

{ #category : 'as yet unclassified' }
{ #category : 'updating' }
OPVersionInfo >> setFailedInfo [

| label |
label := 'failed to download'.
releaseName label: label.
buildDate label: label.
commit label: label.
commitDate label: label
buildDate label: label
]

{ #category : 'accessing model' }
{ #category : 'accessing - model' }
OPVersionInfo >> setModelBeforeInitialization: aVersion [

version := aVersion
]

0 comments on commit 344530f

Please sign in to comment.