Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI: Ember Deprecation - Remove A import from ember/array #25788

Merged
merged 2 commits into from
Mar 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions ui/app/components/mfa/mfa-login-enforcement-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import Component from '@glimmer/component';
import { tracked } from '@glimmer/tracking';
import { action } from '@ember/object';
import { A } from '@ember/array';
import { service } from '@ember/service';
import { task } from 'ember-concurrency';
import handleHasManySelection from 'core/utils/search-select-has-many';
Expand Down Expand Up @@ -41,14 +40,14 @@ export default class MfaLoginEnforcementForm extends Component {
searchSelectOptions = null;

@tracked name;
@tracked targets = A([]);
@tracked targets = [];
@tracked selectedTargetType = 'accessor';
@tracked selectedTargetValue = null;
@tracked searchSelect = {
options: [],
selected: [],
};
@tracked authMethods = A([]);
@tracked authMethods = [];
@tracked modelErrors;

constructor() {
Expand Down
3 changes: 1 addition & 2 deletions ui/app/components/tool-actions-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,12 @@ import { service } from '@ember/service';
import Component from '@ember/component';
import { setProperties, computed, set } from '@ember/object';
import { addSeconds, parseISO } from 'date-fns';
import { A } from '@ember/array';
import { capitalize } from '@ember/string';

const DEFAULTS = {
token: null,
rewrap_token: null,
errors: A(),
errors: null,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this component (and others with a similar pattern) this.errors is set to null in the component lifecycle, so null seems like a reasonable default.

wrap_info: null,
creation_time: null,
creation_ttl: null,
Expand Down
10 changes: 5 additions & 5 deletions ui/app/transforms/array.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/

import Transform from '@ember-data/serializer/transform';
import { isArray, A } from '@ember/array';
import { isArray } from '@ember/array';
/*
This should go inside a globally available place for all apps

Expand All @@ -13,16 +13,16 @@ import { isArray, A } from '@ember/array';
export default class ArrayTransform extends Transform {
deserialize(value) {
if (isArray(value)) {
return A(value);
return [...value];
} else {
return A();
return [];
}
}
serialize(value) {
if (isArray(value)) {
return A(value);
return [...value];
} else {
return A();
return [];
}
}
}
3 changes: 1 addition & 2 deletions ui/lib/core/addon/components/replication-actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,12 @@ import { alias } from '@ember/object/computed';
import Component from '@ember/component';
import ReplicationActions from 'core/mixins/replication-actions';
import layout from '../templates/components/replication-actions';
import { A } from '@ember/array';

const DEFAULTS = {
token: null,
primary_api_addr: null,
primary_cluster_addr: null,
errors: A(),
errors: null,
id: null,
force: false,
};
Expand Down
3 changes: 1 addition & 2 deletions ui/lib/core/addon/components/shamir/flow.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
* SPDX-License-Identifier: BUSL-1.1
*/

import { A } from '@ember/array';
import { action } from '@ember/object';
import { service } from '@ember/service';
import { camelize } from '@ember/string';
Expand Down Expand Up @@ -44,7 +43,7 @@ import { tracked } from '@glimmer/tracking';
*/
export default class ShamirFlowComponent extends Component {
@service store;
@tracked errors = A();
@tracked errors = null;
@tracked attemptResponse = null;

get action() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,12 @@ import Component from '@ember/component';
import decodeConfigFromJWT from 'replication/utils/decode-config-from-jwt';
import ReplicationActions from 'core/mixins/replication-actions';
import { task } from 'ember-concurrency';
import { A } from '@ember/array';

const DEFAULTS = {
token: null,
id: null,
loading: false,
errors: A(),
errors: null,
primary_api_addr: null,
primary_cluster_addr: null,
ca_file: null,
Expand Down
3 changes: 1 addition & 2 deletions ui/types/ember-cli-flash/services/flash-messages.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
declare module 'ember-cli-flash/services/flash-messages' {
import Service from '@ember/service';
import FlashObject from 'ember-cli-flash/flash/object';
import { A } from '@ember/array';

type Partial<T> = { [K in keyof T]?: T[K] };

Expand All @@ -31,7 +30,7 @@ declare module 'ember-cli-flash/services/flash-messages' {
}

class FlashMessageService extends Service {
queue: A<FlashObject>;
queue: FlashObject[];
success: FlashFunction;
warning: FlashFunction;
info: FlashFunction;
Expand Down
Loading