UI: Handle some deprecations (#28276)

* don't update the passed object directly
fixes deprecation https://deprecations.emberjs.com/id/setting-on-hash

* replace hasRecordForId with peekRecord -- ember-data:deprecate-has-record-for-id

* fix deprecation ember-data:deprecate-has-record-for-id

* update deprecation workflow
This commit is contained in:
Chelsea Shaw
2024-09-17 14:59:01 -05:00
committed by GitHub
parent 75bea5c05a
commit a9e6704267
6 changed files with 22 additions and 15 deletions

View File

@@ -30,7 +30,7 @@ export default class NamedPathAdapter extends ApplicationAdapter {
const [store, { modelName }, snapshot] = arguments;
const name = snapshot.attr('name');
// throw error if user attempts to create a record with same name, otherwise POST request silently overrides (updates) the existing model
if (store.hasRecordForId(modelName, name)) {
if (store.peekRecord({ type: modelName, id: name }) !== null) {
throw new Error(`A record already exists with the name: ${name}`);
} else {
return this._saveRecord(...arguments);

View File

@@ -8,6 +8,7 @@ import Resolver from 'ember-resolver';
import loadInitializers from 'ember-load-initializers';
import config from 'vault/config/environment';
// TODO: DEPRECATION https://ember-engines.com/docs/deprecations#-use-alias-for-inject-router-service-from-host-application
export default class App extends Application {
modulePrefix = config.modulePrefix;
podModulePrefix = config.podModulePrefix;

View File

@@ -40,7 +40,8 @@ export default Controller.extend(DEFAULTS, {
}),
actions: {
initCluster(data) {
initCluster(payload) {
const data = { ...payload };
const isCloudSeal = !!this.model.sealType && this.model.sealType !== 'shamir';
if (data.secret_shares) {
const shares = parseInt(data.secret_shares, 10);

View File

@@ -10,7 +10,8 @@ export function initialize() {
registerDeprecationHandler((message, options, next) => {
// filter deprecations that are scheduled to be removed in a specific version
// when upgrading or addressing deprecation warnings be sure to update this or remove if not needed
if (options?.until.includes('5.0') && options?.id.startsWith('ember-data')) {
if (options?.until.includes('6.0')) {
// ignore all deprecations for 6+
return;
}
next(message, options);

View File

@@ -6,5 +6,10 @@
import Model, { belongsTo } from '@ember-data/model';
export default Model.extend({
backend: belongsTo('auth-method', { inverse: 'authConfigs', readOnly: true, async: false }),
backend: belongsTo('auth-method', {
inverse: 'authConfigs',
readOnly: true,
async: false,
as: 'auth-config',
}),
});

View File

@@ -5,20 +5,19 @@
/* global self */
self.deprecationWorkflow = self.deprecationWorkflow || {};
//self.deprecationWorkflow.config = {
//throwOnUnhandled: true
//}
self.deprecationWorkflow.config = {
throwOnUnhandled: false,
};
self.deprecationWorkflow.config = {
// current output from deprecationWorkflow.flushDeprecations();
// deprecations that will not be removed until 5.0.0 are filtered by deprecation-filter initializer rather than silencing below
workflow: [
{ handler: 'silence', matchId: 'ember-data:model-save-promise' },
{ handler: 'silence', matchId: 'ember-engines.deprecation-camelized-engine-names' },
{ handler: 'silence', matchId: 'ember-engines.deprecation-router-service-from-host' },
{ handler: 'silence', matchId: 'ember-modifier.use-modify' },
{ handler: 'silence', matchId: 'ember-modifier.no-element-property' },
{ handler: 'silence', matchId: 'ember-modifier.no-args-property' },
{ handler: 'silence', matchId: 'ember-cli-mirage-config-routes-only-export' },
{ handler: 'silence', matchId: 'setting-on-hash' },
// ember-data
{ handler: 'silence', matchId: 'ember-data:deprecate-early-static' },
{ handler: 'silence', matchId: 'ember-data:deprecate-model-reopen' },
{ handler: 'silence', matchId: 'ember-data:deprecate-promise-proxies' },
{ handler: 'silence', matchId: 'ember-data:no-a-with-array-like' },
{ handler: 'silence', matchId: 'ember-data:deprecate-promise-many-array-behaviors' },
],
};