mirror of https://github.com/hashicorp/consul
Browse Source
Replace bindata packages with stdlib go:embed. Modernize some uiserver code with newer interfaces introduced in go 1.16 (mainly working with fs.File instead of http.File. Remove steps that are no longer used from our build files. Add Github Action to detect differences in agent/uiserver/dist and verify that the files are correct (by compiling UI assets and comparing contents).pull/13314/head
Chris S. Kim
3 years ago
committed by
GitHub
53 changed files with 16052 additions and 1227 deletions
@ -0,0 +1,3 @@ |
|||||||
|
```release-note:improvement |
||||||
|
ui: removed external dependencies for serving UI assets in favor of Go's native embed capabilities |
||||||
|
``` |
@ -0,0 +1,37 @@ |
|||||||
|
# This workflow detects if there is a diff in the `agent/uiserver/dist` directory |
||||||
|
# which is used by Consul to serve its embedded UI. |
||||||
|
# `agent/uiserver/dist` should not be manually updated. |
||||||
|
|
||||||
|
name: Embedded Asset Checker |
||||||
|
|
||||||
|
on: |
||||||
|
pull_request: |
||||||
|
types: [opened, synchronize, labeled, unlabeled, reopened] |
||||||
|
# Runs on PRs to main and all release branches |
||||||
|
branches: |
||||||
|
- main |
||||||
|
- release/* |
||||||
|
|
||||||
|
jobs: |
||||||
|
dist-check: |
||||||
|
if: "! ( contains(github.event.pull_request.labels.*.name, 'pr/update-ui-assets') || github.event.pull_request.user.login == 'hc-github-team-consul-core' )" |
||||||
|
runs-on: ubuntu-latest |
||||||
|
steps: |
||||||
|
- uses: actions/checkout@v2 |
||||||
|
with: |
||||||
|
ref: ${{ github.event.pull_request.head.sha }} |
||||||
|
fetch-depth: 0 # by default the checkout action doesn't checkout all branches |
||||||
|
- name: Check for agent/uiserver/dist dir change in diff |
||||||
|
run: | |
||||||
|
dist_files=$(git --no-pager diff --name-only HEAD "$(git merge-base HEAD "origin/${{ github.event.pull_request.base.ref }}")" -- agent/uiserver/dist) |
||||||
|
if [[ -z "${dist_files}" ]]; then |
||||||
|
exit 0 |
||||||
|
fi |
||||||
|
|
||||||
|
echo "Found diffs in dir agent/uiserver/dist" |
||||||
|
github_message="This PR has diffs in \`agent/uiserver/dist\`. If the changes are intentional, add the label \`pr/update-ui-assets\`. Otherwise, revert changes to \`agent/uiserver/dist\`." |
||||||
|
curl -s -H "Authorization: token ${{ secrets.PR_COMMENT_TOKEN }}" \ |
||||||
|
-X POST \ |
||||||
|
-d "{ \"body\": \"${github_message}\"}" \ |
||||||
|
"https://api.github.com/repos/${GITHUB_REPOSITORY}/issues/${{ github.event.pull_request.number }}/comments" |
||||||
|
exit 1 |
@ -0,0 +1,7 @@ |
|||||||
|
# uiserver |
||||||
|
|
||||||
|
The contents of `dist/` are generated by `make ui` in the root of this repo |
||||||
|
which compiles `ui` assets and copies them here. |
||||||
|
|
||||||
|
A CI job (`publish-static-assets`) will detect any diffs in `ui` files and |
||||||
|
commit the compiled files. Avoid committing files manually to `dist/`. |
File diff suppressed because one or more lines are too long
@ -1,21 +1,19 @@ |
|||||||
package uiserver |
package uiserver |
||||||
|
|
||||||
import ( |
import ( |
||||||
"net/http" |
"io/fs" |
||||||
"os" |
|
||||||
) |
) |
||||||
|
|
||||||
// bufIndexFS is an implementation of http.FS that intercepts requests for
|
// bufIndexFS is an implementation of fs.FS that intercepts requests for
|
||||||
// the index.html file and returns a pre-rendered file from memory.
|
// the index.html file and returns a pre-rendered file from memory.
|
||||||
type bufIndexFS struct { |
type bufIndexFS struct { |
||||||
fs http.FileSystem |
fs fs.FS |
||||||
indexRendered []byte |
bufIndex fs.File |
||||||
indexInfo os.FileInfo |
|
||||||
} |
} |
||||||
|
|
||||||
func (fs *bufIndexFS) Open(name string) (http.File, error) { |
func (fs *bufIndexFS) Open(name string) (fs.File, error) { |
||||||
if name == "/index.html" { |
if name == "index.html" { |
||||||
return newBufferedFile(fs.indexRendered, fs.indexInfo), nil |
return fs.bufIndex, nil |
||||||
} |
} |
||||||
return fs.fs.Open(name) |
return fs.fs.Open(name) |
||||||
} |
} |
||||||
|
@ -1,67 +1,33 @@ |
|||||||
package uiserver |
package uiserver |
||||||
|
|
||||||
import ( |
import ( |
||||||
"bytes" |
"io" |
||||||
"errors" |
"io/fs" |
||||||
"os" |
|
||||||
"time" |
|
||||||
) |
) |
||||||
|
|
||||||
// bufferedFile implements http.File and allows us to modify a file from disk by
|
// bufferedFile implements fs.File and allows us to modify a file from disk by
|
||||||
// writing out the new version into a buffer and then serving file reads from
|
// writing out the new version into a buffer and then serving file reads from
|
||||||
// that.
|
// that.
|
||||||
type bufferedFile struct { |
type bufferedFile struct { |
||||||
buf *bytes.Reader |
buf io.Reader |
||||||
info os.FileInfo |
info fs.FileInfo |
||||||
} |
} |
||||||
|
|
||||||
func newBufferedFile(buf []byte, info os.FileInfo) *bufferedFile { |
func (b *bufferedFile) Stat() (fs.FileInfo, error) { |
||||||
return &bufferedFile{ |
return b.info, nil |
||||||
buf: bytes.NewReader(buf), |
|
||||||
info: info, |
|
||||||
} |
|
||||||
} |
} |
||||||
|
|
||||||
func (t *bufferedFile) Read(p []byte) (n int, err error) { |
func (b *bufferedFile) Read(bytes []byte) (int, error) { |
||||||
return t.buf.Read(p) |
return b.buf.Read(bytes) |
||||||
} |
} |
||||||
|
|
||||||
func (t *bufferedFile) Seek(offset int64, whence int) (int64, error) { |
func (b *bufferedFile) Close() error { |
||||||
return t.buf.Seek(offset, whence) |
|
||||||
} |
|
||||||
|
|
||||||
func (t *bufferedFile) Close() error { |
|
||||||
return nil |
return nil |
||||||
} |
} |
||||||
|
|
||||||
func (t *bufferedFile) Readdir(count int) ([]os.FileInfo, error) { |
func newBufferedFile(buf io.Reader, info fs.FileInfo) *bufferedFile { |
||||||
return nil, errors.New("not a directory") |
return &bufferedFile{ |
||||||
} |
buf: buf, |
||||||
|
info: info, |
||||||
func (t *bufferedFile) Stat() (os.FileInfo, error) { |
} |
||||||
return t, nil |
|
||||||
} |
|
||||||
|
|
||||||
func (t *bufferedFile) Name() string { |
|
||||||
return t.info.Name() |
|
||||||
} |
|
||||||
|
|
||||||
func (t *bufferedFile) Size() int64 { |
|
||||||
return int64(t.buf.Len()) |
|
||||||
} |
|
||||||
|
|
||||||
func (t *bufferedFile) Mode() os.FileMode { |
|
||||||
return t.info.Mode() |
|
||||||
} |
|
||||||
|
|
||||||
func (t *bufferedFile) ModTime() time.Time { |
|
||||||
return t.info.ModTime() |
|
||||||
} |
|
||||||
|
|
||||||
func (t *bufferedFile) IsDir() bool { |
|
||||||
return false |
|
||||||
} |
|
||||||
|
|
||||||
func (t *bufferedFile) Sys() interface{} { |
|
||||||
return nil |
|
||||||
} |
} |
||||||
|
After Width: | Height: | Size: 7.1 KiB |
@ -0,0 +1,138 @@ |
|||||||
|
var jsonlint=function(){var e={trace:function(){},yy:{},symbols_:{error:2,JSONString:3,STRING:4,JSONNumber:5,NUMBER:6,JSONNullLiteral:7,NULL:8,JSONBooleanLiteral:9,TRUE:10,FALSE:11,JSONText:12,JSONValue:13,EOF:14,JSONObject:15,JSONArray:16,"{":17,"}":18,JSONMemberList:19,JSONMember:20,":":21,",":22,"[":23,"]":24,JSONElementList:25,$accept:0,$end:1},terminals_:{2:"error",4:"STRING",6:"NUMBER",8:"NULL",10:"TRUE",11:"FALSE",14:"EOF",17:"{",18:"}",21:":",22:",",23:"[",24:"]"},productions_:[0,[3,1],[5,1],[7,1],[9,1],[9,1],[12,2],[13,1],[13,1],[13,1],[13,1],[13,1],[13,1],[15,2],[15,3],[20,3],[19,1],[19,3],[16,2],[16,3],[25,1],[25,3]],performAction:function(e,t,r,n,i,a){var s=a.length-1 |
||||||
|
switch(i){case 1:this.$=e.replace(/\\(\\|")/g,"$1").replace(/\\n/g,"\n").replace(/\\r/g,"\r").replace(/\\t/g,"\t").replace(/\\v/g,"\v").replace(/\\f/g,"\f").replace(/\\b/g,"\b") |
||||||
|
break |
||||||
|
case 2:this.$=Number(e) |
||||||
|
break |
||||||
|
case 3:this.$=null |
||||||
|
break |
||||||
|
case 4:this.$=!0 |
||||||
|
break |
||||||
|
case 5:this.$=!1 |
||||||
|
break |
||||||
|
case 6:return this.$=a[s-1] |
||||||
|
case 13:this.$={} |
||||||
|
break |
||||||
|
case 14:this.$=a[s-1] |
||||||
|
break |
||||||
|
case 15:this.$=[a[s-2],a[s]] |
||||||
|
break |
||||||
|
case 16:this.$={},this.$[a[s][0]]=a[s][1] |
||||||
|
break |
||||||
|
case 17:this.$=a[s-2],a[s-2][a[s][0]]=a[s][1] |
||||||
|
break |
||||||
|
case 18:this.$=[] |
||||||
|
break |
||||||
|
case 19:this.$=a[s-1] |
||||||
|
break |
||||||
|
case 20:this.$=[a[s]] |
||||||
|
break |
||||||
|
case 21:this.$=a[s-2],a[s-2].push(a[s])}},table:[{3:5,4:[1,12],5:6,6:[1,13],7:3,8:[1,9],9:4,10:[1,10],11:[1,11],12:1,13:2,15:7,16:8,17:[1,14],23:[1,15]},{1:[3]},{14:[1,16]},{14:[2,7],18:[2,7],22:[2,7],24:[2,7]},{14:[2,8],18:[2,8],22:[2,8],24:[2,8]},{14:[2,9],18:[2,9],22:[2,9],24:[2,9]},{14:[2,10],18:[2,10],22:[2,10],24:[2,10]},{14:[2,11],18:[2,11],22:[2,11],24:[2,11]},{14:[2,12],18:[2,12],22:[2,12],24:[2,12]},{14:[2,3],18:[2,3],22:[2,3],24:[2,3]},{14:[2,4],18:[2,4],22:[2,4],24:[2,4]},{14:[2,5],18:[2,5],22:[2,5],24:[2,5]},{14:[2,1],18:[2,1],21:[2,1],22:[2,1],24:[2,1]},{14:[2,2],18:[2,2],22:[2,2],24:[2,2]},{3:20,4:[1,12],18:[1,17],19:18,20:19},{3:5,4:[1,12],5:6,6:[1,13],7:3,8:[1,9],9:4,10:[1,10],11:[1,11],13:23,15:7,16:8,17:[1,14],23:[1,15],24:[1,21],25:22},{1:[2,6]},{14:[2,13],18:[2,13],22:[2,13],24:[2,13]},{18:[1,24],22:[1,25]},{18:[2,16],22:[2,16]},{21:[1,26]},{14:[2,18],18:[2,18],22:[2,18],24:[2,18]},{22:[1,28],24:[1,27]},{22:[2,20],24:[2,20]},{14:[2,14],18:[2,14],22:[2,14],24:[2,14]},{3:20,4:[1,12],20:29},{3:5,4:[1,12],5:6,6:[1,13],7:3,8:[1,9],9:4,10:[1,10],11:[1,11],13:30,15:7,16:8,17:[1,14],23:[1,15]},{14:[2,19],18:[2,19],22:[2,19],24:[2,19]},{3:5,4:[1,12],5:6,6:[1,13],7:3,8:[1,9],9:4,10:[1,10],11:[1,11],13:31,15:7,16:8,17:[1,14],23:[1,15]},{18:[2,17],22:[2,17]},{18:[2,15],22:[2,15]},{22:[2,21],24:[2,21]}],defaultActions:{16:[2,6]},parseError:function(e){throw new Error(e)},parse:function(e){var t=this,r=[0],n=[null],i=[],a=this.table,s="",o=0,l=0,c=0 |
||||||
|
this.lexer.setInput(e),this.lexer.yy=this.yy,this.yy.lexer=this.lexer,void 0===this.lexer.yylloc&&(this.lexer.yylloc={}) |
||||||
|
var u=this.lexer.yylloc |
||||||
|
function f(){var e |
||||||
|
return"number"!=typeof(e=t.lexer.lex()||1)&&(e=t.symbols_[e]||e),e}i.push(u),"function"==typeof this.yy.parseError&&(this.parseError=this.yy.parseError) |
||||||
|
for(var h,p,d,y,m,v,g,b,x,k,w={};;){if(d=r[r.length-1],this.defaultActions[d]?y=this.defaultActions[d]:(null==h&&(h=f()),y=a[d]&&a[d][h]),void 0===y||!y.length||!y[0]){if(!c){for(v in x=[],a[d])this.terminals_[v]&&v>2&&x.push("'"+this.terminals_[v]+"'") |
||||||
|
var _="" |
||||||
|
_=this.lexer.showPosition?"Parse error on line "+(o+1)+":\n"+this.lexer.showPosition()+"\nExpecting "+x.join(", ")+", got '"+this.terminals_[h]+"'":"Parse error on line "+(o+1)+": Unexpected "+(1==h?"end of input":"'"+(this.terminals_[h]||h)+"'"),this.parseError(_,{text:this.lexer.match,token:this.terminals_[h]||h,line:this.lexer.yylineno,loc:u,expected:x})}if(3==c){if(1==h)throw new Error(_||"Parsing halted.") |
||||||
|
l=this.lexer.yyleng,s=this.lexer.yytext,o=this.lexer.yylineno,u=this.lexer.yylloc,h=f()}for(;!(2..toString()in a[d]);){if(0==d)throw new Error(_||"Parsing halted.") |
||||||
|
k=1,r.length=r.length-2*k,n.length=n.length-k,i.length=i.length-k,d=r[r.length-1]}p=h,h=2,y=a[d=r[r.length-1]]&&a[d][2],c=3}if(y[0]instanceof Array&&y.length>1)throw new Error("Parse Error: multiple actions possible at state: "+d+", token: "+h) |
||||||
|
switch(y[0]){case 1:r.push(h),n.push(this.lexer.yytext),i.push(this.lexer.yylloc),r.push(y[1]),h=null,p?(h=p,p=null):(l=this.lexer.yyleng,s=this.lexer.yytext,o=this.lexer.yylineno,u=this.lexer.yylloc,c>0&&c--) |
||||||
|
break |
||||||
|
case 2:if(g=this.productions_[y[1]][1],w.$=n[n.length-g],w._$={first_line:i[i.length-(g||1)].first_line,last_line:i[i.length-1].last_line,first_column:i[i.length-(g||1)].first_column,last_column:i[i.length-1].last_column},void 0!==(m=this.performAction.call(w,s,l,o,this.yy,y[1],n,i)))return m |
||||||
|
g&&(r=r.slice(0,-1*g*2),n=n.slice(0,-1*g),i=i.slice(0,-1*g)),r.push(this.productions_[y[1]][0]),n.push(w.$),i.push(w._$),b=a[r[r.length-2]][r[r.length-1]],r.push(b) |
||||||
|
break |
||||||
|
case 3:return!0}}return!0}},t=function(){var e={EOF:1,parseError:function(e,t){if(!this.yy.parseError)throw new Error(e) |
||||||
|
this.yy.parseError(e,t)},setInput:function(e){return this._input=e,this._more=this._less=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this},input:function(){var e=this._input[0] |
||||||
|
return this.yytext+=e,this.yyleng++,this.match+=e,this.matched+=e,e.match(/\n/)&&this.yylineno++,this._input=this._input.slice(1),e},unput:function(e){return this._input=e+this._input,this},more:function(){return this._more=!0,this},less:function(e){this._input=this.match.slice(e)+this._input},pastInput:function(){var e=this.matched.substr(0,this.matched.length-this.match.length) |
||||||
|
return(e.length>20?"...":"")+e.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var e=this.match |
||||||
|
return e.length<20&&(e+=this._input.substr(0,20-e.length)),(e.substr(0,20)+(e.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var e=this.pastInput(),t=new Array(e.length+1).join("-") |
||||||
|
return e+this.upcomingInput()+"\n"+t+"^"},next:function(){if(this.done)return this.EOF |
||||||
|
var e,t,r,n,i |
||||||
|
this._input||(this.done=!0),this._more||(this.yytext="",this.match="") |
||||||
|
for(var a=this._currentRules(),s=0;s<a.length&&(!(r=this._input.match(this.rules[a[s]]))||t&&!(r[0].length>t[0].length)||(t=r,n=s,this.options.flex));s++);return t?((i=t[0].match(/\n.*/g))&&(this.yylineno+=i.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:i?i[i.length-1].length-1:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.yyleng=this.yytext.length,this._more=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],e=this.performAction.call(this,this.yy,this,a[n],this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),e||void 0):""===this._input?this.EOF:void this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var e=this.next() |
||||||
|
return void 0!==e?e:this.lex()},begin:function(e){this.conditionStack.push(e)},popState:function(){return this.conditionStack.pop()},_currentRules:function(){return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules},topState:function(){return this.conditionStack[this.conditionStack.length-2]},pushState:function(e){this.begin(e)},options:{},performAction:function(e,t,r){switch(r){case 0:break |
||||||
|
case 1:return 6 |
||||||
|
case 2:return t.yytext=t.yytext.substr(1,t.yyleng-2),4 |
||||||
|
case 3:return 17 |
||||||
|
case 4:return 18 |
||||||
|
case 5:return 23 |
||||||
|
case 6:return 24 |
||||||
|
case 7:return 22 |
||||||
|
case 8:return 21 |
||||||
|
case 9:return 10 |
||||||
|
case 10:return 11 |
||||||
|
case 11:return 8 |
||||||
|
case 12:return 14 |
||||||
|
case 13:return"INVALID"}},rules:[/^(?:\s+)/,/^(?:(-?([0-9]|[1-9][0-9]+))(\.[0-9]+)?([eE][-+]?[0-9]+)?\b)/,/^(?:"(?:\\[\\"bfnrt/]|\\u[a-fA-F0-9]{4}|[^\\\0-\x09\x0a-\x1f"])*")/,/^(?:\{)/,/^(?:\})/,/^(?:\[)/,/^(?:\])/,/^(?:,)/,/^(?::)/,/^(?:true\b)/,/^(?:false\b)/,/^(?:null\b)/,/^(?:$)/,/^(?:.)/],conditions:{INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,10,11,12,13],inclusive:!0}}} |
||||||
|
return e}() |
||||||
|
return e.lexer=t,e}() |
||||||
|
"undefined"!=typeof require&&"undefined"!=typeof exports&&(exports.parser=jsonlint,exports.parse=function(){return jsonlint.parse.apply(jsonlint,arguments)},exports.main=function(e){if(!e[1])throw new Error("Usage: "+e[0]+" FILE") |
||||||
|
if("undefined"!=typeof process)var t=require("fs").readFileSync(require("path").join(process.cwd(),e[1]),"utf8") |
||||||
|
else t=require("file").path(require("file").cwd()).join(e[1]).read({charset:"utf-8"}) |
||||||
|
return exports.parser.parse(t)},"undefined"!=typeof module&&require.main===module&&exports.main("undefined"!=typeof process?process.argv.slice(1):require("system").args)),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}((function(e){"use strict" |
||||||
|
function t(e,t,r){return/^(?:operator|sof|keyword c|case|new|[\[{}\(,;:]|=>)$/.test(t.lastType)||"quasi"==t.lastType&&/\{\s*$/.test(e.string.slice(0,e.pos-(r||0)))}e.defineMode("javascript",(function(r,n){var i,a,s=r.indentUnit,o=n.statementIndent,l=n.jsonld,c=n.json||l,u=n.typescript,f=n.wordCharacters||/[\w$\xa1-\uffff]/,h=function(){function e(e){return{type:e,style:"keyword"}}var t=e("keyword a"),r=e("keyword b"),n=e("keyword c"),i=e("operator"),a={type:"atom",style:"atom"},s={if:e("if"),while:t,with:t,else:r,do:r,try:r,finally:r,return:n,break:n,continue:n,new:e("new"),delete:n,throw:n,debugger:n,var:e("var"),const:e("var"),let:e("var"),function:e("function"),catch:e("catch"),for:e("for"),switch:e("switch"),case:e("case"),default:e("default"),in:i,typeof:i,instanceof:i,true:a,false:a,null:a,undefined:a,NaN:a,Infinity:a,this:e("this"),class:e("class"),super:e("atom"),yield:n,export:e("export"),import:e("import"),extends:n,await:n,async:e("async")} |
||||||
|
if(u){var o={type:"variable",style:"variable-3"},l={interface:e("class"),implements:n,namespace:n,module:e("module"),enum:e("module"),public:e("modifier"),private:e("modifier"),protected:e("modifier"),abstract:e("modifier"),as:i,string:o,number:o,boolean:o,any:o} |
||||||
|
for(var c in l)s[c]=l[c]}return s}(),p=/[+\-*&%=<>!?|~^]/,d=/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/ |
||||||
|
function y(e,t,r){return i=e,a=r,t}function m(e,r){var n,i=e.next() |
||||||
|
if('"'==i||"'"==i)return r.tokenize=(n=i,function(e,t){var r,i=!1 |
||||||
|
if(l&&"@"==e.peek()&&e.match(d))return t.tokenize=m,y("jsonld-keyword","meta") |
||||||
|
for(;null!=(r=e.next())&&(r!=n||i);)i=!i&&"\\"==r |
||||||
|
return i||(t.tokenize=m),y("string","string")}),r.tokenize(e,r) |
||||||
|
if("."==i&&e.match(/^\d+(?:[eE][+\-]?\d+)?/))return y("number","number") |
||||||
|
if("."==i&&e.match(".."))return y("spread","meta") |
||||||
|
if(/[\[\]{}\(\),;\:\.]/.test(i))return y(i) |
||||||
|
if("="==i&&e.eat(">"))return y("=>","operator") |
||||||
|
if("0"==i&&e.eat(/x/i))return e.eatWhile(/[\da-f]/i),y("number","number") |
||||||
|
if("0"==i&&e.eat(/o/i))return e.eatWhile(/[0-7]/i),y("number","number") |
||||||
|
if("0"==i&&e.eat(/b/i))return e.eatWhile(/[01]/i),y("number","number") |
||||||
|
if(/\d/.test(i))return e.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/),y("number","number") |
||||||
|
if("/"==i)return e.eat("*")?(r.tokenize=v,v(e,r)):e.eat("/")?(e.skipToEnd(),y("comment","comment")):t(e,r,1)?(function(e){for(var t,r=!1,n=!1;null!=(t=e.next());){if(!r){if("/"==t&&!n)return |
||||||
|
"["==t?n=!0:n&&"]"==t&&(n=!1)}r=!r&&"\\"==t}}(e),e.match(/^\b(([gimyu])(?![gimyu]*\2))+\b/),y("regexp","string-2")):(e.eatWhile(p),y("operator","operator",e.current())) |
||||||
|
if("`"==i)return r.tokenize=g,g(e,r) |
||||||
|
if("#"==i)return e.skipToEnd(),y("error","error") |
||||||
|
if(p.test(i))return e.eatWhile(p),y("operator","operator",e.current()) |
||||||
|
if(f.test(i)){e.eatWhile(f) |
||||||
|
var a=e.current(),s=h.propertyIsEnumerable(a)&&h[a] |
||||||
|
return s&&"."!=r.lastType?y(s.type,s.style,a):y("variable","variable",a)}}function v(e,t){for(var r,n=!1;r=e.next();){if("/"==r&&n){t.tokenize=m |
||||||
|
break}n="*"==r}return y("comment","comment")}function g(e,t){for(var r,n=!1;null!=(r=e.next());){if(!n&&("`"==r||"$"==r&&e.eat("{"))){t.tokenize=m |
||||||
|
break}n=!n&&"\\"==r}return y("quasi","string-2",e.current())}function b(e,t){t.fatArrowAt&&(t.fatArrowAt=null) |
||||||
|
var r=e.string.indexOf("=>",e.start) |
||||||
|
if(!(r<0)){for(var n=0,i=!1,a=r-1;a>=0;--a){var s=e.string.charAt(a),o="([{}])".indexOf(s) |
||||||
|
if(o>=0&&o<3){if(!n){++a |
||||||
|
break}if(0==--n)break}else if(o>=3&&o<6)++n |
||||||
|
else if(f.test(s))i=!0 |
||||||
|
else{if(/["'\/]/.test(s))return |
||||||
|
if(i&&!n){++a |
||||||
|
break}}}i&&!n&&(t.fatArrowAt=a)}}var x={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,this:!0,"jsonld-keyword":!0} |
||||||
|
function k(e,t,r,n,i,a){this.indented=e,this.column=t,this.type=r,this.prev=i,this.info=a,null!=n&&(this.align=n)}function w(e,t){for(var r=e.localVars;r;r=r.next)if(r.name==t)return!0 |
||||||
|
for(var n=e.context;n;n=n.prev)for(r=n.vars;r;r=r.next)if(r.name==t)return!0}var _={state:null,column:null,marked:null,cc:null} |
||||||
|
function E(){for(var e=arguments.length-1;e>=0;e--)_.cc.push(arguments[e])}function j(){return E.apply(null,arguments),!0}function S(e){function t(t){for(var r=t;r;r=r.next)if(r.name==e)return!0 |
||||||
|
return!1}var r=_.state |
||||||
|
if(_.marked="def",r.context){if(t(r.localVars))return |
||||||
|
r.localVars={name:e,next:r.localVars}}else{if(t(r.globalVars))return |
||||||
|
n.globalVars&&(r.globalVars={name:e,next:r.globalVars})}}var I={name:"this",next:{name:"arguments"}} |
||||||
|
function $(){_.state.context={prev:_.state.context,vars:_.state.localVars},_.state.localVars=I}function A(){_.state.localVars=_.state.context.vars,_.state.context=_.state.context.prev}function M(e,t){var r=function(){var r=_.state,n=r.indented |
||||||
|
if("stat"==r.lexical.type)n=r.lexical.indented |
||||||
|
else for(var i=r.lexical;i&&")"==i.type&&i.align;i=i.prev)n=i.indented |
||||||
|
r.lexical=new k(n,_.stream.column(),e,null,r.lexical,t)} |
||||||
|
return r.lex=!0,r}function N(){var e=_.state |
||||||
|
e.lexical.prev&&(")"==e.lexical.type&&(e.indented=e.lexical.indented),e.lexical=e.lexical.prev)}function O(e){return function t(r){return r==e?j():";"==e?E():j(t)}}function V(e,t){return"var"==e?j(M("vardef",t.length),ae,O(";"),N):"keyword a"==e?j(M("form"),T,V,N):"keyword b"==e?j(M("form"),V,N):"{"==e?j(M("}"),ee,N):";"==e?j():"if"==e?("else"==_.state.lexical.info&&_.state.cc[_.state.cc.length-1]==N&&_.state.cc.pop()(),j(M("form"),T,V,N,ue)):"function"==e?j(me):"for"==e?j(M("form"),fe,V,N):"variable"==e?j(M("stat"),D):"switch"==e?j(M("form"),T,M("}","switch"),O("{"),ee,N,N):"case"==e?j(T,O(":")):"default"==e?j(O(":")):"catch"==e?j(M("form"),$,O("("),ve,O(")"),V,N,A):"class"==e?j(M("form"),ge,N):"export"==e?j(M("stat"),we,N):"import"==e?j(M("stat"),_e,N):"module"==e?j(M("form"),se,M("}"),O("{"),ee,N,N):"async"==e?j(V):E(M("stat"),T,O(";"),N)}function T(e){return L(e,!1)}function z(e){return L(e,!0)}function L(e,t){if(_.state.fatArrowAt==_.stream.start){var r=t?W:C |
||||||
|
if("("==e)return j($,M(")"),Y(se,")"),N,O("=>"),r,A) |
||||||
|
if("variable"==e)return E($,se,O("=>"),r,A)}var n=t?F:J |
||||||
|
return x.hasOwnProperty(e)?j(n):"function"==e?j(me,n):"keyword c"==e?j(t?P:q):"("==e?j(M(")"),q,Ae,O(")"),N,n):"operator"==e||"spread"==e?j(t?z:T):"["==e?j(M("]"),Ie,N,n):"{"==e?Z(K,"}",null,n):"quasi"==e?E(U,n):"new"==e?j(function(e){return function(t){return"."==t?j(e?G:B):E(e?z:T)}}(t)):j()}function q(e){return e.match(/[;\}\)\],]/)?E():E(T)}function P(e){return e.match(/[;\}\)\],]/)?E():E(z)}function J(e,t){return","==e?j(T):F(e,t,!1)}function F(e,t,r){var n=0==r?J:F,i=0==r?T:z |
||||||
|
return"=>"==e?j($,r?W:C,A):"operator"==e?/\+\+|--/.test(t)?j(n):"?"==t?j(T,O(":"),i):j(i):"quasi"==e?E(U,n):";"!=e?"("==e?Z(z,")","call",n):"."==e?j(H,n):"["==e?j(M("]"),q,O("]"),N,n):void 0:void 0}function U(e,t){return"quasi"!=e?E():"${"!=t.slice(t.length-2)?j(U):j(T,R)}function R(e){if("}"==e)return _.marked="string-2",_.state.tokenize=g,j(U)}function C(e){return b(_.stream,_.state),E("{"==e?V:T)}function W(e){return b(_.stream,_.state),E("{"==e?V:z)}function B(e,t){if("target"==t)return _.marked="keyword",j(J)}function G(e,t){if("target"==t)return _.marked="keyword",j(F)}function D(e){return":"==e?j(N,V):E(J,O(";"),N)}function H(e){if("variable"==e)return _.marked="property",j()}function K(e,t){return"variable"==e||"keyword"==_.style?(_.marked="property",j("get"==t||"set"==t?Q:X)):"number"==e||"string"==e?(_.marked=l?"property":_.style+" property",j(X)):"jsonld-keyword"==e?j(X):"modifier"==e?j(K):"["==e?j(T,O("]"),X):"spread"==e?j(T):void 0}function Q(e){return"variable"!=e?E(X):(_.marked="property",j(me))}function X(e){return":"==e?j(z):"("==e?E(me):void 0}function Y(e,t){function r(n,i){if(","==n){var a=_.state.lexical |
||||||
|
return"call"==a.info&&(a.pos=(a.pos||0)+1),j(e,r)}return n==t||i==t?j():j(O(t))}return function(n,i){return n==t||i==t?j():E(e,r)}}function Z(e,t,r){for(var n=3;n<arguments.length;n++)_.cc.push(arguments[n]) |
||||||
|
return j(M(t,r),Y(e,t),N)}function ee(e){return"}"==e?j():E(V,ee)}function te(e){if(u&&":"==e)return j(ne)}function re(e,t){if("="==t)return j(z)}function ne(e){if("variable"==e)return _.marked="variable-3",j(ie)}function ie(e,t){return"<"==t?j(Y(ne,">"),ie):"["==e?j(O("]"),ie):void 0}function ae(){return E(se,te,le,ce)}function se(e,t){return"modifier"==e?j(se):"variable"==e?(S(t),j()):"spread"==e?j(se):"["==e?Z(se,"]"):"{"==e?Z(oe,"}"):void 0}function oe(e,t){return"variable"!=e||_.stream.match(/^\s*:/,!1)?("variable"==e&&(_.marked="property"),"spread"==e?j(se):"}"==e?E():j(O(":"),se,le)):(S(t),j(le))}function le(e,t){if("="==t)return j(z)}function ce(e){if(","==e)return j(ae)}function ue(e,t){if("keyword b"==e&&"else"==t)return j(M("form","else"),V,N)}function fe(e){if("("==e)return j(M(")"),he,O(")"),N)}function he(e){return"var"==e?j(ae,O(";"),de):";"==e?j(de):"variable"==e?j(pe):E(T,O(";"),de)}function pe(e,t){return"in"==t||"of"==t?(_.marked="keyword",j(T)):j(J,de)}function de(e,t){return";"==e?j(ye):"in"==t||"of"==t?(_.marked="keyword",j(T)):E(T,O(";"),ye)}function ye(e){")"!=e&&j(T)}function me(e,t){return"*"==t?(_.marked="keyword",j(me)):"variable"==e?(S(t),j(me)):"("==e?j($,M(")"),Y(ve,")"),N,te,V,A):void 0}function ve(e){return"spread"==e?j(ve):E(se,te,re)}function ge(e,t){if("variable"==e)return S(t),j(be)}function be(e,t){return"extends"==t?j(T,be):"{"==e?j(M("}"),xe,N):void 0}function xe(e,t){return"variable"==e||"keyword"==_.style?"static"==t?(_.marked="keyword",j(xe)):(_.marked="property","get"==t||"set"==t?j(ke,me,xe):j(me,xe)):"*"==t?(_.marked="keyword",j(xe)):";"==e?j(xe):"}"==e?j():void 0}function ke(e){return"variable"!=e?E():(_.marked="property",j())}function we(e,t){return"*"==t?(_.marked="keyword",j(Se,O(";"))):"default"==t?(_.marked="keyword",j(T,O(";"))):E(V)}function _e(e){return"string"==e?j():E(Ee,Se)}function Ee(e,t){return"{"==e?Z(Ee,"}"):("variable"==e&&S(t),"*"==t&&(_.marked="keyword"),j(je))}function je(e,t){if("as"==t)return _.marked="keyword",j(Ee)}function Se(e,t){if("from"==t)return _.marked="keyword",j(T)}function Ie(e){return"]"==e?j():E(z,$e)}function $e(e){return"for"==e?E(Ae,O("]")):","==e?j(Y(P,"]")):E(Y(z,"]"))}function Ae(e){return"for"==e?j(fe,Ae):"if"==e?j(T,Ae):void 0}return N.lex=!0,{startState:function(e){var t={tokenize:m,lastType:"sof",cc:[],lexical:new k((e||0)-s,0,"block",!1),localVars:n.localVars,context:n.localVars&&{vars:n.localVars},indented:e||0} |
||||||
|
return n.globalVars&&"object"==typeof n.globalVars&&(t.globalVars=n.globalVars),t},token:function(e,t){if(e.sol()&&(t.lexical.hasOwnProperty("align")||(t.lexical.align=!1),t.indented=e.indentation(),b(e,t)),t.tokenize!=v&&e.eatSpace())return null |
||||||
|
var r=t.tokenize(e,t) |
||||||
|
return"comment"==i?r:(t.lastType="operator"!=i||"++"!=a&&"--"!=a?i:"incdec",function(e,t,r,n,i){var a=e.cc |
||||||
|
for(_.state=e,_.stream=i,_.marked=null,_.cc=a,_.style=t,e.lexical.hasOwnProperty("align")||(e.lexical.align=!0);;){if((a.length?a.pop():c?T:V)(r,n)){for(;a.length&&a[a.length-1].lex;)a.pop()() |
||||||
|
return _.marked?_.marked:"variable"==r&&w(e,n)?"variable-2":t}}}(t,r,i,a,e))},indent:function(t,r){if(t.tokenize==v)return e.Pass |
||||||
|
if(t.tokenize!=m)return 0 |
||||||
|
var i=r&&r.charAt(0),a=t.lexical |
||||||
|
if(!/^\s*else\b/.test(r))for(var l=t.cc.length-1;l>=0;--l){var c=t.cc[l] |
||||||
|
if(c==N)a=a.prev |
||||||
|
else if(c!=ue)break}"stat"==a.type&&"}"==i&&(a=a.prev),o&&")"==a.type&&"stat"==a.prev.type&&(a=a.prev) |
||||||
|
var u=a.type,f=i==u |
||||||
|
return"vardef"==u?a.indented+("operator"==t.lastType||","==t.lastType?a.info+1:0):"form"==u&&"{"==i?a.indented:"form"==u?a.indented+s:"stat"==u?a.indented+(function(e,t){return"operator"==e.lastType||","==e.lastType||p.test(t.charAt(0))||/[,.]/.test(t.charAt(0))}(t,r)?o||s:0):"switch"!=a.info||f||0==n.doubleIndentSwitch?a.align?a.column+(f?0:1):a.indented+(f?0:s):a.indented+(/^(?:case|default)\b/.test(r)?s:2*s)},electricInput:/^\s*(?:case .*?:|default:|\{|\})$/,blockCommentStart:c?null:"/*",blockCommentEnd:c?null:"*/",lineComment:c?null:"//",fold:"brace",closeBrackets:"()[]{}''\"\"``",helperType:c?"json":"javascript",jsonldMode:l,jsonMode:c,expressionAllowed:t,skipExpression:function(e){var t=e.cc[e.cc.length-1] |
||||||
|
t!=T&&t!=z||e.cc.pop()}}})),e.registerHelper("wordChars","javascript",/[\w$]/),e.defineMIME("text/javascript","javascript"),e.defineMIME("text/ecmascript","javascript"),e.defineMIME("application/javascript","javascript"),e.defineMIME("application/x-javascript","javascript"),e.defineMIME("application/ecmascript","javascript"),e.defineMIME("application/json",{name:"javascript",json:!0}),e.defineMIME("application/x-json",{name:"javascript",json:!0}),e.defineMIME("application/ld+json",{name:"javascript",jsonld:!0}),e.defineMIME("text/typescript",{name:"javascript",typescript:!0}),e.defineMIME("application/typescript",{name:"javascript",typescript:!0})})) |
@ -0,0 +1,38 @@ |
|||||||
|
(function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)})((function(e){"use strict" |
||||||
|
e.defineMode("ruby",(function(e){function t(e){for(var t={},n=0,r=e.length;n<r;++n)t[e[n]]=!0 |
||||||
|
return t}var n,r=t(["alias","and","BEGIN","begin","break","case","class","def","defined?","do","else","elsif","END","end","ensure","false","for","if","in","module","next","not","or","redo","rescue","retry","return","self","super","then","true","undef","unless","until","when","while","yield","nil","raise","throw","catch","fail","loop","callcc","caller","lambda","proc","public","protected","private","require","load","require_relative","extend","autoload","__END__","__FILE__","__LINE__","__dir__"]),i=t(["def","class","case","for","while","until","module","then","catch","loop","proc","begin"]),o=t(["end","until"]),a={"[":"]","{":"}","(":")"} |
||||||
|
function u(e,t,n){return n.tokenize.push(e),e(t,n)}function f(e,t){if(e.sol()&&e.match("=begin")&&e.eol())return t.tokenize.push(s),"comment" |
||||||
|
if(e.eatSpace())return null |
||||||
|
var r,i,o=e.next() |
||||||
|
if("`"==o||"'"==o||'"'==o)return u(c(o,"string",'"'==o||"`"==o),e,t) |
||||||
|
if("/"==o){var f=e.current().length |
||||||
|
if(e.skipTo("/")){var l=e.current().length |
||||||
|
e.backUp(e.current().length-f) |
||||||
|
for(var d=0;e.current().length<l;){var p=e.next() |
||||||
|
if("("==p?d+=1:")"==p&&(d-=1),d<0)break}if(e.backUp(e.current().length-f),0==d)return u(c(o,"string-2",!0),e,t)}return"operator"}if("%"==o){var k="string",h=!0 |
||||||
|
e.eat("s")?k="atom":e.eat(/[WQ]/)?k="string":e.eat(/[r]/)?k="string-2":e.eat(/[wxq]/)&&(k="string",h=!1) |
||||||
|
var m=e.eat(/[^\w\s=]/) |
||||||
|
return m?(a.propertyIsEnumerable(m)&&(m=a[m]),u(c(m,k,h,!0),e,t)):"operator"}if("#"==o)return e.skipToEnd(),"comment" |
||||||
|
if("<"==o&&(r=e.match(/^<-?[\`\"\']?([a-zA-Z_?]\w*)[\`\"\']?(?:;|$)/)))return u((i=r[1],function(e,t){return e.match(i)?t.tokenize.pop():e.skipToEnd(),"string"}),e,t) |
||||||
|
if("0"==o)return e.eat("x")?e.eatWhile(/[\da-fA-F]/):e.eat("b")?e.eatWhile(/[01]/):e.eatWhile(/[0-7]/),"number" |
||||||
|
if(/\d/.test(o))return e.match(/^[\d_]*(?:\.[\d_]+)?(?:[eE][+\-]?[\d_]+)?/),"number" |
||||||
|
if("?"==o){for(;e.match(/^\\[CM]-/););return e.eat("\\")?e.eatWhile(/\w/):e.next(),"string"}if(":"==o)return e.eat("'")?u(c("'","atom",!1),e,t):e.eat('"')?u(c('"',"atom",!0),e,t):e.eat(/[\<\>]/)?(e.eat(/[\<\>]/),"atom"):e.eat(/[\+\-\*\/\&\|\:\!]/)?"atom":e.eat(/[a-zA-Z$@_\xa1-\uffff]/)?(e.eatWhile(/[\w$\xa1-\uffff]/),e.eat(/[\?\!\=]/),"atom"):"operator" |
||||||
|
if("@"==o&&e.match(/^@?[a-zA-Z_\xa1-\uffff]/))return e.eat("@"),e.eatWhile(/[\w\xa1-\uffff]/),"variable-2" |
||||||
|
if("$"==o)return e.eat(/[a-zA-Z_]/)?e.eatWhile(/[\w]/):e.eat(/\d/)?e.eat(/\d/):e.next(),"variable-3" |
||||||
|
if(/[a-zA-Z_\xa1-\uffff]/.test(o))return e.eatWhile(/[\w\xa1-\uffff]/),e.eat(/[\?\!]/),e.eat(":")?"atom":"ident" |
||||||
|
if("|"!=o||!t.varList&&"{"!=t.lastTok&&"do"!=t.lastTok){if(/[\(\)\[\]{}\\;]/.test(o))return n=o,null |
||||||
|
if("-"==o&&e.eat(">"))return"arrow" |
||||||
|
if(/[=+\-\/*:\.^%<>~|]/.test(o)){var x=e.eatWhile(/[=+\-\/*:\.^%<>~|]/) |
||||||
|
return"."!=o||x||(n="."),"operator"}return null}return n="|",null}function l(e){return e||(e=1),function(t,n){if("}"==t.peek()){if(1==e)return n.tokenize.pop(),n.tokenize[n.tokenize.length-1](t,n) |
||||||
|
n.tokenize[n.tokenize.length-1]=l(e-1)}else"{"==t.peek()&&(n.tokenize[n.tokenize.length-1]=l(e+1)) |
||||||
|
return f(t,n)}}function d(){var e=!1 |
||||||
|
return function(t,n){return e?(n.tokenize.pop(),n.tokenize[n.tokenize.length-1](t,n)):(e=!0,f(t,n))}}function c(e,t,n,r){return function(i,o){var a,u=!1 |
||||||
|
for("read-quoted-paused"===o.context.type&&(o.context=o.context.prev,i.eat("}"));null!=(a=i.next());){if(a==e&&(r||!u)){o.tokenize.pop() |
||||||
|
break}if(n&&"#"==a&&!u){if(i.eat("{")){"}"==e&&(o.context={prev:o.context,type:"read-quoted-paused"}),o.tokenize.push(l()) |
||||||
|
break}if(/[@\$]/.test(i.peek())){o.tokenize.push(d()) |
||||||
|
break}}u=!u&&"\\"==a}return t}}function s(e,t){return e.sol()&&e.match("=end")&&e.eol()&&t.tokenize.pop(),e.skipToEnd(),"comment"}return{startState:function(){return{tokenize:[f],indented:0,context:{type:"top",indented:-e.indentUnit},continuedLine:!1,lastTok:null,varList:!1}},token:function(e,t){n=null,e.sol()&&(t.indented=e.indentation()) |
||||||
|
var a,u=t.tokenize[t.tokenize.length-1](e,t),f=n |
||||||
|
if("ident"==u){var l=e.current() |
||||||
|
"keyword"==(u="."==t.lastTok?"property":r.propertyIsEnumerable(e.current())?"keyword":/^[A-Z]/.test(l)?"tag":"def"==t.lastTok||"class"==t.lastTok||t.varList?"def":"variable")&&(f=l,i.propertyIsEnumerable(l)?a="indent":o.propertyIsEnumerable(l)?a="dedent":"if"!=l&&"unless"!=l||e.column()!=e.indentation()?"do"==l&&t.context.indented<t.indented&&(a="indent"):a="indent")}return(n||u&&"comment"!=u)&&(t.lastTok=f),"|"==n&&(t.varList=!t.varList),"indent"==a||/[\(\[\{]/.test(n)?t.context={prev:t.context,type:n||u,indented:t.indented}:("dedent"==a||/[\)\]\}]/.test(n))&&t.context.prev&&(t.context=t.context.prev),e.eol()&&(t.continuedLine="\\"==n||"operator"==u),u},indent:function(t,n){if(t.tokenize[t.tokenize.length-1]!=f)return 0 |
||||||
|
var r=n&&n.charAt(0),i=t.context,o=i.type==a[r]||"keyword"==i.type&&/^(?:end|until|else|elsif|when|rescue)\b/.test(n) |
||||||
|
return i.indented+(o?0:e.indentUnit)+(t.continuedLine?e.indentUnit:0)},electricInput:/^\s*(?:end|rescue|\})$/,lineComment:"#"}})),e.defineMIME("text/x-ruby","ruby")})) |
@ -0,0 +1,37 @@ |
|||||||
|
(function(t){"object"==typeof exports&&"object"==typeof module?t(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],t):t(CodeMirror)})((function(t){"use strict" |
||||||
|
var e={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},n={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,caseFold:!1} |
||||||
|
t.defineMode("xml",(function(r,o){var a,i,l=r.indentUnit,u={},d=o.htmlMode?e:n |
||||||
|
for(var c in d)u[c]=d[c] |
||||||
|
for(var c in o)u[c]=o[c] |
||||||
|
function s(t,e){function n(n){return e.tokenize=n,n(t,e)}var r=t.next() |
||||||
|
return"<"==r?t.eat("!")?t.eat("[")?t.match("CDATA[")?n(m("atom","]]>")):null:t.match("--")?n(m("comment","--\x3e")):t.match("DOCTYPE",!0,!0)?(t.eatWhile(/[\w\._\-]/),n(function t(e){return function(n,r){for(var o;null!=(o=n.next());){if("<"==o)return r.tokenize=t(e+1),r.tokenize(n,r) |
||||||
|
if(">"==o){if(1==e){r.tokenize=s |
||||||
|
break}return r.tokenize=t(e-1),r.tokenize(n,r)}}return"meta"}}(1))):null:t.eat("?")?(t.eatWhile(/[\w\._\-]/),e.tokenize=m("meta","?>"),"meta"):(a=t.eat("/")?"closeTag":"openTag",e.tokenize=f,"tag bracket"):"&"==r?(t.eat("#")?t.eat("x")?t.eatWhile(/[a-fA-F\d]/)&&t.eat(";"):t.eatWhile(/[\d]/)&&t.eat(";"):t.eatWhile(/[\w\.\-:]/)&&t.eat(";"))?"atom":"error":(t.eatWhile(/[^&<]/),null)}function f(t,e){var n,r,o=t.next() |
||||||
|
if(">"==o||"/"==o&&t.eat(">"))return e.tokenize=s,a=">"==o?"endTag":"selfcloseTag","tag bracket" |
||||||
|
if("="==o)return a="equals",null |
||||||
|
if("<"==o){e.tokenize=s,e.state=x,e.tagName=e.tagStart=null |
||||||
|
var i=e.tokenize(t,e) |
||||||
|
return i?i+" tag error":"tag error"}return/[\'\"]/.test(o)?(e.tokenize=(n=o,(r=function(t,e){for(;!t.eol();)if(t.next()==n){e.tokenize=f |
||||||
|
break}return"string"}).isInAttribute=!0,r),e.stringStartCol=t.column(),e.tokenize(t,e)):(t.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function m(t,e){return function(n,r){for(;!n.eol();){if(n.match(e)){r.tokenize=s |
||||||
|
break}n.next()}return t}}function g(t,e,n){this.prev=t.context,this.tagName=e,this.indent=t.indented,this.startOfLine=n,(u.doNotIndent.hasOwnProperty(e)||t.context&&t.context.noIndent)&&(this.noIndent=!0)}function p(t){t.context&&(t.context=t.context.prev)}function h(t,e){for(var n;;){if(!t.context)return |
||||||
|
if(n=t.context.tagName,!u.contextGrabbers.hasOwnProperty(n)||!u.contextGrabbers[n].hasOwnProperty(e))return |
||||||
|
p(t)}}function x(t,e,n){return"openTag"==t?(n.tagStart=e.column(),b):"closeTag"==t?k:x}function b(t,e,n){return"word"==t?(n.tagName=e.current(),i="tag",y):(i="error",b)}function k(t,e,n){if("word"==t){var r=e.current() |
||||||
|
return n.context&&n.context.tagName!=r&&u.implicitlyClosed.hasOwnProperty(n.context.tagName)&&p(n),n.context&&n.context.tagName==r||!1===u.matchClosing?(i="tag",w):(i="tag error",v)}return i="error",v}function w(t,e,n){return"endTag"!=t?(i="error",w):(p(n),x)}function v(t,e,n){return i="error",w(t,0,n)}function y(t,e,n){if("word"==t)return i="attribute",z |
||||||
|
if("endTag"==t||"selfcloseTag"==t){var r=n.tagName,o=n.tagStart |
||||||
|
return n.tagName=n.tagStart=null,"selfcloseTag"==t||u.autoSelfClosers.hasOwnProperty(r)?h(n,r):(h(n,r),n.context=new g(n,r,o==n.indented)),x}return i="error",y}function z(t,e,n){return"equals"==t?N:(u.allowMissing||(i="error"),y(t,0,n))}function N(t,e,n){return"string"==t?T:"word"==t&&u.allowUnquoted?(i="string",y):(i="error",y(t,0,n))}function T(t,e,n){return"string"==t?T:y(t,0,n)}return s.isInText=!0,{startState:function(t){var e={tokenize:s,state:x,indented:t||0,tagName:null,tagStart:null,context:null} |
||||||
|
return null!=t&&(e.baseIndent=t),e},token:function(t,e){if(!e.tagName&&t.sol()&&(e.indented=t.indentation()),t.eatSpace())return null |
||||||
|
a=null |
||||||
|
var n=e.tokenize(t,e) |
||||||
|
return(n||a)&&"comment"!=n&&(i=null,e.state=e.state(a||n,t,e),i&&(n="error"==i?n+" error":i)),n},indent:function(e,n,r){var o=e.context |
||||||
|
if(e.tokenize.isInAttribute)return e.tagStart==e.indented?e.stringStartCol+1:e.indented+l |
||||||
|
if(o&&o.noIndent)return t.Pass |
||||||
|
if(e.tokenize!=f&&e.tokenize!=s)return r?r.match(/^(\s*)/)[0].length:0 |
||||||
|
if(e.tagName)return!1!==u.multilineTagIndentPastTag?e.tagStart+e.tagName.length+2:e.tagStart+l*(u.multilineTagIndentFactor||1) |
||||||
|
if(u.alignCDATA&&/<!\[CDATA\[/.test(n))return 0 |
||||||
|
var a=n&&/^<(\/)?([\w_:\.-]*)/.exec(n) |
||||||
|
if(a&&a[1])for(;o;){if(o.tagName==a[2]){o=o.prev |
||||||
|
break}if(!u.implicitlyClosed.hasOwnProperty(o.tagName))break |
||||||
|
o=o.prev}else if(a)for(;o;){var i=u.contextGrabbers[o.tagName] |
||||||
|
if(!i||!i.hasOwnProperty(a[2]))break |
||||||
|
o=o.prev}for(;o&&o.prev&&!o.startOfLine;)o=o.prev |
||||||
|
return o?o.indent+l:e.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"\x3c!--",blockCommentEnd:"--\x3e",configuration:u.htmlMode?"html":"xml",helperType:u.htmlMode?"html":"xml",skipAttribute:function(t){t.state==N&&(t.state=y)}}})),t.defineMIME("text/xml","xml"),t.defineMIME("application/xml","xml"),t.mimeModes.hasOwnProperty("text/html")||t.defineMIME("text/html",{name:"xml",htmlMode:!0})})) |
@ -0,0 +1 @@ |
|||||||
|
((e,t=("undefined"!=typeof document?document.currentScript.dataset:module.exports))=>{t.routes=JSON.stringify(e)})({dc:{acls:{tokens:{_options:{abilities:["read tokens"]}}}}}) |
@ -0,0 +1 @@ |
|||||||
|
((e,t=("undefined"!=typeof document?document.currentScript.dataset:module.exports))=>{t.services=JSON.stringify(e)})({}) |
@ -0,0 +1 @@ |
|||||||
|
((s,e=("undefined"!=typeof document?document.currentScript.dataset:module.exports))=>{e.routes=JSON.stringify(s)})({dc:{nodes:{show:{sessions:{_options:{path:"/lock-sessions"}}}}}}) |
@ -0,0 +1 @@ |
|||||||
|
((e,t=("undefined"!=typeof document?document.currentScript.dataset:module.exports))=>{t.services=JSON.stringify(e)})({}) |
@ -0,0 +1 @@ |
|||||||
|
((e,t=("undefined"!=typeof document?document.currentScript.dataset:module.exports))=>{t.routes=JSON.stringify(e)})({dc:{nspaces:{_options:{path:"/namespaces",abilities:["read nspaces"]},index:{_options:{path:"/",queryParams:{sortBy:"sort",searchproperty:{as:"searchproperty",empty:[["Name","Description","Role","Policy"]]},search:{as:"filter",replace:!0}}}},edit:{_options:{path:"/:name"}},create:{_options:{template:"../edit",path:"/create",abilities:["create nspaces"]}}}}}) |
@ -0,0 +1 @@ |
|||||||
|
((e,t=("undefined"!=typeof document?document.currentScript.dataset:module.exports))=>{t.services=JSON.stringify(e)})({}) |
@ -0,0 +1 @@ |
|||||||
|
((t,e=("undefined"!=typeof document?document.currentScript.dataset:module.exports))=>{e.routes=JSON.stringify(t)})({dc:{partitions:{_options:{path:"/partitions",abilities:["read partitions"]},index:{_options:{path:"/",queryParams:{sortBy:"sort",searchproperty:{as:"searchproperty",empty:[["Name","Description"]]},search:{as:"filter",replace:!0}}}},edit:{_options:{path:"/:name"}},create:{_options:{template:"../edit",path:"/create",abilities:["create partitions"]}}}}}) |
@ -0,0 +1 @@ |
|||||||
|
((e,t=("undefined"!=typeof document?document.currentScript.dataset:module.exports))=>{t.services=JSON.stringify(e)})({"component:consul/partition/selector":{class:"consul-ui/components/consul/partition/selector"}}) |
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -0,0 +1 @@ |
|||||||
|
((e,r=("undefined"!=typeof document?document.currentScript.dataset:module.exports))=>{r.routes=JSON.stringify(e)})({"oauth-provider-debug":{_options:{path:"/oauth-provider-debug",queryParams:{redirect_uri:"redirect_uri",response_type:"response_type",scope:"scope"}}}}) |
File diff suppressed because one or more lines are too long
@ -0,0 +1 @@ |
|||||||
|
((e,s=("undefined"!=typeof document?document.currentScript.dataset:module.exports))=>{s.services=JSON.stringify(e)})({"route:basic":{class:"consul-ui/routing/route"},"service:intl":{class:"consul-ui/services/i18n"},"service:state":{class:"consul-ui/services/state-with-charts"},"auth-provider:oidc-with-url":{class:"consul-ui/services/auth-providers/oauth2-code-with-url-provider"},"component:consul/partition/selector":{class:"@glimmer/component"}}) |
@ -0,0 +1 @@ |
|||||||
|
((e,i=("undefined"!=typeof document?document.currentScript.dataset:module.exports))=>{i.services=JSON.stringify(e)})({"route:application":{class:"consul-ui/routing/application-debug"},"service:intl":{class:"consul-ui/services/i18n-debug"}}) |
@ -0,0 +1,204 @@ |
|||||||
|
(function(n){"use strict" |
||||||
|
function e(n,e,r){return e<=n&&n<=r}"undefined"!=typeof module&&module.exports&&!n["encoding-indexes"]&&(n["encoding-indexes"]=require("./encoding-indexes-75eea16b259716db4fd162ee283d2ae5.js")["encoding-indexes"]) |
||||||
|
var r=Math.floor |
||||||
|
function i(n){if(void 0===n)return{} |
||||||
|
if(n===Object(n))return n |
||||||
|
throw TypeError("Could not convert argument to dictionary")}function t(n){return 0<=n&&n<=127}var o=t |
||||||
|
function s(n){this.tokens=[].slice.call(n),this.tokens.reverse()}s.prototype={endOfStream:function(){return!this.tokens.length},read:function(){return this.tokens.length?this.tokens.pop():-1},prepend:function(n){if(Array.isArray(n))for(var e=n;e.length;)this.tokens.push(e.pop()) |
||||||
|
else this.tokens.push(n)},push:function(n){if(Array.isArray(n))for(var e=n;e.length;)this.tokens.unshift(e.shift()) |
||||||
|
else this.tokens.unshift(n)}} |
||||||
|
function a(n,e){if(n)throw TypeError("Decoder error") |
||||||
|
return e||65533}function u(n){throw TypeError("The code point "+n+" could not be encoded.")}function l(n){return n=String(n).trim().toLowerCase(),Object.prototype.hasOwnProperty.call(c,n)?c[n]:null}var f=[{encodings:[{labels:["unicode-1-1-utf-8","utf-8","utf8"],name:"UTF-8"}],heading:"The Encoding"},{encodings:[{labels:["866","cp866","csibm866","ibm866"],name:"IBM866"},{labels:["csisolatin2","iso-8859-2","iso-ir-101","iso8859-2","iso88592","iso_8859-2","iso_8859-2:1987","l2","latin2"],name:"ISO-8859-2"},{labels:["csisolatin3","iso-8859-3","iso-ir-109","iso8859-3","iso88593","iso_8859-3","iso_8859-3:1988","l3","latin3"],name:"ISO-8859-3"},{labels:["csisolatin4","iso-8859-4","iso-ir-110","iso8859-4","iso88594","iso_8859-4","iso_8859-4:1988","l4","latin4"],name:"ISO-8859-4"},{labels:["csisolatincyrillic","cyrillic","iso-8859-5","iso-ir-144","iso8859-5","iso88595","iso_8859-5","iso_8859-5:1988"],name:"ISO-8859-5"},{labels:["arabic","asmo-708","csiso88596e","csiso88596i","csisolatinarabic","ecma-114","iso-8859-6","iso-8859-6-e","iso-8859-6-i","iso-ir-127","iso8859-6","iso88596","iso_8859-6","iso_8859-6:1987"],name:"ISO-8859-6"},{labels:["csisolatingreek","ecma-118","elot_928","greek","greek8","iso-8859-7","iso-ir-126","iso8859-7","iso88597","iso_8859-7","iso_8859-7:1987","sun_eu_greek"],name:"ISO-8859-7"},{labels:["csiso88598e","csisolatinhebrew","hebrew","iso-8859-8","iso-8859-8-e","iso-ir-138","iso8859-8","iso88598","iso_8859-8","iso_8859-8:1988","visual"],name:"ISO-8859-8"},{labels:["csiso88598i","iso-8859-8-i","logical"],name:"ISO-8859-8-I"},{labels:["csisolatin6","iso-8859-10","iso-ir-157","iso8859-10","iso885910","l6","latin6"],name:"ISO-8859-10"},{labels:["iso-8859-13","iso8859-13","iso885913"],name:"ISO-8859-13"},{labels:["iso-8859-14","iso8859-14","iso885914"],name:"ISO-8859-14"},{labels:["csisolatin9","iso-8859-15","iso8859-15","iso885915","iso_8859-15","l9"],name:"ISO-8859-15"},{labels:["iso-8859-16"],name:"ISO-8859-16"},{labels:["cskoi8r","koi","koi8","koi8-r","koi8_r"],name:"KOI8-R"},{labels:["koi8-ru","koi8-u"],name:"KOI8-U"},{labels:["csmacintosh","mac","macintosh","x-mac-roman"],name:"macintosh"},{labels:["dos-874","iso-8859-11","iso8859-11","iso885911","tis-620","windows-874"],name:"windows-874"},{labels:["cp1250","windows-1250","x-cp1250"],name:"windows-1250"},{labels:["cp1251","windows-1251","x-cp1251"],name:"windows-1251"},{labels:["ansi_x3.4-1968","ascii","cp1252","cp819","csisolatin1","ibm819","iso-8859-1","iso-ir-100","iso8859-1","iso88591","iso_8859-1","iso_8859-1:1987","l1","latin1","us-ascii","windows-1252","x-cp1252"],name:"windows-1252"},{labels:["cp1253","windows-1253","x-cp1253"],name:"windows-1253"},{labels:["cp1254","csisolatin5","iso-8859-9","iso-ir-148","iso8859-9","iso88599","iso_8859-9","iso_8859-9:1989","l5","latin5","windows-1254","x-cp1254"],name:"windows-1254"},{labels:["cp1255","windows-1255","x-cp1255"],name:"windows-1255"},{labels:["cp1256","windows-1256","x-cp1256"],name:"windows-1256"},{labels:["cp1257","windows-1257","x-cp1257"],name:"windows-1257"},{labels:["cp1258","windows-1258","x-cp1258"],name:"windows-1258"},{labels:["x-mac-cyrillic","x-mac-ukrainian"],name:"x-mac-cyrillic"}],heading:"Legacy single-byte encodings"},{encodings:[{labels:["chinese","csgb2312","csiso58gb231280","gb2312","gb_2312","gb_2312-80","gbk","iso-ir-58","x-gbk"],name:"GBK"},{labels:["gb18030"],name:"gb18030"}],heading:"Legacy multi-byte Chinese (simplified) encodings"},{encodings:[{labels:["big5","big5-hkscs","cn-big5","csbig5","x-x-big5"],name:"Big5"}],heading:"Legacy multi-byte Chinese (traditional) encodings"},{encodings:[{labels:["cseucpkdfmtjapanese","euc-jp","x-euc-jp"],name:"EUC-JP"},{labels:["csiso2022jp","iso-2022-jp"],name:"ISO-2022-JP"},{labels:["csshiftjis","ms932","ms_kanji","shift-jis","shift_jis","sjis","windows-31j","x-sjis"],name:"Shift_JIS"}],heading:"Legacy multi-byte Japanese encodings"},{encodings:[{labels:["cseuckr","csksc56011987","euc-kr","iso-ir-149","korean","ks_c_5601-1987","ks_c_5601-1989","ksc5601","ksc_5601","windows-949"],name:"EUC-KR"}],heading:"Legacy multi-byte Korean encodings"},{encodings:[{labels:["csiso2022kr","hz-gb-2312","iso-2022-cn","iso-2022-cn-ext","iso-2022-kr"],name:"replacement"},{labels:["utf-16be"],name:"UTF-16BE"},{labels:["utf-16","utf-16le"],name:"UTF-16LE"},{labels:["x-user-defined"],name:"x-user-defined"}],heading:"Legacy miscellaneous encodings"}],c={} |
||||||
|
f.forEach((function(n){n.encodings.forEach((function(n){n.labels.forEach((function(e){c[e]=n}))}))})) |
||||||
|
var d,h,g={},p={} |
||||||
|
function _(n,e){return e&&e[n]||null}function b(n,e){var r=e.indexOf(n) |
||||||
|
return-1===r?null:r}function w(e){if(!("encoding-indexes"in n))throw Error("Indexes missing. Did you forget to include encoding-indexes-75eea16b259716db4fd162ee283d2ae5.js first?") |
||||||
|
return n["encoding-indexes"][e]}function m(n,e){if(!(this instanceof m))throw TypeError("Called as a function. Did you forget 'new'?") |
||||||
|
n=void 0!==n?String(n):"utf-8",e=i(e),this._encoding=null,this._decoder=null,this._ignoreBOM=!1,this._BOMseen=!1,this._error_mode="replacement",this._do_not_flush=!1 |
||||||
|
var r=l(n) |
||||||
|
if(null===r||"replacement"===r.name)throw RangeError("Unknown encoding: "+n) |
||||||
|
if(!p[r.name])throw Error("Decoder not present. Did you forget to include encoding-indexes-75eea16b259716db4fd162ee283d2ae5.js first?") |
||||||
|
return this._encoding=r,Boolean(e.fatal)&&(this._error_mode="fatal"),Boolean(e.ignoreBOM)&&(this._ignoreBOM=!0),Object.defineProperty||(this.encoding=this._encoding.name.toLowerCase(),this.fatal="fatal"===this._error_mode,this.ignoreBOM=this._ignoreBOM),this}function v(e,r){if(!(this instanceof v))throw TypeError("Called as a function. Did you forget 'new'?") |
||||||
|
r=i(r),this._encoding=null,this._encoder=null,this._do_not_flush=!1,this._fatal=Boolean(r.fatal)?"fatal":"replacement" |
||||||
|
if(Boolean(r.NONSTANDARD_allowLegacyEncoding)){var t=l(e=void 0!==e?String(e):"utf-8") |
||||||
|
if(null===t||"replacement"===t.name)throw RangeError("Unknown encoding: "+e) |
||||||
|
if(!g[t.name])throw Error("Encoder not present. Did you forget to include encoding-indexes-75eea16b259716db4fd162ee283d2ae5.js first?") |
||||||
|
this._encoding=t}else this._encoding=l("utf-8"),void 0!==e&&"console"in n&&console.warn("TextEncoder constructor called with encoding label, which is ignored.") |
||||||
|
return Object.defineProperty||(this.encoding=this._encoding.name.toLowerCase()),this}function y(n){var r=n.fatal,i=0,t=0,o=0,s=128,u=191 |
||||||
|
this.handler=function(n,l){if(-1===l&&0!==o)return o=0,a(r) |
||||||
|
if(-1===l)return-1 |
||||||
|
if(0===o){if(e(l,0,127))return l |
||||||
|
if(e(l,194,223))o=1,i=31&l |
||||||
|
else if(e(l,224,239))224===l&&(s=160),237===l&&(u=159),o=2,i=15&l |
||||||
|
else{if(!e(l,240,244))return a(r) |
||||||
|
240===l&&(s=144),244===l&&(u=143),o=3,i=7&l}return null}if(!e(l,s,u))return i=o=t=0,s=128,u=191,n.prepend(l),a(r) |
||||||
|
if(s=128,u=191,i=i<<6|63&l,(t+=1)!==o)return null |
||||||
|
var f=i |
||||||
|
return i=o=t=0,f}}function x(n){n.fatal |
||||||
|
this.handler=function(n,r){if(-1===r)return-1 |
||||||
|
if(o(r))return r |
||||||
|
var i,t |
||||||
|
e(r,128,2047)?(i=1,t=192):e(r,2048,65535)?(i=2,t=224):e(r,65536,1114111)&&(i=3,t=240) |
||||||
|
for(var s=[(r>>6*i)+t];i>0;){var a=r>>6*(i-1) |
||||||
|
s.push(128|63&a),i-=1}return s}}function O(n,e){var r=e.fatal |
||||||
|
this.handler=function(e,i){if(-1===i)return-1 |
||||||
|
if(t(i))return i |
||||||
|
var o=n[i-128] |
||||||
|
return null===o?a(r):o}}function k(n,e){e.fatal |
||||||
|
this.handler=function(e,r){if(-1===r)return-1 |
||||||
|
if(o(r))return r |
||||||
|
var i=b(r,n) |
||||||
|
return null===i&&u(r),i+128}}function E(n){var r=n.fatal,i=0,o=0,s=0 |
||||||
|
this.handler=function(n,u){if(-1===u&&0===i&&0===o&&0===s)return-1 |
||||||
|
var l |
||||||
|
if(-1!==u||0===i&&0===o&&0===s||(i=0,o=0,s=0,a(r)),0!==s){l=null,e(u,48,57)&&(l=function(n){if(n>39419&&n<189e3||n>1237575)return null |
||||||
|
if(7457===n)return 59335 |
||||||
|
var e,r=0,i=0,t=w("gb18030-ranges") |
||||||
|
for(e=0;e<t.length;++e){var o=t[e] |
||||||
|
if(!(o[0]<=n))break |
||||||
|
r=o[0],i=o[1]}return i+n-r}(10*(126*(10*(i-129)+o-48)+s-129)+u-48)) |
||||||
|
var f=[o,s,u] |
||||||
|
return i=0,o=0,s=0,null===l?(n.prepend(f),a(r)):l}if(0!==o)return e(u,129,254)?(s=u,null):(n.prepend([o,u]),i=0,o=0,a(r)) |
||||||
|
if(0!==i){if(e(u,48,57))return o=u,null |
||||||
|
var c=i,d=null |
||||||
|
i=0 |
||||||
|
var h=u<127?64:65 |
||||||
|
return(e(u,64,126)||e(u,128,254))&&(d=190*(c-129)+(u-h)),null===(l=null===d?null:_(d,w("gb18030")))&&t(u)&&n.prepend(u),null===l?a(r):l}return t(u)?u:128===u?8364:e(u,129,254)?(i=u,null):a(r)}}function j(n,e){n.fatal |
||||||
|
this.handler=function(n,i){if(-1===i)return-1 |
||||||
|
if(o(i))return i |
||||||
|
if(58853===i)return u(i) |
||||||
|
if(e&&8364===i)return 128 |
||||||
|
var t=b(i,w("gb18030")) |
||||||
|
if(null!==t){var s=t%190 |
||||||
|
return[r(t/190)+129,s+(s<63?64:65)]}if(e)return u(i) |
||||||
|
t=function(n){if(59335===n)return 7457 |
||||||
|
var e,r=0,i=0,t=w("gb18030-ranges") |
||||||
|
for(e=0;e<t.length;++e){var o=t[e] |
||||||
|
if(!(o[1]<=n))break |
||||||
|
r=o[1],i=o[0]}return i+n-r}(i) |
||||||
|
var a=r(t/10/126/10),l=r((t-=10*a*126*10)/10/126),f=r((t-=10*l*126)/10) |
||||||
|
return[a+129,l+48,f+129,t-10*f+48]}}function B(n){var r=n.fatal,i=0 |
||||||
|
this.handler=function(n,o){if(-1===o&&0!==i)return i=0,a(r) |
||||||
|
if(-1===o&&0===i)return-1 |
||||||
|
if(0!==i){var s=i,u=null |
||||||
|
i=0 |
||||||
|
var l=o<127?64:98 |
||||||
|
switch((e(o,64,126)||e(o,161,254))&&(u=157*(s-129)+(o-l)),u){case 1133:return[202,772] |
||||||
|
case 1135:return[202,780] |
||||||
|
case 1164:return[234,772] |
||||||
|
case 1166:return[234,780]}var f=null===u?null:_(u,w("big5")) |
||||||
|
return null===f&&t(o)&&n.prepend(o),null===f?a(r):f}return t(o)?o:e(o,129,254)?(i=o,null):a(r)}}function S(n){n.fatal |
||||||
|
this.handler=function(n,e){if(-1===e)return-1 |
||||||
|
if(o(e))return e |
||||||
|
var i=function(n){var e=h=h||w("big5").map((function(n,e){return e<5024?null:n})) |
||||||
|
return 9552===n||9566===n||9569===n||9578===n||21313===n||21317===n?e.lastIndexOf(n):b(n,e)}(e) |
||||||
|
if(null===i)return u(e) |
||||||
|
var t=r(i/157)+129 |
||||||
|
if(t<161)return u(e) |
||||||
|
var s=i%157 |
||||||
|
return[t,s+(s<63?64:98)]}}function T(n){var r=n.fatal,i=!1,o=0 |
||||||
|
this.handler=function(n,s){if(-1===s&&0!==o)return o=0,a(r) |
||||||
|
if(-1===s&&0===o)return-1 |
||||||
|
if(142===o&&e(s,161,223))return o=0,65216+s |
||||||
|
if(143===o&&e(s,161,254))return i=!0,o=s,null |
||||||
|
if(0!==o){var u=o |
||||||
|
o=0 |
||||||
|
var l=null |
||||||
|
return e(u,161,254)&&e(s,161,254)&&(l=_(94*(u-161)+(s-161),w(i?"jis0212":"jis0208"))),i=!1,e(s,161,254)||n.prepend(s),null===l?a(r):l}return t(s)?s:142===s||143===s||e(s,161,254)?(o=s,null):a(r)}}function I(n){n.fatal |
||||||
|
this.handler=function(n,i){if(-1===i)return-1 |
||||||
|
if(o(i))return i |
||||||
|
if(165===i)return 92 |
||||||
|
if(8254===i)return 126 |
||||||
|
if(e(i,65377,65439))return[142,i-65377+161] |
||||||
|
8722===i&&(i=65293) |
||||||
|
var t=b(i,w("jis0208")) |
||||||
|
return null===t?u(i):[r(t/94)+161,t%94+161]}}function U(n){var r=n.fatal,i=0,t=1,o=2,s=3,u=4,l=5,f=6,c=i,d=i,h=0,g=!1 |
||||||
|
this.handler=function(n,p){switch(c){default:case i:return 27===p?(c=l,null):e(p,0,127)&&14!==p&&15!==p&&27!==p?(g=!1,p):-1===p?-1:(g=!1,a(r)) |
||||||
|
case t:return 27===p?(c=l,null):92===p?(g=!1,165):126===p?(g=!1,8254):e(p,0,127)&&14!==p&&15!==p&&27!==p&&92!==p&&126!==p?(g=!1,p):-1===p?-1:(g=!1,a(r)) |
||||||
|
case o:return 27===p?(c=l,null):e(p,33,95)?(g=!1,65344+p):-1===p?-1:(g=!1,a(r)) |
||||||
|
case s:return 27===p?(c=l,null):e(p,33,126)?(g=!1,h=p,c=u,null):-1===p?-1:(g=!1,a(r)) |
||||||
|
case u:if(27===p)return c=l,a(r) |
||||||
|
if(e(p,33,126)){c=s |
||||||
|
var b=_(94*(h-33)+p-33,w("jis0208")) |
||||||
|
return null===b?a(r):b}return-1===p?(c=s,n.prepend(p),a(r)):(c=s,a(r)) |
||||||
|
case l:return 36===p||40===p?(h=p,c=f,null):(n.prepend(p),g=!1,c=d,a(r)) |
||||||
|
case f:var m=h |
||||||
|
h=0 |
||||||
|
var v=null |
||||||
|
if(40===m&&66===p&&(v=i),40===m&&74===p&&(v=t),40===m&&73===p&&(v=o),36!==m||64!==p&&66!==p||(v=s),null!==v){c=c=v |
||||||
|
var y=g |
||||||
|
return g=!0,y?a(r):null}return n.prepend([m,p]),g=!1,c=d,a(r)}}}function C(n){n.fatal |
||||||
|
var e=0,i=1,t=2,s=e |
||||||
|
this.handler=function(n,a){if(-1===a&&s!==e)return n.prepend(a),s=e,[27,40,66] |
||||||
|
if(-1===a&&s===e)return-1 |
||||||
|
if(!(s!==e&&s!==i||14!==a&&15!==a&&27!==a))return u(65533) |
||||||
|
if(s===e&&o(a))return a |
||||||
|
if(s===i&&(o(a)&&92!==a&&126!==a||165==a||8254==a)){if(o(a))return a |
||||||
|
if(165===a)return 92 |
||||||
|
if(8254===a)return 126}if(o(a)&&s!==e)return n.prepend(a),s=e,[27,40,66] |
||||||
|
if((165===a||8254===a)&&s!==i)return n.prepend(a),s=i,[27,40,74] |
||||||
|
8722===a&&(a=65293) |
||||||
|
var l=b(a,w("jis0208")) |
||||||
|
return null===l?u(a):s!==t?(n.prepend(a),s=t,[27,36,66]):[r(l/94)+33,l%94+33]}}function A(n){var r=n.fatal,i=0 |
||||||
|
this.handler=function(n,o){if(-1===o&&0!==i)return i=0,a(r) |
||||||
|
if(-1===o&&0===i)return-1 |
||||||
|
if(0!==i){var s=i,u=null |
||||||
|
i=0 |
||||||
|
var l=o<127?64:65,f=s<160?129:193 |
||||||
|
if((e(o,64,126)||e(o,128,252))&&(u=188*(s-f)+o-l),e(u,8836,10715))return 48508+u |
||||||
|
var c=null===u?null:_(u,w("jis0208")) |
||||||
|
return null===c&&t(o)&&n.prepend(o),null===c?a(r):c}return t(o)||128===o?o:e(o,161,223)?65216+o:e(o,129,159)||e(o,224,252)?(i=o,null):a(r)}}function L(n){n.fatal |
||||||
|
this.handler=function(n,i){if(-1===i)return-1 |
||||||
|
if(o(i)||128===i)return i |
||||||
|
if(165===i)return 92 |
||||||
|
if(8254===i)return 126 |
||||||
|
if(e(i,65377,65439))return i-65377+161 |
||||||
|
8722===i&&(i=65293) |
||||||
|
var t=function(n){return(d=d||w("jis0208").map((function(n,r){return e(r,8272,8835)?null:n}))).indexOf(n)}(i) |
||||||
|
if(null===t)return u(i) |
||||||
|
var s=r(t/188),a=t%188 |
||||||
|
return[s+(s<31?129:193),a+(a<63?64:65)]}}function M(n){var r=n.fatal,i=0 |
||||||
|
this.handler=function(n,o){if(-1===o&&0!==i)return i=0,a(r) |
||||||
|
if(-1===o&&0===i)return-1 |
||||||
|
if(0!==i){var s=i,u=null |
||||||
|
i=0,e(o,65,254)&&(u=190*(s-129)+(o-65)) |
||||||
|
var l=null===u?null:_(u,w("euc-kr")) |
||||||
|
return null===u&&t(o)&&n.prepend(o),null===l?a(r):l}return t(o)?o:e(o,129,254)?(i=o,null):a(r)}}function P(n){n.fatal |
||||||
|
this.handler=function(n,e){if(-1===e)return-1 |
||||||
|
if(o(e))return e |
||||||
|
var i=b(e,w("euc-kr")) |
||||||
|
return null===i?u(e):[r(i/190)+129,i%190+65]}}function D(n,e){var r=n>>8,i=255&n |
||||||
|
return e?[r,i]:[i,r]}function F(n,r){var i=r.fatal,t=null,o=null |
||||||
|
this.handler=function(r,s){if(-1===s&&(null!==t||null!==o))return a(i) |
||||||
|
if(-1===s&&null===t&&null===o)return-1 |
||||||
|
if(null===t)return t=s,null |
||||||
|
var u |
||||||
|
if(u=n?(t<<8)+s:(s<<8)+t,t=null,null!==o){var l=o |
||||||
|
return o=null,e(u,56320,57343)?65536+1024*(l-55296)+(u-56320):(r.prepend(D(u,n)),a(i))}return e(u,55296,56319)?(o=u,null):e(u,56320,57343)?a(i):u}}function J(n,r){r.fatal |
||||||
|
this.handler=function(r,i){if(-1===i)return-1 |
||||||
|
if(e(i,0,65535))return D(i,n) |
||||||
|
var t=D(55296+(i-65536>>10),n),o=D(56320+(i-65536&1023),n) |
||||||
|
return t.concat(o)}}function K(n){n.fatal |
||||||
|
this.handler=function(n,e){return-1===e?-1:t(e)?e:63360+e-128}}function R(n){n.fatal |
||||||
|
this.handler=function(n,r){return-1===r?-1:o(r)?r:e(r,63360,63487)?r-63360+128:u(r)}}Object.defineProperty&&(Object.defineProperty(m.prototype,"encoding",{get:function(){return this._encoding.name.toLowerCase()}}),Object.defineProperty(m.prototype,"fatal",{get:function(){return"fatal"===this._error_mode}}),Object.defineProperty(m.prototype,"ignoreBOM",{get:function(){return this._ignoreBOM}})),m.prototype.decode=function(n,e){var r |
||||||
|
r="object"==typeof n&&n instanceof ArrayBuffer?new Uint8Array(n):"object"==typeof n&&"buffer"in n&&n.buffer instanceof ArrayBuffer?new Uint8Array(n.buffer,n.byteOffset,n.byteLength):new Uint8Array(0),e=i(e),this._do_not_flush||(this._decoder=p[this._encoding.name]({fatal:"fatal"===this._error_mode}),this._BOMseen=!1),this._do_not_flush=Boolean(e.stream) |
||||||
|
for(var t,o=new s(r),a=[];;){var u=o.read() |
||||||
|
if(-1===u)break |
||||||
|
if(-1===(t=this._decoder.handler(o,u)))break |
||||||
|
null!==t&&(Array.isArray(t)?a.push.apply(a,t):a.push(t))}if(!this._do_not_flush){do{if(-1===(t=this._decoder.handler(o,o.read())))break |
||||||
|
null!==t&&(Array.isArray(t)?a.push.apply(a,t):a.push(t))}while(!o.endOfStream()) |
||||||
|
this._decoder=null}return function(n){var e,r |
||||||
|
return e=["UTF-8","UTF-16LE","UTF-16BE"],r=this._encoding.name,-1===e.indexOf(r)||this._ignoreBOM||this._BOMseen||(n.length>0&&65279===n[0]?(this._BOMseen=!0,n.shift()):n.length>0&&(this._BOMseen=!0)),function(n){for(var e="",r=0;r<n.length;++r){var i=n[r] |
||||||
|
i<=65535?e+=String.fromCharCode(i):(i-=65536,e+=String.fromCharCode(55296+(i>>10),56320+(1023&i)))}return e}(n)}.call(this,a)},Object.defineProperty&&Object.defineProperty(v.prototype,"encoding",{get:function(){return this._encoding.name.toLowerCase()}}),v.prototype.encode=function(n,e){n=void 0===n?"":String(n),e=i(e),this._do_not_flush||(this._encoder=g[this._encoding.name]({fatal:"fatal"===this._fatal})),this._do_not_flush=Boolean(e.stream) |
||||||
|
for(var r,t=new s(function(n){for(var e=String(n),r=e.length,i=0,t=[];i<r;){var o=e.charCodeAt(i) |
||||||
|
if(o<55296||o>57343)t.push(o) |
||||||
|
else if(56320<=o&&o<=57343)t.push(65533) |
||||||
|
else if(55296<=o&&o<=56319)if(i===r-1)t.push(65533) |
||||||
|
else{var s=e.charCodeAt(i+1) |
||||||
|
if(56320<=s&&s<=57343){var a=1023&o,u=1023&s |
||||||
|
t.push(65536+(a<<10)+u),i+=1}else t.push(65533)}i+=1}return t}(n)),o=[];;){var a=t.read() |
||||||
|
if(-1===a)break |
||||||
|
if(-1===(r=this._encoder.handler(t,a)))break |
||||||
|
Array.isArray(r)?o.push.apply(o,r):o.push(r)}if(!this._do_not_flush){for(;-1!==(r=this._encoder.handler(t,t.read()));)Array.isArray(r)?o.push.apply(o,r):o.push(r) |
||||||
|
this._encoder=null}return new Uint8Array(o)},g["UTF-8"]=function(n){return new x(n)},p["UTF-8"]=function(n){return new y(n)},"encoding-indexes"in n&&f.forEach((function(n){"Legacy single-byte encodings"===n.heading&&n.encodings.forEach((function(n){var e=n.name,r=w(e.toLowerCase()) |
||||||
|
p[e]=function(n){return new O(r,n)},g[e]=function(n){return new k(r,n)}}))})),p.GBK=function(n){return new E(n)},g.GBK=function(n){return new j(n,!0)},g.gb18030=function(n){return new j(n)},p.gb18030=function(n){return new E(n)},g.Big5=function(n){return new S(n)},p.Big5=function(n){return new B(n)},g["EUC-JP"]=function(n){return new I(n)},p["EUC-JP"]=function(n){return new T(n)},g["ISO-2022-JP"]=function(n){return new C(n)},p["ISO-2022-JP"]=function(n){return new U(n)},g.Shift_JIS=function(n){return new L(n)},p.Shift_JIS=function(n){return new A(n)},g["EUC-KR"]=function(n){return new P(n)},p["EUC-KR"]=function(n){return new M(n)},g["UTF-16BE"]=function(n){return new J(!0,n)},p["UTF-16BE"]=function(n){return new F(!0,n)},g["UTF-16LE"]=function(n){return new J(!1,n)},p["UTF-16LE"]=function(n){return new F(!1,n)},g["x-user-defined"]=function(n){return new R(n)},p["x-user-defined"]=function(n){return new K(n)},n.TextEncoder||(n.TextEncoder=v),n.TextDecoder||(n.TextDecoder=m),"undefined"!=typeof module&&module.exports&&(module.exports={TextEncoder:n.TextEncoder,TextDecoder:n.TextDecoder,EncodingIndexes:n["encoding-indexes"]})})(this||{}) |
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 6.4 KiB |
After Width: | Height: | Size: 6.2 KiB |
@ -0,0 +1,5 @@ |
|||||||
|
(function(e){const t=new Map(Object.entries(JSON.parse(e.querySelector("[data-consul-ui-fs]").textContent))),n=function(t){var n=e.createElement("script") |
||||||
|
n.src=t,e.body.appendChild(n)} |
||||||
|
"TextDecoder"in window||(n(t.get(["text-encoding","encoding-indexes"].join("/")+".js")),n(t.get(["text-encoding","encoding"].join("/")+".js"))),window.CSS&&window.CSS.escape||n(t.get(["css.escape","css.escape"].join("/")+".js")) |
||||||
|
try{const t=e.querySelector('[name="consul-ui/config/environment"]'),n=JSON.parse(e.querySelector("[data-consul-ui-config]").textContent),o=JSON.parse(decodeURIComponent(t.getAttribute("content"))),c="string"!=typeof n.ContentPath?"":n.ContentPath |
||||||
|
c.length>0&&(o.rootURL=c),t.setAttribute("content",encodeURIComponent(JSON.stringify(o)))}catch(o){throw new Error("Unable to parse consul-ui settings: "+o.message)}})(document) |
After Width: | Height: | Size: 983 B |
@ -0,0 +1,4 @@ |
|||||||
|
(function(r){const e=["init","serviceRecentSummarySeries","serviceRecentSummaryStats","upstreamRecentSummaryStats","downstreamRecentSummaryStats"] |
||||||
|
r.consul=new class{constructor(){this.registry={},this.providers={}}registerMetricsProvider(r,t){for(var i of e)if("function"!=typeof t[i])throw new Error(`Can't register metrics provider '${r}': missing ${i} method.`) |
||||||
|
this.registry[r]=t}getMetricsProvider(r,e){if(!(r in this.registry))throw new Error(`Metrics Provider '${r}' is not registered.`) |
||||||
|
return r in this.providers||(this.providers[r]=Object.create(this.registry[r]),this.providers[r].init(e)),this.providers[r]}}})(window) |
@ -0,0 +1,43 @@ |
|||||||
|
(function(){var e={unitSuffix:"",labels:{},data:[]},t={options:{},init:function(e){if(this.options=e,!this.options.metrics_proxy_enabled)throw new Error("prometheus metrics provider currently requires the ui_config.metrics_proxy to be configured in the Consul agent.")},httpGet:function(e,t,r){if(t){var s=-1!==e.indexOf("?")?"&":"?" |
||||||
|
e=e+s+Object.keys(t).map((function(e){return encodeURIComponent(e)+"="+encodeURIComponent(t[e])})).join("&")}return this.options.fetch(e,{headers:r||{}}).then((function(e){if(e.ok)return e.json() |
||||||
|
var t=new Error("HTTP Error: "+e.statusText) |
||||||
|
throw t.statusCode=e.status,t}))},serviceRecentSummarySeries:function(e,t,r,s,n){var a=(new Date).getTime()/1e3 |
||||||
|
return n.start=a-900,n.end=a,this.hasL7Metrics(s)?this.fetchRequestRateSeries(e,t,r,n):this.fetchDataRateSeries(e,t,r,n)},serviceRecentSummaryStats:function(e,t,r,s,n){var a=[] |
||||||
|
return this.hasL7Metrics(s)?(a.push(this.fetchRPS(e,t,r,"service",n)),a.push(this.fetchER(e,t,r,"service",n)),a.push(this.fetchPercentile(50,e,t,r,"service",n)),a.push(this.fetchPercentile(99,e,t,r,"service",n))):(a.push(this.fetchConnRate(e,t,r,"service",n)),a.push(this.fetchServiceRx(e,t,r,"service",n)),a.push(this.fetchServiceTx(e,t,r,"service",n)),a.push(this.fetchServiceNoRoute(e,t,r,"service",n))),this.fetchStats(a)},upstreamRecentSummaryStats:function(e,t,r,s){return this.fetchRecentSummaryStats(e,t,r,"upstream",s)},downstreamRecentSummaryStats:function(e,t,r,s){return this.fetchRecentSummaryStats(e,t,r,"downstream",s)},fetchRecentSummaryStats:function(e,t,r,s,n){var a=[] |
||||||
|
return a.push(this.fetchRPS(e,t,r,s,n)),a.push(this.fetchER(e,t,r,s,n)),a.push(this.fetchPercentile(50,e,t,r,s,n)),a.push(this.fetchPercentile(99,e,t,r,s,n)),a.push(this.fetchConnRate(e,t,r,s,n)),a.push(this.fetchServiceRx(e,t,r,s,n)),a.push(this.fetchServiceTx(e,t,r,s,n)),a.push(this.fetchServiceNoRoute(e,t,r,s,n)),this.fetchStatsGrouped(a)},hasL7Metrics:function(e){return"http"===e||"http2"===e||"grpc"===e},fetchStats:function(e){return Promise.all(e).then((function(t){for(var r={stats:[]},s=0;s<e.length;s++)t[s].value&&r.stats.push(t[s]) |
||||||
|
return r}))},fetchStatsGrouped:function(e){return Promise.all(e).then((function(t){for(var r={stats:{}},s=0;s<e.length;s++)if(t[s])for(var n in t[s])t[s].hasOwnProperty(n)&&(r.stats[n]||(r.stats[n]=[]),r.stats[n].push(t[s][n])) |
||||||
|
return r}))},reformatSeries:function(t,r){return function(s){if(!s.data||!s.data.result||0==s.data.result.length||!s.data.result[0].values||0==s.data.result[0].values.length)return e |
||||||
|
let n=s.data.result[0].values.map((function(e){return{time:Math.round(1e3*e[0])}})) |
||||||
|
return s.data.result.map((function(e){e.values.map((function(t,r){n[r][e.metric.label]=parseFloat(t[1])}))})),{unitSuffix:t,labels:r,data:n}}},fetchRequestRateSeries:function(e,t,r,s){var n=`sum by (label) (label_replace(label_replace(irate(envoy_listener_http_downstream_rq_xx{consul_source_service="${e}",consul_source_datacenter="${t}",consul_source_namespace="${r}",envoy_http_conn_manager_prefix="public_listener"}[10m]), "label", "Successes", "envoy_response_code_class", "[^5]"), "label", "Errors", "envoy_response_code_class", "5"))` |
||||||
|
return this.fetchSeries(n,s).then(this.reformatSeries(" rps",{Total:"Total inbound requests per second",Successes:"Successful responses (with an HTTP response code not in the 5xx range) per second.",Errors:"Error responses (with an HTTP response code in the 5xx range) per second."}))},fetchDataRateSeries:function(e,t,r,s){var n=`8 * sum by (label) (label_replace(irate(envoy_tcp_downstream_cx_tx_bytes_total{consul_source_service="${e}",consul_source_datacenter="${t}",consul_source_namespace="${r}",envoy_tcp_prefix="public_listener"}[10m]), "label", "Outbound", "__name__", ".*") or label_replace(irate(envoy_tcp_downstream_cx_rx_bytes_total{consul_source_service="${e}",consul_source_datacenter="${t}",consul_source_namespace="${r}",envoy_tcp_prefix="public_listener"}[10m]), "label", "Inbound", "__name__", ".*"))` |
||||||
|
return this.fetchSeries(n,s).then(this.reformatSeries("bps",{Total:"Total bandwidth",Inbound:"Inbound data rate (data recieved) from the network in bits per second.",Outbound:"Outbound data rate (data transmitted) from the network in bits per second."}))},makeSubject:function(e,t,r,s){var n=`${r}/${e} (${t})` |
||||||
|
return"upstream"==s?n+" → {{GROUP}}":"downstream"==s?"{{GROUP}} → "+n:n},makeHTTPSelector:function(e,t,r,s){if("downstream"==s)return`consul_destination_service="${e}",consul_destination_datacenter="${t}",consul_destination_namespace="${r}"` |
||||||
|
var n=`consul_source_service="${e}",consul_source_datacenter="${t}",consul_source_namespace="${r}"` |
||||||
|
return n+="upstream"==s?',envoy_http_conn_manager_prefix="upstream"':',envoy_http_conn_manager_prefix="public_listener"'},makeTCPSelector:function(e,t,r,s){if("downstream"==s)return`consul_destination_service="${e}",consul_destination_datacenter="${t}",consul_destination_namespace="${r}"` |
||||||
|
var n=`consul_source_service="${e}",consul_source_datacenter="${t}",consul_source_namespace="${r}"` |
||||||
|
return n+="upstream"==s?',envoy_tcp_prefix=~"upstream.*"':',envoy_tcp_prefix="public_listener"'},groupQuery:function(e,t){return"upstream"==e?t+=" by (consul_upstream_service,consul_upstream_datacenter,consul_upstream_namespace)":"downstream"==e&&(t+=" by (consul_source_service,consul_source_datacenter,consul_source_namespace)"),t},groupByInfix:function(e){return"upstream"==e?"upstream":"downstream"==e&&"source"},metricPrefixHTTP:function(e){return"downstream"==e?"envoy_cluster_upstream_rq":"envoy_http_downstream_rq"},metricPrefixTCP:function(e){return"downstream"==e?"envoy_cluster_upstream_cx":"envoy_tcp_downstream_cx"},fetchRPS:function(e,t,s,n){var a=this.makeHTTPSelector(e,t,s,n),c=this.makeSubject(e,t,s,n),i=`sum(rate(${this.metricPrefixHTTP(n)}_completed{${a}}[15m]))` |
||||||
|
return this.fetchStat(this.groupQuery(n,i),"RPS",`<b>${c}</b> request rate averaged over the last 15 minutes`,r,this.groupByInfix(n))},fetchER:function(e,t,s,n){var a=this.makeHTTPSelector(e,t,s,n),c=this.makeSubject(e,t,s,n),i="" |
||||||
|
"upstream"==n?i+=" by (consul_upstream_service,consul_upstream_datacenter,consul_upstream_namespace)":"downstream"==n&&(i+=" by (consul_source_service,consul_source_datacenter,consul_source_namespace)") |
||||||
|
var u=this.metricPrefixHTTP(n),o=`sum(rate(${u}_xx{${a},envoy_response_code_class="5"}[15m]))${i}/sum(rate(${u}_xx{${a}}[15m]))${i}` |
||||||
|
return this.fetchStat(o,"ER",`Percentage of <b>${c}</b> requests which were 5xx status over the last 15 minutes`,(function(e){return r(e)+"%"}),this.groupByInfix(n))},fetchPercentile:function(e,t,r,n,a){var c=this.makeHTTPSelector(t,r,n,a),i=this.makeSubject(t,r,n,a),u="le" |
||||||
|
"upstream"==a?u+=",consul_upstream_service,consul_upstream_datacenter,consul_upstream_namespace":"downstream"==a&&(u+=",consul_source_service,consul_source_datacenter,consul_source_namespace") |
||||||
|
var o=`histogram_quantile(${e/100}, sum by(${u}) (rate(${this.metricPrefixHTTP(a)}_time_bucket{${c}}[15m])))` |
||||||
|
return this.fetchStat(o,"P"+e,`<b>${i}</b> ${e}th percentile request service time over the last 15 minutes`,s,this.groupByInfix(a))},fetchConnRate:function(e,t,s,n){var a=this.makeTCPSelector(e,t,s,n),c=this.makeSubject(e,t,s,n),i=`sum(rate(${this.metricPrefixTCP(n)}_total{${a}}[15m]))` |
||||||
|
return this.fetchStat(this.groupQuery(n,i),"CR",`<b>${c}</b> inbound TCP connections per second averaged over the last 15 minutes`,r,this.groupByInfix(n))},fetchServiceRx:function(e,t,s,n){var a=this.makeTCPSelector(e,t,s,n),c=this.makeSubject(e,t,s,n),i=`8 * sum(rate(${this.metricPrefixTCP(n)}_rx_bytes_total{${a}}[15m]))` |
||||||
|
return this.fetchStat(this.groupQuery(n,i),"RX",`<b>${c}</b> received bits per second averaged over the last 15 minutes`,r,this.groupByInfix(n))},fetchServiceTx:function(e,t,s,n){var a=this.makeTCPSelector(e,t,s,n),c=this.makeSubject(e,t,s,n),i=`8 * sum(rate(${this.metricPrefixTCP(n)}_tx_bytes_total{${a}}[15m]))` |
||||||
|
return this.fetchStat(this.groupQuery(n,i),"TX",`<b>${c}</b> transmitted bits per second averaged over the last 15 minutes`,r,this.groupByInfix(n))},fetchServiceNoRoute:function(e,t,s,n){var a=this.makeTCPSelector(e,t,s,n),c=this.makeSubject(e,t,s,n),i="_no_route" |
||||||
|
"downstream"==n&&(i="_connect_fail") |
||||||
|
var u=`sum(rate(${this.metricPrefixTCP(n)}${i}{${a}}[15m]))` |
||||||
|
return this.fetchStat(this.groupQuery(n,u),"NR",`<b>${c}</b> unroutable (failed) connections per second averaged over the last 15 minutes`,r,this.groupByInfix(n))},fetchStat:function(e,t,r,s,n){n||(e+=" OR on() vector(0)") |
||||||
|
var a={query:e,time:(new Date).getTime()/1e3} |
||||||
|
return this.httpGet("/api/v1/query",a).then((function(e){if(!n){var a=parseFloat(e.data.result[0].value[1]) |
||||||
|
return{label:t,desc:r,value:isNaN(a)?"-":s(a)}}for(var c={},i=0;i<e.data.result.length;i++){var u=e.data.result[i],o=(a=parseFloat(u.value[1]),`${u.metric["consul_"+n+"_service"]}.${u.metric["consul_"+n+"_namespace"]}.${u.metric["consul_"+n+"_datacenter"]}`) |
||||||
|
c[o]={label:t,desc:r.replace("{{GROUP}}",o),value:isNaN(a)?"-":s(a)}}return c}))},fetchSeries:function(e,t){var r={query:e,start:t.start,end:t.end,step:"10s",timeout:"8s"} |
||||||
|
return this.httpGet("/api/v1/query_range",r)}} |
||||||
|
function r(e){return e<1e3?Number.isInteger(e)?""+e:Number(e>=100?e.toPrecision(3):e<1?e.toFixed(2):e.toPrecision(2)):e>=1e3&&e<1e6?+(e/1e3).toPrecision(3)+"k":e>=1e6&&e<1e9?+(e/1e6).toPrecision(3)+"m":e>=1e9&&e<1e12?+(e/1e9).toPrecision(3)+"g":e>=1e12?+(e/1e12).toFixed(0)+"t":void 0}function s(e){if(e<1e3)return Math.round(e)+"ms" |
||||||
|
var t=e/1e3 |
||||||
|
if(t<60)return t.toFixed(1)+"s" |
||||||
|
var r=t/60 |
||||||
|
if(r<60)return r.toFixed(1)+"m" |
||||||
|
var s=r/60 |
||||||
|
return s<24?s.toFixed(1)+"h":(s/24).toFixed(1)+"d"}window.consul.registerMetricsProvider("prometheus",t)})() |
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -0,0 +1,19 @@ |
|||||||
|
<!DOCTYPE html> |
||||||
|
<html> |
||||||
|
<head> |
||||||
|
<meta charset="UTF-8"> |
||||||
|
<title>Consul</title> |
||||||
|
<script> |
||||||
|
var CURRENT_REQUEST_KEY = '__torii_request'; |
||||||
|
var pendingRequestKey = window.localStorage.getItem(CURRENT_REQUEST_KEY); |
||||||
|
|
||||||
|
if (pendingRequestKey) { |
||||||
|
window.localStorage.removeItem(CURRENT_REQUEST_KEY); |
||||||
|
var url = window.location.toString(); |
||||||
|
window.localStorage.setItem(pendingRequestKey, url); |
||||||
|
} |
||||||
|
|
||||||
|
window.close(); |
||||||
|
</script> |
||||||
|
</head> |
||||||
|
</html> |
@ -0,0 +1,3 @@ |
|||||||
|
# http://www.robotstxt.org |
||||||
|
User-agent: * |
||||||
|
Disallow: / |
@ -0,0 +1,19 @@ |
|||||||
|
<!DOCTYPE html> |
||||||
|
<html> |
||||||
|
<head> |
||||||
|
<meta charset="UTF-8"> |
||||||
|
<title>Torii OAuth Redirect</title> |
||||||
|
<script> |
||||||
|
var CURRENT_REQUEST_KEY = '__torii_request'; |
||||||
|
var pendingRequestKey = window.localStorage.getItem(CURRENT_REQUEST_KEY); |
||||||
|
|
||||||
|
if (pendingRequestKey) { |
||||||
|
window.localStorage.removeItem(CURRENT_REQUEST_KEY); |
||||||
|
var url = window.location.toString(); |
||||||
|
window.localStorage.setItem(pendingRequestKey, url); |
||||||
|
} |
||||||
|
|
||||||
|
window.close(); |
||||||
|
</script> |
||||||
|
</head> |
||||||
|
</html> |
@ -1,21 +1,23 @@ |
|||||||
package uiserver |
package uiserver |
||||||
|
|
||||||
import "net/http" |
import ( |
||||||
|
"io/fs" |
||||||
|
) |
||||||
|
|
||||||
// redirectFS is an http.FS that serves the index.html file for any path that is
|
// redirectFS is an fs.FS that serves the index.html file for any path that is
|
||||||
// not found on the underlying FS.
|
// not found on the underlying FS.
|
||||||
//
|
//
|
||||||
// TODO: it seems better to actually 404 bad paths or at least redirect them
|
// TODO: it seems better to actually 404 bad paths or at least redirect them
|
||||||
// rather than pretend index.html is everywhere but this is behavior changing
|
// rather than pretend index.html is everywhere but this is behavior changing
|
||||||
// so I don't want to take it on as part of this refactor.
|
// so I don't want to take it on as part of this refactor.
|
||||||
type redirectFS struct { |
type redirectFS struct { |
||||||
fs http.FileSystem |
fs fs.FS |
||||||
} |
} |
||||||
|
|
||||||
func (fs *redirectFS) Open(name string) (http.File, error) { |
func (fs *redirectFS) Open(name string) (fs.File, error) { |
||||||
file, err := fs.fs.Open(name) |
file, err := fs.fs.Open(name) |
||||||
if err != nil { |
if err != nil { |
||||||
file, err = fs.fs.Open("/index.html") |
file, err = fs.fs.Open("index.html") |
||||||
} |
} |
||||||
return file, err |
return file, err |
||||||
} |
} |
||||||
|
@ -1,7 +1,4 @@ |
|||||||
ARG GOLANG_VERSION=1.18.1 |
ARG GOLANG_VERSION=1.18.1 |
||||||
FROM golang:${GOLANG_VERSION} |
FROM golang:${GOLANG_VERSION} |
||||||
|
|
||||||
RUN go install github.com/elazarl/go-bindata-assetfs/go-bindata-assetfs@master |
|
||||||
RUN go install github.com/hashicorp/go-bindata/go-bindata@master |
|
||||||
|
|
||||||
WORKDIR /consul |
WORKDIR /consul |
||||||
|
Loading…
Reference in new issue