open-nomad/ui/app/components/copy-button.js
Buck Doyle 9322dfc46f
UI: Add copy button for client/allocation UUIDs (#5926)
The button shows a success icon and tooltip on click, and resets
after two seconds.
2019-07-15 12:14:32 -05:00

17 lines
350 B
JavaScript

import Component from '@ember/component';
import { task, timeout } from 'ember-concurrency';
export default Component.extend({
classNames: ['copy-button'],
clipboardText: null,
state: null,
indicateSuccess: task(function*() {
this.set('state', 'success');
yield timeout(2000);
this.set('state', null);
}).restartable(),
});