pharo icon indicating copy to clipboard operation
pharo copied to clipboard

Inspector Extensions for Zinc in P10/P11

Open astares opened this issue 2 years ago • 8 comments

With the new capabilities of inspector extensions using Spec2 it would be nice to have more additional custom inspector extensions - for instance for Zinc.

astares avatar May 16 '22 08:05 astares

inspectionHeaders: aBuilder
	<inspectorPresentationOrder: 10 title: 'Headers'>
	
	^ aBuilder newTable 
		addColumn: (SpStringTableColumn 
			title: 'Key'
			evaluated: [ :each | StObjectPrinter asTruncatedTextFrom: each key ])
			beSortable;
		addColumn: (SpStringTableColumn 
			title: 'Value' 
			evaluated: [ :each | StObjectPrinter asTruncatedTextFrom: each value ])
			beSortable;
		items: (self headers headers associations collect: [:e | StInspectorAssociationNode hostObject: e ]);
		yourself

allows to directly see the headers on the ZnResponse instances:

image

astares avatar May 16 '22 08:05 astares

inspectionEntity: aBuilder
	<inspectorPresentationOrder: 10 title: 'Entity'>
	 
	^ aBuilder newText
		text: self entity contents asString;
		yourself

allows to browse the response contents directly:

image

astares avatar May 16 '22 08:05 astares

@svenvc / @MarcusDenker

As Zinc is externally hosted the questions is in which repo / package we can put them and how to load.

Following what NewTools provide it would make sense to have them in a "Zinc-HTTP-Inspector-Extensions":

image

astares avatar May 16 '22 08:05 astares

Yes this would be very nice to have, it is missing right now.

I agree, it is an add-on that would best go into "Zinc-HTTP-Inspector-Extensions"

svenvc avatar May 24 '22 08:05 svenvc

@svenvc / @estebanlm / @MarcusDenker / @demarey

So how could we introduce this?

Is it better to place them in Zinc repo (Option 1) or would it better fit to provide inspector extensions in NewTools repo (Option 2) ? I personally think that it would be better with option 1 as the tool extensions belong to the code they extend

I do not know how Zinc contributions are handled at the moment?

a) is such new code added in svens repo first and then introduced into Pharo repo b) can it be introduced in Pharo repo and then resynched to your repo

astares avatar May 24 '22 10:05 astares

If you want, do a PR to zinc first, then we can test it a bit, after that it can simply be loaded to pharo

svenvc avatar May 24 '22 11:05 svenvc

@svenvc / @estebanlm / @MarcusDenker / @demarey

So how could we introduce this?

Is it better to place them in Zinc repo (Option 1) or would it better fit to provide inspector extensions in NewTools repo (Option 2) ? I personally think that it would be better with option 1 as the tool extensions belong to the code they extend

I agree: option 1 is better. It should be loadable independently of core Zinc packages. Thanks

demarey avatar May 25 '22 06:05 demarey

Done Zinc repo. See https://github.com/svenvc/zinc/issues/93

astares avatar May 25 '22 07:05 astares

I think this issue can be closed then.

hernanmd avatar Aug 19 '23 13:08 hernanmd