Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ui): add 403 signout handler to new api requests #15426

Merged
merged 1 commit into from
Oct 16, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ ui/src/api/.openapi-generator/VERSION
ui/src/api/git_push.sh

# UI generated typescript types
ui/src/client/index.ts
ui/src/client/generatedRoutes.ts

http/swagger_gen.go

Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
### Features
1. [15313](https://github.com/influxdata/influxdb/pull/15313): Add shortcut for toggling comments in script editor

### UI Improvements
1. [15426](https://github.com/influxdata/influxdb/pull/15426): Add 403 handler that redirects back to the sign-in page on oats-generated routes.

### Bug Fixes
1. [15295](https://github.com/influxdata/influxdb/pull/15295): Ensures users are created with an active status
1. [15306](https://github.com/influxdata/influxdb/pull/15306): Added missing string values for CacheStatus type
Expand Down
4 changes: 2 additions & 2 deletions ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@
"tsc:cypress": "tsc -p ./cypress/tsconfig.json --noEmit --pretty --skipLibCheck",
"cy": "CYPRESS_baseUrl=http://localhost:9999 cypress open",
"cy:dev": "CYPRESS_baseUrl=http://localhost:8080 cypress open",
"generate": "oats ../http/swagger.yml > src/client/index.ts"
"generate": "oats ../http/swagger.yml > src/client/generatedRoutes.ts"
},
"author": "",
"devDependencies": {
"@babel/core": "^7.5.5",
"@babel/preset-env": "^7.5.5",
"@cypress/webpack-preprocessor": "^4.0.3",
"@influxdata/oats": "0.4.0",
"@influxdata/oats": "0.5.0",
"@types/chroma-js": "^1.3.4",
"@types/codemirror": "^0.0.56",
"@types/d3-color": "^1.2.1",
Expand Down
12 changes: 12 additions & 0 deletions ui/src/client/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import {setResponseHandler, postSignout} from './generatedRoutes'

setResponseHandler((status, headers, data) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

beautiful!

if (status === 403) {
postSignout({})
window.location.href = '/signin'
}

return {status, headers, data}
})

export * from './generatedRoutes'
8 changes: 4 additions & 4 deletions ui/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1107,10 +1107,10 @@
resolved "https://registry.yarnpkg.com/@influxdata/influxdb-templates/-/influxdb-templates-0.9.0.tgz#d4b1f727c8949147d2ade63f5754425a0d1a0e9d"
integrity sha512-R/QhYJz+nNPGT8LkWHXKOLYYUROavDPfIFoGP7sIrxhStjm+hb0TzHYeQ75HLPQqKh54zCB8cv/TINwRgijYBw==

"@influxdata/oats@0.4.0":
version "0.4.0"
resolved "https://registry.yarnpkg.com/@influxdata/oats/-/oats-0.4.0.tgz#709b288232473140802fd1a3871f9b0f7ae49fc2"
integrity sha512-VgzO2jU0UguGFmdBEuqMM7jQS9soW0pqj251LmLKQhlFbuL9AKCAIOO6rf6OFqC3sCloduxwgZRc+Y9EprQhmQ==
"@influxdata/oats@0.5.0":
version "0.5.0"
resolved "https://registry.yarnpkg.com/@influxdata/oats/-/oats-0.5.0.tgz#0fdd308524fa407303ffa6a3d60fe959777dcfcb"
integrity sha512-oBlSB5ROM6JMqsVBDLlJzkBiMvAom+b4dszH83LPdM9H+pUtj2SeUoMpQhj9/4ioCnUVZx8HFN58/a/pkmADAQ==
dependencies:
commander "^2.20.0"
humps "^2.0.1"
Expand Down