feat: initial commit
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright 2019 Red Hat, Inc. and/or its affiliates.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @author Stan Silvert
|
||||
*/
|
||||
export class AIACommand {
|
||||
constructor(keycloak, action) {
|
||||
this.keycloak = keycloak;
|
||||
this.action = action;
|
||||
}
|
||||
|
||||
execute() {
|
||||
this.keycloak.login({
|
||||
action: this.action
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
//# sourceMappingURL=AIACommand.js.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../src/app/util/AIACommand.ts"],"names":["AIACommand","constructor","keycloak","action","execute","login"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA;AACA;AACA;AACA,OAAO,MAAMA,UAAN,CAAiB;AAEpBC,EAAAA,WAAW,CAASC,QAAT,EAA4CC,MAA5C,EAA4D;AAAA,SAAnDD,QAAmD,GAAnDA,QAAmD;AAAA,SAAhBC,MAAgB,GAAhBA,MAAgB;AAAE;;AAElEC,EAAAA,OAAO,GAAS;AACnB,SAAKF,QAAL,CAAcG,KAAd,CAAoB;AAChBF,MAAAA,MAAM,EAAE,KAAKA;AADG,KAApB;AAIH;;AATmB","sourcesContent":["/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {KeycloakService} from '../keycloak-service/keycloak.service';\n\n/**\n * @author Stan Silvert\n */\nexport class AIACommand {\n\n constructor(private keycloak: KeycloakService, private action: string) {}\n\n public execute(): void {\n this.keycloak.login({\n action: this.action,\n })\n\n }\n}"],"file":"AIACommand.js"}
|
||||
@@ -0,0 +1,19 @@
|
||||
function parse(linkHeader) {
|
||||
if (!linkHeader) return {};
|
||||
const links = linkHeader.split(/,\s*</);
|
||||
return links.reduce((acc, link) => {
|
||||
const matcher = link.match(/<?([^>]*)>(.*)/);
|
||||
if (!matcher) return {};
|
||||
const linkUrl = matcher[1];
|
||||
const rel = matcher[2].match(/\s*(.+)\s*=\s*"?([^"]+)"?/);
|
||||
|
||||
if (rel) {
|
||||
acc[rel[2]] = linkUrl;
|
||||
}
|
||||
|
||||
return acc;
|
||||
}, {});
|
||||
}
|
||||
|
||||
export default parse;
|
||||
//# sourceMappingURL=ParseLink.js.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../src/app/util/ParseLink.ts"],"names":["parse","linkHeader","links","split","reduce","acc","link","matcher","match","linkUrl","rel"],"mappings":"AAMA,SAASA,KAAT,CAAeC,UAAf,EAAsD;AACpD,MAAI,CAACA,UAAL,EAAiB,OAAO,EAAP;AACjB,QAAMC,KAAK,GAAGD,UAAU,CAACE,KAAX,CAAiB,OAAjB,CAAd;AACA,SAAOD,KAAK,CAACE,MAAN,CAAoB,CAACC,GAAD,EAAaC,IAAb,KAAqC;AAC9D,UAAMC,OAAO,GAAGD,IAAI,CAACE,KAAL,CAAW,gBAAX,CAAhB;AACA,QAAI,CAACD,OAAL,EAAc,OAAO,EAAP;AACd,UAAME,OAAO,GAAGF,OAAO,CAAC,CAAD,CAAvB;AACA,UAAMG,GAAG,GAAGH,OAAO,CAAC,CAAD,CAAP,CAAWC,KAAX,CAAiB,2BAAjB,CAAZ;;AACA,QAAIE,GAAJ,EAAS;AACLL,MAAAA,GAAG,CAACK,GAAG,CAAC,CAAD,CAAJ,CAAH,GAAcD,OAAd;AACH;;AACD,WAAOJ,GAAP;AACD,GATM,EASJ,EATI,CAAP;AAUD;;AAED,eAAeL,KAAf","sourcesContent":["\nexport interface Links {\n prev?: string;\n next?: string;\n}\n\nfunction parse(linkHeader: string | undefined): Links {\n if (!linkHeader) return {};\n const links = linkHeader.split(/,\\s*</);\n return links.reduce<Links>((acc: Links, link: string): Links => {\n const matcher = link.match(/<?([^>]*)>(.*)/);\n if (!matcher) return {};\n const linkUrl = matcher[1];\n const rel = matcher[2].match(/\\s*(.+)\\s*=\\s*\"?([^\"]+)\"?/);\n if (rel) {\n acc[rel[2]] = linkUrl;\n }\n return acc;\n }, {});\n}\n\nexport default parse;"],"file":"ParseLink.js"}
|
||||
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright 2019 Red Hat, Inc. and/or its affiliates
|
||||
* and other contributors as indicated by the @author tags.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Create a redirect uri that can return to this application with referrer and referrer_uri intact.
|
||||
*
|
||||
* @param currentLocation The ReactRouter location to return to.
|
||||
*
|
||||
* @author Stan Silvert
|
||||
*/
|
||||
export const createRedirect = currentLocation => {
|
||||
let redirectUri = baseUrl;
|
||||
|
||||
if (typeof referrer !== 'undefined') {
|
||||
// '_hash_' is a workaround for when uri encoding is not
|
||||
// sufficient to escape the # character properly.
|
||||
// The problem is that both the redirect and the application URL contain a hash.
|
||||
// The browser will consider anything after the first hash to be client-side. So
|
||||
// it sees the hash in the redirect param and stops.
|
||||
redirectUri += "?referrer=" + referrer + "&referrer_uri=" + referrerUri.replace('#', '_hash_');
|
||||
}
|
||||
|
||||
return encodeURIComponent(redirectUri) + encodeURIComponent("/#" + currentLocation);
|
||||
};
|
||||
//# sourceMappingURL=RedirectUri.js.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../src/app/util/RedirectUri.ts"],"names":["createRedirect","currentLocation","redirectUri","baseUrl","referrer","referrerUri","replace","encodeURIComponent"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMA,cAAc,GAAIC,eAAD,IAAqC;AAC/D,MAAIC,WAAmB,GAAGC,OAA1B;;AAEA,MAAI,OAAOC,QAAP,KAAoB,WAAxB,EAAqC;AACjC;AACA;AACA;AACA;AACA;AACAF,IAAAA,WAAW,IAAI,eAAeE,QAAf,GAA0B,gBAA1B,GAA6CC,WAAW,CAACC,OAAZ,CAAoB,GAApB,EAAyB,QAAzB,CAA5D;AACH;;AAED,SAAOC,kBAAkB,CAACL,WAAD,CAAlB,GAAkCK,kBAAkB,CAAC,OAAON,eAAR,CAA3D;AACH,CAbM","sourcesContent":["/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates\n * and other contributors as indicated by the @author tags.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\ndeclare const baseUrl: string;\ndeclare const referrer: string;\ndeclare const referrerUri: string;\n\n/**\n * Create a redirect uri that can return to this application with referrer and referrer_uri intact.\n * \n * @param currentLocation The ReactRouter location to return to.\n * \n * @author Stan Silvert\n */\nexport const createRedirect = (currentLocation: string): string => {\n let redirectUri: string = baseUrl;\n \n if (typeof referrer !== 'undefined') {\n // '_hash_' is a workaround for when uri encoding is not\n // sufficient to escape the # character properly.\n // The problem is that both the redirect and the application URL contain a hash.\n // The browser will consider anything after the first hash to be client-side. So\n // it sees the hash in the redirect param and stops.\n redirectUri += \"?referrer=\" + referrer + \"&referrer_uri=\" + referrerUri.replace('#', '_hash_');\n }\n\n return encodeURIComponent(redirectUri) + encodeURIComponent(\"/#\" + currentLocation); \n}"],"file":"RedirectUri.js"}
|
||||
@@ -0,0 +1,50 @@
|
||||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
|
||||
/*
|
||||
* Copyright 2020 Red Hat, Inc. and/or its affiliates.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @author Stan Silvert
|
||||
*/
|
||||
class TimeUtil {
|
||||
constructor() {
|
||||
_defineProperty(this, "options", {
|
||||
year: 'numeric',
|
||||
month: 'long',
|
||||
day: 'numeric',
|
||||
hour: 'numeric',
|
||||
minute: 'numeric'
|
||||
});
|
||||
|
||||
_defineProperty(this, "formatter", void 0);
|
||||
|
||||
try {
|
||||
this.formatter = new Intl.DateTimeFormat(locale, this.options);
|
||||
} catch (e) {
|
||||
// unknown locale falling back to English
|
||||
this.formatter = new Intl.DateTimeFormat('en', this.options);
|
||||
}
|
||||
}
|
||||
|
||||
format(time) {
|
||||
return this.formatter.format(time);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
const TimeUtilInstance = new TimeUtil();
|
||||
export default TimeUtilInstance;
|
||||
//# sourceMappingURL=TimeUtil.js.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../src/app/util/TimeUtil.ts"],"names":["TimeUtil","constructor","year","month","day","hour","minute","formatter","Intl","DateTimeFormat","locale","options","e","format","time","TimeUtilInstance"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA;AACA;AACA;AACA,MAAMA,QAAN,CAAe;AAIXC,EAAAA,WAAW,GAAG;AAAA,qCAHI;AAAEC,MAAAA,IAAI,EAAE,SAAR;AAAmBC,MAAAA,KAAK,EAAE,MAA1B;AAAkCC,MAAAA,GAAG,EAAE,SAAvC;AAAkDC,MAAAA,IAAI,EAAE,SAAxD;AAAmEC,MAAAA,MAAM,EAAE;AAA3E,KAGJ;;AAAA;;AACV,QAAI;AACA,WAAKC,SAAL,GAAiB,IAAIC,IAAI,CAACC,cAAT,CAAwBC,MAAxB,EAAgC,KAAKC,OAArC,CAAjB;AACH,KAFD,CAEE,OAAMC,CAAN,EAAS;AACP;AACA,WAAKL,SAAL,GAAiB,IAAIC,IAAI,CAACC,cAAT,CAAwB,IAAxB,EAA8B,KAAKE,OAAnC,CAAjB;AACH;AACJ;;AAEDE,EAAAA,MAAM,CAACC,IAAD,EAAuB;AACzB,WAAO,KAAKP,SAAL,CAAeM,MAAf,CAAsBC,IAAtB,CAAP;AACH;;AAfU;;AAkBf,MAAMC,gBAA0B,GAAG,IAAIf,QAAJ,EAAnC;AACA,eAAee,gBAAf","sourcesContent":["/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\ndeclare const locale: string;\n\n/**\n * @author Stan Silvert\n */\nclass TimeUtil {\n private options = { year: 'numeric', month: 'long', day: 'numeric', hour: 'numeric', minute: 'numeric' };\n private formatter: Intl.DateTimeFormat;\n\n constructor() {\n try {\n this.formatter = new Intl.DateTimeFormat(locale, this.options);\n } catch(e) {\n // unknown locale falling back to English\n this.formatter = new Intl.DateTimeFormat('en', this.options);\n }\n }\n\n format(time: number): string {\n return this.formatter.format(time);\n }\n}\n\nconst TimeUtilInstance: TimeUtil = new TimeUtil();\nexport default TimeUtilInstance as TimeUtil;"],"file":"TimeUtil.js"}
|
||||
Reference in New Issue
Block a user