-
Notifications
You must be signed in to change notification settings - Fork 13
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
Content family and org #545
Conversation
…ontent() affects: @esri/hub-common, @esri/hub-content, @esri/hub-search ISSUES CLOSED: #355
affects: @esri/hub-common, @esri/hub-content
… not returned by the API affects: @esri/hub-content
…, & getItemHubId affects: @esri/hub-common
affects: @esri/hub-content always set content.item.modified to the item's modified date content.modified should prefer the enriched date and fall back to item.modified
…ments affects: @esri/hub-content also enrichContent is now tolerant of content not having errors
@@ -319,11 +348,25 @@ export interface IHubContent extends IHubResource, IItem { | |||
data?: { | |||
[propName: string]: any; | |||
}; | |||
// service types: Feature Service, Map Service | |||
/** service information (currentVersion, capabilities, maxRecordCount etc) */ | |||
server?: Partial<IFeatureServiceDefinition>; |
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.
Should this be service
? vs server
?
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 Hub API returns server
, so we rollin' w/ that.
Codecov Report
@@ Coverage Diff @@
## master #545 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 430 430
Lines 5929 5982 +53
Branches 912 935 +23
=========================================
+ Hits 5929 5982 +53
Continue to review full report at Codecov.
|
layers?: Array<Partial<ILayerDefinition>>; | ||
// layer types: Feature Layers, Raster Layers | ||
/** layer information (geometryType, fields, etc) */ | ||
layer?: Partial<ILayerDefinition>; |
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.
Thoughts on just using layers
and if there is only one entry... treating it like a layer
?
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.
so, layer
represents the one layer out of all the ones on the server that you are currently looking at. If this we an instance of a class, we'd have a layerId
property and a layer getter like this.layers.filter(layer => layer.id === this.layerId)
.
// layer types: Feature Layers, Raster Layers | ||
/** layer information (geometryType, fields, etc) */ | ||
layer?: Partial<ILayerDefinition>; | ||
recordCount?: number; |
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.
how does recordCount
work w/ layers
?
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.
recordCount
only refers the the "current" layer (see #545 (comment)). and is not returned for service types (Feature Service
, Map Service
), only for the Feature Layer
pseudo type.
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.
i.e it must be re-fetched if you switch layers
@@ -269,8 +297,13 @@ export function datasetToItem(dataset: DatasetResource): IItem { | |||
id: itemId, | |||
owner: owner as string, | |||
orgId, | |||
created: (created || createdAt) as number, | |||
modified: (modified || updatedAt) as number, | |||
created: created as number, |
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.
I sorta thought createdAt came from the hub api but i don't see it. Are we sure we will never have createdAt?
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.
Hmm thinking more about this, i guess created at was from our composer service.
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 comes from the model serializer adapter (or composer). I've tested this locally sending models that come out of composer in the app's datasetModelToContent()
and it does the right thing.
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.
I have a massive spreadsheet that maps all the attributes returned from the API for various content types and maps them to the dataset model, which is a superset w/ CPs, and such.
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.
Not sure I quite follow all of that, but seems legit :)
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.
Looks good to me, only minor comments.
|
||
/** | ||
* return the layerId if we can tell that item is a single layer service | ||
* @param {*} item from AGO |
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.
Minor, comment formatting. Outside scope of this PR, but have we ever explored adding eslint-plugin-jsdoc
or similar for enforcing consistent commenting/docing styles?
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.
so you are saying that the doc comments shouldn't have types, right? b/c that is taken care of by typedoc?
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.
I hadn't considered that. I guess it'd just be nice if our inline comments were aligned w/ the docs generated by typedoc.
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.
I'm not sure what's out of alignment, either specifically w/ this comment (other than I think it should not have the types), or in general, but if there are improvements w/ can make w/ eslint-plugin-jsdoc
I say open an issue.
This PR gets closer to resolving #322. In essence, everything we need should be there if the content was fetched from the Hub API. If the content is coming from portal, we still have to add logic to
enrichContent()
to fetch additional enrichments such asserver
,layers
,recordCount
, etc.This PR also makes a few fixes to the way
itemToContent
anddatasetToContent
were handlinghubId
andisPortal
. TLDR: we should only sethubId
if we are fairy confident that it is in the index. Also,isPortal
is not returned by the API, we'll need to set it (and the proxiedurl
) inenrichContent()
before callingfetchEnrichments()
.In service of those, the PR also moves several low level utils from the Hub app to Hub.js (getFamily, getItemHubId, etc), and it also re-orders how properties are set in
datasetToConent()
to logically group them (common, server, layer). So it may seem like a lot of 🧀 was moved.