-
Notifications
You must be signed in to change notification settings - Fork 286
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
octane migration - deprecation-item-source (#1906)
* octane migration - deprecation-item-source * Update app/components/deprecation-item-source.js Co-authored-by: Ricardo Mendes <rokusu@gmail.com> * Update app/components/deprecation-item-source.js Co-authored-by: Ricardo Mendes <rokusu@gmail.com> * Update app/components/deprecation-item-source.js Co-authored-by: Ricardo Mendes <rokusu@gmail.com> * fix linting error * Update app/components/deprecation-item-source.hbs Co-authored-by: Robert Wagner <rwwagner90@gmail.com> Co-authored-by: Bing Dai <bdai@linkedin.com> Co-authored-by: Ricardo Mendes <rokusu@gmail.com> Co-authored-by: Robert Wagner <rwwagner90@gmail.com>
- Loading branch information
1 parent
31efd7c
commit d6f8610
Showing
3 changed files
with
58 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,28 @@ | ||
{{yield this}} | ||
<div class="deprecation-source pb-2" data-test-deprecation-source> | ||
<button | ||
class="send-to-console send-to-console--chevron-only mr-3" | ||
title="Trace deprecations in console" | ||
data-test-trace-deprecations-btn | ||
{{on "click" this.handleClick}} | ||
type="button" | ||
> | ||
{{svg-jar "send-with-chevron" width="6px" height="9px"}} | ||
Trace in the Console | ||
</button> | ||
<span class="source"> | ||
{{#if this.isClickable}} | ||
<a | ||
class="font-mono" | ||
href="#" | ||
data-test-deprecation-source-link | ||
{{on "click" this.handleRedirect}} | ||
> | ||
{{this.url}} | ||
</a> | ||
{{else}} | ||
<span class="font-mono" data-test-deprecation-source-text> | ||
{{this.url}} | ||
</span> | ||
{{/if}} | ||
</span> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,38 @@ | ||
import { tagName } from '@ember-decorators/component'; | ||
import { computed, get } from '@ember/object'; | ||
import { action } from '@ember/object'; | ||
import { inject as service } from '@ember/service'; | ||
import { and, readOnly, bool } from '@ember/object/computed'; | ||
import Component from '@ember/component'; | ||
|
||
@tagName('') | ||
import Component from '@glimmer/component'; | ||
export default class DeprecationItemSource extends Component { | ||
@service port; | ||
|
||
@bool('model.map.source') known; | ||
|
||
@computed('model.map.{line,source}', 'known') | ||
get url() { | ||
let source = get(this, 'model.map.source'); | ||
let source = this.args.itemModel?.map.source; | ||
if (this.known) { | ||
return `${source}:${get(this, 'model.map.line')}`; | ||
return `${source}:${this.args.itemModel?.map.line}`; | ||
} else { | ||
return 'Unkown source'; | ||
} | ||
} | ||
|
||
@readOnly('port.adapter') adapter; | ||
get adapter() { | ||
return this.port.adapter; | ||
} | ||
|
||
@and('known', 'adapter.canOpenResource') isClickable; | ||
get isClickable() { | ||
return this.known && this.adapter.canOpenResource; | ||
} | ||
|
||
get known() { | ||
return this.args.itemModel?.map.source; | ||
} | ||
|
||
@action | ||
handleClick() { | ||
this.args.traceSource?.(this.args.modelGroup, this.args.itemModel); | ||
} | ||
|
||
@action | ||
handleRedirect() { | ||
this.args.openResource?.(this.args.itemModel?.map); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters