Skip to content

Commit

Permalink
Merge branch 'develop' into role_delete_bug_fix
Browse files Browse the repository at this point in the history
  • Loading branch information
lbwexler committed Aug 7, 2024
2 parents ec04cc8 + 2cab9e9 commit d3992f4
Show file tree
Hide file tree
Showing 30 changed files with 2,336 additions and 1,525 deletions.
3,252 changes: 1,886 additions & 1,366 deletions .yarn/releases/yarn-1.22.19.cjs → .yarn/releases/yarn-1.22.22.cjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .yarnrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@


lastUpdateCheck 1575658302616
yarn-path ".yarn/releases/yarn-1.22.19.cjs"
yarn-path ".yarn/releases/yarn-1.22.22.cjs"
55 changes: 51 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,46 @@

## 67.0.0-SNAPSHOT - unreleased

### 🎁 New Features

* Added support for Correlation IDs across fetch requests and error / activity tracking:
* New `FetchService` members: `autoGenCorrelationIds`, `genCorrelationId` and
`correlationIdHeaderKey` to support generation and inclusion of Correlation IDs on outbound
request headers.
* Correlation ID assignment is available via:
* `FetchOptions.correlationId` - specify an ID to be used on a particular request or `true`
to use a UUID generated by Hoist (see `FetchService.genCorrelationId()`).
* `TrackOptions.correlationId` - specify an ID for a tracked activity, if not already
relayed from a `FetchService` response.
* If set on a fetch request, Correlation IDs are passed through to downstream Hoist activity
tracking and error reporting and are available for review in the Admin Console.
* New `XH.genUUID()` method to generate UUIDs for use as Correlation IDs or elsewhere.
* `GridModel` will now accept `false` as a value to omit context menus.

### 🐞 Bug Fixes

* Fixed bug where a role with a dot in its name could not be deleted.
* Fixed `SelectEditor` to ensure new value is flushed before editing stops.


### 💥 Breaking Changes
* Requires `hoist-core >= 21.0`.

### ⚙️ Technical

* Remove context menus from column choosers.

### 📚 Libraries

* Requires `hoist-core >= 21.0` to use corresponding role delete bug fix.
* uuid `added @ 10.0`

## 66.1.1 - 2024-08-01

### 🐞 Bug Fixes

* Fixed bug where a role with a dot in its name could not be deleted.
* `HoistException` now correctly passes an exception message to its underlying `Error` instance.
* Fixed `GridModel.cellBorders` to apply top and bottom cell borders, as expected.
* Fix to new `mergeDeep` method.

## 66.1.0 - 2024-07-31

Expand All @@ -19,15 +52,29 @@
* New `mergeDeep` method provided in `@xh/hoist/utils/js` as an alternative to `lodash.merge`,
without lodash's surprising deep-merging of array-based properties.
* Enhanced Roles Admin UI to support bulk category reassignment.
* Enhanced the number formatters' `zeroPad` option to take an integer in addition to true/false, for
finer-grained control over padding length.

### 🐞 Bug Fixes

* Fixed `Record.descendants` and `Record.allDescendants` getters that were incorrectly returning the
parent record itself. Now only the descendants are returned, as expected.
* ⚠️ Note that apps relying on the previous behavior will need to adjust to account for the
parent record no longer being included. (Tree grids with custom parent/child checkbox
selection are one example of a component that might be affected by this change.)
* Fixed `Grid` regression where pinned columns were automatically un-pinned when the viewport became
too small to accommodate them.
* Fixed bug where `Grid` context-menus would lose focus when rendered inside `Overlay` components.

### ⚙️ Typescript API Adjustments

* ⚠️ Please ensure you update your app to `hoist-dev-utils >= v9.0.1` - this ensures you have a
recent version of `type-fest` as a dev dependency, required to compile some recent Hoist
typescript changes.
* The `NumberFormatOptions.precision` arg has been more strictly typed to `Precision`, a new type
exported from `@xh/hoist/format`. (It was previously `number`.) Apps might require minor
adjustments - e.g. typing shared format configs as `NumberFormatOptions` to satisfy the compiler.

### ⚙️ Technical

* Enhanced beta `MsalClient` and `AuthZeroClient` OAuth implementations to support passing
Expand All @@ -41,7 +88,7 @@
static page) for all iFrame-based "silent" token requests, as per MS recommendations. Intended to
avoid potential race conditions triggered by redirecting to the base app URL in these cases.
* Fixed bug where `ContextMenu` items could be improperly positioned.
*️Note that `MenuItems` inside a desktop `ContextMenu` are now rendered in a portal, outside
*️ Note that `MenuItems` inside a desktop `ContextMenu` are now rendered in a portal, outside
the normal component hierarchy, to ensures that menu items are positioned properly relative to
their parent. It should not affect most apps, but could impact menu style customizations that
rely on specific CSS selectors targeting the previous DOM structure.
Expand Down Expand Up @@ -158,7 +205,7 @@

## 64.0.0 - 2024-05-17

### 💥 Breaking Changes (upgrade difficulty: 🟠 MEDIUM - major Hoist Core = AG Grid updates)
### 💥 Breaking Changes (upgrade difficulty: 🟠 MEDIUM - major Hoist Core + AG Grid updates)

#### Hoist Core v20 with Multi-Instance Support

Expand Down
9 changes: 9 additions & 0 deletions admin/columns/Tracking.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,15 @@ export const entryId: ColumnSpec = {
align: 'right'
};

export const correlationId: ColumnSpec = {
field: {
name: 'correlationId',
type: 'string',
displayName: 'Correlation ID'
},
width: 100
};

export const error: ColumnSpec = {
field: {
name: 'error',
Expand Down
1 change: 1 addition & 0 deletions admin/tabs/activity/clienterrors/ClientErrorDetail.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ export const clientErrorDetail = hoistCmp.factory<ClientErrorsModel>(({model}) =
label: 'User Alerted?'
}),
formField({field: 'id'}),
formField({field: 'correlationId'}),
formField({
field: 'url',
readonlyRenderer: hyperlinkVal
Expand Down
4 changes: 3 additions & 1 deletion admin/tabs/activity/clienterrors/ClientErrorsModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,15 @@ export class ClientErrorsModel extends HoistModel {
{...Col.instance, hidden},
{...Col.day},
{...Col.dateCreatedWithSec, displayName: 'Timestamp'},
{...Col.impersonating, hidden}
{...Col.impersonating, hidden},
{...Col.correlationId}
]
});

const enableValues = true;
this.filterChooserModel = new FilterChooserModel({
fieldSpecs: [
{field: 'correlationId'},
{field: 'username', displayName: 'User', enableValues},
{field: 'browser', enableValues},
{field: 'device', enableValues},
Expand Down
2 changes: 2 additions & 0 deletions admin/tabs/activity/tracking/ActivityTrackingModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ export class ActivityTrackingModel extends HoistModel {
fields: [
Col.browser.field,
Col.category.field,
Col.correlationId.field,
Col.data.field,
{...(Col.dateCreated.field as FieldSpec), displayName: 'Timestamp'},
Col.day.field,
Expand All @@ -111,6 +112,7 @@ export class ActivityTrackingModel extends HoistModel {
this.filterChooserModel = new FilterChooserModel({
fieldSpecs: [
{field: 'category', enableValues},
{field: 'correlationId'},
{field: 'username', displayName: 'User', enableValues},
{field: 'device', enableValues},
{field: 'browser', enableValues},
Expand Down
3 changes: 2 additions & 1 deletion admin/tabs/activity/tracking/detail/ActivityDetailModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ export class ActivityDetailModel extends HoistModel {
{...Col.browser},
{...Col.userAgent, hidden},
{...Col.elapsed},
{...Col.dateCreatedWithSec, displayName: 'Timestamp'}
{...Col.dateCreatedWithSec, displayName: 'Timestamp'},
{...Col.correlationId}
]
});

Expand Down
1 change: 1 addition & 0 deletions admin/tabs/activity/tracking/detail/ActivityDetailView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ const detailRecForm = hoistCmp.factory<ActivityDetailModel>(({model}) => {
})
}),
formField({field: 'id'}),
formField({field: 'correlationId'}),
formField({
field: 'url',
readonlyRenderer: hyperlinkVal
Expand Down
8 changes: 6 additions & 2 deletions cmp/ag-grid/AgGrid.scss
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,14 @@
border-color: var(--xh-grid-group-border-color);
}
}
.ag-cell {
border-bottom: none;
border-top: none;
}
}

&--no-row-borders {
.ag-row,
.ag-cell {
.ag-row {
border-bottom: none;
border-top: none;
}
Expand Down Expand Up @@ -249,6 +252,7 @@
&--cell-borders {
.ag-cell {
border-right-color: var(--xh-grid-border-color);
border-bottom-color: var(--xh-grid-border-color);
}

.ag-row {
Expand Down
7 changes: 4 additions & 3 deletions cmp/grid/GridModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -277,9 +277,9 @@ export interface GridConfig {

/**
* Array of RecordActions, dividers, or token strings with which to create a context menu.
* May also be specified as a function returning same.
* May also be specified as a function returning same or false to omit context menu from grid.
*/
contextMenu?: GridContextMenuSpec;
contextMenu?: GridContextMenuSpec | false;

/**
* Governs if the grid should reuse a limited set of DOM elements for columns visible in the
Expand Down Expand Up @@ -539,7 +539,8 @@ export class GridModel extends HoistModel {
this.groupRowRenderer = managedRenderer(groupRowRenderer, 'GROUP_ROW');
this.groupSortFn = withDefault(groupSortFn, this.defaultGroupSortFn);
this.showGroupRowCounts = showGroupRowCounts;
this.contextMenu = withDefault(contextMenu, GridModel.defaultContextMenu);
this.contextMenu =
contextMenu === false ? [] : withDefault(contextMenu, GridModel.defaultContextMenu);
this.useVirtualColumns = useVirtualColumns;
this.externalSort = externalSort;
this.autosizeOptions = defaults(
Expand Down
8 changes: 8 additions & 0 deletions core/XH.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ import {
import {installServicesAsync} from './impl/InstallServices';
import {instanceManager} from './impl/InstanceManager';
import {HoistModel, ModelSelector, RefreshContextModel} from './model';
import {v4} from 'uuid';

export const MIN_HOIST_CORE_VERSION = '18.0';

Expand Down Expand Up @@ -780,6 +781,13 @@ export class XHApi {
return uniqueId('xh-id-');
}

/**
* Generate a universally unique identifier (UUID). Useful for generating Correlation IDs.
*/
genUUID(): string {
return v4();
}

//----------------
// Implementation
//----------------
Expand Down
14 changes: 11 additions & 3 deletions core/exception/Exception.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,23 +184,31 @@ export class Exception {
// Implementation
//-----------------------
private static createFetchException(attributes: PlainObject) {
let correlationId: string = null;
const correlationIdHeaderKey = XH?.fetchService?.correlationIdHeaderKey;
if (correlationIdHeaderKey) {
correlationId = attributes.fetchOptions?.headers?.[correlationIdHeaderKey];
}

return this.createInternal({
isFetchAborted: false,
httpStatus: 0, // native fetch doesn't put status on its Error
serverDetails: null,
stack: null, // server-sourced exceptions do not include, neither should client, not relevant
correlationId,
...attributes
}) as FetchException;
}

private static createInternal(attributes: PlainObject, baseError: Error = new Error()) {
private static createInternal(attributes: PlainObject, baseError?: Error) {
const {message, ...rest} = attributes;
return Object.assign(
baseError,
baseError ?? new Error(message),
{
isRoutine: false,
isHoistException: true
},
attributes
rest
) as HoistException;
}
}
Expand Down
5 changes: 3 additions & 2 deletions core/exception/ExceptionHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export class ExceptionHandler {
* logging back to the server for stateful error tracking in the Admin Console.
*
* Typical application entry points to this method are the {@link XH.handleException} alias and
* {@link Promise.catchDefault}.
* {@link Promise.prototype.catchDefault}.
*
* This handler provides the most value with HoistExceptions created by {@link Exception.create}.
* Hoist automatically creates such exceptions in most instances, most notably in FetchService,
Expand Down Expand Up @@ -201,7 +201,8 @@ export class ExceptionHandler {
appVersion: XH.getEnv('clientVersion'),
url: window.location.href,
userAlerted,
clientUsername: username
clientUsername: username,
correlationId: exception.correlationId
},
// Post clientUsername as a parameter to ensure client username matches session.
params: {
Expand Down
3 changes: 3 additions & 0 deletions core/exception/Types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ import {FetchOptions} from '@xh/hoist/svc';
export interface HoistException extends Error {
isHoistException: true;

/** Correlation ID associated with this exception, if any. */
correlationId?: string;

/**
* Is the exception an expected, normal behavior of the app?
*
Expand Down
Loading

0 comments on commit d3992f4

Please sign in to comment.