feat: update keycloak theme

This commit is contained in:
Jonas Juselius
2024-02-22 09:47:34 +01:00
parent d6fde78f8d
commit f9e012da95
9813 changed files with 611335 additions and 162181 deletions
@@ -1,5 +1,7 @@
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; }
var _class;
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
/*
* Copyright 2019 Red Hat, Inc. and/or its affiliates.
*
@@ -15,21 +17,19 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import * as React from "../../../common/keycloak/web_modules/react.js";
import { Alert, AlertActionCloseButton, AlertGroup, AlertVariant } from "../../../common/keycloak/web_modules/@patternfly/react-core.js";
import * as React from "../../keycloak.v2/web_modules/react.js";
import { Alert, AlertActionCloseButton, AlertGroup, AlertVariant } from "../../keycloak.v2/web_modules/@patternfly/react-core.js";
import { Msg } from "../widgets/Msg.js";
export class ContentAlert extends React.Component {
constructor(props) {
super(props);
_defineProperty(this, "hideAlert", key => {
this.setState({
alerts: [...this.state.alerts.filter(el => el.key !== key)]
});
});
_defineProperty(this, "getUniqueId", () => new Date().getTime());
_defineProperty(this, "postAlert", (variant, message, params) => {
const alerts = this.state.alerts;
const key = this.getUniqueId();
@@ -41,50 +41,43 @@ export class ContentAlert extends React.Component {
this.setState({
alerts
});
if (variant !== AlertVariant.danger) {
setTimeout(() => this.hideAlert(key), 8000);
}
});
this.state = {
alerts: []
};
ContentAlert.instance = this;
}
/**
* @param message A literal text message or localization key.
*/
static success(message, params) {
ContentAlert.instance.postAlert(AlertVariant.success, message, params);
}
/**
* @param message A literal text message or localization key.
*/
static danger(message, params) {
ContentAlert.instance.postAlert(AlertVariant.danger, message, params);
}
/**
* @param message A literal text message or localization key.
*/
static warning(message, params) {
ContentAlert.instance.postAlert(AlertVariant.warning, message, params);
}
/**
* @param message A literal text message or localization key.
*/
static info(message, params) {
ContentAlert.instance.postAlert(AlertVariant.info, message, params);
}
render() {
return /*#__PURE__*/React.createElement(AlertGroup, {
isToast: true,
@@ -106,8 +99,7 @@ export class ContentAlert extends React.Component {
key: key
})));
}
}
_class = ContentAlert;
_defineProperty(ContentAlert, "instance", void 0);
//# sourceMappingURL=ContentAlert.js.map
File diff suppressed because one or more lines are too long
@@ -13,12 +13,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import * as React from "../../../common/keycloak/web_modules/react.js";
import { Button, Text, Title, Tooltip, PageSection, TextContent, PageSectionVariants, SplitItem, Split } from "../../../common/keycloak/web_modules/@patternfly/react-core.js";
import { SyncAltIcon } from "../../../common/keycloak/web_modules/@patternfly/react-icons.js";
import * as React from "../../keycloak.v2/web_modules/react.js";
import { Button, Text, Title, Tooltip, PageSection, TextContent, PageSectionVariants, SplitItem, Split } from "../../keycloak.v2/web_modules/@patternfly/react-core.js";
import { SyncAltIcon } from "../../keycloak.v2/web_modules/@patternfly/react-icons.js";
import { Msg } from "../widgets/Msg.js";
import { ContentAlert } from "./ContentAlert.js";
/**
* @author Stan Silvert ssilvert@redhat.com (C) 2019 Red Hat Inc.
*/
@@ -26,7 +26,6 @@ export class ContentPage extends React.Component {
constructor(props) {
super(props);
}
render() {
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ContentAlert, null), /*#__PURE__*/React.createElement(PageSection, {
variant: PageSectionVariants.light,
@@ -57,7 +56,6 @@ export class ContentPage extends React.Component {
msgKey: "refresh"
})))))), this.props.children);
}
}
;
//# sourceMappingURL=ContentPage.js.map
File diff suppressed because one or more lines are too long
@@ -1,5 +1,6 @@
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; }
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
/*
* Copyright 2018 Red Hat, Inc. and/or its affiliates.
*
@@ -15,8 +16,8 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import * as React from "../../../../common/keycloak/web_modules/react.js";
import { ActionGroup, Button, Form, FormGroup, TextInput, Grid, GridItem, ExpandableSection, ValidatedOptions, PageSection, PageSectionVariants, Text, TextVariants, TextContent } from "../../../../common/keycloak/web_modules/@patternfly/react-core.js";
import * as React from "../../../keycloak.v2/web_modules/react.js";
import { ActionGroup, Button, Form, FormGroup, TextInput, InputGroup, Grid, GridItem, ExpandableSection, ValidatedOptions, PageSection, PageSectionVariants, Text, TextVariants, TextContent } from "../../../keycloak.v2/web_modules/@patternfly/react-core.js";
import { AccountServiceContext } from "../../account-service/AccountServiceContext.js";
import { Msg } from "../../widgets/Msg.js";
import { ContentPage } from "../ContentPage.js";
@@ -24,22 +25,19 @@ import { ContentAlert } from "../ContentAlert.js";
import { LocaleSelector } from "../../widgets/LocaleSelectors.js";
import { KeycloakContext } from "../../keycloak-service/KeycloakContext.js";
import { AIACommand } from "../../util/AIACommand.js";
import { ExternalLinkSquareAltIcon } from "../../../keycloak.v2/web_modules/@patternfly/react-icons.js";
/**
* @author Stan Silvert ssilvert@redhat.com (C) 2018 Red Hat Inc.
*/
export class AccountPage extends React.Component {
constructor(props, context) {
super(props);
_defineProperty(this, "context", void 0);
_defineProperty(this, "isRegistrationEmailAsUsername", features.isRegistrationEmailAsUsername);
_defineProperty(this, "isEditUserNameAllowed", features.isEditUserNameAllowed);
_defineProperty(this, "isDeleteAccountAllowed", features.deleteAccountAllowed);
_defineProperty(this, "isUpdateEmailFeatureEnabled", features.updateEmailFeatureEnabled);
_defineProperty(this, "isUpdateEmailActionEnabled", features.updateEmailActionEnabled);
_defineProperty(this, "DEFAULT_STATE", {
errors: {
username: '',
@@ -55,37 +53,34 @@ export class AccountPage extends React.Component {
attributes: {}
}
});
_defineProperty(this, "state", this.DEFAULT_STATE);
_defineProperty(this, "handleCancel", () => {
this.fetchPersonalInfo();
});
_defineProperty(this, "handleChange", (value, event) => {
const target = event.currentTarget;
const name = target.name;
this.setState({
errors: { ...this.state.errors,
errors: {
...this.state.errors,
[name]: target.validationMessage
},
formFields: { ...this.state.formFields,
formFields: {
...this.state.formFields,
[name]: value
}
});
});
_defineProperty(this, "handleSubmit", event => {
event.preventDefault();
const form = event.target;
const isValid = form.checkValidity();
if (isValid) {
const reqData = { ...this.state.formFields
const reqData = {
...this.state.formFields
};
this.context.doPost("/", reqData).then(() => {
ContentAlert.success('accountUpdatedMessage');
if (locale !== this.state.formFields.attributes.locale[0]) {
window.location.reload();
}
@@ -97,17 +92,19 @@ export class AccountPage extends React.Component {
return acc;
}, {});
this.setState({
errors: { ...validationMessages
errors: {
...validationMessages
},
formFields: this.state.formFields
});
}
});
_defineProperty(this, "handleDelete", keycloak => {
new AIACommand(keycloak, "delete_account").execute();
});
_defineProperty(this, "handleEmailUpdate", keycloak => {
new AIACommand(keycloak, "UPDATE_EMAIL").execute();
});
_defineProperty(this, "UsernameInput", () => /*#__PURE__*/React.createElement(TextInput, {
isRequired: true,
type: "text",
@@ -118,7 +115,6 @@ export class AccountPage extends React.Component {
onChange: this.handleChange,
validated: this.state.errors.username !== '' ? ValidatedOptions.error : ValidatedOptions.default
}));
_defineProperty(this, "RestrictedUsernameInput", () => /*#__PURE__*/React.createElement(TextInput, {
isReadOnly: true,
type: "text",
@@ -126,16 +122,13 @@ export class AccountPage extends React.Component {
name: "username",
value: this.state.formFields.username
}));
this.context = context;
this.fetchPersonalInfo();
}
fetchPersonalInfo() {
this.context.doGet("/").then(response => {
this.setState(this.DEFAULT_STATE);
const formFields = response.data;
if (!formFields.attributes) {
formFields.attributes = {
locale: [locale]
@@ -143,14 +136,13 @@ export class AccountPage extends React.Component {
} else if (!formFields.attributes.locale) {
formFields.attributes.locale = [locale];
}
this.setState({ ...{
this.setState({
...{
formFields: formFields
}
});
});
}
render() {
const fields = this.state.formFields;
return /*#__PURE__*/React.createElement(ContentPage, {
@@ -166,13 +158,13 @@ export class AccountPage extends React.Component {
}, Msg.localize('allFieldsRequired'))), /*#__PURE__*/React.createElement(Form, {
onSubmit: event => this.handleSubmit(event),
className: "personal-info-form"
}, !this.isRegistrationEmailAsUsername && /*#__PURE__*/React.createElement(FormGroup, {
}, !this.isRegistrationEmailAsUsername && fields.username != undefined && /*#__PURE__*/React.createElement(FormGroup, {
label: Msg.localize("username"),
fieldId: "user-name",
helperTextInvalid: this.state.errors.username,
validated: this.state.errors.username !== "" ? ValidatedOptions.error : ValidatedOptions.default
}, this.isEditUserNameAllowed && /*#__PURE__*/React.createElement(this.UsernameInput, null), !this.isEditUserNameAllowed && /*#__PURE__*/React.createElement(this.RestrictedUsernameInput, null)), /*#__PURE__*/React.createElement(FormGroup, {
label: Msg.localize("email"),
}, this.isEditUserNameAllowed && /*#__PURE__*/React.createElement(this.UsernameInput, null), !this.isEditUserNameAllowed && /*#__PURE__*/React.createElement(this.RestrictedUsernameInput, null)), !this.isUpdateEmailFeatureEnabled && /*#__PURE__*/React.createElement(FormGroup, {
label: Msg.localize('email'),
fieldId: "email-address",
helperTextInvalid: this.state.errors.email,
validated: this.state.errors.email !== "" ? ValidatedOptions.error : ValidatedOptions.default
@@ -185,7 +177,24 @@ export class AccountPage extends React.Component {
value: fields.email,
onChange: this.handleChange,
validated: this.state.errors.email !== "" ? ValidatedOptions.error : ValidatedOptions.default
})), /*#__PURE__*/React.createElement(FormGroup, {
})), this.isUpdateEmailFeatureEnabled && /*#__PURE__*/React.createElement(FormGroup, {
label: Msg.localize('email'),
fieldId: "email-address"
}, /*#__PURE__*/React.createElement(InputGroup, null, /*#__PURE__*/React.createElement(TextInput, {
isDisabled: true,
type: "email",
id: "email-address",
name: "email",
value: fields.email
}), this.isUpdateEmailActionEnabled && (!this.isRegistrationEmailAsUsername || this.isEditUserNameAllowed) && /*#__PURE__*/React.createElement(KeycloakContext.Consumer, null, keycloak => /*#__PURE__*/React.createElement(Button, {
id: "update-email-btn",
variant: "link",
onClick: () => this.handleEmailUpdate(keycloak),
icon: /*#__PURE__*/React.createElement(ExternalLinkSquareAltIcon, null),
iconPosition: "right"
}, /*#__PURE__*/React.createElement(Msg, {
msgKey: "updateEmail"
}))))), /*#__PURE__*/React.createElement(FormGroup, {
label: Msg.localize("firstName"),
fieldId: "first-name",
helperTextInvalid: this.state.errors.firstName,
@@ -222,8 +231,10 @@ export class AccountPage extends React.Component {
value: fields.attributes.locale || "",
onChange: value => this.setState({
errors: this.state.errors,
formFields: { ...this.state.formFields,
attributes: { ...this.state.formFields.attributes,
formFields: {
...this.state.formFields,
attributes: {
...this.state.formFields.attributes,
locale: [value]
}
}
@@ -247,7 +258,7 @@ export class AccountPage extends React.Component {
marginTop: "30px"
}
}, /*#__PURE__*/React.createElement(ExpandableSection, {
toggleText: "Delete Account"
toggleText: Msg.localize("deleteAccount")
}, /*#__PURE__*/React.createElement(Grid, {
hasGutter: true
}, /*#__PURE__*/React.createElement(GridItem, {
@@ -267,10 +278,7 @@ export class AccountPage extends React.Component {
span: 2
}))))));
}
}
_defineProperty(AccountPage, "contextType", AccountServiceContext);
;
//# sourceMappingURL=AccountPage.js.map
File diff suppressed because one or more lines are too long
@@ -1,5 +1,6 @@
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; }
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
/*
* Copyright 2019 Red Hat, Inc. and/or its affiliates.
*
@@ -15,30 +16,33 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import * as React from "../../../../common/keycloak/web_modules/react.js";
import { withRouter } from "../../../../common/keycloak/web_modules/react-router-dom.js";
import * as React from "../../../keycloak.v2/web_modules/react.js";
import { withRouter } from "../../../keycloak.v2/web_modules/react-router-dom.js";
import { AIACommand } from "../../util/AIACommand.js";
import { Msg } from "../../widgets/Msg.js";
import { Title, Button, EmptyState, EmptyStateVariant, EmptyStateIcon, EmptyStateBody, TitleSizes } from "../../../../common/keycloak/web_modules/@patternfly/react-core.js";
import { PassportIcon } from "../../../../common/keycloak/web_modules/@patternfly/react-icons.js";
import { KeycloakContext } from "../../keycloak-service/KeycloakContext.js"; // Note: This class demonstrates two features of the ContentPages framework:
import { Title, Button, EmptyState, EmptyStateVariant, EmptyStateIcon, EmptyStateBody, TitleSizes } from "../../../keycloak.v2/web_modules/@patternfly/react-core.js";
import { PassportIcon } from "../../../keycloak.v2/web_modules/@patternfly/react-icons.js";
import { KeycloakContext } from "../../keycloak-service/KeycloakContext.js";
// Note: This class demonstrates two features of the ContentPages framework:
// 1) The PageDef is available as a React property.
// 2) You can add additional custom properties to the PageDef. In this case,
// we add a value called kcAction in content.js and access it by extending the
// PageDef interface.
// Extend RouteComponentProps to get access to router information such as
// the hash-routed path associated with this page. See this.props.location.pathname
// as used below.
/**
* @author Stan Silvert
*/
class ApplicationInitiatedActionPage extends React.Component {
constructor(props) {
super(props);
_defineProperty(this, "handleClick", keycloak => {
new AIACommand(keycloak, this.props.pageDef.kcAction).execute();
});
}
render() {
return /*#__PURE__*/React.createElement(EmptyState, {
variant: EmptyStateVariant.full
@@ -60,11 +64,10 @@ class ApplicationInitiatedActionPage extends React.Component {
msgKey: "continue"
}))));
}
}
;
; // Note that the class name is not exported above. To get access to the router,
// Note that the class name is not exported above. To get access to the router,
// we use withRouter() and export a different name.
export const AppInitiatedActionPage = withRouter(ApplicationInitiatedActionPage);
//# sourceMappingURL=AppInitiatedActionPage.js.map
File diff suppressed because one or more lines are too long
@@ -1,5 +1,6 @@
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; }
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
/*
* Copyright 2018 Red Hat, Inc. and/or its affiliates.
*
@@ -15,9 +16,10 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import * as React from "../../../../common/keycloak/web_modules/react.js";
import { DataList, DataListItem, DataListItemRow, DataListCell, DataListToggle, DataListContent, DataListItemCells, DescriptionList, DescriptionListTerm, DescriptionListGroup, DescriptionListDescription, Grid, GridItem, Button, PageSection, PageSectionVariants, Stack } from "../../../../common/keycloak/web_modules/@patternfly/react-core.js";
import { InfoAltIcon, CheckIcon, ExternalLinkAltIcon } from "../../../../common/keycloak/web_modules/@patternfly/react-icons.js";
import * as React from "../../../keycloak.v2/web_modules/react.js";
import { DataList, DataListItem, DataListItemRow, DataListCell, DataListToggle, DataListContent, DataListItemCells, DescriptionList, DescriptionListTerm, DescriptionListGroup, DescriptionListDescription, Grid, GridItem, Button, PageSection, PageSectionVariants, Stack } from "../../../keycloak.v2/web_modules/@patternfly/react-core.js";
import { InfoAltIcon, CheckIcon, ExternalLinkAltIcon } from "../../../keycloak.v2/web_modules/@patternfly/react-icons.js";
import { ContentPage } from "../ContentPage.js";
import { ContinueCancelModal } from "../../widgets/ContinueCancelModal.js";
import { AccountServiceContext } from "../../account-service/AccountServiceContext.js";
@@ -25,15 +27,12 @@ import { Msg } from "../../widgets/Msg.js";
export class ApplicationsPage extends React.Component {
constructor(props, context) {
super(props);
_defineProperty(this, "context", void 0);
_defineProperty(this, "removeConsent", clientId => {
this.context.doDelete("/applications/" + clientId + "/consent").then(() => {
this.context.doDelete("/applications/" + encodeURIComponent(clientId) + "/consent").then(() => {
this.fetchApplications();
});
});
_defineProperty(this, "onToggle", row => {
const newIsRowOpen = this.state.isRowOpen;
newIsRowOpen[row] = !newIsRowOpen[row];
@@ -41,7 +40,6 @@ export class ApplicationsPage extends React.Component {
isRowOpen: newIsRowOpen
});
});
this.context = context;
this.state = {
isRowOpen: [],
@@ -49,7 +47,6 @@ export class ApplicationsPage extends React.Component {
};
this.fetchApplications();
}
fetchApplications() {
this.context.doGet("/applications").then(response => {
const applications = response.data || [];
@@ -59,15 +56,13 @@ export class ApplicationsPage extends React.Component {
});
});
}
elementId(item, application) {
return `application-${item}-${application.clientId}`;
}
render() {
return /*#__PURE__*/React.createElement(ContentPage, {
title: Msg.localize('applicationsPageTitle'),
introMessage: "Manage your application permissions."
introMessage: Msg.localize('applicationsPageSubTitle')
}, /*#__PURE__*/React.createElement(PageSection, {
isFilled: true,
variant: PageSectionVariants.light
@@ -147,11 +142,15 @@ export class ApplicationsPage extends React.Component {
"aria-label": Msg.localize('applicationDetails'),
id: this.elementId("expandable", application),
isHidden: !this.state.isRowOpen[appIndex]
}, /*#__PURE__*/React.createElement(DescriptionList, null, /*#__PURE__*/React.createElement(DescriptionListGroup, null, /*#__PURE__*/React.createElement(DescriptionListTerm, null, Msg.localize('client')), /*#__PURE__*/React.createElement(DescriptionListDescription, null, application.clientId)), application.description && /*#__PURE__*/React.createElement(DescriptionListGroup, null, /*#__PURE__*/React.createElement(DescriptionListTerm, null, Msg.localize('description')), /*#__PURE__*/React.createElement(DescriptionListDescription, null, application.description)), application.effectiveUrl && /*#__PURE__*/React.createElement(DescriptionListGroup, null, /*#__PURE__*/React.createElement(DescriptionListTerm, null, "URL"), /*#__PURE__*/React.createElement(DescriptionListDescription, null, application.effectiveUrl.split('"'))), application.consent && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(DescriptionListGroup, null, /*#__PURE__*/React.createElement(DescriptionListTerm, null, "Has access to"), application.consent.grantedScopes.map((scope, scopeIndex) => {
}, /*#__PURE__*/React.createElement(DescriptionList, null, /*#__PURE__*/React.createElement(DescriptionListGroup, null, /*#__PURE__*/React.createElement(DescriptionListTerm, null, Msg.localize('client')), /*#__PURE__*/React.createElement(DescriptionListDescription, null, application.clientId)), application.description && /*#__PURE__*/React.createElement(DescriptionListGroup, null, /*#__PURE__*/React.createElement(DescriptionListTerm, null, Msg.localize('description')), /*#__PURE__*/React.createElement(DescriptionListDescription, null, application.description)), application.effectiveUrl && /*#__PURE__*/React.createElement(DescriptionListGroup, null, /*#__PURE__*/React.createElement(DescriptionListTerm, null, "URL"), /*#__PURE__*/React.createElement(DescriptionListDescription, {
id: this.elementId("effectiveurl", application)
}, application.effectiveUrl.split('"'))), application.consent && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(DescriptionListGroup, null, /*#__PURE__*/React.createElement(DescriptionListTerm, null, "Has access to"), application.consent.grantedScopes.map((scope, scopeIndex) => {
return /*#__PURE__*/React.createElement(React.Fragment, {
key: 'scope-' + scopeIndex
}, /*#__PURE__*/React.createElement(DescriptionListDescription, null, /*#__PURE__*/React.createElement(CheckIcon, null), " ", scope.name));
})), /*#__PURE__*/React.createElement(DescriptionListGroup, null, /*#__PURE__*/React.createElement(DescriptionListTerm, null, Msg.localize('accessGrantedOn') + ': '), /*#__PURE__*/React.createElement(DescriptionListDescription, null, new Intl.DateTimeFormat(locale, {
}, /*#__PURE__*/React.createElement(DescriptionListDescription, null, /*#__PURE__*/React.createElement(CheckIcon, null), Msg.localize(scope.name)));
})), application.tosUri && /*#__PURE__*/React.createElement(DescriptionListGroup, null, /*#__PURE__*/React.createElement(DescriptionListTerm, null, Msg.localize('termsOfService')), /*#__PURE__*/React.createElement(DescriptionListDescription, null, application.tosUri)), application.policyUri && /*#__PURE__*/React.createElement(DescriptionListGroup, null, /*#__PURE__*/React.createElement(DescriptionListTerm, null, Msg.localize('policy')), /*#__PURE__*/React.createElement(DescriptionListDescription, null, application.policyUri)), application.logoUri && /*#__PURE__*/React.createElement(DescriptionListGroup, null, /*#__PURE__*/React.createElement(DescriptionListTerm, null, Msg.localize('logo')), /*#__PURE__*/React.createElement(DescriptionListDescription, null, /*#__PURE__*/React.createElement("img", {
src: application.logoUri
}))), /*#__PURE__*/React.createElement(DescriptionListGroup, null, /*#__PURE__*/React.createElement(DescriptionListTerm, null, Msg.localize('accessGrantedOn') + ': '), /*#__PURE__*/React.createElement(DescriptionListDescription, null, new Intl.DateTimeFormat(locale, {
year: 'numeric',
month: 'long',
day: 'numeric',
@@ -171,14 +170,10 @@ export class ApplicationsPage extends React.Component {
modalContinueButtonLabel: Msg.localize('confirmButton') // defaults to 'Continue'
,
onContinue: () => this.removeConsent(application.clientId) // required
}))), /*#__PURE__*/React.createElement(GridItem, null, /*#__PURE__*/React.createElement(InfoAltIcon, null), " ", Msg.localize('infoMessage')))));
})))));
}
}
_defineProperty(ApplicationsPage, "contextType", AccountServiceContext);
;
//# sourceMappingURL=ApplicationsPage.js.map
File diff suppressed because one or more lines are too long
@@ -13,16 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import * as React from "../../../../common/keycloak/web_modules/react.js";
import * as React from "../../../keycloak.v2/web_modules/react.js";
export class AuthenticatorPage extends React.Component {
constructor(props) {
super(props);
}
render() {
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("h2", null, "Hello Authenticator Page"));
}
}
;
//# sourceMappingURL=AuthenticatorPage.js.map
@@ -1 +1 @@
{"version":3,"sources":["../../../src/app/content/authenticator-page/AuthenticatorPage.tsx"],"names":["React","AuthenticatorPage","Component","constructor","props","render"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA,OAAO,KAAKA,KAAZ;AAKA,OAAO,MAAMC,iBAAN,SAAgCD,KAAK,CAACE,SAAtC,CAAwE;AAEpEC,EAAAA,WAAW,CAACC,KAAD,EAAgC;AAC9C,UAAMA,KAAN;AACH;;AAEMC,EAAAA,MAAM,GAAoB;AAC7B,wBACI,8CACE,2DADF,CADJ;AAKH;;AAZ0E;AAa9E","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 \nexport interface AuthenticatorPageProps {\n}\n \nexport class AuthenticatorPage extends React.Component<AuthenticatorPageProps> {\n \n public constructor(props: AuthenticatorPageProps) {\n super(props);\n }\n\n public render(): React.ReactNode {\n return (\n <div>\n <h2>Hello Authenticator Page</h2>\n </div>\n );\n }\n};"],"file":"AuthenticatorPage.js"}
{"version":3,"file":"AuthenticatorPage.js","names":["React","AuthenticatorPage","Component","constructor","props","render","createElement"],"sources":["../../../src/app/content/authenticator-page/AuthenticatorPage.tsx"],"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 \nexport interface AuthenticatorPageProps {\n}\n \nexport class AuthenticatorPage extends React.Component<AuthenticatorPageProps> {\n \n public constructor(props: AuthenticatorPageProps) {\n super(props);\n }\n\n public render(): React.ReactNode {\n return (\n <div>\n <h2>Hello Authenticator Page</h2>\n </div>\n );\n }\n};"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAO,KAAKA,KAAK;AAKjB,OAAO,MAAMC,iBAAiB,SAASD,KAAK,CAACE,SAAS,CAAyB;EAEpEC,WAAWA,CAACC,KAA6B,EAAE;IAC9C,KAAK,CAACA,KAAK,CAAC;EAChB;EAEOC,MAAMA,CAAA,EAAoB;IAC7B,oBACIL,KAAA,CAAAM,aAAA,2BACEN,KAAA,CAAAM,aAAA,aAAI,0BAA4B,CAC7B,CAAC;EAEd;AACJ;AAAC"}
@@ -1,5 +1,6 @@
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; }
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
/*
* Copyright 2018 Red Hat, Inc. and/or its affiliates.
*
@@ -15,46 +16,41 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import * as React from "../../../../common/keycloak/web_modules/react.js";
import * as React from "../../../keycloak.v2/web_modules/react.js";
import { AccountServiceContext } from "../../account-service/AccountServiceContext.js";
import TimeUtil from "../../util/TimeUtil.js";
import { Button, DataList, DataListItem, DataListItemRow, DataListContent, DescriptionList, DescriptionListTerm, DescriptionListDescription, DescriptionListGroup, Grid, GridItem, Label, PageSection, PageSectionVariants, Title, Tooltip, SplitItem, Split } from "../../../../common/keycloak/web_modules/@patternfly/react-core.js";
import { DesktopIcon, MobileAltIcon, SyncAltIcon } from "../../../../common/keycloak/web_modules/@patternfly/react-icons.js";
import { Button, DataList, DataListItem, DataListItemRow, DataListContent, DescriptionList, DescriptionListTerm, DescriptionListDescription, DescriptionListGroup, Grid, GridItem, Label, PageSection, PageSectionVariants, Title, Tooltip, SplitItem, Split } from "../../../keycloak.v2/web_modules/@patternfly/react-core.js";
import { DesktopIcon, MobileAltIcon, SyncAltIcon } from "../../../keycloak.v2/web_modules/@patternfly/react-icons.js";
import { Msg } from "../../widgets/Msg.js";
import { ContinueCancelModal } from "../../widgets/ContinueCancelModal.js";
import { KeycloakContext } from "../../keycloak-service/KeycloakContext.js";
import { ContentPage } from "../ContentPage.js";
import { ContentAlert } from "../ContentAlert.js";
/**
* @author Stan Silvert ssilvert@redhat.com (C) 2019 Red Hat Inc.
*/
export class DeviceActivityPage extends React.Component {
constructor(props, context) {
super(props);
_defineProperty(this, "context", void 0);
_defineProperty(this, "signOutAll", keycloakService => {
this.context.doDelete("/sessions").then(() => {
keycloakService.logout();
});
});
_defineProperty(this, "signOutSession", (device, session) => {
this.context.doDelete("/sessions/" + session.id).then(() => {
this.context.doDelete("/sessions/" + encodeURIComponent(session.id)).then(() => {
this.fetchDevices();
ContentAlert.success('signedOutSession', [session.browser, device.os]);
});
});
this.context = context;
this.state = {
devices: []
};
this.fetchDevices();
}
fetchDevices() {
this.context.doGet("/sessions/devices").then(response => {
console.log({
@@ -65,9 +61,9 @@ export class DeviceActivityPage extends React.Component {
devices: devices
});
});
} // current device and session should display at the top of their respective lists
}
// current device and session should display at the top of their respective lists
moveCurrentToTop(devices) {
let currentDevice = devices[0];
devices.forEach((device, index) => {
@@ -85,15 +81,12 @@ export class DeviceActivityPage extends React.Component {
});
return devices;
}
time(time) {
return TimeUtil.format(time * 1000);
}
elementId(item, session, element = 'session') {
return `${element}-${session.id.substring(0, 7)}-${item}`;
}
findDeviceTypeIcon(session, device) {
const deviceType = device.mobile;
if (deviceType === true) return /*#__PURE__*/React.createElement(MobileAltIcon, {
@@ -103,41 +96,34 @@ export class DeviceActivityPage extends React.Component {
id: this.elementId('icon-desktop', session, 'device')
});
}
findOS(device) {
if (device.os.toLowerCase().includes('unknown')) return Msg.localize('unknownOperatingSystem');
return device.os;
}
findOSVersion(device) {
if (device.osVersion.toLowerCase().includes('unknown')) return '';
return device.osVersion;
}
makeClientsString(clients) {
let clientsString = "";
clients.forEach((client, index) => {
let clientName;
if (client.hasOwnProperty('clientName') && client.clientName !== undefined && client.clientName !== '') {
clientName = Msg.localize(client.clientName);
} else {
clientName = client.clientId;
}
clientsString += clientName;
if (clients.length > index + 1) clientsString += ', ';
});
return clientsString;
}
isShowSignOutAll(devices) {
if (devices.length === 0) return false;
if (devices.length > 1) return true;
if (devices[0].sessions.length > 1) return true;
return false;
}
render() {
return /*#__PURE__*/React.createElement(ContentPage, {
title: "device-activity",
@@ -168,7 +154,9 @@ export class DeviceActivityPage extends React.Component {
variant: "link",
onClick: this.fetchDevices.bind(this),
icon: /*#__PURE__*/React.createElement(SyncAltIcon, null)
}, "Refresh"))), /*#__PURE__*/React.createElement(SplitItem, null, /*#__PURE__*/React.createElement(KeycloakContext.Consumer, null, keycloak => this.isShowSignOutAll(this.state.devices) && /*#__PURE__*/React.createElement(ContinueCancelModal, {
}, /*#__PURE__*/React.createElement(Msg, {
msgKey: "refresh"
})))), /*#__PURE__*/React.createElement(SplitItem, null, /*#__PURE__*/React.createElement(KeycloakContext.Consumer, null, keycloak => this.isShowSignOutAll(this.state.devices) && /*#__PURE__*/React.createElement(ContinueCancelModal, {
buttonTitle: "signOutAllDevices",
buttonId: "sign-out-all",
modalTitle: "signOutAllDevices",
@@ -189,6 +177,7 @@ export class DeviceActivityPage extends React.Component {
isHidden: false,
className: "pf-u-flex-grow-1"
}, /*#__PURE__*/React.createElement(Grid, {
id: this.elementId("item", session),
className: "signed-in-device-grid",
hasGutter: true
}, /*#__PURE__*/React.createElement(GridItem, {
@@ -201,9 +190,10 @@ export class DeviceActivityPage extends React.Component {
span: 10
}, /*#__PURE__*/React.createElement("span", {
id: this.elementId('browser', session),
className: "pf-u-mr-md"
className: "pf-u-mr-md session-title"
}, this.findOS(device), " ", this.findOSVersion(device), " / ", session.browser), session.current && /*#__PURE__*/React.createElement(Label, {
color: "green"
color: "green",
id: this.elementId('current-badge', session)
}, /*#__PURE__*/React.createElement(Msg, {
msgKey: "currentSession"
}))), /*#__PURE__*/React.createElement(GridItem, {
@@ -225,14 +215,21 @@ export class DeviceActivityPage extends React.Component {
sm: '2Col',
lg: '3Col'
}
}, /*#__PURE__*/React.createElement(DescriptionListGroup, null, /*#__PURE__*/React.createElement(DescriptionListTerm, null, Msg.localize('ipAddress')), /*#__PURE__*/React.createElement(DescriptionListDescription, null, session.ipAddress)), /*#__PURE__*/React.createElement(DescriptionListGroup, null, /*#__PURE__*/React.createElement(DescriptionListTerm, null, Msg.localize('lastAccessedOn')), /*#__PURE__*/React.createElement(DescriptionListDescription, null, this.time(session.lastAccess))), /*#__PURE__*/React.createElement(DescriptionListGroup, null, /*#__PURE__*/React.createElement(DescriptionListTerm, null, Msg.localize('clients')), /*#__PURE__*/React.createElement(DescriptionListDescription, null, this.makeClientsString(session.clients))), /*#__PURE__*/React.createElement(DescriptionListGroup, null, /*#__PURE__*/React.createElement(DescriptionListTerm, null, Msg.localize('started')), /*#__PURE__*/React.createElement(DescriptionListDescription, null, this.time(session.started))), /*#__PURE__*/React.createElement(DescriptionListGroup, null, /*#__PURE__*/React.createElement(DescriptionListTerm, null, Msg.localize('expires')), /*#__PURE__*/React.createElement(DescriptionListDescription, null, this.time(session.expires)))))))));
}, /*#__PURE__*/React.createElement(DescriptionListGroup, null, /*#__PURE__*/React.createElement(DescriptionListTerm, null, Msg.localize('ipAddress')), /*#__PURE__*/React.createElement(DescriptionListDescription, {
id: this.elementId('ip', session)
}, session.ipAddress)), /*#__PURE__*/React.createElement(DescriptionListGroup, null, /*#__PURE__*/React.createElement(DescriptionListTerm, null, Msg.localize('lastAccessedOn')), /*#__PURE__*/React.createElement(DescriptionListDescription, {
id: this.elementId('last-access', session)
}, this.time(session.lastAccess))), /*#__PURE__*/React.createElement(DescriptionListGroup, null, /*#__PURE__*/React.createElement(DescriptionListTerm, null, Msg.localize('clients')), /*#__PURE__*/React.createElement(DescriptionListDescription, {
id: this.elementId('clients', session)
}, this.makeClientsString(session.clients))), /*#__PURE__*/React.createElement(DescriptionListGroup, null, /*#__PURE__*/React.createElement(DescriptionListTerm, null, Msg.localize('started')), /*#__PURE__*/React.createElement(DescriptionListDescription, {
id: this.elementId('started', session)
}, this.time(session.started))), /*#__PURE__*/React.createElement(DescriptionListGroup, null, /*#__PURE__*/React.createElement(DescriptionListTerm, null, Msg.localize('expires')), /*#__PURE__*/React.createElement(DescriptionListDescription, {
id: this.elementId('expires', session)
}, this.time(session.expires)))))))));
}));
})))));
}
}
_defineProperty(DeviceActivityPage, "contextType", AccountServiceContext);
;
//# sourceMappingURL=DeviceActivityPage.js.map
File diff suppressed because one or more lines are too long
@@ -13,15 +13,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import * as React from "../../../../common/keycloak/web_modules/react.js";
import { WarningTriangleIcon } from "../../../../common/keycloak/web_modules/@patternfly/react-icons.js";
import * as React from "../../../keycloak.v2/web_modules/react.js";
import { WarningTriangleIcon } from "../../../keycloak.v2/web_modules/@patternfly/react-icons.js";
import { Msg } from "../../widgets/Msg.js";
import EmptyMessageState from "../../widgets/EmptyMessageState.js";
export class ForbiddenPage extends React.Component {
constructor() {
super({});
}
render() {
return /*#__PURE__*/React.createElement(EmptyMessageState, {
icon: WarningTriangleIcon,
@@ -30,7 +29,6 @@ export class ForbiddenPage extends React.Component {
msgKey: "needAccessRights"
}));
}
}
;
//# sourceMappingURL=ForbiddenPage.js.map
@@ -1 +1 @@
{"version":3,"sources":["../../../src/app/content/forbidden-page/ForbiddenPage.tsx"],"names":["React","WarningTriangleIcon","Msg","EmptyMessageState","ForbiddenPage","Component","constructor","render"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,KAAKA,KAAZ;AAEA,SAASC,mBAAT;AACA,SAAQC,GAAR;AACA,OAAOC,iBAAP;AAGA,OAAO,MAAMC,aAAN,SAA4BJ,KAAK,CAACK,SAAlC,CAA4C;AAExCC,EAAAA,WAAW,GAAG;AACjB,UAAM,EAAN;AACH;;AAEMC,EAAAA,MAAM,GAAoB;AAC7B,wBACI,oBAAC,iBAAD;AAAmB,MAAA,IAAI,EAAEN,mBAAzB;AAA8C,MAAA,UAAU,EAAC;AAAzD,oBACI,oBAAC,GAAD;AAAK,MAAA,MAAM,EAAC;AAAZ,MADJ,CADJ;AAKH;;AAZ8C;AAalD","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 */\nimport * as React from 'react';\n\nimport { WarningTriangleIcon } from '@patternfly/react-icons';\nimport {Msg} from '../../widgets/Msg';\nimport EmptyMessageState from '../../widgets/EmptyMessageState';\n\n\nexport class ForbiddenPage extends React.Component {\n\n public constructor() {\n super({});\n }\n\n public render(): React.ReactNode {\n return (\n <EmptyMessageState icon={WarningTriangleIcon} messageKey=\"forbidden\">\n <Msg msgKey=\"needAccessRights\"/>\n </EmptyMessageState>\n );\n }\n};\n"],"file":"ForbiddenPage.js"}
{"version":3,"file":"ForbiddenPage.js","names":["React","WarningTriangleIcon","Msg","EmptyMessageState","ForbiddenPage","Component","constructor","render","createElement","icon","messageKey","msgKey"],"sources":["../../../src/app/content/forbidden-page/ForbiddenPage.tsx"],"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 */\nimport * as React from 'react';\n\nimport { WarningTriangleIcon } from '@patternfly/react-icons';\nimport {Msg} from '../../widgets/Msg';\nimport EmptyMessageState from '../../widgets/EmptyMessageState';\n\n\nexport class ForbiddenPage extends React.Component {\n\n public constructor() {\n super({});\n }\n\n public render(): React.ReactNode {\n return (\n <EmptyMessageState icon={WarningTriangleIcon} messageKey=\"forbidden\">\n <Msg msgKey=\"needAccessRights\"/>\n </EmptyMessageState>\n );\n }\n};\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,KAAKA,KAAK;AAEjB,SAASC,mBAAmB;AAC5B,SAAQC,GAAG;AACX,OAAOC,iBAAiB;AAGxB,OAAO,MAAMC,aAAa,SAASJ,KAAK,CAACK,SAAS,CAAC;EAExCC,WAAWA,CAAA,EAAG;IACjB,KAAK,CAAC,CAAC,CAAC,CAAC;EACb;EAEOC,MAAMA,CAAA,EAAoB;IAC7B,oBACIP,KAAA,CAAAQ,aAAA,CAACL,iBAAiB;MAACM,IAAI,EAAER,mBAAoB;MAACS,UAAU,EAAC;IAAW,gBAChEV,KAAA,CAAAQ,aAAA,CAACN,GAAG;MAACS,MAAM,EAAC;IAAkB,CAAC,CAChB,CAAC;EAE5B;AACJ;AAAC"}
@@ -0,0 +1,133 @@
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
import * as React from "../../../keycloak.v2/web_modules/react.js";
import { Checkbox, DataList, DataListItem, DataListItemRow, DataListCell, DataListItemCells } from "../../../keycloak.v2/web_modules/@patternfly/react-core.js";
import { ContentPage } from "../ContentPage.js";
import { AccountServiceContext } from "../../account-service/AccountServiceContext.js";
import { Msg } from "../../widgets/Msg.js";
export class GroupsPage extends React.Component {
constructor(props, context) {
super(props);
_defineProperty(this, "context", void 0);
_defineProperty(this, "changeDirectMembership", (checked, event) => {
this.setState({
isDirectMembership: checked
});
});
this.context = context;
this.state = {
groups: [],
directGroups: [],
isDirectMembership: false
};
this.fetchGroups();
}
fetchGroups() {
this.context.doGet("/groups").then(response => {
const directGroups = response.data || [];
const groups = [...directGroups];
const groupsPaths = directGroups.map(s => s.path);
directGroups.forEach(el => this.getParents(el, groups, groupsPaths));
this.setState({
groups: groups,
directGroups: directGroups
});
});
}
getParents(el, groups, groupsPaths) {
const parentPath = el.path.slice(0, el.path.lastIndexOf('/'));
if (parentPath && groupsPaths.indexOf(parentPath) === -1) {
el = {
name: parentPath.slice(parentPath.lastIndexOf('/') + 1),
path: parentPath
};
groups.push(el);
groupsPaths.push(parentPath);
this.getParents(el, groups, groupsPaths);
}
}
emptyGroup() {
return /*#__PURE__*/React.createElement(DataListItem, {
key: "emptyItem",
"aria-labelledby": "empty-item"
}, /*#__PURE__*/React.createElement(DataListItemRow, {
key: "emptyRow"
}, /*#__PURE__*/React.createElement(DataListItemCells, {
dataListCells: [/*#__PURE__*/React.createElement(DataListCell, {
key: "empty"
}, /*#__PURE__*/React.createElement("strong", null, /*#__PURE__*/React.createElement(Msg, {
msgKey: "noGroupsText"
})))]
})));
}
renderGroupList(group, appIndex) {
return /*#__PURE__*/React.createElement(DataListItem, {
id: `${appIndex}-group`,
key: 'group-' + appIndex,
"aria-labelledby": "groups-list"
}, /*#__PURE__*/React.createElement(DataListItemRow, null, /*#__PURE__*/React.createElement(DataListItemCells, {
dataListCells: [/*#__PURE__*/React.createElement(DataListCell, {
id: `${appIndex}-group-name`,
width: 2,
key: 'name-' + appIndex
}, group.name), /*#__PURE__*/React.createElement(DataListCell, {
id: `${appIndex}-group-path`,
width: 2,
key: 'path-' + appIndex
}, group.path), /*#__PURE__*/React.createElement(DataListCell, {
id: `${appIndex}-group-directMembership`,
width: 2,
key: 'directMembership-' + appIndex
}, /*#__PURE__*/React.createElement(Checkbox, {
id: `${appIndex}-checkbox-directMembership`,
isChecked: group.id != null,
isDisabled: true
}))]
})));
}
render() {
return /*#__PURE__*/React.createElement(ContentPage, {
title: Msg.localize('groupLabel')
}, /*#__PURE__*/React.createElement(DataList, {
id: "groups-list",
"aria-label": Msg.localize('groupLabel'),
isCompact: true
}, /*#__PURE__*/React.createElement(DataListItem, {
id: "groups-list-header",
"aria-labelledby": "Columns names"
}, /*#__PURE__*/React.createElement(DataListItemRow, null, /*#__PURE__*/React.createElement(DataListItemCells, {
dataListCells: [/*#__PURE__*/React.createElement(DataListCell, {
key: "directMembership-header"
}, /*#__PURE__*/React.createElement(Checkbox, {
label: Msg.localize('directMembership'),
id: "directMembership-checkbox",
isChecked: this.state.isDirectMembership,
onChange: this.changeDirectMembership
}))]
}))), /*#__PURE__*/React.createElement(DataListItem, {
id: "groups-list-header",
"aria-labelledby": "Columns names"
}, /*#__PURE__*/React.createElement(DataListItemRow, null, /*#__PURE__*/React.createElement(DataListItemCells, {
dataListCells: [/*#__PURE__*/React.createElement(DataListCell, {
key: "group-name-header",
width: 2
}, /*#__PURE__*/React.createElement("strong", null, /*#__PURE__*/React.createElement(Msg, {
msgKey: "Name"
}))), /*#__PURE__*/React.createElement(DataListCell, {
key: "group-path-header",
width: 2
}, /*#__PURE__*/React.createElement("strong", null, /*#__PURE__*/React.createElement(Msg, {
msgKey: "path"
}))), /*#__PURE__*/React.createElement(DataListCell, {
key: "group-direct-membership-header",
width: 2
}, /*#__PURE__*/React.createElement("strong", null, /*#__PURE__*/React.createElement(Msg, {
msgKey: "directMembership"
})))]
}))), this.state.groups.length === 0 ? this.emptyGroup() : this.state.isDirectMembership ? this.state.directGroups.map((group, appIndex) => this.renderGroupList(group, appIndex)) : this.state.groups.map((group, appIndex) => this.renderGroupList(group, appIndex))));
}
}
_defineProperty(GroupsPage, "contextType", AccountServiceContext);
;
//# sourceMappingURL=GroupsPage.js.map
File diff suppressed because one or more lines are too long
@@ -1,5 +1,6 @@
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; }
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
/*
* Copyright 2019 Red Hat, Inc. and/or its affiliates.
*
@@ -15,24 +16,22 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import * as React from "../../../../common/keycloak/web_modules/react.js";
import { withRouter } from "../../../../common/keycloak/web_modules/react-router-dom.js";
import { Button, DataList, DataListAction, DataListItemCells, DataListCell, DataListItemRow, Label, PageSection, PageSectionVariants, Split, SplitItem, Stack, StackItem, Title, DataListItem } from "../../../../common/keycloak/web_modules/@patternfly/react-core.js";
import { BitbucketIcon, CubeIcon, GitlabIcon, LinkIcon, PaypalIcon, UnlinkIcon } from "../../../../common/keycloak/web_modules/@patternfly/react-icons.js";
import * as React from "../../../keycloak.v2/web_modules/react.js";
import { withRouter } from "../../../keycloak.v2/web_modules/react-router-dom.js";
import { Button, DataList, DataListAction, DataListItemCells, DataListCell, DataListItemRow, Label, PageSection, PageSectionVariants, Split, SplitItem, Stack, StackItem, Title, DataListItem } from "../../../keycloak.v2/web_modules/@patternfly/react-core.js";
import { BitbucketIcon, CubeIcon, GitlabIcon, LinkIcon, OpenshiftIcon, PaypalIcon, UnlinkIcon, FacebookIcon, GoogleIcon, InstagramIcon, MicrosoftIcon, TwitterIcon, StackOverflowIcon, LinkedinIcon, GithubIcon } from "../../../keycloak.v2/web_modules/@patternfly/react-icons.js";
import { AccountServiceContext } from "../../account-service/AccountServiceContext.js";
import { Msg } from "../../widgets/Msg.js";
import { ContentPage } from "../ContentPage.js";
import { createRedirect } from "../../util/RedirectUri.js";
/**
* @author Stan Silvert
*/
class LinkedAccountsPage extends React.Component {
constructor(props, context) {
super(props);
_defineProperty(this, "context", void 0);
this.context = context;
this.state = {
linkedAccounts: [],
@@ -40,7 +39,6 @@ class LinkedAccountsPage extends React.Component {
};
this.getLinkedAccounts();
}
getLinkedAccounts() {
this.context.doGet("/linked-accounts").then(response => {
console.log({
@@ -54,7 +52,6 @@ class LinkedAccountsPage extends React.Component {
});
});
}
unLinkAccount(account) {
const url = '/linked-accounts/' + account.providerName;
this.context.doDelete(url).then(response => {
@@ -64,7 +61,6 @@ class LinkedAccountsPage extends React.Component {
this.getLinkedAccounts();
});
}
linkAccount(account) {
const url = '/linked-accounts/' + account.providerName;
const redirectUri = createRedirect(this.props.location.pathname);
@@ -80,7 +76,6 @@ class LinkedAccountsPage extends React.Component {
window.location.href = response.data.accountLinkUri;
});
}
render() {
return /*#__PURE__*/React.createElement(ContentPage, {
title: Msg.localize('linkedAccountsTitle'),
@@ -110,16 +105,13 @@ class LinkedAccountsPage extends React.Component {
"aria-label": Msg.localize('unlinkedLoginProviders')
}, this.makeRows(this.state.unLinkedAccounts, false))))));
}
emptyRow(isLinked) {
let isEmptyMessage = '';
if (isLinked) {
isEmptyMessage = Msg.localize('linkedEmpty');
} else {
isEmptyMessage = Msg.localize('unlinkedEmpty');
}
return /*#__PURE__*/React.createElement(DataListItem, {
key: "emptyItem",
"aria-labelledby": Msg.localize('isEmptyMessage')
@@ -131,12 +123,10 @@ class LinkedAccountsPage extends React.Component {
}, isEmptyMessage)]
})));
}
makeRows(accounts, isLinked) {
if (accounts.length === 0) {
return this.emptyRow(isLinked);
}
return /*#__PURE__*/React.createElement(React.Fragment, null, " ", accounts.map(account => /*#__PURE__*/React.createElement(DataListItem, {
id: `${account.providerAlias}-idp`,
key: account.providerName,
@@ -191,7 +181,6 @@ class LinkedAccountsPage extends React.Component {
msgKey: "link"
})))))), " ");
}
label(account) {
if (account.social) {
return /*#__PURE__*/React.createElement(Label, {
@@ -200,49 +189,82 @@ class LinkedAccountsPage extends React.Component {
msgKey: "socialLogin"
}));
}
return /*#__PURE__*/React.createElement(Label, {
color: "green"
}, /*#__PURE__*/React.createElement(Msg, {
msgKey: "systemDefined"
}));
}
findIcon(account) {
const socialIconId = `${account.providerAlias}-idp-icon-social`;
console.log(account);
switch (true) {
case account.providerName.toLowerCase().includes('linkedin'):
return /*#__PURE__*/React.createElement(LinkedinIcon, {
id: socialIconId,
size: "lg"
});
case account.providerName.toLowerCase().includes('facebook'):
return /*#__PURE__*/React.createElement(FacebookIcon, {
id: socialIconId,
size: "lg"
});
case account.providerName.toLowerCase().includes('google'):
return /*#__PURE__*/React.createElement(GoogleIcon, {
id: socialIconId,
size: "lg"
});
case account.providerName.toLowerCase().includes('instagram'):
return /*#__PURE__*/React.createElement(InstagramIcon, {
id: socialIconId,
size: "lg"
});
case account.providerName.toLowerCase().includes('microsoft'):
return /*#__PURE__*/React.createElement(MicrosoftIcon, {
id: socialIconId,
size: "lg"
});
case account.providerName.toLowerCase().includes('bitbucket'):
return /*#__PURE__*/React.createElement(BitbucketIcon, {
id: socialIconId,
size: "lg"
});
case account.providerName.toLowerCase().includes('openshift'):
return /*#__PURE__*/React.createElement("div", {
className: "idp-icon-social",
id: "openshift-idp-icon-social"
case account.providerName.toLowerCase().includes('twitter'):
return /*#__PURE__*/React.createElement(TwitterIcon, {
id: socialIconId,
size: "lg"
});
case account.providerName.toLowerCase().includes('openshift'):
// return <div className="idp-icon-social" id="openshift-idp-icon-social" />;
return /*#__PURE__*/React.createElement(OpenshiftIcon, {
id: socialIconId,
size: "lg"
});
case account.providerName.toLowerCase().includes('gitlab'):
return /*#__PURE__*/React.createElement(GitlabIcon, {
id: socialIconId,
size: "lg"
});
case account.providerName.toLowerCase().includes('github'):
return /*#__PURE__*/React.createElement(GithubIcon, {
id: socialIconId,
size: "lg"
});
case account.providerName.toLowerCase().includes('paypal'):
return /*#__PURE__*/React.createElement(PaypalIcon, {
id: socialIconId,
size: "lg"
});
case account.providerName.toLowerCase().includes('stackoverflow'):
return /*#__PURE__*/React.createElement(StackOverflowIcon, {
id: socialIconId,
size: "lg"
});
case account.providerName !== '' && account.social:
return /*#__PURE__*/React.createElement("div", {
className: "idp-icon-social",
id: socialIconId
});
default:
return /*#__PURE__*/React.createElement(CubeIcon, {
id: `${account.providerAlias}-idp-icon-default`,
@@ -250,11 +272,8 @@ class LinkedAccountsPage extends React.Component {
});
}
}
}
_defineProperty(LinkedAccountsPage, "contextType", AccountServiceContext);
;
const LinkedAccountsPagewithRouter = withRouter(LinkedAccountsPage);
export { LinkedAccountsPagewithRouter as LinkedAccountsPage };
File diff suppressed because one or more lines are too long
@@ -1,22 +1,19 @@
import * as React from "../../../../common/keycloak/web_modules/react.js";
import * as React from "../../../keycloak.v2/web_modules/react.js";
import { Msg } from "../../widgets/Msg.js";
export class AbstractResourcesTable extends React.Component {
hasPermissions(row) {
return this.state.permissions.has(row) && this.state.permissions.get(row).length > 0;
}
firstUser(row) {
if (!this.hasPermissions(row)) return 'ERROR!!!!'; // should never happen
return this.state.permissions.get(row)[0].username;
}
numOthers(row) {
if (!this.hasPermissions(row)) return -1; // should never happen
return this.state.permissions.get(row).length - 1;
}
sharedWithUsersMessage(row) {
if (!this.hasPermissions(row)) return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Msg, {
msgKey: "resourceNotShared"
@@ -27,7 +24,6 @@ export class AbstractResourcesTable extends React.Component {
msgKey: "and"
}, /*#__PURE__*/React.createElement("strong", null, this.numOthers(row))), ".");
}
getClientName(client) {
if (client.hasOwnProperty('name') && client.name !== null && client.name !== '') {
return Msg.localize(client.name);
@@ -35,6 +31,5 @@ export class AbstractResourcesTable extends React.Component {
return client.clientId;
}
}
}
//# sourceMappingURL=AbstractResourceTable.js.map
@@ -1 +1 @@
{"version":3,"sources":["../../../src/app/content/my-resources-page/AbstractResourceTable.tsx"],"names":["React","Msg","AbstractResourcesTable","Component","hasPermissions","row","state","permissions","has","get","length","firstUser","username","numOthers","sharedWithUsersMessage","getClientName","client","hasOwnProperty","name","localize","clientId"],"mappings":"AAAA,OAAO,KAAKA,KAAZ;AAEA,SAASC,GAAT;AAUA,OAAO,MAAeC,sBAAf,SAA6EF,KAAK,CAACG,SAAnF,CAAqH;AAEhHC,EAAAA,cAAc,CAACC,GAAD,EAAuB;AAC7C,WAAQ,KAAKC,KAAL,CAAWC,WAAX,CAAuBC,GAAvB,CAA2BH,GAA3B,CAAD,IAAsC,KAAKC,KAAL,CAAWC,WAAX,CAAuBE,GAAvB,CAA2BJ,GAA3B,EAAiCK,MAAjC,GAA0C,CAAvF;AACD;;AAEOC,EAAAA,SAAS,CAACN,GAAD,EAAsB;AACrC,QAAI,CAAC,KAAKD,cAAL,CAAoBC,GAApB,CAAL,EAA+B,OAAO,WAAP,CADM,CACc;;AAEnD,WAAO,KAAKC,KAAL,CAAWC,WAAX,CAAuBE,GAAvB,CAA2BJ,GAA3B,EAAiC,CAAjC,EAAoCO,QAA3C;AACD;;AAESC,EAAAA,SAAS,CAACR,GAAD,EAAsB;AACvC,QAAI,CAAC,KAAKD,cAAL,CAAoBC,GAApB,CAAL,EAA+B,OAAO,CAAC,CAAR,CADQ,CACG;;AAE1C,WAAO,KAAKC,KAAL,CAAWC,WAAX,CAAuBE,GAAvB,CAA2BJ,GAA3B,EAAiCK,MAAjC,GAA0C,CAAjD;AACD;;AAEMI,EAAAA,sBAAsB,CAACT,GAAD,EAA+B;AAC1D,QAAI,CAAC,KAAKD,cAAL,CAAoBC,GAApB,CAAL,EAA+B,oBAAQ,oBAAC,KAAD,CAAO,QAAP,qBAAgB,oBAAC,GAAD;AAAK,MAAA,MAAM,EAAC;AAAZ,MAAhB,CAAR;AAE/B,wBACE,oBAAC,KAAD,CAAO,QAAP,qBACE,oBAAC,GAAD;AAAK,MAAA,MAAM,EAAC;AAAZ,oBACE,oCAAS,KAAKM,SAAL,CAAeN,GAAf,CAAT,CADF,CADF,EAIG,KAAKQ,SAAL,CAAeR,GAAf,IAAsB,CAAtB,iBAA2B,oBAAC,GAAD;AAAK,MAAA,MAAM,EAAC;AAAZ,oBAC1B,oCAAS,KAAKQ,SAAL,CAAeR,GAAf,CAAT,CAD0B,CAJ9B,MADF;AAUD;;AAESU,EAAAA,aAAa,CAACC,MAAD,EAAyB;AAC9C,QAAIA,MAAM,CAACC,cAAP,CAAsB,MAAtB,KAAiCD,MAAM,CAACE,IAAP,KAAgB,IAAjD,IAAyDF,MAAM,CAACE,IAAP,KAAgB,EAA7E,EAAiF;AAC/E,aAAOjB,GAAG,CAACkB,QAAJ,CAAaH,MAAM,CAACE,IAApB,CAAP;AACD,KAFD,MAEO;AACL,aAAOF,MAAM,CAACI,QAAd;AACD;AACF;;AAvCyH","sourcesContent":["import * as React from 'react';\nimport { Permission, PaginatedResources, Client } from './resource-model';\nimport { Msg } from '../../widgets/Msg';\n\nexport interface ResourcesTableProps {\n resources: PaginatedResources;\n}\n\nexport interface ResourcesTableState {\n permissions: Map<number, Permission[]>;\n}\n\nexport abstract class AbstractResourcesTable<S extends ResourcesTableState> extends React.Component<ResourcesTableProps, S> {\n\n protected hasPermissions(row: number): boolean {\n return (this.state.permissions.has(row)) && (this.state.permissions.get(row)!.length > 0);\n }\n\n private firstUser(row: number): string {\n if (!this.hasPermissions(row)) return 'ERROR!!!!'; // should never happen\n\n return this.state.permissions.get(row)![0].username;\n }\n\n protected numOthers(row: number): number {\n if (!this.hasPermissions(row)) return -1; // should never happen\n\n return this.state.permissions.get(row)!.length - 1;\n }\n\n public sharedWithUsersMessage(row: number): React.ReactNode {\n if (!this.hasPermissions(row)) return (<React.Fragment><Msg msgKey='resourceNotShared' /></React.Fragment>);\n\n return (\n <React.Fragment>\n <Msg msgKey='resourceSharedWith'>\n <strong>{this.firstUser(row)}</strong>\n </Msg>\n {this.numOthers(row) > 0 && <Msg msgKey='and'>\n <strong>{this.numOthers(row)}</strong>\n </Msg>}.\n </React.Fragment>\n );\n }\n\n protected getClientName(client: Client): string {\n if (client.hasOwnProperty('name') && client.name !== null && client.name !== '') {\n return Msg.localize(client.name!);\n } else {\n return client.clientId;\n }\n }\n}\n"],"file":"AbstractResourceTable.js"}
{"version":3,"file":"AbstractResourceTable.js","names":["React","Msg","AbstractResourcesTable","Component","hasPermissions","row","state","permissions","has","get","length","firstUser","username","numOthers","sharedWithUsersMessage","createElement","Fragment","msgKey","getClientName","client","hasOwnProperty","name","localize","clientId"],"sources":["../../../src/app/content/my-resources-page/AbstractResourceTable.tsx"],"sourcesContent":["import * as React from 'react';\nimport { Permission, PaginatedResources, Client } from './resource-model';\nimport { Msg } from '../../widgets/Msg';\n\nexport interface ResourcesTableProps {\n resources: PaginatedResources;\n}\n\nexport interface ResourcesTableState {\n permissions: Map<number, Permission[]>;\n}\n\nexport abstract class AbstractResourcesTable<S extends ResourcesTableState> extends React.Component<ResourcesTableProps, S> {\n\n protected hasPermissions(row: number): boolean {\n return (this.state.permissions.has(row)) && (this.state.permissions.get(row)!.length > 0);\n }\n\n private firstUser(row: number): string {\n if (!this.hasPermissions(row)) return 'ERROR!!!!'; // should never happen\n\n return this.state.permissions.get(row)![0].username;\n }\n\n protected numOthers(row: number): number {\n if (!this.hasPermissions(row)) return -1; // should never happen\n\n return this.state.permissions.get(row)!.length - 1;\n }\n\n public sharedWithUsersMessage(row: number): React.ReactNode {\n if (!this.hasPermissions(row)) return (<React.Fragment><Msg msgKey='resourceNotShared' /></React.Fragment>);\n\n return (\n <React.Fragment>\n <Msg msgKey='resourceSharedWith'>\n <strong>{this.firstUser(row)}</strong>\n </Msg>\n {this.numOthers(row) > 0 && <Msg msgKey='and'>\n <strong>{this.numOthers(row)}</strong>\n </Msg>}.\n </React.Fragment>\n );\n }\n\n protected getClientName(client: Client): string {\n if (client.hasOwnProperty('name') && client.name !== null && client.name !== '') {\n return Msg.localize(client.name!);\n } else {\n return client.clientId;\n }\n }\n}\n"],"mappings":"AAAA,OAAO,KAAKA,KAAK;AAEjB,SAASC,GAAG;AAUZ,OAAO,MAAeC,sBAAsB,SAAwCF,KAAK,CAACG,SAAS,CAAyB;EAEhHC,cAAcA,CAACC,GAAW,EAAW;IAC7C,OAAQ,IAAI,CAACC,KAAK,CAACC,WAAW,CAACC,GAAG,CAACH,GAAG,CAAC,IAAM,IAAI,CAACC,KAAK,CAACC,WAAW,CAACE,GAAG,CAACJ,GAAG,CAAC,CAAEK,MAAM,GAAG,CAAE;EAC3F;EAEQC,SAASA,CAACN,GAAW,EAAU;IACrC,IAAI,CAAC,IAAI,CAACD,cAAc,CAACC,GAAG,CAAC,EAAE,OAAO,WAAW,CAAC,CAAC;;IAEnD,OAAO,IAAI,CAACC,KAAK,CAACC,WAAW,CAACE,GAAG,CAACJ,GAAG,CAAC,CAAE,CAAC,CAAC,CAACO,QAAQ;EACrD;EAEUC,SAASA,CAACR,GAAW,EAAU;IACvC,IAAI,CAAC,IAAI,CAACD,cAAc,CAACC,GAAG,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;;IAE1C,OAAO,IAAI,CAACC,KAAK,CAACC,WAAW,CAACE,GAAG,CAACJ,GAAG,CAAC,CAAEK,MAAM,GAAG,CAAC;EACpD;EAEOI,sBAAsBA,CAACT,GAAW,EAAmB;IAC1D,IAAI,CAAC,IAAI,CAACD,cAAc,CAACC,GAAG,CAAC,EAAE,oBAAQL,KAAA,CAAAe,aAAA,CAACf,KAAK,CAACgB,QAAQ,qBAAChB,KAAA,CAAAe,aAAA,CAACd,GAAG;MAACgB,MAAM,EAAC;IAAmB,CAAE,CAAiB,CAAC;IAE1G,oBACEjB,KAAA,CAAAe,aAAA,CAACf,KAAK,CAACgB,QAAQ,qBACbhB,KAAA,CAAAe,aAAA,CAACd,GAAG;MAACgB,MAAM,EAAC;IAAoB,gBAC9BjB,KAAA,CAAAe,aAAA,iBAAS,IAAI,CAACJ,SAAS,CAACN,GAAG,CAAU,CAClC,CAAC,EACL,IAAI,CAACQ,SAAS,CAACR,GAAG,CAAC,GAAG,CAAC,iBAAIL,KAAA,CAAAe,aAAA,CAACd,GAAG;MAACgB,MAAM,EAAC;IAAK,gBAC3CjB,KAAA,CAAAe,aAAA,iBAAS,IAAI,CAACF,SAAS,CAACR,GAAG,CAAU,CAClC,CAAC,EAAC,GACO,CAAC;EAErB;EAEUa,aAAaA,CAACC,MAAc,EAAU;IAC9C,IAAIA,MAAM,CAACC,cAAc,CAAC,MAAM,CAAC,IAAID,MAAM,CAACE,IAAI,KAAK,IAAI,IAAIF,MAAM,CAACE,IAAI,KAAK,EAAE,EAAE;MAC/E,OAAOpB,GAAG,CAACqB,QAAQ,CAACH,MAAM,CAACE,IAAK,CAAC;IACnC,CAAC,MAAM;MACL,OAAOF,MAAM,CAACI,QAAQ;IACxB;EACF;AACF"}
@@ -1,5 +1,6 @@
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; }
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
/*
* Copyright 2019 Red Hat, Inc. and/or its affiliates.
*
@@ -15,9 +16,10 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import * as React from "../../../../common/keycloak/web_modules/react.js";
import { Button, Modal, Form, FormGroup, TextInput, InputGroup, ModalVariant } from "../../../../common/keycloak/web_modules/@patternfly/react-core.js";
import { OkIcon } from "../../../../common/keycloak/web_modules/@patternfly/react-icons.js";
import * as React from "../../../keycloak.v2/web_modules/react.js";
import { Button, Modal, Form, FormGroup, TextInput, InputGroup, ModalVariant } from "../../../keycloak.v2/web_modules/@patternfly/react-core.js";
import { OkIcon } from "../../../keycloak.v2/web_modules/@patternfly/react-icons.js";
import { Scope } from "./resource-model.js";
import { Msg } from "../../widgets/Msg.js";
import { AccountServiceContext } from "../../account-service/AccountServiceContext.js";
@@ -26,9 +28,7 @@ import { PermissionSelect } from "./PermissionSelect.js";
export class EditTheResource extends React.Component {
constructor(props, context) {
super(props);
_defineProperty(this, "context", void 0);
_defineProperty(this, "handleToggleDialog", () => {
if (this.state.isOpen) {
this.setState({
@@ -42,7 +42,6 @@ export class EditTheResource extends React.Component {
});
}
});
_defineProperty(this, "updateChanged", row => {
const changed = this.state.changed;
changed[row] = !changed[row];
@@ -50,23 +49,19 @@ export class EditTheResource extends React.Component {
changed
});
});
this.context = context;
this.state = {
changed: [],
isOpen: false
};
}
clearState() {
this.setState({});
}
async savePermission(permission) {
await this.context.doPut(`/resources/${this.props.resource._id}/permissions`, [permission]);
await this.context.doPut(`/resources/${encodeURIComponent(this.props.resource._id)}/permissions`, [permission]);
ContentAlert.success(Msg.localize('updateSuccess'));
}
render() {
return /*#__PURE__*/React.createElement(React.Fragment, null, this.props.children(this.handleToggleDialog), /*#__PURE__*/React.createElement(Modal, {
title: 'Edit the resource - ' + this.props.resource.name,
@@ -109,12 +104,9 @@ export class EditTheResource extends React.Component {
onClick: () => this.savePermission(p)
}, /*#__PURE__*/React.createElement(OkIcon, null)))), /*#__PURE__*/React.createElement("hr", null))))));
}
}
_defineProperty(EditTheResource, "defaultProps", {
permissions: []
});
_defineProperty(EditTheResource, "contextType", AccountServiceContext);
//# sourceMappingURL=EditTheResource.js.map
File diff suppressed because one or more lines are too long
@@ -1,5 +1,6 @@
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; }
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
/*
* Copyright 2018 Red Hat, Inc. and/or its affiliates.
*
@@ -15,9 +16,10 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import * as React from "../../../../common/keycloak/web_modules/react.js";
import * as React from "../../../keycloak.v2/web_modules/react.js";
import parse from "../../util/ParseLink.js";
import { Button, Level, LevelItem, PageSection, PageSectionVariants, Stack, StackItem, Tab, Tabs, TextInput } from "../../../../common/keycloak/web_modules/@patternfly/react-core.js";
import { Button, Level, LevelItem, PageSection, PageSectionVariants, Stack, StackItem, Tab, Tabs, TextInput } from "../../../keycloak.v2/web_modules/@patternfly/react-core.js";
import { AccountServiceContext } from "../../account-service/AccountServiceContext.js";
import { Scope } from "./resource-model.js";
import { ResourcesTable } from "./ResourcesTable.js";
@@ -29,23 +31,17 @@ const SHARED_WITH_ME_TAB = 1;
export class MyResourcesPage extends React.Component {
constructor(props, context) {
super(props);
_defineProperty(this, "context", void 0);
_defineProperty(this, "first", 0);
_defineProperty(this, "max", 5);
_defineProperty(this, "makeScopeObj", scope => {
return new Scope(scope.name, scope.displayName);
});
_defineProperty(this, "fetchPermissionRequests", () => {
this.state.myResources.data.forEach(resource => {
this.fetchShareRequests(resource);
});
});
_defineProperty(this, "fetchPending", async () => {
const response = await this.context.doGet(`/resources/pending-requests`);
const resources = response.data || [];
@@ -61,7 +57,6 @@ export class MyResourcesPage extends React.Component {
});
});
});
_defineProperty(this, "handleFilterRequest", value => {
this.setState({
nameFilter: value
@@ -70,11 +65,9 @@ export class MyResourcesPage extends React.Component {
name: value
});
});
_defineProperty(this, "handleFirstPageClick", () => {
this.fetchInitialResources();
});
_defineProperty(this, "handleNextClick", () => {
if (this.isSharedWithMeTab()) {
this.fetchResources(this.state.sharedWithMe.nextUrl);
@@ -82,7 +75,6 @@ export class MyResourcesPage extends React.Component {
this.fetchResources(this.state.myResources.nextUrl);
}
});
_defineProperty(this, "handlePreviousClick", () => {
if (this.isSharedWithMeTab()) {
this.fetchResources(this.state.sharedWithMe.prevUrl);
@@ -90,8 +82,7 @@ export class MyResourcesPage extends React.Component {
this.fetchResources(this.state.myResources.prevUrl);
}
});
_defineProperty(this, "handleTabClick", (event, tabIndex) => {
_defineProperty(this, "handleTabClick", tabIndex => {
if (this.state.activeTabKey === tabIndex) return;
this.setState({
nameFilter: '',
@@ -100,7 +91,6 @@ export class MyResourcesPage extends React.Component {
this.fetchInitialResources();
});
});
this.context = context;
this.state = {
activeTabKey: MY_RESOURCES_TAB,
@@ -119,11 +109,9 @@ export class MyResourcesPage extends React.Component {
};
this.fetchInitialResources();
}
isSharedWithMeTab() {
return this.state.activeTabKey === SHARED_WITH_ME_TAB;
}
hasNext() {
if (this.isSharedWithMeTab()) {
return this.state.sharedWithMe.nextUrl !== null && this.state.sharedWithMe.nextUrl !== '';
@@ -131,7 +119,6 @@ export class MyResourcesPage extends React.Component {
return this.state.myResources.nextUrl !== null && this.state.myResources.nextUrl !== '';
}
}
hasPrevious() {
if (this.isSharedWithMeTab()) {
return this.state.sharedWithMe.prevUrl !== null && this.state.sharedWithMe.prevUrl !== '';
@@ -139,7 +126,6 @@ export class MyResourcesPage extends React.Component {
return this.state.myResources.prevUrl !== null && this.state.myResources.prevUrl !== '';
}
}
fetchInitialResources() {
if (this.isSharedWithMeTab()) {
this.fetchResources("/resources/shared-with-me");
@@ -150,27 +136,26 @@ export class MyResourcesPage extends React.Component {
});
}
}
fetchFilteredResources(params) {
if (this.isSharedWithMeTab()) {
this.fetchResources("/resources/shared-with-me", params);
} else {
this.fetchResources("/resources", { ...params,
this.fetchResources("/resources", {
...params,
first: this.first,
max: this.max
});
}
}
fetchResources(url, extraParams) {
this.context.doGet(url, {
params: extraParams
}).then(response => {
const resources = response.data || [];
resources.forEach(resource => resource.shareRequests = []); // serialize the Scope objects from JSON so that toString() will work.
resources.forEach(resource => resource.shareRequests = []);
// serialize the Scope objects from JSON so that toString() will work.
resources.forEach(resource => resource.scopes = resource.scopes.map(this.makeScopeObj));
if (this.isSharedWithMeTab()) {
this.setState({
sharedWithMe: this.parseResourceResponse(response)
@@ -182,28 +167,23 @@ export class MyResourcesPage extends React.Component {
}
});
}
fetchShareRequests(resource) {
this.context.doGet('/resources/' + resource._id + '/permissions/requests').then(response => {
resource.shareRequests = response.data || [];
if (resource.shareRequests.length > 0) {
this.forceUpdate();
}
});
}
parseResourceResponse(response) {
const links = response.headers.get('link') || undefined;
const parsed = parse(links);
let next = '';
let prev = '';
if (parsed !== null) {
if (parsed.next) next = parsed.next;
if (parsed.prev) prev = parsed.prev;
}
const resources = response.data || [];
return {
nextUrl: next,
@@ -211,7 +191,6 @@ export class MyResourcesPage extends React.Component {
data: resources
};
}
makeTab(eventKey, title, resources, sharedResourcesTab) {
return /*#__PURE__*/React.createElement(Tab, {
id: title,
@@ -240,7 +219,6 @@ export class MyResourcesPage extends React.Component {
resources: resources
}))));
}
render() {
return /*#__PURE__*/React.createElement(ContentPage, {
title: "resources",
@@ -249,7 +227,7 @@ export class MyResourcesPage extends React.Component {
variant: PageSectionVariants.light
}, /*#__PURE__*/React.createElement(Tabs, {
activeKey: this.state.activeTabKey,
onSelect: this.handleTabClick
onSelect: (event, index) => this.handleTabClick(index)
}, this.makeTab(0, 'myResources', this.state.myResources, false), this.makeTab(1, 'sharedwithMe', this.state.sharedWithMe, true)), /*#__PURE__*/React.createElement(Level, {
hasGutter: true
}, /*#__PURE__*/React.createElement(LevelItem, null, this.hasPrevious() && /*#__PURE__*/React.createElement(Button, {
@@ -266,7 +244,6 @@ export class MyResourcesPage extends React.Component {
msgKey: "nextPage"
}), ">")))));
}
clearNextPrev() {
const newMyResources = this.state.myResources;
newMyResources.nextUrl = '';
@@ -275,10 +252,7 @@ export class MyResourcesPage extends React.Component {
myResources: newMyResources
});
}
}
_defineProperty(MyResourcesPage, "contextType", AccountServiceContext);
;
//# sourceMappingURL=MyResourcesPage.js.map
File diff suppressed because one or more lines are too long
@@ -1,5 +1,6 @@
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; }
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
/*
* Copyright 2019 Red Hat, Inc. and/or its affiliates.
*
@@ -15,42 +16,36 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import * as React from "../../../../common/keycloak/web_modules/react.js";
import { Button, Modal, Text, Badge, DataListItem, DataList, TextVariants, DataListItemRow, DataListItemCells, DataListCell, Chip, Split, SplitItem, ModalVariant } from "../../../../common/keycloak/web_modules/@patternfly/react-core.js";
import { UserCheckIcon } from "../../../../common/keycloak/web_modules/@patternfly/react-icons.js";
import * as React from "../../../keycloak.v2/web_modules/react.js";
import { Button, Modal, Text, Badge, DataListItem, DataList, TextVariants, DataListItemRow, DataListItemCells, DataListCell, Chip, Split, SplitItem, ModalVariant } from "../../../keycloak.v2/web_modules/@patternfly/react-core.js";
import { UserCheckIcon } from "../../../keycloak.v2/web_modules/@patternfly/react-icons.js";
import { AccountServiceContext } from "../../account-service/AccountServiceContext.js";
import { Msg } from "../../widgets/Msg.js";
import { ContentAlert } from "../ContentAlert.js";
export class PermissionRequest extends React.Component {
constructor(props, context) {
super(props);
_defineProperty(this, "context", void 0);
_defineProperty(this, "handleApprove", async (shareRequest, index) => {
this.handle(shareRequest.username, shareRequest.scopes, true);
this.props.resource.shareRequests.splice(index, 1);
});
_defineProperty(this, "handleDeny", async (shareRequest, index) => {
this.handle(shareRequest.username, shareRequest.scopes);
this.props.resource.shareRequests.splice(index, 1);
});
_defineProperty(this, "handle", async (username, scopes, approve = false) => {
const id = this.props.resource._id;
this.handleToggleDialog();
const permissionsRequest = await this.context.doGet(`/resources/${id}/permissions`);
const permissionsRequest = await this.context.doGet(`/resources/${encodeURIComponent(id)}/permissions`);
const permissions = permissionsRequest.data || [];
const foundPermission = permissions.find(p => p.username === username);
const userScopes = foundPermission ? foundPermission.scopes : [];
if (approve) {
userScopes.push(...scopes);
}
try {
await this.context.doPut(`/resources/${id}/permissions`, [{
await this.context.doPut(`/resources/${encodeURIComponent(id)}/permissions`, [{
username: username,
scopes: userScopes
}]);
@@ -60,19 +55,16 @@ export class PermissionRequest extends React.Component {
console.error('Could not update permissions', e.error);
}
});
_defineProperty(this, "handleToggleDialog", () => {
this.setState({
isOpen: !this.state.isOpen
});
});
this.context = context;
this.state = {
isOpen: false
};
}
render() {
const id = `shareRequest-${this.props.resource.name.replace(/\s/, '-')}`;
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Button, {
@@ -139,13 +131,10 @@ export class PermissionRequest extends React.Component {
}, "Deny"))))]
})))))));
}
}
_defineProperty(PermissionRequest, "defaultProps", {
permissions: [],
row: 0
});
_defineProperty(PermissionRequest, "contextType", AccountServiceContext);
//# sourceMappingURL=PermissionRequest.js.map
File diff suppressed because one or more lines are too long
@@ -1,55 +1,49 @@
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; }
import * as React from "../../../../common/keycloak/web_modules/react.js";
import { Select, SelectOption, SelectVariant } from "../../../../common/keycloak/web_modules/@patternfly/react-core.js";
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
import * as React from "../../../keycloak.v2/web_modules/react.js";
import { Select, SelectOption, SelectVariant } from "../../../keycloak.v2/web_modules/@patternfly/react-core.js";
import { Msg } from "../../widgets/Msg.js";
class ScopeValue {
constructor(value) {
_defineProperty(this, "value", void 0);
this.value = value;
}
toString() {
return this.value.displayName ? this.value.displayName : this.value.name;
}
compareTo(selectOption) {
return selectOption.name === this.value.name;
}
}
export class PermissionSelect extends React.Component {
constructor(props) {
super(props);
_defineProperty(this, "onSelect", (_event, selection) => {
_defineProperty(this, "onSelect", (event, value) => {
const {
selected
} = this.state;
const {
onSelect
} = this.props;
if (selected.includes(selection)) {
if (!(value instanceof ScopeValue)) {
return;
}
if (selected.includes(value)) {
this.setState(prevState => ({
selected: prevState.selected.filter(item => item !== selection)
selected: prevState.selected.filter(item => item !== value)
}), () => onSelect(this.state.selected.map(sv => sv.value)));
} else {
this.setState(prevState => ({
selected: [...prevState.selected, selection]
selected: [...prevState.selected, value]
}), () => onSelect(this.state.selected.map(sv => sv.value)));
}
});
_defineProperty(this, "onToggle", isExpanded => {
this.setState({
isExpanded
});
});
_defineProperty(this, "clearSelection", () => {
this.setState({
selected: [],
@@ -57,13 +51,10 @@ export class PermissionSelect extends React.Component {
});
this.props.onSelect([]);
});
let values = [];
if (this.props.selected) {
values = this.props.selected.map(s => new ScopeValue(s));
}
this.state = {
isExpanded: false,
selected: values,
@@ -73,7 +64,6 @@ export class PermissionSelect extends React.Component {
}))
};
}
render() {
const {
isExpanded,
@@ -86,6 +76,7 @@ export class PermissionSelect extends React.Component {
}, /*#__PURE__*/React.createElement(Msg, {
msgKey: "selectPermissions"
})), /*#__PURE__*/React.createElement(Select, {
maxHeight: 300,
direction: this.props.direction || 'down',
variant: SelectVariant.typeaheadMulti,
typeAheadAriaLabel: Msg.localize("selectPermissions"),
@@ -95,9 +86,9 @@ export class PermissionSelect extends React.Component {
selections: selected,
isOpen: isExpanded,
"aria-labelledby": titleId,
placeholderText: Msg.localize("selectPermissions")
placeholderText: Msg.localize("selectPermissions"),
menuAppendTo: "parent"
}, this.state.scopes));
}
}
//# sourceMappingURL=PermissionSelect.js.map
File diff suppressed because one or more lines are too long
@@ -1,5 +1,6 @@
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; }
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
/*
* Copyright 2018 Red Hat, Inc. and/or its affiliates.
*
@@ -15,9 +16,10 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import * as React from "../../../../common/keycloak/web_modules/react.js";
import { DataList, DataListItem, DataListItemRow, DataListCell, DataListToggle, DataListContent, DataListItemCells, Level, LevelItem, Button, DataListAction, Dropdown, DropdownPosition, DropdownItem, KebabToggle } from "../../../../common/keycloak/web_modules/@patternfly/react-core.js";
import { Remove2Icon, RepositoryIcon, ShareAltIcon, EditAltIcon } from "../../../../common/keycloak/web_modules/@patternfly/react-icons.js";
import * as React from "../../../keycloak.v2/web_modules/react.js";
import { DataList, DataListItem, DataListItemRow, DataListCell, DataListToggle, DataListContent, DataListItemCells, Level, LevelItem, Button, DataListAction, Dropdown, DropdownPosition, DropdownItem, KebabToggle } from "../../../keycloak.v2/web_modules/@patternfly/react-core.js";
import { Remove2Icon, RepositoryIcon, ShareAltIcon, EditAltIcon } from "../../../keycloak.v2/web_modules/@patternfly/react-icons.js";
import { AccountServiceContext } from "../../account-service/AccountServiceContext.js";
import { PermissionRequest } from "./PermissionRequest.js";
import { ShareTheResource } from "./ShareTheResource.js";
@@ -30,9 +32,7 @@ import { ContinueCancelModal } from "../../widgets/ContinueCancelModal.js";
export class ResourcesTable extends AbstractResourcesTable {
constructor(props, context) {
super(props);
_defineProperty(this, "context", void 0);
_defineProperty(this, "onToggle", row => {
const newIsRowOpen = this.state.isRowOpen;
newIsRowOpen[row] = !newIsRowOpen[row];
@@ -41,23 +41,19 @@ export class ResourcesTable extends AbstractResourcesTable {
isRowOpen: newIsRowOpen
});
});
_defineProperty(this, "onContextToggle", (row, isOpen) => {
if (this.state.isModalActive) return;
const data = this.props.resources.data;
const contextOpen = this.state.contextOpen;
contextOpen[row] = isOpen;
if (isOpen) {
const index = row > data.length ? row - data.length - 1 : row;
this.fetchPermissions(data[index], index);
}
this.setState({
contextOpen
});
});
this.context = context;
this.state = {
isRowOpen: [],
@@ -66,9 +62,8 @@ export class ResourcesTable extends AbstractResourcesTable {
permissions: new Map()
};
}
fetchPermissions(resource, row) {
this.context.doGet(`/resources/${resource._id}/permissions`).then(response => {
this.context.doGet(`/resources/${encodeURIComponent(resource._id)}/permissions`).then(response => {
const newPermissions = new Map(this.state.permissions);
newPermissions.set(row, response.data || []);
this.setState({
@@ -76,17 +71,15 @@ export class ResourcesTable extends AbstractResourcesTable {
});
});
}
removeShare(resource, row) {
const permissions = this.state.permissions.get(row).map(a => ({
username: a.username,
scopes: []
}));
return this.context.doPut(`/resources/${resource._id}/permissions`, permissions).then(() => {
return this.context.doPut(`/resources/${encodeURIComponent(resource._id)}/permissions`, permissions).then(() => {
ContentAlert.success(Msg.localize('unShareSuccess'));
});
}
render() {
if (this.props.resources.data.length === 0) {
return /*#__PURE__*/React.createElement(EmptyMessageState, {
@@ -94,7 +87,6 @@ export class ResourcesTable extends AbstractResourcesTable {
messageKey: "notHaveAnyResource"
});
}
return /*#__PURE__*/React.createElement(DataList, {
"aria-label": Msg.localize('resources'),
id: "resourcesList"
@@ -306,8 +298,6 @@ export class ResourcesTable extends AbstractResourcesTable {
id: 'shared-with-user-message-' + row
}, this.sharedWithUsersMessage(row)), /*#__PURE__*/React.createElement(LevelItem, null, /*#__PURE__*/React.createElement("span", null)))))));
}
}
_defineProperty(ResourcesTable, "contextType", AccountServiceContext);
//# sourceMappingURL=ResourcesTable.js.map
File diff suppressed because one or more lines are too long
@@ -1,5 +1,6 @@
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; }
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
/*
* Copyright 2019 Red Hat, Inc. and/or its affiliates.
*
@@ -15,46 +16,39 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import * as React from "../../../../common/keycloak/web_modules/react.js";
import { Button, Chip, ChipGroup, Form, FormGroup, Gallery, GalleryItem, Modal, Stack, StackItem, TextInput, ModalVariant } from "../../../../common/keycloak/web_modules/@patternfly/react-core.js";
import * as React from "../../../keycloak.v2/web_modules/react.js";
import { Button, Chip, ChipGroup, Form, FormGroup, Gallery, GalleryItem, Modal, Stack, StackItem, TextInput, ModalVariant } from "../../../keycloak.v2/web_modules/@patternfly/react-core.js";
import { AccountServiceContext } from "../../account-service/AccountServiceContext.js";
import { Msg } from "../../widgets/Msg.js";
import { ContentAlert } from "../ContentAlert.js";
import { PermissionSelect } from "./PermissionSelect.js";
/**
* @author Stan Silvert ssilvert@redhat.com (C) 2019 Red Hat Inc.
*/
export class ShareTheResource extends React.Component {
constructor(props, context) {
super(props);
_defineProperty(this, "context", void 0);
_defineProperty(this, "handleAddPermission", () => {
const rscId = this.props.resource._id;
const newPermissions = [];
for (const permission of this.state.permissionsSelected) {
newPermissions.push(permission.name);
}
const permissions = [];
for (const username of this.state.usernames) {
permissions.push({
username: username,
scopes: newPermissions
});
}
this.handleToggleDialog();
this.context.doPut(`/resources/${rscId}/permissions`, permissions).then(() => {
this.context.doPut(`/resources/${encodeURIComponent(rscId)}/permissions`, permissions).then(() => {
ContentAlert.success('shareSuccess');
this.props.onClose();
});
});
_defineProperty(this, "handleToggleDialog", () => {
if (this.state.isOpen) {
this.setState({
@@ -68,21 +62,18 @@ export class ShareTheResource extends React.Component {
});
}
});
_defineProperty(this, "handleUsernameChange", username => {
this.setState({
usernameInput: username
});
});
_defineProperty(this, "handleAddUsername", async () => {
if (this.state.usernameInput !== '' && !this.state.usernames.includes(this.state.usernameInput)) {
const response = await this.context.doGet(`/resources/${this.props.resource._id}/user`, {
const response = await this.context.doGet(`/resources/${encodeURIComponent(this.props.resource._id)}/user`, {
params: {
value: this.state.usernameInput
}
});
if (response.data && response.data.username) {
this.setState({
usernameInput: '',
@@ -93,21 +84,18 @@ export class ShareTheResource extends React.Component {
}
}
});
_defineProperty(this, "handleEnterKeyInAddField", event => {
if (event.key === "Enter") {
event.preventDefault();
this.handleAddUsername();
}
});
_defineProperty(this, "handleDeleteUsername", username => {
const newUsernames = this.state.usernames.filter(user => user !== username);
this.setState({
usernames: newUsernames
});
});
this.context = context;
this.state = {
isOpen: false,
@@ -117,7 +105,6 @@ export class ShareTheResource extends React.Component {
usernameInput: ''
};
}
clearState() {
this.setState({
permissionsSelected: [],
@@ -126,23 +113,18 @@ export class ShareTheResource extends React.Component {
usernameInput: ''
});
}
isAddDisabled() {
return this.state.usernameInput === '' || this.isAlreadyShared();
}
isAlreadyShared() {
for (let permission of this.props.permissions) {
if (permission.username === this.state.usernameInput) return true;
}
return false;
}
isFormInvalid() {
return this.state.usernames.length === 0 || this.state.permissionsSelected.length === 0;
}
render() {
return /*#__PURE__*/React.createElement(React.Fragment, null, this.props.children(this.handleToggleDialog), /*#__PURE__*/React.createElement(Modal, {
title: 'Share the resource - ' + this.props.resource.name,
@@ -211,12 +193,9 @@ export class ShareTheResource extends React.Component {
isFilled: true
}, this.props.sharedWithUsersMsg))));
}
}
_defineProperty(ShareTheResource, "defaultProps", {
permissions: []
});
_defineProperty(ShareTheResource, "contextType", AccountServiceContext);
//# sourceMappingURL=ShareTheResource.js.map
File diff suppressed because one or more lines are too long
@@ -13,9 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import * as React from "../../../../common/keycloak/web_modules/react.js";
import { DataList, DataListItem, DataListItemRow, DataListCell, DataListItemCells, ChipGroup, Chip } from "../../../../common/keycloak/web_modules/@patternfly/react-core.js";
import { RepositoryIcon } from "../../../../common/keycloak/web_modules/@patternfly/react-icons.js";
import * as React from "../../../keycloak.v2/web_modules/react.js";
import { DataList, DataListItem, DataListItemRow, DataListCell, DataListItemCells, ChipGroup, Chip } from "../../../keycloak.v2/web_modules/@patternfly/react-core.js";
import { RepositoryIcon } from "../../../keycloak.v2/web_modules/@patternfly/react-icons.js";
import { Msg } from "../../widgets/Msg.js";
import { AbstractResourcesTable } from "./AbstractResourceTable.js";
import EmptyMessageState from "../../widgets/EmptyMessageState.js";
@@ -26,7 +27,6 @@ export class SharedResourcesTable extends AbstractResourcesTable {
permissions: new Map()
};
}
render() {
if (this.props.resources.data.length === 0) {
return /*#__PURE__*/React.createElement(EmptyMessageState, {
@@ -34,7 +34,6 @@ export class SharedResourcesTable extends AbstractResourcesTable {
messageKey: "noResourcesSharedWithYou"
});
}
return /*#__PURE__*/React.createElement(DataList, {
"aria-label": Msg.localize('resources'),
id: "sharedResourcesList"
@@ -92,6 +91,5 @@ export class SharedResourcesTable extends AbstractResourcesTable {
}, scope.displayName || scope.name))))]
})))));
}
}
//# sourceMappingURL=SharedResourcesTable.js.map
File diff suppressed because one or more lines are too long
@@ -3,7 +3,6 @@ export class Scope {
this.name = name;
this.displayName = displayName;
}
toString() {
if (this.hasOwnProperty('displayName') && this.displayName) {
return this.displayName;
@@ -11,6 +10,5 @@ export class Scope {
return this.name;
}
}
}
//# sourceMappingURL=resource-model.js.map
@@ -1 +1 @@
{"version":3,"sources":["../../../src/app/content/my-resources-page/resource-model.ts"],"names":["Scope","constructor","name","displayName","toString","hasOwnProperty"],"mappings":"AAeA,OAAO,MAAMA,KAAN,CAAY;AACVC,EAAAA,WAAW,CAAQC,IAAR,EAA6BC,WAA7B,EAAmD;AAAA,SAA3CD,IAA2C,GAA3CA,IAA2C;AAAA,SAAtBC,WAAsB,GAAtBA,WAAsB;AAAE;;AAEhEC,EAAAA,QAAQ,GAAW;AACtB,QAAI,KAAKC,cAAL,CAAoB,aAApB,KAAuC,KAAKF,WAAhD,EAA8D;AAC1D,aAAO,KAAKA,WAAZ;AACH,KAFD,MAEO;AACH,aAAO,KAAKD,IAAZ;AACH;AACJ;;AATgB","sourcesContent":["export interface Resource {\n _id: string;\n name: string;\n client: Client;\n scopes: Scope[];\n uris: string[];\n shareRequests: Permission[];\n}\n\nexport interface Client {\n baseUrl: string;\n clientId: string;\n name?: string;\n}\n\nexport class Scope {\n public constructor(public name: string, public displayName?: string) {}\n\n public toString(): string {\n if (this.hasOwnProperty('displayName') && (this.displayName)) {\n return this.displayName;\n } else {\n return this.name;\n }\n }\n}\n\nexport interface PaginatedResources {\n nextUrl: string;\n prevUrl: string;\n data: Resource[];\n}\n\nexport interface Permission {\n email?: string;\n firstName?: string;\n lastName?: string;\n scopes: Scope[] | string[]; // this should be Scope[] - fix API\n username: string;\n}\n\nexport interface Permissions {\n permissions: Permission[];\n row?: number;\n}\n"],"file":"resource-model.js"}
{"version":3,"file":"resource-model.js","names":["Scope","constructor","name","displayName","toString","hasOwnProperty"],"sources":["../../../src/app/content/my-resources-page/resource-model.ts"],"sourcesContent":["export interface Resource {\n _id: string;\n name: string;\n client: Client;\n scopes: Scope[];\n uris: string[];\n shareRequests: Permission[];\n}\n\nexport interface Client {\n baseUrl: string;\n clientId: string;\n name?: string;\n}\n\nexport class Scope {\n public constructor(public name: string, public displayName?: string) {}\n\n public toString(): string {\n if (this.hasOwnProperty('displayName') && (this.displayName)) {\n return this.displayName;\n } else {\n return this.name;\n }\n }\n}\n\nexport interface PaginatedResources {\n nextUrl: string;\n prevUrl: string;\n data: Resource[];\n}\n\nexport interface Permission {\n email?: string;\n firstName?: string;\n lastName?: string;\n scopes: Scope[] | string[]; // this should be Scope[] - fix API\n username: string;\n}\n\nexport interface Permissions {\n permissions: Permission[];\n row?: number;\n}\n"],"mappings":"AAeA,OAAO,MAAMA,KAAK,CAAC;EACVC,WAAWA,CAAQC,IAAY,EAASC,WAAoB,EAAE;IAAA,KAA3CD,IAAY,GAAZA,IAAY;IAAA,KAASC,WAAoB,GAApBA,WAAoB;EAAG;EAE/DC,QAAQA,CAAA,EAAW;IACtB,IAAI,IAAI,CAACC,cAAc,CAAC,aAAa,CAAC,IAAK,IAAI,CAACF,WAAY,EAAE;MAC1D,OAAO,IAAI,CAACA,WAAW;IAC3B,CAAC,MAAM;MACH,OAAO,IAAI,CAACD,IAAI;IACpB;EACJ;AACF"}
@@ -3,17 +3,16 @@
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
import * as React from "../../../../common/keycloak/web_modules/react.js";
import { WarningTriangleIcon } from "../../../../common/keycloak/web_modules/@patternfly/react-icons.js";
import { withRouter } from "../../../../common/keycloak/web_modules/react-router-dom.js";
import * as React from "../../../keycloak.v2/web_modules/react.js";
import { WarningTriangleIcon } from "../../../keycloak.v2/web_modules/@patternfly/react-icons.js";
import { withRouter } from "../../../keycloak.v2/web_modules/react-router-dom.js";
import { Msg } from "../../widgets/Msg.js";
import EmptyMessageState from "../../widgets/EmptyMessageState.js";
class PgNotFound extends React.Component {
constructor(props) {
super(props);
}
render() {
return /*#__PURE__*/React.createElement(EmptyMessageState, {
icon: WarningTriangleIcon,
@@ -23,9 +22,7 @@ class PgNotFound extends React.Component {
params: [this.props.location.pathname]
}));
}
}
;
export const PageNotFound = withRouter(PgNotFound);
//# sourceMappingURL=PageNotFound.js.map
@@ -1 +1 @@
{"version":3,"sources":["../../../src/app/content/page-not-found/PageNotFound.tsx"],"names":["React","WarningTriangleIcon","withRouter","Msg","EmptyMessageState","PgNotFound","Component","constructor","props","render","location","pathname","PageNotFound"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AAEA,OAAO,KAAKA,KAAZ;AAEA,SAASC,mBAAT;AACA,SAAQC,UAAR;AACA,SAAQC,GAAR;AACA,OAAOC,iBAAP;;AAIA,MAAMC,UAAN,SAAyBL,KAAK,CAACM,SAA/B,CAA4D;AAEjDC,EAAAA,WAAW,CAACC,KAAD,EAA2B;AACzC,UAAMA,KAAN;AACH;;AAEMC,EAAAA,MAAM,GAAoB;AAC7B,wBACI,oBAAC,iBAAD;AAAmB,MAAA,IAAI,EAAER,mBAAzB;AAA8C,MAAA,UAAU,EAAC;AAAzD,oBACI,oBAAC,GAAD;AAAK,MAAA,MAAM,EAAC,cAAZ;AAA2B,MAAA,MAAM,EAAE,CAAC,KAAKO,KAAL,CAAWE,QAAX,CAAoBC,QAArB;AAAnC,MADJ,CADJ;AAKH;;AAZuD;;AAa3D;AAED,OAAO,MAAMC,YAAY,GAAGV,UAAU,CAACG,UAAD,CAA/B","sourcesContent":["/*\n * To change this license header, choose License Headers in Project Properties.\n * To change this template file, choose Tools | Templates\n * and open the template in the editor.\n */\n\nimport * as React from 'react';\n\nimport { WarningTriangleIcon } from '@patternfly/react-icons';\nimport {withRouter, RouteComponentProps} from 'react-router-dom';\nimport {Msg} from '../../widgets/Msg';\nimport EmptyMessageState from '../../widgets/EmptyMessageState';\n\nexport interface PageNotFoundProps extends RouteComponentProps {}\n\nclass PgNotFound extends React.Component<PageNotFoundProps> {\n\n public constructor(props: PageNotFoundProps) {\n super(props);\n }\n\n public render(): React.ReactNode {\n return (\n <EmptyMessageState icon={WarningTriangleIcon} messageKey=\"pageNotFound\">\n <Msg msgKey=\"invalidRoute\" params={[this.props.location.pathname]} />\n </EmptyMessageState>\n );\n }\n};\n\nexport const PageNotFound = withRouter(PgNotFound);"],"file":"PageNotFound.js"}
{"version":3,"file":"PageNotFound.js","names":["React","WarningTriangleIcon","withRouter","Msg","EmptyMessageState","PgNotFound","Component","constructor","props","render","createElement","icon","messageKey","msgKey","params","location","pathname","PageNotFound"],"sources":["../../../src/app/content/page-not-found/PageNotFound.tsx"],"sourcesContent":["/*\n * To change this license header, choose License Headers in Project Properties.\n * To change this template file, choose Tools | Templates\n * and open the template in the editor.\n */\n\nimport * as React from 'react';\n\nimport { WarningTriangleIcon } from '@patternfly/react-icons';\nimport {withRouter, RouteComponentProps} from 'react-router-dom';\nimport {Msg} from '../../widgets/Msg';\nimport EmptyMessageState from '../../widgets/EmptyMessageState';\n\nexport interface PageNotFoundProps extends RouteComponentProps {}\n\nclass PgNotFound extends React.Component<PageNotFoundProps> {\n\n public constructor(props: PageNotFoundProps) {\n super(props);\n }\n\n public render(): React.ReactNode {\n return (\n <EmptyMessageState icon={WarningTriangleIcon} messageKey=\"pageNotFound\">\n <Msg msgKey=\"invalidRoute\" params={[this.props.location.pathname]} />\n </EmptyMessageState>\n );\n }\n};\n\nexport const PageNotFound = withRouter(PgNotFound);"],"mappings":"AAAA;AACA;AACA;AACA;AACA;;AAEA,OAAO,KAAKA,KAAK;AAEjB,SAASC,mBAAmB;AAC5B,SAAQC,UAAU;AAClB,SAAQC,GAAG;AACX,OAAOC,iBAAiB;AAIxB,MAAMC,UAAU,SAASL,KAAK,CAACM,SAAS,CAAoB;EAEjDC,WAAWA,CAACC,KAAwB,EAAE;IACzC,KAAK,CAACA,KAAK,CAAC;EAChB;EAEOC,MAAMA,CAAA,EAAoB;IAC7B,oBACIT,KAAA,CAAAU,aAAA,CAACN,iBAAiB;MAACO,IAAI,EAAEV,mBAAoB;MAACW,UAAU,EAAC;IAAc,gBACnEZ,KAAA,CAAAU,aAAA,CAACP,GAAG;MAACU,MAAM,EAAC,cAAc;MAACC,MAAM,EAAE,CAAC,IAAI,CAACN,KAAK,CAACO,QAAQ,CAACC,QAAQ;IAAE,CAAE,CACrD,CAAC;EAE5B;AACJ;AAAC;AAED,OAAO,MAAMC,YAAY,GAAGf,UAAU,CAACG,UAAU,CAAC"}
@@ -1,5 +1,6 @@
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; }
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
/*
* Copyright 2018 Red Hat, Inc. and/or its affiliates.
*
@@ -15,9 +16,10 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import * as React from "../../../../common/keycloak/web_modules/react.js";
import { withRouter } from "../../../../common/keycloak/web_modules/react-router-dom.js";
import { Alert, Button, DataList, DataListAction, DataListItemCells, DataListCell, DataListItem, DataListItemRow, EmptyState, EmptyStateVariant, EmptyStateBody, Split, SplitItem, Title, Dropdown, DropdownPosition, KebabToggle, PageSection, PageSectionVariants } from "../../../../common/keycloak/web_modules/@patternfly/react-core.js";
import * as React from "../../../keycloak.v2/web_modules/react.js";
import { withRouter } from "../../../keycloak.v2/web_modules/react-router-dom.js";
import { Alert, Button, DataList, DataListAction, DataListItemCells, DataListCell, DataListItem, DataListItemRow, EmptyState, EmptyStateVariant, EmptyStateBody, Split, SplitItem, Title, Dropdown, DropdownPosition, KebabToggle, PageSection, PageSectionVariants } from "../../../keycloak.v2/web_modules/@patternfly/react-core.js";
import { AIACommand } from "../../util/AIACommand.js";
import TimeUtil from "../../util/TimeUtil.js";
import { AccountServiceContext } from "../../account-service/AccountServiceContext.js";
@@ -27,41 +29,37 @@ import { ContentPage } from "../ContentPage.js";
import { ContentAlert } from "../ContentAlert.js";
import { KeycloakContext } from "../../keycloak-service/KeycloakContext.js";
// A CredentialContainer is unique by combo of credential type and credential category
/**
* @author Stan Silvert ssilvert@redhat.com (C) 2018 Red Hat Inc.
*/
class SigningInPage extends React.Component {
constructor(props, context) {
super(props);
_defineProperty(this, "context", void 0);
_defineProperty(this, "handleRemove", (credentialId, userLabel) => {
this.context.doDelete("/credentials/" + credentialId).then(() => {
this.context.doDelete("/credentials/" + encodeURIComponent(credentialId)).then(() => {
this.getCredentialContainers();
ContentAlert.success("successRemovedMessage", [userLabel]);
});
});
this.context = context;
this.state = {
credentialContainers: new Map()
};
this.getCredentialContainers();
}
getCredentialContainers() {
this.context.doGet("/credentials").then(response => {
const allContainers = new Map();
const containers = response.data || [];
containers.forEach(container => {
let categoryMap = allContainers.get(container.category);
if (!categoryMap) {
categoryMap = new Map();
allContainers.set(container.category, categoryMap);
}
categoryMap.set(container.type, container);
});
this.setState({
@@ -69,18 +67,15 @@ class SigningInPage extends React.Component {
});
});
}
static credElementId(credType, credId, item) {
return `${credType}-${item}-${credId.substring(0, 8)}`;
}
render() {
return /*#__PURE__*/React.createElement(ContentPage, {
title: "signingIn",
introMessage: "signingInSubMessage"
}, this.renderCategories());
}
renderCategories() {
return Array.from(this.state.credentialContainers.keys()).map(category => /*#__PURE__*/React.createElement(PageSection, {
key: category,
@@ -93,12 +88,10 @@ class SigningInPage extends React.Component {
msgKey: category
})), this.renderTypes(category)));
}
renderTypes(category) {
let credTypeMap = this.state.credentialContainers.get(category);
return /*#__PURE__*/React.createElement(KeycloakContext.Consumer, null, keycloak => /*#__PURE__*/React.createElement(React.Fragment, null, Array.from(credTypeMap.keys()).map((credType, index, typeArray) => [this.renderCredTypeTitle(credTypeMap.get(credType), keycloak, category), this.renderUserCredentials(credTypeMap, credType, keycloak)])));
}
renderEmptyRow(type, isLast) {
if (isLast) return; // don't put empty row at the end
@@ -110,14 +103,12 @@ class SigningInPage extends React.Component {
dataListCells: [/*#__PURE__*/React.createElement(DataListCell, null)]
})));
}
renderUserCredentials(credTypeMap, credType, keycloak) {
const credContainer = credTypeMap.get(credType);
const userCredentialMetadatas = credContainer.userCredentialMetadatas;
const removeable = credContainer.removeable;
const type = credContainer.type;
const displayName = credContainer.displayName;
if (!userCredentialMetadatas || userCredentialMetadatas.length === 0) {
const localizedDisplayName = Msg.localize(displayName);
return /*#__PURE__*/React.createElement(DataList, {
@@ -144,21 +135,17 @@ class SigningInPage extends React.Component {
})]
}))));
}
userCredentialMetadatas.forEach(credentialMetadata => {
let credential = credentialMetadata.credential;
if (!credential.userLabel) credential.userLabel = Msg.localize(credential.type);
if (credential.hasOwnProperty('createdDate') && credential.createdDate && credential.createdDate > 0) {
credential.strCreatedDate = TimeUtil.format(credential.createdDate);
}
});
let updateAIA;
if (credContainer.updateAction) {
updateAIA = new AIACommand(keycloak, credContainer.updateAction);
}
let maxWidth = {
maxWidth: 689
};
@@ -195,7 +182,6 @@ class SigningInPage extends React.Component {
credRemover: this.handleRemove
})))))), " ");
}
credentialRowCells(credMetadata, type) {
const credRowCells = [];
const credential = credMetadata.credential;
@@ -208,7 +194,6 @@ class SigningInPage extends React.Component {
className: "pf-u-max-width",
style: maxWidth
}, credential.userLabel));
if (credential.strCreatedDate) {
credRowCells.push( /*#__PURE__*/React.createElement(DataListCell, {
id: `${SigningInPage.credElementId(type, credential.id, "created-at")}`,
@@ -222,18 +207,14 @@ class SigningInPage extends React.Component {
key: "spacer-" + credential.id
}));
}
return credRowCells;
}
renderCredTypeTitle(credContainer, keycloak, category) {
if (!credContainer.hasOwnProperty("helptext") && !credContainer.hasOwnProperty("createAction")) return;
let setupAction;
if (credContainer.createAction) {
setupAction = new AIACommand(keycloak, credContainer.createAction);
}
const credContainerDisplayName = Msg.localize(credContainer.displayName);
return /*#__PURE__*/React.createElement(React.Fragment, {
key: "credTypeTitle-" + credContainer.type
@@ -277,7 +258,7 @@ class SigningInPage extends React.Component {
}, /*#__PURE__*/React.createElement("span", {
className: "pf-c-button__icon"
}, /*#__PURE__*/React.createElement("i", {
className: "fas fa-plus-circle",
className: "fa fa-plus-circle",
"aria-hidden": "true"
})), /*#__PURE__*/React.createElement(Msg, {
msgKey: "setUpNew",
@@ -294,20 +275,16 @@ class SigningInPage extends React.Component {
}, /*#__PURE__*/React.createElement("span", {
className: "pf-c-button__icon"
}, /*#__PURE__*/React.createElement("i", {
className: "fas fa-plus-circle",
className: "fa fa-plus-circle",
"aria-hidden": "true"
})), /*#__PURE__*/React.createElement(Msg, {
msgKey: "setUpNew",
params: [credContainerDisplayName]
}))))));
}
}
_defineProperty(SigningInPage, "contextType", AccountServiceContext);
;
class CredentialAction extends React.Component {
render() {
if (this.props.updateAction) {
@@ -323,7 +300,6 @@ class CredentialAction extends React.Component {
msgKey: "update"
})));
}
if (this.props.removeable) {
const userLabel = this.props.credential.userLabel;
return /*#__PURE__*/React.createElement(DataListAction, {
@@ -339,12 +315,9 @@ class CredentialAction extends React.Component {
onContinue: () => this.props.credRemover(this.props.credential.id, userLabel)
}));
}
return /*#__PURE__*/React.createElement(React.Fragment, null);
}
}
const SigningInPageWithRouter = withRouter(SigningInPage);
export { SigningInPageWithRouter as SigningInPage };
//# sourceMappingURL=SigningInPage.js.map
File diff suppressed because one or more lines are too long