Skip to content

Commit

Permalink
Upgrade to 3.28 (#203)
Browse files Browse the repository at this point in the history
* Initial upgrade to 3.28

* Initial upgrade to 3.28

* Fix test command and run yarn install

* Codemods output - prior testing

* Update packages in yellow and green

* Update packages in yellow and green

* ember-cli-htmlbars-inline-precompile is no longer needed with ember-cli-htmlbars versions 4.0.0 and higher

* upgrade ember-bootstrap to 2.8.0

* WIP

* fix unknown rule for template lint

* fix depractation warnings with npx @ember/octanify

* Update ember-bootstrap to 5.x

* ember-cli-app-version

* Add webpack, ember-auto-import depends on it

* Revert changes to the eslintrc file

* Add a dependency helper explode assignable expressesion

* Remove jquery and update truth helper

* Remove flash package, seems to be unused

* remove an old package and write own implementation

* Remove depracated package

* Use new format for lint to

* Update string helper

* use this for property lookup in templates, fallback has been depracated

* upgrade sentry and sass

* upgrade ember-cli-sass

* upgrade uglifyer which was renamed to terser

* upgrade optional features

* upgrade dotenv

* Add this when accessing attributes
  • Loading branch information
kaysiz authored Jun 13, 2024
1 parent 255e3cc commit d1a4f7e
Show file tree
Hide file tree
Showing 27 changed files with 3,519 additions and 4,076 deletions.
9 changes: 9 additions & 0 deletions .ember-cli
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
/**
Ember CLI sends analytics information by default. The data is completely
anonymous, but there are times when you might want to disable this behavior.

Setting `disableAnalytics` to true will prevent any data from being sent.
*/
"disableAnalytics": false
}
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ module.exports = {
},
env: {
browser: false,
node: true
node: true,
}
}
]
Expand Down
21 changes: 21 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# unconventional js
/blueprints/*/files/
/vendor/

# compiled output
/dist/
/tmp/

# dependencies
/bower_components/
/node_modules/

# misc
/coverage/
!.*
.eslintcache

# ember-try
/.node_modules.ember-try/
/bower.json.ember-try
/package.json.ember-try
2 changes: 1 addition & 1 deletion .template-lintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module.exports = {
'no-triple-curlies': false,
'no-unused-block-params': false,
'simple-unless': false,
'no-console': false,
'no-log': false,
'no-bare-strings': false
}
};
4 changes: 2 additions & 2 deletions app/adapters/application.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import DS from 'ember-data';
import JSONAPIAdapter from '@ember-data/adapter/json-api';
import ENV from 'ror-app/config/environment';
import { inject as service } from '@ember/service';
import { computed } from '@ember/object';

export default DS.JSONAPIAdapter.extend({
export default JSONAPIAdapter.extend({
launchDarkly: service(),
host: computed('launchDarkly.variation', function() {
return this.launchDarkly.variation('v2_ui') ? ENV.API_URL_V2 : ENV.API_URL_V1;
Expand Down
4 changes: 2 additions & 2 deletions app/adapters/organization.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import DS from 'ember-data';
import JSONAPIAdapter from '@ember-data/adapter/json-api';
import ENV from 'ror-app/config/environment';
import { inject as service } from '@ember/service';
import { computed } from '@ember/object';

export default DS.JSONAPIAdapter.extend({
export default JSONAPIAdapter.extend({
launchDarkly: service(),
host: computed('launchDarkly.variation', function() {
return this.launchDarkly.variation('v2_ui') ? ENV.API_URL_V2 : ENV.API_URL_V1;
Expand Down
4 changes: 2 additions & 2 deletions app/components/application-header.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ export default Component.extend({

actions: {
search() {
this.get('globalSearch').doSearch(this.query);
this.globalSearch.doSearch(this.query);
},
clear() {
this.get('globalSearch').doSearch(null);
this.globalSearch.doSearch(null);
}
}
});
4 changes: 2 additions & 2 deletions app/components/filter-sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export default Component.extend({
this.filterValue = this.filterValue.slice(0, -1)
this.set('model.query.filter', this.filterValue)
//this.get('globalSearch').doSearch(this.query, this.allStatus)
this.get('router').transitionTo('organizations.index', { queryParams: { query: this.model.query.query, page: this.model.query.page, all_status: this.model.query.allStatus, filter: this.model.query.filter}});
this.router.transitionTo('organizations.index', { queryParams: { query: this.model.query.query, page: this.model.query.page, all_status: this.model.query.allStatus, filter: this.model.query.filter}});
},
clearFilter() {
this.filterValue = ''
Expand All @@ -32,7 +32,7 @@ export default Component.extend({
this.set('withdrawnStatus', false);
this.filterValue = "status:active"
this.set('model.query.filter', this.filterValue)
this.get('router').transitionTo('organizations.index', { queryParams: { query: this.model.query.query, page: this.model.query.page, all_status: this.model.query.allStatus, filter: this.model.query.filter}});
this.router.transitionTo('organizations.index', { queryParams: { query: this.model.query.query, page: this.model.query.page, all_status: this.model.query.allStatus, filter: this.model.query.filter}});
}
}

Expand Down
15 changes: 8 additions & 7 deletions app/components/page-numbers.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
import { alias } from '@ember/object/computed';
import Component from '@ember/component';
import { computed } from '@ember/object';

export default Component.extend({
tagName: 'row',

currentPage: computed.alias("model.query.page"),
totalPages: computed.alias("model.meta.totalPages"),
currentPage: alias("model.query.page"),
totalPages: alias("model.meta.totalPages"),

pageItems: computed("currentPage","totalPages", function() {
const page = Number(this.get("currentPage") || 1);
const totalPages = Number(this.get("totalPages"));
const page = Number(this.currentPage || 1);
const totalPages = Number(this.totalPages);

return Array.from(Array(totalPages).keys()).reduce(function (sum, i) {
if (i < 2 || (i > (page - 4) && i < (page + 2)) || i > (totalPages - 3)) {
Expand All @@ -24,8 +25,8 @@ export default Component.extend({
}),

nextPage: computed("currentPage", "totalPages", function() {
const page = Number(this.get("currentPage"));
const totalPages = Number(this.get("totalPages"));
const page = Number(this.currentPage);
const totalPages = Number(this.totalPages);
if (page < totalPages) {
return page + 1;
} else {
Expand All @@ -34,7 +35,7 @@ export default Component.extend({
}),

previousPage: computed("currentPage", function() {
const page = Number(this.get("currentPage"));
const page = Number(this.currentPage);
if (page > 1) {
return page - 1;
} else {
Expand Down
13 changes: 13 additions & 0 deletions app/helpers/decimal-format.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { helper } from '@ember/component/helper';

export function decimalFormat(params) {
const [number] = params;

if (isNaN(number) || number === '') {
return "";
}

return new Intl.NumberFormat().format(number);
}

export default helper(decimalFormat);
38 changes: 19 additions & 19 deletions app/models/organization.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
import DS from 'ember-data';
import Model, { attr } from '@ember-data/model';

export default DS.Model.extend({
meta: DS.attr(),
export default Model.extend({
meta: attr(),

name: DS.attr('string'), //TODO: Remove this when v1 has been retired
names: DS.attr(),
local: DS.attr('string'),
types: DS.attr(),
links: DS.attr(),
aliases: DS.attr(),
acronyms: DS.attr(),
external_ids: DS.attr(),
wikipediaUrl: DS.attr('string'),
labels: DS.attr(),
country: DS.attr(),
addresses: DS.attr(),
relationships: DS.attr(),
status: DS.attr('string'),
admin: DS.attr(),
locations: DS.attr()
name: attr('string'), //TODO: Remove this when v1 has been retired
names: attr(),
local: attr('string'),
types: attr(),
links: attr(),
aliases: attr(),
acronyms: attr(),
external_ids: attr(),
wikipediaUrl: attr('string'),
labels: attr(),
country: attr(),
addresses: attr(),
relationships: attr(),
status: attr('string'),
admin: attr(),
locations: attr()
});

4 changes: 2 additions & 2 deletions app/serializers/application.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import JSONSerializer from '@ember-data/serializer/json';
import { underscore } from '@ember/string';
import { assign } from '@ember/polyfills';
import DS from 'ember-data';

export default DS.JSONSerializer.extend({
export default JSONSerializer.extend({
normalizeArrayResponse(store, primaryModelClass, payload, id, requestType) {
let total = payload.number_of_results;
let totalPages = Math.min(Math.ceil(total / 20), 500);
Expand Down
5 changes: 2 additions & 3 deletions app/services/global-search.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import Service from '@ember/service';
import { inject as service } from '@ember/service';
import Service, { inject as service } from '@ember/service';
// import { assign } from '@ember/polyfills';

export default Service.extend({
Expand All @@ -16,6 +15,6 @@ export default Service.extend({
//let params = assign(this.model.get('query'), { query: this.query, sort: this.sort });

// this.router.transitionTo({ queryParams: params });
this.get('router').transitionTo('organizations.index', { queryParams: { query: query, page: 1}});
this.router.transitionTo('organizations.index', { queryParams: { query: query, page: 1}});
}
});
6 changes: 3 additions & 3 deletions app/templates/application.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
{{outlet}}
</div>

{{application-subscribe}}
{{application-socials}}
{{application-footer}}
<ApplicationSubscribe />
<ApplicationSocials />
<ApplicationFooter />
48 changes: 23 additions & 25 deletions app/templates/components/application-header.hbs
Original file line number Diff line number Diff line change
@@ -1,68 +1,66 @@
{{#bs-navbar backgroundColor="white" class="navbar-expand-lg"
onCollapse=(action (mut collapsed) true) onExpand=(action (mut collapsed) false) as |navbar|}}
<BsNavbar @backgroundColor="white" @class="navbar-expand-lg" @onCollapse={{action (mut this.collapsed) true}} @onExpand={{action (mut this.collapsed) false}} as |navbar|>
<div class="container-fluid">
<a class="navbar-brand d-block" href="/">
<img class="pl-0 pr-0" src="/assets/ror-logo.svg" alt="Research Organization Registry logo">
</a>
<div id="search">
<form {{action "search" query on="submit"}} class="form-inline mw-25" role="search">
{{input name="query" value=query id="query" class="form-control" placeholder='Search Registry...' escape-press=(action
'clear') enter=(action 'search')}}
<form {{action "search" this.query on="submit"}} class="form-inline mw-25" role="search">
<Input name="query" value={{this.query}} id="query" class="form-control" placeholder="Search Registry..." escape-press={{action "clear"}} enter={{action "search"}} />
</form>
</div>

{{navbar.toggle}}

{{#navbar.content}}
{{#navbar.nav class="ml-auto" as |nav|}}
<navbar.content>
<navbar.nav @class="ml-auto" as |nav|>

{{#nav.item}}
<nav.item>
<a class="nav-link" href="/about/">
<p>About</p>
</a>
{{/nav.item}}
</nav.item>

{{#nav.item}}
<nav.item>
<a class="nav-link" href="/registry/">
<p>Registry</p>
</a>
{{/nav.item}}
</nav.item>

{{#nav.item}}
<nav.item>
<a class="nav-link" href="/community/">
<p>Community</p>
</a>
{{/nav.item}}
</nav.item>

{{#nav.item}}
<nav.item>
<a class="nav-link" href="/blog/">
<p>Blog</p>
</a>
{{/nav.item}}
</nav.item>

{{#nav.item}}
<nav.item>
<a class="nav-link external" href="https://ror.readme.io">
<p>Documentation <i class="fa-solid fa-external-link"></i></p>
</a>
{{/nav.item}}
</nav.item>

{{/navbar.nav}}
{{/navbar.content}}
</navbar.nav>
</navbar.content>
</div>
{{/bs-navbar}}
{{#if showAdvanced}}
</BsNavbar>
{{#if this.showAdvanced}}
<div class="row">
<div class="col-md-12">
<div class="callout small">
<h2>Show records with status:</h2>
<form {{action "applyFilter" query on="submit"}} class="form-inline mw-25" role="search">
{{input type="checkbox" id="active-status" name="activeStatus"}}
<Input type="checkbox" id="active-status" name="activeStatus" />
<label for="active-status">Active</label>
{{input type="checkbox" id="inactive-status" name="inactiveStatus"}}
<Input type="checkbox" id="inactive-status" name="inactiveStatus" />
<label for="inactive-status">Inactive</label>
{{input type="checkbox" id="withdrawn-status" name="withdrawnStatus"}}
<Input type="checkbox" id="withdrawn-status" name="withdrawnStatus" />
<label for="withdrawn-status">Withdrawn</label>
{{input type="checkbox" id="all-status" name="allStatus" change=(action 'applyFilter')}}
<Input type="checkbox" id="all-status" name="allStatus" change={{action "applyFilter"}} />
<label for="all-status">All statuses</label>
</form>
</div>
Expand Down
6 changes: 3 additions & 3 deletions app/templates/components/filter-sidebar.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
<h3>Record status <i class="fa-solid fa-question-circle" aria-hidden="true"><BsPopover @triggerEvents="hover" class="popover">Each ROR record has a status of active, inactive or withdrawn. <b>Inactive</b> indicates that an organization has split, merged or otherwise ceased to operate. <b>Withdrawn</b> indicates that an organization was added to ROR in error.</BsPopover></i></h3>
<hr>
<div class="filters-list">
{{input class="filters-list-input" type="checkbox" id="active-status" name="activeStatus" checked=activeStatus}}
<Input class="filters-list-input" type="checkbox" id="active-status" name="activeStatus" checked={{this.activeStatus}} />
<label class="filters-list-label" for="active-status">Active</label>
</div>
<div class="filters-list">
{{input class="filters-list-input" type="checkbox" id="inactive-status" name="inactiveStatus" checked=inactiveStatus}}
<Input class="filters-list-input" type="checkbox" id="inactive-status" name="inactiveStatus" checked={{this.inactiveStatus}} />
<label class="filters-list-label" for="inactive-status">Inactive</label>
</div>
<div class="filters-list">
{{input class="filters-list-input" type="checkbox" id="withdrawn-status" name="withdrawnStatus" checked=withdrawnStatus}}
<Input class="filters-list-input" type="checkbox" id="withdrawn-status" name="withdrawnStatus" checked={{this.withdrawnStatus}} />
<label class="filters-list-label" for="withdrawn-status">Withdrawn</label>
</div>
</div>
Expand Down
Loading

0 comments on commit d1a4f7e

Please sign in to comment.