Skip to content

Commit

Permalink
Merge pull request #184 from jhiner/999
Browse files Browse the repository at this point in the history
[AUTHZ-999] Update extension with tenant logs v3 compatibility
  • Loading branch information
jhiner authored Jul 19, 2019
2 parents a309f20 + 2da6f1b commit 31f55d0
Show file tree
Hide file tree
Showing 12 changed files with 1,198 additions and 770 deletions.
12 changes: 6 additions & 6 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ jobs:
- run:
name: FOSSA Init
command: fossa init
- run:
name: FOSSA Analyze
command: fossa analyze
- run:
name: FOSSA Test
command: fossa test
# - run:
# name: FOSSA Analyze
# command: fossa analyze
# - run:
# name: FOSSA Test
# command: fossa test

# code climate requires before-build and after-build to be executed around test
- run:
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [3.7.0] - 2019-07-19

### Changes

- Compatibility with Tenant Logs v3

## [3.6.4] - 2019-07-09

### Fixed
Expand Down
1 change: 0 additions & 1 deletion client/containers/Logs.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ class LogsContainer extends Component {
</div>
<div className="row">
<div className="col-xs-12 wrapper">
<TableTotals currentCount={logs.records.size} totalCount={logs.total} textFormat={languageDictionary.tableTotalsTextFormat} />
{this.createToolbar(true)}
</div>
</div>
Expand Down
3 changes: 1 addition & 2 deletions client/reducers/logs.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,8 @@ export const logs = createReducer(fromJS(initialState), { // eslint-disable-line
const { data } = action.payload;
return state.merge({
loading: false,
total: data.total,
nextPage: action.meta.page + 1,
records: state.get('records').concat(fromJS(data.logs.map(log => {
records: state.get('records').concat(fromJS(data.map(log => {
log.shortType = log.type;
log.type = logTypes[log.type];
if (!log.type) {
Expand Down
4 changes: 2 additions & 2 deletions client/reducers/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ const userLogs = createReducer(fromJS(initialState.logs), {
[constants.FETCH_USER_LOGS_FULFILLED]: (state, action) =>
state.merge({
loading: false,
records: fromJS(typeof action.payload.data.logs !== 'undefined' ?
action.payload.data.logs.map(log => {
records: fromJS(typeof action.payload.data !== 'undefined' ?
action.payload.data.map(log => {
log.time_ago = moment(log.date).fromNow();
log.shortType = log.type;
log.type = logTypes[log.type];
Expand Down
1,806 changes: 1,121 additions & 685 deletions package-lock.json

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "auth0-delegated-admin",
"version": "3.6.4",
"version": "3.7.0",
"description": "This extension allows non-dashboard administrators to manage (a subset of) users.",
"engines": {
"node": ">8.9"
Expand Down Expand Up @@ -38,7 +38,7 @@
"auth0-extension-tools": "1.3.3",
"auth0-extension-ui": "^1.2.2",
"auth0-js": "^9.6.0",
"axios": "^0.14.0",
"axios": "^0.19.0",
"bluebird": "^3.4.0",
"body-parser": "^1.15.1",
"codemirror": "^5.19.0",
Expand Down Expand Up @@ -91,7 +91,7 @@
"@babel/polyfill": "^7.0.0",
"@babel/preset-env": "^7.2.0",
"@babel/register": "^7.0.0",
"auth0-extensions-cli": "^4.0.1",
"auth0-extensions-cli": "^4.0.3",
"autoprefixer": "^6.5.1",
"babel-eslint": "7.1.1",
"babel-loader": "^8.0.4",
Expand All @@ -103,7 +103,7 @@
"css-loader": "0.26.1",
"enzyme": "^3.9.0",
"enzyme-adapter-react-15": "^1.4.0",
"eslint": "^3.9.1",
"eslint": "^4.19.1",
"eslint-config-auth0": "^6.0.1",
"eslint-config-auth0-base": "^12.1.0",
"eslint-plugin-babel": "^3.3.0",
Expand Down
1 change: 0 additions & 1 deletion server/routes/logs.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ export default (scriptManager) => {
req.auth0.logs
.getAll({
q: 'NOT type: sapi AND NOT type:fapi',
include_totals: true,
sort: 'date:-1',
per_page: 20,
page: req.query.page || 0,
Expand Down
3 changes: 0 additions & 3 deletions server/routes/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -516,9 +516,6 @@ export default (storage, scriptManager) => {
.then((accessToken) => {
const options = {
uri: `https://${config('AUTH0_DOMAIN')}/api/v2/users/${encodeURIComponent(req.params.id)}/logs`,
qs: {
include_totals: true
},
headers: {
authorization: `Bearer ${accessToken}`
},
Expand Down
44 changes: 20 additions & 24 deletions tests/client/reducers/logs.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,27 +90,24 @@ describe('logs reducer', () => {
logs(initialState, {
type: constants.FETCH_LOGS_FULFILLED,
payload: {
data: {
total: 100,
logs: [
{
_id: '49559553682563810286559514517590841916612030849441857538',
client_name: 'My App',
connection: 'Username-Password-Authentication',
date: '2016-09-26T13:03:50.703Z',
type: 'custom_type',
user_name: '[email protected]'
},
{
_id: '49559553682563810286559514516535449676088458549131214850',
client_name: 'My App',
connection: 'Username-Password-Authentication',
date: '2016-09-26T13:03:36.005Z',
type: 's',
user_name: '[email protected]'
}
]
}
data: [
{
_id: '49559553682563810286559514517590841916612030849441857538',
client_name: 'My App',
connection: 'Username-Password-Authentication',
date: '2016-09-26T13:03:50.703Z',
type: 'custom_type',
user_name: '[email protected]'
},
{
_id: '49559553682563810286559514516535449676088458549131214850',
client_name: 'My App',
connection: 'Username-Password-Authentication',
date: '2016-09-26T13:03:36.005Z',
type: 's',
user_name: '[email protected]'
}
]
},
meta: {
page: 1
Expand All @@ -133,7 +130,7 @@ describe('logs reducer', () => {
color: '#FFA500'
}
},
user_name: '[email protected]',
user_name: '[email protected]'
},
{
_id: '49559553682563810286559514516535449676088458549131214850',
Expand All @@ -148,11 +145,10 @@ describe('logs reducer', () => {
color: 'green'
}
},
user_name: '[email protected]',
user_name: '[email protected]'
}
],
currentRecord: null,
total: 100,
nextPage: 2
}
);
Expand Down
78 changes: 37 additions & 41 deletions tests/client/reducers/user.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,26 +100,24 @@ describe('user reducer', () => {
user(initialState, {
type: constants.FETCH_USER_LOGS_FULFILLED,
payload: {
data: {
logs: [
{
_id: '49559553682563810286559514517590841916612030849441857538',
client_name: 'My App',
connection: 'Username-Password-Authentication',
date: '2016-09-26T13:03:50.703Z',
type: 's',
user_name: '[email protected]'
},
{
_id: '49559553682563810286559514516535449676088458549131214850',
client_name: 'My App',
connection: 'Username-Password-Authentication',
date: '2016-09-26T13:03:36.005Z',
type: 's',
user_name: '[email protected]'
}
]
}
data: [
{
_id: '49559553682563810286559514517590841916612030849441857538',
client_name: 'My App',
connection: 'Username-Password-Authentication',
date: '2016-09-26T13:03:50.703Z',
type: 's',
user_name: '[email protected]'
},
{
_id: '49559553682563810286559514516535449676088458549131214850',
client_name: 'My App',
connection: 'Username-Password-Authentication',
date: '2016-09-26T13:03:36.005Z',
type: 's',
user_name: '[email protected]'
}
]
}
}).toJSON()
).toEqual(
Expand Down Expand Up @@ -182,26 +180,24 @@ describe('user reducer', () => {
user(initialState, {
type: constants.FETCH_USER_LOGS_FULFILLED,
payload: {
data: {
logs: [
{
_id: '49559553682563810286559514517590841916612030849441857538',
client_name: 'My App',
connection: 'Username-Password-Authentication',
date: '2016-09-26T13:03:50.703Z',
type: 's',
user_name: '[email protected]'
},
{
_id: '49559553682563810286559514516535449676088458549131214850',
client_name: 'My App',
connection: 'Username-Password-Authentication',
date: '2016-09-26T13:03:36.005Z',
type: 'custom_type',
user_name: '[email protected]'
}
]
}
data: [
{
_id: '49559553682563810286559514517590841916612030849441857538',
client_name: 'My App',
connection: 'Username-Password-Authentication',
date: '2016-09-26T13:03:50.703Z',
type: 's',
user_name: '[email protected]'
},
{
_id: '49559553682563810286559514516535449676088458549131214850',
client_name: 'My App',
connection: 'Username-Password-Authentication',
date: '2016-09-26T13:03:36.005Z',
type: 'custom_type',
user_name: '[email protected]'
}
]
}
}).toJSON()
).toEqual(
Expand Down Expand Up @@ -264,7 +260,7 @@ describe('user reducer', () => {
user(initialState, {
type: constants.FETCH_USER_LOGS_FULFILLED,
payload: {
data: {}
data: []
}
}).toJSON()
).toEqual(
Expand Down
2 changes: 1 addition & 1 deletion webtask.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"title": "Delegated Administration Dashboard",
"name": "auth0-delegated-admin",
"version": "3.6.4",
"version": "3.7.0",
"author": "auth0",
"useHashName": false,
"description": "This extension allows non-dashboard administrators to manage (a subset of) users.",
Expand Down

0 comments on commit 31f55d0

Please sign in to comment.