2018-03-14 23:16:20 +08:00
|
|
|
#
|
|
|
|
# Copyright (C) 2017 - present Instructure, Inc.
|
|
|
|
#
|
|
|
|
# This file is part of Canvas.
|
|
|
|
#
|
|
|
|
# Canvas is free software: you can redistribute it and/or modify it under
|
|
|
|
# the terms of the GNU Affero General Public License as published by the Free
|
|
|
|
# Software Foundation, version 3 of the License.
|
|
|
|
#
|
|
|
|
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
|
|
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
|
|
|
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
|
|
|
# details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU Affero General Public License along
|
|
|
|
# with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
#
|
|
|
|
|
Add notes & additional stats to Developer Keys page
This commit enhances the Developer Keys page in two ways:
Notes field:
A notes field is added on the `developer_keys` table. When creating a
key, there is sometimes a need to record more information (for example,
a ticket number for the request, information on how the key is to be
used, etc). The notes field is exposed in the developer key listing, in
the API response, and in the dialog for creating/editing a key.
Usage stats:
While adding the notes field, I found a `TODO` marker for "add some
better stats here, like token count, last usage, etc.". Mark that `TODO`
as `DONE`! This PR adds two methods to the `DeveloperKey` model:
`access_token_count` and `last_used_at`. These fields are returned in
the API response, and are displayed in the Stats column on the Developer
Key page.
Test Plan:
- Add a new developer key. There should be a notes field present in the
form and it should save the value of the field when creating the key.
- Edit the key; you should be able to update the notes field.
- Assign access tokens using the developer key. The usage information
should be reflected in the stats for that key.
2017-03-22 04:48:55 +08:00
|
|
|
class AddNotesToDeveloperKeys < ActiveRecord::Migration[4.2]
|
|
|
|
tag :predeploy
|
|
|
|
|
|
|
|
def change
|
|
|
|
add_column :developer_keys, :notes, :text
|
|
|
|
end
|
|
|
|
end
|