-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from polarityio/develop
Initial Release
- Loading branch information
Showing
33 changed files
with
1,501 additions
and
217 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
# Create Polarity Slack App | ||
|
||
1. Go to https://api.slack.com/apps/ | ||
2. Click on `Create New App` | ||
<div> | ||
<img alt="Click on Create New App" src="./assets/click-on-create-new-app.png"> | ||
</div> | ||
|
||
3. Select `From an app manifest` | ||
<div> | ||
<img alt="Click on From App Manifest" src="./assets/click-from-an-app-manifest.png"> | ||
</div> | ||
|
||
4. Select your workspace you would like the integration to run on via the dropdown, then Click `Next` | ||
<div> | ||
<img alt="Select Workspace" src="./assets/select-workspace-from-dropdown.png"> | ||
</div> | ||
|
||
5. Delete the contents of the YAML App Manifest | ||
<div> | ||
<img alt="Delete App Manifest" src="./assets/delete-app-manifest.png"> | ||
</div> | ||
|
||
6. Paste in ***this*** App Manifest in the empty input, then Click `Next`: | ||
```yaml | ||
display_information: | ||
name: Polarity | ||
description: Polarity's Slack Application for use in tandem with our Polarity Slack Integration. | ||
background_color: "#53a13b" | ||
features: | ||
app_home: | ||
home_tab_enabled: false | ||
messages_tab_enabled: true | ||
messages_tab_read_only_enabled: true | ||
bot_user: | ||
display_name: Polarity | ||
always_online: true | ||
oauth_config: | ||
scopes: | ||
user: | ||
- search:read | ||
bot: | ||
- channels:read | ||
- groups:read | ||
- im:read | ||
- mpim:read | ||
- chat:write | ||
- chat:write.customize | ||
- chat:write.public | ||
|
||
settings: | ||
org_deploy_enabled: false | ||
socket_mode_enabled: false | ||
token_rotation_enabled: false | ||
``` | ||
7. Click `Create` | ||
<div> | ||
<img alt="Click Create" src="./assets/click-create.png"> | ||
</div> | ||
|
||
8. On the `Polarity` Slack app page it brings you to, click `Install to Workspace` | ||
<div> | ||
<img alt="Install to Workspace" src="./assets/install-to-workspace.png"> | ||
</div> | ||
|
||
9. Click `Allow` | ||
> ***NOTE:*** The user that clicks allow will determine which private channels can be searched. Creating a new user with access to the private channels you want to search and clicking `Allow` while logged into this user is recommended. | ||
<div> | ||
<img alt="Click Allow" src="./assets/click-allow.png"> | ||
</div> | ||
|
||
10. Download the image found here: https://github.com/polarityio/slack/raw/develop/assets/app-profile-picture.png | ||
<div> | ||
<img width="75"style="border-radius: 49%" alt="App Profile Picture" src="./assets/app-profile-picture.png"> | ||
</div> | ||
|
||
11. On the `Basic Information` tab | ||
<div> | ||
<img alt="Basic Information Tab" src="./assets/basic-info-tab.png"> | ||
</div> | ||
- Scroll down to the `Display Information` section, click `+ Add App Icon`, and select the image from `Step 10`. | ||
<div> | ||
<img alt="Add Icon" src="./assets/add-icon.png"> | ||
</div> | ||
|
||
12. Now you `User Token` and `Bot Token` can be found on the `OAuth & Permissions` tab | ||
<div> | ||
<img alt="Get User and Bot Token" src="./assets/get-tokens.png"> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,136 @@ | ||
polarity.export = PolarityComponent.extend({ | ||
details: Ember.computed.alias('block.data.details'), | ||
timezone: Ember.computed('Intl', function () { | ||
return Intl.DateTimeFormat().resolvedOptions().timeZone; | ||
}), | ||
availableChannelsToMessage: [], | ||
messageValue: '', | ||
sendingMessage: false, | ||
messagingToast: '', | ||
errorMessagingToast: '', | ||
sendingMessage: '', | ||
selectedChannel: {}, | ||
foundMessageSearchResultsOpen: false, | ||
loadingMoreMessages: false, | ||
init() { | ||
//TODO: Change or delete | ||
const availableChannelsToMessage = this.get('block.userOptions.messagingChannelNames') | ||
.split(',') | ||
.map((channelName) => | ||
this.get('details.channels').find( | ||
({ name }) => name == channelName.trim().toLowerCase().replace(/ /g, '-') | ||
) | ||
) | ||
.filter((x) => x); | ||
|
||
this.set('availableChannelsToMessage', availableChannelsToMessage); | ||
this.set('selectedChannel', availableChannelsToMessage[0]); | ||
this.set( | ||
'messageValue', | ||
this.get('block.userOptions.addEntityToMessageByDefault') | ||
? this.get('block.entity.value') | ||
: '' | ||
); | ||
|
||
this._super(...arguments); | ||
}, | ||
observer: Ember.on( | ||
'willUpdate', | ||
Ember.observer('details.maxUniqueKeyNumber', function () { | ||
if (this.get('maxUniqueKeyNumber') !== this.get('_maxUniqueKeyNumber')) { | ||
this.set('_maxUniqueKeyNumber', this.get('maxUniqueKeyNumber')); | ||
|
||
//TODO: Change or delete | ||
} | ||
}) | ||
), | ||
actions: { | ||
toggleOwnershipMessage: function () { | ||
this.toggleProperty('change or delete'); | ||
toggleShowingFoundMessages: function () { | ||
this.toggleProperty('foundMessageSearchResultsOpen'); | ||
}, | ||
showMoreOfMessage: function (index) { | ||
this.set( | ||
`details.foundMessagesFromSearch.${index}.displayMessage`, | ||
this.get(`details.foundMessagesFromSearch.${index}.message`) | ||
); | ||
this.set(`details.foundMessagesFromSearch.${index}.shouldShowMoreMessage`, false); | ||
}, | ||
selectChannel: function (selectedChannelId) { | ||
this.set( | ||
'selectedChannel', | ||
this.get('details.channels').find(({ id }) => id == selectedChannelId) | ||
); | ||
}, | ||
loadMoreSearchMessages: function () { | ||
if(this.get('loadingMoreMessages')) return; | ||
const outerThis = this; | ||
outerThis.set('loadingMoreMessages', true); | ||
outerThis.get('block').notifyPropertyChange('data'); | ||
|
||
outerThis | ||
.sendIntegrationMessage({ | ||
action: 'loadMoreSearchMessages', | ||
data: { | ||
entity: this.get('block.entity'), | ||
channels: this.get('details.channels'), | ||
currentSearchResultsPage: this.get('details.currentSearchResultsPage') | ||
} | ||
}) | ||
.then( | ||
({ | ||
foundMessagesFromSearch, | ||
currentSearchResultsPage, | ||
totalNumberOfSearchResultPages | ||
}) => { | ||
this.set( | ||
'details.foundMessagesFromSearch', | ||
this.get('details.foundMessagesFromSearch').concat(foundMessagesFromSearch) | ||
); | ||
this.set('details.currentSearchResultsPage', currentSearchResultsPage); | ||
this.set( | ||
'details.totalNumberOfSearchResultPages', | ||
totalNumberOfSearchResultPages | ||
); | ||
} | ||
) | ||
.catch((err) => { | ||
// Remove the `... Load More` button | ||
this.set( | ||
'details.currentSearchResultsPage', | ||
this.get('details.totalNumberOfSearchResultPages') | ||
); | ||
}) | ||
.finally(() => { | ||
outerThis.set('loadingMoreMessages', false); | ||
outerThis.get('block').notifyPropertyChange('data'); | ||
}); | ||
}, | ||
onMessageExample: function () { | ||
sendMessage: function () { | ||
const outerThis = this; | ||
outerThis.set('asdfMessage', ''); | ||
outerThis.set('asdfErrorMessage', ''); | ||
outerThis.set('asdfIsRunning', true); | ||
outerThis.set('messagingToast', ''); | ||
outerThis.set('errorMessagingToast', ''); | ||
outerThis.set('sendingMessage', true); | ||
outerThis.get('block').notifyPropertyChange('data'); | ||
|
||
outerThis | ||
.sendIntegrationMessage({ | ||
action: 'onMessageExample', | ||
action: 'sendMessage', | ||
data: { | ||
entity: outerThis.get('entity'), | ||
text: this.get('messageValue'), | ||
channel: this.get('selectedChannel').id | ||
} | ||
}) | ||
.then(({ result }) => { | ||
outerThis.set('change or delete', result); | ||
outerThis.set('asdfMessage', 'Successfully asdf IOC'); | ||
.then(() => { | ||
outerThis.set('messageValue', ''); | ||
outerThis.set('messagingToast', 'Successfully Sent Message'); | ||
}) | ||
.catch((err) => { | ||
outerThis.set( | ||
'asdfErrorMessage', | ||
'Failed to asdf IOC: ' + | ||
'errorMessagingToast', | ||
'Failed to Send Message: ' + | ||
(err && | ||
(err.detail || err.err || err.message || err.title || err.description)) || | ||
'Unknown Reason' | ||
); | ||
}) | ||
.finally(() => { | ||
outerThis.set('asdfIsRunning', false); | ||
outerThis.set('sendingMessage', false); | ||
outerThis.get('block').notifyPropertyChange('data'); | ||
setTimeout(() => { | ||
outerThis.set('asdfMessage', ''); | ||
outerThis.set('asdfErrorMessage', ''); | ||
outerThis.set('messagingToast', ''); | ||
outerThis.set('errorMessagingToast', ''); | ||
outerThis.get('block').notifyPropertyChange('data'); | ||
}, 5000); | ||
}); | ||
}, | ||
} | ||
} | ||
}); |
Oops, something went wrong.