ui/app/components/input-random-port/component.js

39 lines
701 B
JavaScript

import { set } from '@ember/object';
import Component from '@ember/component';
import layout from './template';
import { next } from '@ember/runloop';
import $ from 'jquery';
export default Component.extend({
layout,
showEdit: false,
min: '1',
max: '65535',
value: null,
standardKey: 'generic.random',
placeholder: null,
init() {
this._super(...arguments);
if (this.value) {
set(this, 'showEdit', true);
}
},
actions: {
showEdit() {
set(this, 'showEdit', true);
next(() => {
if (this.isDestroyed || this.isDestroying) {
return;
}
$('INPUT').last()[0].focus();
});
}
}
});