Skip to content

Commit

Permalink
Require Hoist-Core v18 and associated cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
lbwexler committed Jan 12, 2024
1 parent a51c4bc commit a0c687f
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 37 deletions.
5 changes: 0 additions & 5 deletions admin/tabs/general/alertBanner/AlertBannerModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,6 @@ export class AlertBannerModel extends HoistModel {
];
}

get supportPresets() {
return XH.environmentService.isMinHoistCoreVersion('16.3.0');
}

constructor() {
super();
makeObservable(this);
Expand Down Expand Up @@ -155,7 +151,6 @@ export class AlertBannerModel extends HoistModel {
}

async loadPresetsAsync() {
if (!this.supportPresets) return;
try {
this.savedPresets = await XH.fetchJson({url: 'alertBannerAdmin/alertPresets'});
} catch (e) {
Expand Down
3 changes: 1 addition & 2 deletions admin/tabs/general/alertBanner/AlertBannerPanel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,7 @@ const formPanel = hoistCmp.factory<AlertBannerModel>(({model}) => {
text: 'Presets',
outlined: true
}),
content: presetMenu(),
omit: !model.supportPresets
content: presetMenu()
}),
filler(),
button({
Expand Down
15 changes: 2 additions & 13 deletions admin/tabs/server/connectionpool/ConnPoolMonitorModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,15 @@ import {forOwn, sortBy} from 'lodash';
import * as MCol from '../../monitor/MonitorColumns';

export class ConnPoolMonitorModel extends HoistModel {
readonly minHoistCoreVersion = '17.2.0';
get supported(): boolean {
return XH.environmentService.isMinHoistCoreVersion(this.minHoistCoreVersion);
}

@bindable enabled: boolean = true;
@bindable poolConfiguration: PlainObject = {};
@bindable.ref poolConfiguration: PlainObject = {};

@managed gridModel: GridModel;
@managed chartModel: ChartModel;

constructor() {
super();

if (!this.supported) {
this.enabled = false;
return;
}

this.gridModel = new GridModel({
enableExport: true,
exportOptions: {filename: exportFilenameWithDate('conn-pool-monitor')},
Expand Down Expand Up @@ -91,8 +81,7 @@ export class ConnPoolMonitorModel extends HoistModel {
}

override async doLoadAsync(loadSpec: LoadSpec) {
const {supported, gridModel, chartModel} = this;
if (!supported) return;
const {gridModel, chartModel} = this;

try {
const resp = await XH.fetchJson({
Expand Down
6 changes: 0 additions & 6 deletions admin/tabs/server/connectionpool/ConnPoolMonitorPanel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,6 @@ export const connPoolMonitorPanel = hoistCmp.factory({
model: creates(ConnPoolMonitorModel),

render({model}) {
if (!model.supported) {
return errorMessage({
error: `Connection pool monitoring requires Hoist Core >= ${model.minHoistCoreVersion}.`
});
}

if (!model.enabled) {
return errorMessage({
error: 'Connection pool monitoring disabled via xhConnPoolMonitoringConfig, or no suitable DataSource detected.'
Expand Down
3 changes: 1 addition & 2 deletions admin/tabs/server/logViewer/LogDisplay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,7 @@ const tbar = hoistCmp.factory<LogDisplayModel>(({model}) => {
className: model.caseSensitive
? 'xh-log-display__filter-button xh-log-display__filter-button--active'
: 'xh-log-display__filter-button xh-log-display__filter-button--inactive',
tooltip: 'Case-sensitive filter option',
omit: !XH.environmentService.isMinHoistCoreVersion('16.2.0')
tooltip: 'Case-sensitive filter option'
}),
button({
text: '.*',
Expand Down
2 changes: 1 addition & 1 deletion core/XH.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ import {instanceManager} from './impl/InstanceManager';
import {HoistModel, ModelSelector, RefreshContextModel} from './model';
import {apiDeprecated} from '@xh/hoist/utils/js';

export const MIN_HOIST_CORE_VERSION = '16.0';
export const MIN_HOIST_CORE_VERSION = '18.0';

declare const xhAppCode: string;
declare const xhAppName: string;
Expand Down
6 changes: 2 additions & 4 deletions svc/EnvironmentService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,17 +110,15 @@ export class EnvironmentService extends HoistService {

private checkServerVersionAsync = async () => {
const data = await XH.fetchJson({url: 'xh/version'}),
{appVersion, appBuild, mode, shouldUpdate} = data;
{appVersion, appBuild, mode} = data;

// Compare latest version/build info from server against the same info (also supplied by
// server) when the app initialized. A change indicates an update to the app and will
// force the user to refresh or prompt the user to refresh via the banner according to the
// `mode` set in `xhAppVersionCheck`. Builds are checked here to trigger refresh prompts
// across SNAPSHOT updates for projects with active dev/QA users.
if (appVersion !== this.get('appVersion') || appBuild !== this.get('appBuild')) {
if (mode === 'promptReload' || shouldUpdate) {
// Todo: `shouldUpdate` checked for backwards compatibility with hoist-core v16.3.0
// and earlier - remove in future.
if (mode === 'promptReload') {
XH.appContainerModel.showUpdateBanner(appVersion, appBuild);
} else if (mode === 'forceReload') {
XH.suspendApp({
Expand Down
5 changes: 1 addition & 4 deletions svc/IdentityService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,6 @@ export class IdentityService extends HoistService {
}

private canUserImpersonate(user: HoistUser): boolean {
const hasPerm = XH.environmentService.isMinHoistCoreVersion('16.3.0')
? user.hasRole(`HOIST_IMPERSONATOR`)
: user.isHoistAdmin;
return hasPerm && XH.getConf('xhEnableImpersonation');
return user.hasRole(`HOIST_IMPERSONATOR`) && XH.getConf('xhEnableImpersonation');
}
}

0 comments on commit a0c687f

Please sign in to comment.