Skip to content

Commit

Permalink
Feature: Surface documentation links (#2219)
Browse files Browse the repository at this point in the history
  • Loading branch information
thewahome authored Apr 26, 2023
1 parent 299c3f3 commit bf9bcd1
Show file tree
Hide file tree
Showing 25 changed files with 868 additions and 706 deletions.
38 changes: 34 additions & 4 deletions src/app/services/reducers/resources-reducer.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,33 @@ const paths = [{
url: '/issues',
name: 'issues (1)',
labels: [
{ name: 'v1.0', methods: ['Get', 'Post'] },
{ name: 'beta', methods: ['Get', 'Post'] }
{
name: 'v1.0', methods: [{
name: 'Get',
documentationUrl: null
}, {
name: 'Post',
documentationUrl: null
}]
},
{
name: 'beta', methods: [{
name: 'Get',
documentationUrl: null
}, {
name: 'Post',
documentationUrl: null
}]
}
],
version: 'v1.0',
methods: ['Get', 'Post'],
methods: [{
name: 'Get',
documentationUrl: null
}, {
name: 'Post',
documentationUrl: null
}],
isExpanded: true,
parent: '/',
level: 1,
Expand All @@ -94,7 +116,15 @@ const paths = [{
const resourceLinks: IResourceLink[] = [
{
labels: [
{ name: 'v1.0', methods: ['Get', 'Post'] }
{
name: 'v1.0', methods: [{
name: 'Get',
documentationUrl: null
}, {
name: 'Post',
documentationUrl: null
}]
}
],
key: '5-issues',
url: '/issues',
Expand Down
5 changes: 4 additions & 1 deletion src/app/utils/resources/resources-filter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ function getResourcesSupportedByVersion(
}

function versionExists(resource: IResource, version: string): boolean {
return resource.labels.some((k) => k.name === version);
return resource &&
resource.labels &&
resource.labels.length > 0 &&
resource.labels.some((k) => k.name === version);
}

function searchResources(haystack: IResource[], needle: string): IResource[] {
Expand Down
Loading

0 comments on commit bf9bcd1

Please sign in to comment.