{"version":3,"sources":["../../../src/app/content/applications-page/ApplicationsPage.tsx"],"names":["React","DataList","DataListItem","DataListItemRow","DataListCell","DataListToggle","DataListContent","DataListItemCells","Grid","GridItem","Button","InfoAltIcon","CheckIcon","ExternalLinkAltIcon","ContentPage","ContinueCancelModal","AccountServiceContext","Msg","ApplicationsPage","Component","constructor","props","context","clientId","doDelete","then","fetchApplications","row","newIsRowOpen","state","isRowOpen","setState","applications","doGet","response","data","Array","length","fill","elementId","item","application","render","localize","visibility","map","appIndex","onToggle","window","open","effectiveUrl","clientName","userConsentRequired","offlineAccess","inUse","description","split","consent","grantedScopes","scope","scopeIndex","name","tosUri","policyUri","Intl","DateTimeFormat","locale","year","month","day","hour","minute","second","format","createDate","logoUri","removeConsent"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA,OAAO,KAAKA,KAAZ;AAEA,SACEC,QADF,EAEEC,YAFF,EAGEC,eAHF,EAIEC,YAJF,EAKEC,cALF,EAMEC,eANF,EAOEC,iBAPF,EAQEC,IARF,EASEC,QATF,EAUEC,MAVF;AAaA,SAASC,WAAT,EAAsBC,SAAtB,EAAmDC,mBAAnD;AACA,SAASC,WAAT;AACA,SAASC,mBAAT;AAEA,SAASC,qBAAT;AACA,SAASC,GAAT;AAuCA,OAAO,MAAMC,gBAAN,SAA+BlB,KAAK,CAACmB,SAArC,CAA6F;AAI3FC,EAAAA,WAAW,CAACC,KAAD,EAA+BC,OAA/B,EAAyF;AACzG,UAAMD,KAAN;;AADyG;;AAAA,2CAWlFE,QAAD,IAAsB;AAC5C,WAAKD,OAAL,CAAcE,QAAd,CAAuB,mBAAmBD,QAAnB,GAA8B,UAArD,EACGE,IADH,CACQ,MAAM;AACV,aAAKC,iBAAL;AACD,OAHH;AAID,KAhB0G;;AAAA,sCAkBvFC,GAAD,IAAuB;AACxC,YAAMC,YAAuB,GAAG,KAAKC,KAAL,CAAWC,SAA3C;AACAF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AAGE,QAAA,UAAU,EAAE1B,GAAG,CAAC0B,QAAJ,CAAa,kBAAb,CAHd,CAGgD;AAHhD;AAIE,QAAA,YAAY,EAAE1B,GAAG,CAAC0B,QAAJ,CAAa,oBAAb,EAAmC,CAACF,WAAW,CAAClB,QAAb,CAAnC,CAJhB;AAKE,QAAA,wBAAwB,EAAEN,GAAG,CAAC0B,QAAJ,CAAa,eAAb,CAL5B,CAK2D;AAL3D;AAME,QAAA,UAAU,EAAE,MAAM,KAAKiC,aAAL,CAAmBnC,WAAW,CAAClB,QAA/B,CANpB,CAM8D;;AAN9D,QADF,CADF,CAFF,EAcE,oBAAC,QAAD,QAAU,oBAAC,WAAD,OAAV,OAA2BN,GAAG,CAAC0B,QAAJ,CAAa,aAAb,CAA3B,CAdF,CA7CJ,CAzBF,CADF;AA2FD,KA5FA,CA1BH,CADF,CADF;AA4HD;;AAxKiG;;gBAAvFzB,gB,iBACUF,qB;;AAwKtB","sourcesContent":["/*\n * Copyright 2018 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 * as React from 'react';\n\nimport {\n DataList,\n DataListItem,\n DataListItemRow,\n DataListCell,\n DataListToggle,\n DataListContent,\n DataListItemCells,\n Grid,\n GridItem,\n Button,\n} from '@patternfly/react-core';\n\nimport { InfoAltIcon, CheckIcon, BuilderImageIcon, ExternalLinkAltIcon } from '@patternfly/react-icons';\nimport { ContentPage } from '../ContentPage';\nimport { ContinueCancelModal } from '../../widgets/ContinueCancelModal';\nimport { HttpResponse } from '../../account-service/account.service';\nimport { AccountServiceContext } from '../../account-service/AccountServiceContext';\nimport { Msg } from '../../widgets/Msg';\n\ndeclare const locale: string;\n\nexport interface ApplicationsPageProps {\n}\n\nexport interface ApplicationsPageState {\n isRowOpen: boolean[];\n applications: Application[];\n}\n\nexport interface GrantedScope {\n displayTest: string;\n id: string;\n name: string;\n}\n\nexport interface Consent {\n createDate: number;\n grantedScopes: GrantedScope[];\n lastUpdatedDate: number;\n}\n\ninterface Application {\n effectiveUrl: string;\n clientId: string;\n clientName: string;\n consent: Consent;\n description: string;\n inUse: boolean;\n offlineAccess: boolean;\n userConsentRequired: boolean;\n scope: string[];\n logoUri: string;\n policyUri: string;\n tosUri: string;\n}\n\nexport class ApplicationsPage extends React.Component {\n static contextType = AccountServiceContext;\n context: React.ContextType;\n\n public constructor(props: ApplicationsPageProps, context: React.ContextType) {\n super(props);\n this.context = context;\n this.state = {\n isRowOpen: [],\n applications: []\n };\n\n this.fetchApplications();\n }\n\n private removeConsent = (clientId: string) => {\n this.context!.doDelete(\"/applications/\" + clientId + \"/consent\")\n .then(() => {\n this.fetchApplications();\n });\n }\n\n private onToggle = (row: number): void => {\n const newIsRowOpen: boolean[] = this.state.isRowOpen;\n newIsRowOpen[row] = !newIsRowOpen[row];\n this.setState({ isRowOpen: newIsRowOpen });\n };\n\n private fetchApplications(): void {\n this.context!.doGet(\"/applications\")\n .then((response: HttpResponse) => {\n const applications = response.data || [];\n this.setState({\n isRowOpen: new Array(applications.length).fill(false),\n applications: applications\n });\n });\n }\n\n private elementId(item: string, application: Application): string {\n return `application-${item}-${application.clientId}`;\n }\n\n public render(): React.ReactNode {\n return (\n \n \n \n \n // invisible toggle allows headings to line up properly\n \n \n \n \n \n ,\n \n \n ,\n \n \n ,\n ]}\n />\n \n \n {this.state.applications.map((application: Application, appIndex: number) => {\n return (\n \n \n this.onToggle(appIndex)}\n isExpanded={this.state.isRowOpen[appIndex]}\n id={this.elementId('toggle', application)}\n aria-controls={this.elementId(\"expandable\", application)}\n />\n \n \n ,\n \n {application.userConsentRequired ? Msg.localize('thirdPartyApp') : Msg.localize('internalApp')}\n {application.offlineAccess ? ', ' + Msg.localize('offlineAccess') : ''}\n ,\n \n {application.inUse ? Msg.localize('inUse') : Msg.localize('notInUse')}\n \n ]}\n />\n \n \n \n
\n {Msg.localize('client') + ': '} {application.clientId}\n {application.description &&\n {Msg.localize('description') + ': '} {application.description}\n }\n {application.effectiveUrl &&\n URL: {application.effectiveUrl.split('\"')}\n }\n {application.consent &&\n \n \n Has access to:\n \n {application.consent.grantedScopes.map((scope: GrantedScope, scopeIndex: number) => {\n return (\n \n {scope.name}\n \n )\n })}\n {application.tosUri && {Msg.localize('termsOfService') + ': '}{application.tosUri}}\n {application.policyUri && {Msg.localize('policy') + ': '}{application.policyUri}}\n {Msg.localize('accessGrantedOn') + ': '}\n {new Intl.DateTimeFormat(locale, {\n year: 'numeric',\n month: 'long',\n day: 'numeric',\n hour: 'numeric',\n minute: 'numeric',\n second: 'numeric'\n }).format(application.consent.createDate)}\n \n \n }\n
\n {application.logoUri &&
}\n
\n {(application.consent || application.offlineAccess) &&\n \n
\n \n \n this.removeConsent(application.clientId)} // required\n />\n \n \n {Msg.localize('infoMessage')}\n
\n }\n \n
\n )\n })}\n
\n
\n );\n }\n};\n"],"file":"ApplicationsPage.js"}