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

Fix some build-time deprecations #1989

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
2 changes: 1 addition & 1 deletion app/models/collection-provider.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { computed } from '@ember/object';
import { htmlSafe } from '@ember/string';
import { htmlSafe } from '@ember/template';
import { belongsTo, hasMany, AsyncBelongsTo, AsyncHasMany } from '@ember-data/model';

import CollectionModel from './collection';
Expand Down
2 changes: 1 addition & 1 deletion app/models/institution.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { attr, belongsTo, hasMany, AsyncBelongsTo, AsyncHasMany } from '@ember-data/model';
import { computed } from '@ember/object';
import { htmlSafe } from '@ember/string';
import { htmlSafe } from '@ember/template';

import InstitutionSummaryMetricModel from 'ember-osf-web/models/institution-summary-metric';
import InstitutionDepartmentsModel from './institution-department';
Expand Down
2 changes: 1 addition & 1 deletion app/models/node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { attr, belongsTo, hasMany, AsyncBelongsTo, AsyncHasMany } from '@ember-d
import { computed } from '@ember/object';
import { alias, bool, equal, not } from '@ember/object/computed';
import { inject as service } from '@ember/service';
import { htmlSafe } from '@ember/string';
import { htmlSafe } from '@ember/template';
import { buildValidations, validator } from 'ember-cp-validations';
import Intl from 'ember-intl/services/intl';

Expand Down
2 changes: 1 addition & 1 deletion app/models/registration-provider.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { htmlSafe } from '@ember/string';
import { htmlSafe } from '@ember/template';
import { attr, belongsTo, hasMany, AsyncBelongsTo, AsyncHasMany } from '@ember-data/model';
import ReviewActionModel from 'ember-osf-web/models/review-action';

Expand Down
2 changes: 1 addition & 1 deletion app/validators/-messages.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import ValidatorsMessages from 'ember-intl-cp-validations/validators/messages';
import ValidatorsMessages from '@ember-intl/cp-validations/validators/messages';

export default class Messages extends ValidatorsMessages {
prefix = 'validationErrors';
Expand Down
2 changes: 0 additions & 2 deletions ember-cli-build.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/* eslint-env node */

const nodeSass = require('node-sass');

const EmberApp = require('ember-cli/lib/broccoli/ember-app');
const broccoliAssetRevDefaults = require('broccoli-asset-rev/lib/default-options');
Expand Down Expand Up @@ -49,7 +48,6 @@ module.exports = function(defaults) {
prepend: config.assetsPrefix,
},
sassOptions: {
implementation: nodeSass,
includePaths: [
'app/styles/',
],
Expand Down
2 changes: 1 addition & 1 deletion lib/app-components/addon/helpers/math.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Helper from '@ember/component/helper';
import { htmlSafe } from '@ember/string';
import { htmlSafe } from '@ember/template';
import katex, { KatexRenderOptions } from 'katex';

export interface Delimiter {
Expand Down
1 change: 0 additions & 1 deletion lib/app-components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"ember-auto-import": "*",
"ember-cli-babel": "*",
"ember-cli-htmlbars": "*",
"ember-cli-sanitize-html": "*",
"ember-cli-sass": "*",
"ember-cli-template-lint": "*",
"ember-cli-typescript": "*",
Expand Down
1 change: 0 additions & 1 deletion lib/collections/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
"ember-auto-import": "*",
"ember-cli-babel": "*",
"ember-cli-htmlbars": "*",
"ember-cli-sanitize-html": "*",
"ember-cli-sass": "*",
"ember-cli-template-lint": "*",
"ember-cli-typescript": "*",
Expand Down
11 changes: 0 additions & 11 deletions lib/osf-components/addon/components/osf-logo/component.ts

This file was deleted.

105 changes: 0 additions & 105 deletions lib/osf-components/addon/components/osf-logo/styles.scss

This file was deleted.

5 changes: 0 additions & 5 deletions lib/osf-components/addon/components/osf-logo/template.hbs

This file was deleted.

76 changes: 38 additions & 38 deletions lib/osf-components/addon/components/sign-up-form/template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -3,44 +3,44 @@
local-class='sign-up-form'
{{action 'submit' on='submit'}}
>
{{validated-input/text
(html-attributes data-test-sign-up-full-name=true)
model=this.userRegistration
valuePath='fullName'
shouldShowMessages=this.didValidate
disabled=this.hasSubmitted
placeholder=(t 'osf-components.sign-up-form.full_name')
ariaLabel=(t 'osf-components.sign-up-form.full_name')
}}
{{validated-input/text
(html-attributes data-test-sign-up-email-1=true)
model=this.userRegistration
valuePath='email1'
shouldShowMessages=this.didValidate
disabled=this.hasSubmitted
placeholder=(t 'osf-components.sign-up-form.contact_email')
ariaLabel=(t 'osf-components.sign-up-form.contact_email')
}}
{{validated-input/text
(html-attributes data-test-sign-up-email-2=true)
model=this.userRegistration
valuePath='email2'
shouldShowMessages=this.didValidate
disabled=this.hasSubmitted
placeholder=(t 'osf-components.sign-up-form.confirm_email')
ariaLabel=(t 'osf-components.sign-up-form.confirm_email')
}}
{{validated-input/text
(html-attributes data-test-sign-up-password=true)
password=true
model=this.userRegistration
valuePath='password'
shouldShowMessages=this.didValidate
disabled=this.hasSubmitted
onKeyUp=(perform this.strength this.userRegistration.password)
placeholder=(t 'osf-components.sign-up-form.password')
ariaLabel=(t 'osf-components.sign-up-form.password')
}}
<ValidatedInput::Text
data-test-sign-up-full-name=true
@model={{this.userRegistration}}
@valuePath='fullName'
@shouldShowMessages={{this.didValidate}}
disabled={{this.hasSubmitted}}
placeholder={{t 'osf-components.sign-up-form.full_name'}}
ariaLabel={{t 'osf-components.sign-up-form.full_name'}}
/>
<ValidatedInput::Text
data-test-sign-up-email-1=true
@model={{this.userRegistration}}
@valuePath='email1'
@shouldShowMessages={{this.didValidate}}
disabled={{this.hasSubmitted}}
placeholder={{t 'osf-components.sign-up-form.contact_email'}}
ariaLabel={{t 'osf-components.sign-up-form.contact_email'}}
/>
<ValidatedInput::Text
data-test-sign-up-email-2=true
@model={{this.userRegistration}}
@valuePath='email2'
@shouldShowMessages={{this.didValidate}}
disabled={{this.hasSubmitted}}
placeholder={{t 'osf-components.sign-up-form.confirm_email'}}
ariaLabel={{t 'osf-components.sign-up-form.confirm_email'}}
/>
<ValidatedInput::Text
data-test-sign-up-password=true
password={{true}}
@model={{this.userRegistration}}
@valuePath='password'
@shouldShowMessages={{this.didValidate}}
disabled={{this.hasSubmitted}}
@onKeyUp={{perform this.strength this.userRegistration.password}}
placeholder={{t 'osf-components.sign-up-form.password'}}
ariaLabel={{t 'osf-components.sign-up-form.password'}}
/>
<div local-class='progress' hidden={{not this.progress}}>
<div
local-class='progress-bar progress-bar-sm'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ export default abstract class BaseValidatedInput<M extends Model> extends Compon
@service intl!: Intl;

// defined in constructor
errors?: string[];
value: any;
isInvalid?: boolean;
isValidating?: boolean;
Expand Down Expand Up @@ -108,18 +107,26 @@ export default abstract class BaseValidatedInput<M extends Model> extends Compon
return this.changeset ? this.changeset.isValidating(this.valuePath as string) : this.isValidating;
}

get errors() {
if (this.changeset?.error?.[this.valuePath as string]) {
return this.changeset.error[this.valuePath as string].validation;
} else if (this.model?.validations?.attrs?.[this.valuePath as string].errors) {
return this.model.validations.attrs[this.valuePath as string].errors;
}
}

init() {
super.init();
if (this.changeset) {
defineProperty(this, 'validation', oneWay(`changeset.data.validations.attrs.${this.valuePath}`));
defineProperty(this, 'errors', oneWay(`changeset.error.${this.valuePath}.validation`));
defineProperty(this, 'value', alias(`changeset.${this.valuePath}`));
defineProperty(this, 'validation', oneWay(`changeset.data.validations.attrs.${this.valuePath as string}`));
defineProperty(this, 'value', alias(`changeset.${this.valuePath as string}`));
} else if (this.model) {
defineProperty(this, 'validation', oneWay(`model.validations.attrs.${this.valuePath}`));
defineProperty(this, 'errors', oneWay(`model.validations.attrs.${this.valuePath}.errors`));
defineProperty(this, 'value', alias(`model.${this.valuePath}`));
defineProperty(this, 'isValidating', oneWay(`model.validations.attrs.${this.valuePath}.isValidating`));
defineProperty(this, 'isInvalid', oneWay(`model.validations.attrs.${this.valuePath}.isInvalid`));
defineProperty(this, 'validation', oneWay(`model.validations.attrs.${this.valuePath as string}`));
defineProperty(this, 'errors', oneWay(`model.validations.attrs.${this.valuePath as string}.errors`));
defineProperty(this, 'value', alias(`model.${this.valuePath as string}`));
defineProperty(this, 'isValidating',
oneWay(`model.validations.attrs.${this.valuePath as string}.isValidating`));
defineProperty(this, 'isInvalid', oneWay(`model.validations.attrs.${this.valuePath as string}.isInvalid`));
}
}
}
1 change: 0 additions & 1 deletion lib/osf-components/app/components/osf-logo/component.js

This file was deleted.

1 change: 0 additions & 1 deletion lib/registries/addon/discover/template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@
setOrder=(action this.setOrder)
}}
{{#discover.results
(html-attributes data-test-results=true)
Copy link
Contributor

Choose a reason for hiding this comment

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

Do any of our selenium or JS tests rely on this data-test selector?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

JS tests not that I've noticed. Selenium maybe, but this page is going away very soon, so we can probably live without it for a couple of weeks.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually, we did have one JS test, but it was removed with another PR for the search project.

as |result|
}}
<RegistriesSearchResult
Expand Down
1 change: 0 additions & 1 deletion lib/registries/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
"ember-cli-babel": "*",
"ember-cli-htmlbars": "*",
"ember-cli-moment-shim": "*",
"ember-cli-sanitize-html": "*",
"ember-cli-sass": "*",
"ember-cli-showdown": "*",
"ember-cli-string-helpers": "*",
Expand Down
Loading
Loading