studiokit-scaffolding-js 4.7.1 → 4.8.0-next.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9,6 +9,8 @@ export interface UserRolesReduxProps {
9
9
  canDeleteSelf?: boolean;
10
10
  }
11
11
  export interface UserRolesOwnProps extends CollectionComponentWrappedProps<UserRole> {
12
+ /** Should the component prevent modifications, independent of permissions? */
13
+ readOnly?: boolean;
12
14
  /** Is the current user allowed to delete their own user role? Overrides the value from redux. */
13
15
  canDeleteSelf?: boolean;
14
16
  /** If multiple roles allowed, each role is displayed per user, otherwise a select dropdown is displayed. */
@@ -104,5 +106,5 @@ export declare class UserRoles extends Component<UserRolesProps, UserRolesState>
104
106
  render(): JSX.Element;
105
107
  }
106
108
  export declare const mapStateToProps: (state: BaseReduxState, ownProps: UserRolesOwnProps) => UserRolesReduxProps;
107
- declare const _default: import("react-redux").ConnectedComponent<typeof UserRoles, Pick<React.ClassAttributes<UserRoles> & UserRolesProps, "externalProviders" | "model" | "ref" | "key" | "guid" | "load" | "modelName" | "pathParams" | "modelStatus" | "queryParams" | "disableAutoLoad" | "modelArray" | "stopPeriodicLoad" | "create" | "update" | "delete" | "previousModelStatus" | "fetchingId" | "textForRole" | "entityName" | "defaultRole" | "roleDescriptions" | "renderAddDescription" | "isUpdateDisabled" | "isDeleteDisabled" | "allowMultipleRoles" | "requiredRole" | "isAddDisabled" | "modifyUserRoleActivityName" | "deleteOwnUserRoleActivityName" | "addRoleExcludeList" | "entity" | "filterUsers" | "onAdd" | "onUpdate" | "onRemove" | "renderTableDescription" | "singularArticleForRole"> & UserRolesOwnProps>;
109
+ declare const _default: import("react-redux").ConnectedComponent<typeof UserRoles, Pick<React.ClassAttributes<UserRoles> & UserRolesProps, "externalProviders" | "model" | "ref" | "key" | "readOnly" | "guid" | "load" | "modelName" | "pathParams" | "modelStatus" | "queryParams" | "disableAutoLoad" | "modelArray" | "stopPeriodicLoad" | "create" | "update" | "delete" | "previousModelStatus" | "fetchingId" | "textForRole" | "entityName" | "defaultRole" | "roleDescriptions" | "renderAddDescription" | "isUpdateDisabled" | "isDeleteDisabled" | "allowMultipleRoles" | "requiredRole" | "isAddDisabled" | "modifyUserRoleActivityName" | "deleteOwnUserRoleActivityName" | "addRoleExcludeList" | "entity" | "filterUsers" | "onAdd" | "onUpdate" | "onRemove" | "renderTableDescription" | "singularArticleForRole"> & UserRolesOwnProps>;
108
110
  export default _default;
@@ -390,12 +390,13 @@ var UserRoles = /** @class */ (function (_super) {
390
390
  //#endregion Remove User
391
391
  UserRoles.prototype.render = function () {
392
392
  var _this = this;
393
- var _a = this.props, modelStatus = _a.modelStatus, canModify = _a.canModify, canDeleteSelf = _a.canDeleteSelf, allowMultipleRoles = _a.allowMultipleRoles, isAddDisabled = _a.isAddDisabled, isUpdateDisabled = _a.isUpdateDisabled, isDeleteDisabled = _a.isDeleteDisabled, defaultRole = _a.defaultRole, requiredRole = _a.requiredRole, roleDescriptions = _a.roleDescriptions, addRoleExcludeList = _a.addRoleExcludeList, entityName = _a.entityName, renderTableDescription = _a.renderTableDescription, renderAddDescription = _a.renderAddDescription;
393
+ var _a = this.props, modelStatus = _a.modelStatus, canModify = _a.canModify, readOnly = _a.readOnly, canDeleteSelf = _a.canDeleteSelf, allowMultipleRoles = _a.allowMultipleRoles, isAddDisabled = _a.isAddDisabled, isUpdateDisabled = _a.isUpdateDisabled, isDeleteDisabled = _a.isDeleteDisabled, defaultRole = _a.defaultRole, requiredRole = _a.requiredRole, roleDescriptions = _a.roleDescriptions, addRoleExcludeList = _a.addRoleExcludeList, entityName = _a.entityName, renderTableDescription = _a.renderTableDescription, renderAddDescription = _a.renderAddDescription;
394
394
  var _b = this.state, sortedUsers = _b.sortedUsers, isAdding = _b.isAdding, isUpdating = _b.isUpdating, isRemoving = _b.isRemoving, shouldResetAddForm = _b.shouldResetAddForm, shouldShowRemoveDialog = _b.shouldShowRemoveDialog, userRoleToUpdate = _b.userRoleToUpdate, userRoleToRemove = _b.userRoleToRemove, successMessage = _b.successMessage, existingMessage = _b.existingMessage, blockedMessage = _b.blockedMessage, failMessage = _b.failMessage;
395
395
  var addableRoleDescriptions = addRoleExcludeList
396
396
  ? lodash_1.pickBy(roleDescriptions, function (_, key) { return !addRoleExcludeList.includes(key); })
397
397
  : roleDescriptions;
398
398
  var roles = Object.keys(roleDescriptions);
399
+ var shouldRenderAsMutable = !readOnly && canModify;
399
400
  return (react_1.default.createElement(react_1.default.Fragment, null,
400
401
  !!successMessage && (react_1.default.createElement(AlertWithIcon_1.default, { id: "successMessageAlert", variant: "success", dismissible: true, onClose: function () {
401
402
  return _this.setState({
@@ -421,13 +422,13 @@ var UserRoles = /** @class */ (function (_super) {
421
422
  });
422
423
  } },
423
424
  react_1.default.createElement("p", { className: "pre-wrap" }, failMessage))),
424
- canModify && (react_1.default.createElement(Add_1.default, { id: "entityUserRolesAdd", disabled: isAddDisabled, entityName: entityName, defaultRole: defaultRole, roleDescriptions: addableRoleDescriptions, renderAddDescription: renderAddDescription, textForRole: this.textForRole, isAddingUsersToRole: isAdding, shouldReset: shouldResetAddForm, addUserRoles: this.addUserRoles })),
425
- !!renderTableDescription && renderTableDescription(canModify),
425
+ shouldRenderAsMutable && (react_1.default.createElement(Add_1.default, { id: "entityUserRolesAdd", disabled: isAddDisabled, entityName: entityName, defaultRole: defaultRole, roleDescriptions: addableRoleDescriptions, renderAddDescription: renderAddDescription, textForRole: this.textForRole, isAddingUsersToRole: isAdding, shouldReset: shouldResetAddForm, addUserRoles: this.addUserRoles })),
426
+ !!renderTableDescription && renderTableDescription(shouldRenderAsMutable),
426
427
  react_1.default.createElement(react_bootstrap_1.Row, { className: "mt3" },
427
428
  react_1.default.createElement(react_bootstrap_1.Col, { xs: 12 }, modelStatus === modelStatus_1.default.LOADING ? (react_1.default.createElement(Loading_1.default, null)) : sortedUsers.length > 0 ? (react_1.default.createElement(Context_1.UserRolesContext.Provider, { value: {
428
429
  isUpdateDisabled: isUpdateDisabled,
429
430
  isDeleteDisabled: isDeleteDisabled,
430
- canModify: canModify,
431
+ canModify: shouldRenderAsMutable,
431
432
  canDeleteSelf: canDeleteSelf,
432
433
  allowMultipleRoles: allowMultipleRoles,
433
434
  roles: roles,
@@ -448,7 +449,9 @@ var UserRoles = /** @class */ (function (_super) {
448
449
  exports.UserRoles = UserRoles;
449
450
  var mapStateToProps = function (state, ownProps) {
450
451
  var canModifyGlobally = baseActivity_1.canPerformActivityGlobally(ownProps.modifyUserRoleActivityName, baseActivity_1.defaultOptions(state));
451
- var canModify = canModifyGlobally ||
452
+ var canModify =
453
+ // If the parent specifies false for canModify, then make the component read-only regardless of the user's permissions
454
+ canModifyGlobally ||
452
455
  (ownProps.entity
453
456
  ? baseActivity_1.canPerformActivityOnEntity(ownProps.modifyUserRoleActivityName, baseActivity_1.defaultOptions(state, ownProps, 'entity'))
454
457
  : false);
package/lib/startup.js CHANGED
@@ -84,14 +84,17 @@ var startup = function (appConfig, endpointMappings) {
84
84
  // do not track console logs when running in development mode (locally)
85
85
  return breadcrumb.category === 'console' && appConfig.NODE_ENV !== 'production' ? null : breadcrumb;
86
86
  },
87
- // enable performance tracing
87
+ // enable performance tracing and session replays
88
88
  integrations: [
89
89
  new tracing_1.Integrations.BrowserTracing({
90
90
  routingInstrumentation: Sentry.reactRouterV5Instrumentation(history)
91
- })
91
+ }),
92
+ new Sentry.Replay()
92
93
  ],
93
- // set a uniform sample rate
94
- tracesSampleRate: appConfig.SENTRY_TRACES_SAMPLE_RATE
94
+ // set sample rates for performance tracing and session replays
95
+ tracesSampleRate: appConfig.SENTRY_TRACES_SAMPLE_RATE,
96
+ replaysSessionSampleRate: appConfig.SENTRY_REPLAYS_SESSION_SAMPLE_RATE,
97
+ replaysOnErrorSampleRate: appConfig.SENTRY_REPLAYS_ON_ERROR_SAMPLE_RATE
95
98
  });
96
99
  }
97
100
  // Unhandled Errors
@@ -23,6 +23,8 @@ export interface AppConfiguration {
23
23
  GOOGLE_ANALYTICS_TRACKING_ID?: string;
24
24
  SENTRY_DSN?: string;
25
25
  SENTRY_TRACES_SAMPLE_RATE?: number;
26
+ SENTRY_REPLAYS_SESSION_SAMPLE_RATE?: number;
27
+ SENTRY_REPLAYS_ON_ERROR_SAMPLE_RATE?: number;
26
28
  APP_INSIGHTS_KEY?: string;
27
29
  CLIENT_ID: string;
28
30
  CLIENT_SECRET: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "studiokit-scaffolding-js",
3
- "version": "4.7.1",
3
+ "version": "4.8.0-next.1.2",
4
4
  "description": "Common scaffolding for Studio apps at Purdue",
5
5
  "repository": "https://gitlab.com/purdue-informatics/studiokit/studiokit-scaffolding-js",
6
6
  "license": "MIT",
@@ -85,7 +85,7 @@
85
85
  ]
86
86
  },
87
87
  "resolutions": {
88
- "@sentry/browser": "^6.14.1",
88
+ "@sentry/browser": "^7.38.0",
89
89
  "@types/react": "^17.0.0",
90
90
  "@types/react-router": "^5.1.11",
91
91
  "kind-of": "^6.0.3",
@@ -99,8 +99,8 @@
99
99
  "@material-ui/icons": "^4.11.2",
100
100
  "@microsoft/applicationinsights-web": "^2.5.11",
101
101
  "@redux-saga/types": "^1.1.0",
102
- "@sentry/react": "^6.14.1",
103
- "@sentry/tracing": "^6.14.1",
102
+ "@sentry/react": "^7.38.0",
103
+ "@sentry/tracing": "^7.38.0",
104
104
  "@types/history": "^4.7.8",
105
105
  "@types/lodash": "^4.14.168",
106
106
  "@types/pluralize": "^0.0.29",