Add visual indicator of LTI Key

closes PLAT-4255

Test Plan:
 n/a

Change-Id: I42cecd3bd0e7970ab63857064178e705fd81c45f
Reviewed-on: https://gerrit.instructure.com/185209
Tested-by: Jenkins
Reviewed-by: Weston Dransfield <wdransfield@instructure.com>
QA-Review: Weston Dransfield <wdransfield@instructure.com>
Product-Review: Jesse Poulos <jpoulos@instructure.com>
This commit is contained in:
Marc Phillips 2019-03-13 15:26:41 -06:00
parent 4294ab9ced
commit 6b7c9806b8
5 changed files with 20 additions and 6 deletions

View File

@ -97,6 +97,7 @@ class DeveloperKeysTable extends React.Component {
{!inherited && <th scope="col">{I18n.t('Owner Email')}</th> } {!inherited && <th scope="col">{I18n.t('Owner Email')}</th> }
<th scope="col">{I18n.t('Details')}</th> <th scope="col">{I18n.t('Details')}</th>
{!inherited && <th scope="col">{I18n.t('Stats')}</th>} {!inherited && <th scope="col">{I18n.t('Stats')}</th>}
<th scope="col">{I18n.t('Type')}</th>
<th scope="col">{I18n.t('State')}</th> <th scope="col">{I18n.t('State')}</th>
{!inherited && <th scope="col">{I18n.t('Actions')}</th>} {!inherited && <th scope="col">{I18n.t('Actions')}</th>}
</tr> </tr>

View File

@ -26,11 +26,13 @@ import PropTypes from 'prop-types'
import Button from '@instructure/ui-buttons/lib/components/Button' import Button from '@instructure/ui-buttons/lib/components/Button'
import CloseButton from '@instructure/ui-buttons/lib/components/CloseButton' import CloseButton from '@instructure/ui-buttons/lib/components/CloseButton'
import Flex, { FlexItem } from '@instructure/ui-layout/lib/components/Flex' import Flex, { FlexItem } from '@instructure/ui-layout/lib/components/Flex'
import IconLti from '@instructure/ui-icons/lib/Line/IconLti'
import Popover, { PopoverTrigger, PopoverContent } from '@instructure/ui-overlays/lib/components/Popover' import Popover, { PopoverTrigger, PopoverContent } from '@instructure/ui-overlays/lib/components/Popover'
import Image from '@instructure/ui-elements/lib/components/Img' import Image from '@instructure/ui-elements/lib/components/Img'
import Link from '@instructure/ui-elements/lib/components/Link' import Link from '@instructure/ui-elements/lib/components/Link'
import ScreenReaderContent from '@instructure/ui-a11y/lib/components/ScreenReaderContent' import ScreenReaderContent from '@instructure/ui-a11y/lib/components/ScreenReaderContent'
import View from '@instructure/ui-layout/lib/components/View' import View from '@instructure/ui-layout/lib/components/View'
import { Tooltip } from '@instructure/ui-overlays'
import DeveloperKeyActionButtons from './ActionButtons' import DeveloperKeyActionButtons from './ActionButtons'
import DeveloperKeyStateControl from './InheritanceStateControl' import DeveloperKeyStateControl from './InheritanceStateControl'
@ -143,7 +145,7 @@ class DeveloperKey extends React.Component {
<td> <td>
<Flex> <Flex>
{this.makeImage(developerKey)} {this.makeImage(developerKey)}
<FlexItem shrink="true"> <FlexItem shrink>
{this.getToolName(developerKey)} {this.getToolName(developerKey)}
</FlexItem> </FlexItem>
</Flex> </Flex>
@ -225,7 +227,18 @@ class DeveloperKey extends React.Component {
</div> </div>
</td> </td>
} }
<td>
{developerKey.is_lti_key
? <Tooltip
tip={I18n.t("Developer key is an external tool.")}
on={['click', 'hover', 'focus']}
>
<Button variant="icon" icon={IconLti}>
<ScreenReaderContent>{I18n.t("Toggle ToolTip")}</ScreenReaderContent>
</Button>
</Tooltip>
: null}
</td>
<td> <td>
<DeveloperKeyStateControl <DeveloperKeyStateControl
ref={this.refToggleGroup} ref={this.refToggleGroup}

View File

@ -48,7 +48,6 @@ module Api::V1::DeveloperKey
hash['access_token_count'] = key.access_token_count hash['access_token_count'] = key.access_token_count
hash['last_used_at'] = key.last_used_at hash['last_used_at'] = key.last_used_at
hash['vendor_code'] = key.vendor_code hash['vendor_code'] = key.vendor_code
hash['is_lti_key'] = key.public_jwk.present?
end end
if account_binding.present? if account_binding.present?
@ -59,6 +58,7 @@ module Api::V1::DeveloperKey
hash['account_name'] = key.account_name hash['account_name'] = key.account_name
hash['visible'] = key.visible hash['visible'] = key.visible
end end
hash['is_lti_key'] = key.public_jwk.present?
hash['id'] = key.global_id hash['id'] = key.global_id
end end
end end

View File

@ -74,7 +74,7 @@ describe DeveloperKeysController, type: :request do
d.update! visible: true d.update! visible: true
get "/api/v1/accounts/#{a.id}/developer_keys", params: { inherited: true } get "/api/v1/accounts/#{a.id}/developer_keys", params: { inherited: true }
expect(json_parse.first.keys).to match_array( expect(json_parse.first.keys).to match_array(
%w[name created_at icon_url workflow_state id developer_key_account_binding] %w[name created_at icon_url workflow_state id developer_key_account_binding is_lti_key]
) )
end end

View File

@ -49,7 +49,7 @@ function devKeyList(numKeys = 10) {
} }
function disabledDevKeyList(numKeys = 10) { function disabledDevKeyList(numKeys = 10) {
return [...Array(numKeys).keys()].map(n => ({id: `${n}`, api_key: "abc12345678", created_at: "2012-06-07T20:36:50Z", return [...Array(numKeys).keys()].map(n => ({id: `${n}`, api_key: "abc12345678", created_at: "2012-06-07T20:36:50Z",
developer_key_account_binding: {workflow_state: "off", account_owns_binding: false}})) developer_key_account_binding: {workflow_state: "off", account_owns_binding: false}}))
} }
@ -90,7 +90,7 @@ test('does render the "Owner Email" heading if not inherited', () => {
test('does not render the "Stats" heading if inherited', () => { test('does not render the "Stats" heading if inherited', () => {
const node = componentNode(devKeyList(), true) const node = componentNode(devKeyList(), true)
notOk(node.querySelectorAll('th')[3]) notOk(node.querySelectorAll('th')[4])
}) })
test('does render the "Stats" heading if not inherited', () => { test('does render the "Stats" heading if not inherited', () => {