Skip to content

Commit

Permalink
Merge pull request #16 from polarityio/develop
Browse files Browse the repository at this point in the history
INT-1318: Add App URL Option, update dependencies
  • Loading branch information
sarus committed Sep 23, 2024
2 parents 86178c9 + 900b216 commit 929eb86
Show file tree
Hide file tree
Showing 8 changed files with 70 additions and 37 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/run-int-dev-checklist.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
jobs:
run-integration-development-checklist:
runs-on: ubuntu-latest
container: 'centos:7'
container: 'rockylinux:8'

steps:
- uses: actions/checkout@v2
Expand Down
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,20 @@ The Polarity Confluence integration allows Polarity to search Confluence to retu

## Confluence Integration Options

### Confluence URL
### Confluence Base/API URL

Your Confluence Base Url to include the schema (i.e., https://) and port if required.
Your Confluence Base/API Url to include the schema (i.e., https://) and port if required.

For example:

```
https://mycompany.atlassian.net/wiki
```

### Confluence Application URL

URL used to access your Confluence web application instance. Leave blank if your Application URL is the same as your Base/API URL. Confluence Cloud users can leave this option blank. This option must be set to "Lock and show option for all users" or "User provides option value".

### Confluence Version

Select the version of Confluence you are authenticating to.
Expand Down
14 changes: 12 additions & 2 deletions config/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ module.exports = {
* @optional
*/
description: 'Lookup Confluence pages by keywords or phrases',
entityTypes: ['*'],
entityTypes: ['IPv4', 'IPv6', 'IPv4CIDR', 'MD5', 'SHA1', 'SHA256', 'url', 'domain', 'email', 'cve'],
// customTypes: [
// {
// key: 'possiblyDefangedUrl',
Expand Down Expand Up @@ -75,7 +75,7 @@ module.exports = {
ca: '',
// An HTTP proxy to be used. Supports proxy Auth with Basic Auth, identical to support for
// the url parameter (by embedding the auth info in the uri)
proxy: ""
proxy: ''
},
/**
* Options that are displayed to the user/admin in the Polarity integration user-interface. Should be structured
Expand All @@ -95,6 +95,16 @@ module.exports = {
userCanEdit: false,
adminOnly: true
},
{
key: 'appUrl',
name: 'Confluence Application URL',
description:
'URL used to access your Confluence web application instance. Leave blank if your Application URL is the same as your API URL. Confluence Cloud users can leave this option blank. This option must be set to "Lock and show option for all users" or "User provides option value".',
default: '',
type: 'text',
userCanEdit: false,
adminOnly: false
},
{
key: 'confluenceType',
name: 'Confluence Version',
Expand Down
24 changes: 21 additions & 3 deletions config/config.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
{
"polarityIntegrationUuid": "c2e3f2a0-cce1-11ed-aeee-075d3490155d",
"name": "Confluence",
"acronym": "CONF",
"description": "Lookup Confluence pages by keywords or phrases",
"entityTypes": [
"*"
"IPv4",
"IPv6",
"IPv4CIDR",
"MD5",
"SHA1",
"SHA256",
"url",
"domain",
"email",
"cve"
],
"defaultColor": "light-gray",
"styles": [
Expand Down Expand Up @@ -38,6 +46,15 @@
"userCanEdit": false,
"adminOnly": true
},
{
"key": "appUrl",
"name": "Confluence Application URL",
"description": "URL used to access your Confluence web application instance. Leave blank if your Application URL is the same as your API URL. Confluence Cloud users can leave this option blank. This option must be set to \"Lock and show option for all users\" or \"User provides option value\".",
"default": "",
"type": "text",
"userCanEdit": false,
"adminOnly": false
},
{
"key": "confluenceType",
"name": "Confluence Version",
Expand Down Expand Up @@ -142,5 +159,6 @@
"userCanEdit": false,
"adminOnly": true
}
]
],
"polarityIntegrationUuid": "c2e3f2a0-cce1-11ed-aeee-075d3490155d"
}
5 changes: 3 additions & 2 deletions integration.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ function _lookupEntity(entityObj, options, cb) {
let pageData = [];
let spaceData = [];

let appUrl = options.appUrl.length > 0 ? options.appUrl : options.baseUrl;
options.baseUrl = options.baseUrl.endsWith('/') ? options.baseUrl.slice(0, -1) : options.baseUrl;
let uri = `${options.baseUrl}/rest/api/search`;
let url = options.baseUrl;
Expand Down Expand Up @@ -286,14 +287,14 @@ function _lookupEntity(entityObj, options, cb) {
summary: getSummaryTags(spaceData, pageData, blogData, attachments, options),
// Data that you want to pass back to the notification window details block
details: {
url: url,
appUrl: appUrl,
space: spaceData,
page: pageData,
blog: blogData,
attachments: attachments,
totalSize: body.totalSize,
size: body.size,
searchLink: `${options.baseUrl}/search?text=${cql}`,
searchLink: `${appUrl}/search?text=${cql}`,
searchTypesString: getSearchTypesString(options)
}
}
Expand Down
40 changes: 20 additions & 20 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "Confluence",
"version": "3.3.1",
"version": "3.4.0",
"main": "./integration.js",
"private": true,
"dependencies": {
"async": "^3.2.4",
"async": "^3.2.6",
"lodash": "^4.17.21",
"postman-request": "^2.88.1-postman.33"
"postman-request": "^2.88.1-postman.40"
}
}
8 changes: 4 additions & 4 deletions templates/confluence-block.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
{{#each data.space as |space|}}
{{#if space.space.name}}
<div class="result-container">
<div class="p-value p-block"><a href ="{{data.url}}{{space.url}}"> {{space.space.name}} </a></div>
<div class="p-value p-block"><a href ="{{data.appUrl}}{{space.url}}"> {{space.space.name}} </a></div>
<div class="d-flex align-items-center justify-content-between meta-data">
<div class="p-footnote">{{space.resultGlobalContainer.title}}</div>
<div class="p-footnote">Updated: {{moment-format space.lastModified "YYYY-MM-DD" timeZone=timezone}}</div>
Expand All @@ -33,7 +33,7 @@
{{#each data.page as |page|}}
{{#if page.content.title}}
<div class="result-container">
<div class="p-value p-block"><a href ="{{data.url}}{{page.content._links.webui}}"> {{page.content.title}} </a></div>
<div class="p-value p-block"><a href ="{{data.appUrl}}{{page.content._links.webui}}"> {{page.content.title}} </a></div>
<div class="d-flex align-items-center justify-content-between meta-data">
<div class="p-footnote">{{page.resultGlobalContainer.title}}</div>
<div class="p-footnote">Updated: {{moment-format page.lastModified "YYYY-MM-DD" timeZone=timezone}}</div>
Expand All @@ -50,7 +50,7 @@
{{#each data.blog as |blog|}}
{{#if blog.content.title}}
<div class="result-container">
<div class="p-value p-block"><a href ="{{data.url}}{{blog.content._links.webui}}"> {{blog.content.title}} </a></div>
<div class="p-value p-block"><a href ="{{data.appUrl}}{{blog.content._links.webui}}"> {{blog.content.title}} </a></div>
<div class="d-flex align-items-center justify-content-between meta-data">
<div class="p-footnote">{{blog.resultGlobalContainer.title}}</div>
<div class="p-footnote">Updated: {{moment-format blog.lastModified "YYYY-MM-DD" timeZone=timezone}}</div>
Expand All @@ -67,7 +67,7 @@
{{#each data.attachments as |attachment|}}
{{#if attachment.content.title}}
<div class="result-container">
<div class="p-value"><a href ="{{data.url}}{{attachment.content._links.webui}}"> {{attachment.content.title}}</a></div>
<div class="p-value"><a href ="{{data.appUrl}}{{attachment.content._links.webui}}"> {{attachment.content.title}}</a></div>
<div class="d-flex align-items-center justify-content-between meta-data">
<div class="p-footnote">{{attachment.resultGlobalContainer.title}}</div>
<div class="p-footnote">Updated: {{moment-format attachment.lastModified "YYYY-MM-DD" timeZone=timezone}}</div>
Expand Down

0 comments on commit 929eb86

Please sign in to comment.