diff --git a/ui-v2/app/components/action-group/index.hbs b/ui-v2/app/components/action-group/index.hbs deleted file mode 100644 index 138d878d18..0000000000 --- a/ui-v2/app/components/action-group/index.hbs +++ /dev/null @@ -1,14 +0,0 @@ -{{! action groups are block only components, you MUST specify a list of actions in the component body }} -{{! therefore if you call this component as an inline component, nothing is produced }} -{{#if hasBlock }} - - - -
- {{yield}} -
-{{/if}} diff --git a/ui-v2/app/components/action-group/index.js b/ui-v2/app/components/action-group/index.js deleted file mode 100644 index 19cee18393..0000000000 --- a/ui-v2/app/components/action-group/index.js +++ /dev/null @@ -1,6 +0,0 @@ -import Component from '@ember/component'; - -export default Component.extend({ - classNames: ['action-group'], - onchange: function() {}, -}); diff --git a/ui-v2/app/components/phrase-editor/index.hbs b/ui-v2/app/components/phrase-editor/index.hbs deleted file mode 100644 index b03553df24..0000000000 --- a/ui-v2/app/components/phrase-editor/index.hbs +++ /dev/null @@ -1,11 +0,0 @@ - - \ No newline at end of file diff --git a/ui-v2/app/components/phrase-editor/index.js b/ui-v2/app/components/phrase-editor/index.js deleted file mode 100644 index bea454784a..0000000000 --- a/ui-v2/app/components/phrase-editor/index.js +++ /dev/null @@ -1,62 +0,0 @@ -import Component from '@ember/component'; -import { set } from '@ember/object'; -import { inject as service } from '@ember/service'; - -export default Component.extend({ - dom: service('dom'), - classNames: ['phrase-editor'], - item: '', - onchange: function(e) {}, - search: function(e) { - // TODO: Temporarily continue supporting `searchable` - let searchable = this.searchable; - if (searchable) { - if (!Array.isArray(searchable)) { - searchable = [searchable]; - } - searchable.forEach(item => { - item.search(this.value); - }); - } - this.onchange(e); - }, - oninput: function(e) {}, - onkeydown: function(e) {}, - actions: { - keydown: function(e) { - switch (e.keyCode) { - case 8: // backspace - if (e.target.value == '' && this.value.length > 0) { - this.actions.remove.bind(this)(this.value.length - 1); - } - break; - case 27: // escape - set(this, 'value', []); - this.search({ target: this }); - break; - } - this.onkeydown({ target: this }); - }, - input: function(e) { - set(this, 'item', e.target.value); - this.oninput({ target: this }); - }, - remove: function(index, e) { - this.value.removeAt(index, 1); - this.search({ target: this }); - this.input.focus(); - }, - add: function(e) { - const item = this.item.trim(); - if (item !== '') { - set(this, 'item', ''); - const currentItems = this.value || []; - const items = new Set(currentItems).add(item); - if (items.size > currentItems.length) { - set(this, 'value', [...items]); - this.search({ target: this }); - } - } - }, - }, -}); diff --git a/ui-v2/app/routes/dc/acls.js b/ui-v2/app/routes/dc/acls.js index f7792dd950..46fdd7de0a 100644 --- a/ui-v2/app/routes/dc/acls.js +++ b/ui-v2/app/routes/dc/acls.js @@ -1,38 +1,3 @@ import Route from '@ember/routing/route'; -import { get } from '@ember/object'; -import { inject as service } from '@ember/service'; import WithBlockingActions from 'consul-ui/mixins/with-blocking-actions'; -export default Route.extend(WithBlockingActions, { - router: service('router'), - settings: service('settings'), - feedback: service('feedback'), - repo: service('repository/token'), - actions: { - authorize: function(secret, nspace) { - const dc = this.modelFor('dc').dc.Name; - return this.repo - .self(secret, dc) - .then(item => { - return this.settings.persist({ - token: { - Namespace: get(item, 'Namespace'), - AccessorID: get(item, 'AccessorID'), - SecretID: secret, - }, - }); - }) - .catch(e => { - this.feedback.execute( - () => { - return Promise.resolve(); - }, - 'authorize', - function(type, e) { - return 'error'; - }, - {} - ); - }); - }, - }, -}); +export default Route.extend(WithBlockingActions, {}); diff --git a/ui-v2/app/utils/model/writable.js b/ui-v2/app/utils/model/writable.js deleted file mode 100644 index 664401078f..0000000000 --- a/ui-v2/app/utils/model/writable.js +++ /dev/null @@ -1,11 +0,0 @@ -export default function(model, props, attr = {}) { - model.eachAttribute(function(item) { - attr[item] = { - ...attr[item], - ...{ - serialize: props.indexOf(item) !== -1, - }, - }; - }); - return attr; -} diff --git a/ui-v2/tests/integration/components/action-group-test.js b/ui-v2/tests/integration/components/action-group-test.js deleted file mode 100644 index b831aec21c..0000000000 --- a/ui-v2/tests/integration/components/action-group-test.js +++ /dev/null @@ -1,39 +0,0 @@ -import { module, test } from 'qunit'; -import { setupRenderingTest } from 'ember-qunit'; -import { render, find } from '@ember/test-helpers'; -import hbs from 'htmlbars-inline-precompile'; - -module('Integration | Component | action group', function(hooks) { - setupRenderingTest(hooks); - - test("it doesn't render anything when used inline", async function(assert) { - await render(hbs`{{action-group}}`); - - assert.dom('*').hasText(''); - }); - test('it renders', async function(assert) { - // Set any properties with this.set('myProperty', 'value'); - // Handle any actions with this.on('myAction', function(val) { ... }); - - // this.render(hbs`{{action-group}}`); - - // assert.equal( - // this.$() - // .text() - // .trim(), - // '' - // ); - - // Template block usage: - await render(hbs` - {{#action-group}}{{/action-group}} - `); - - assert.notEqual( - find('*') - .textContent.trim() - .indexOf('Open'), - -1 - ); - }); -}); diff --git a/ui-v2/tests/integration/components/phrase-editor-test.js b/ui-v2/tests/integration/components/phrase-editor-test.js deleted file mode 100644 index cbc2720feb..0000000000 --- a/ui-v2/tests/integration/components/phrase-editor-test.js +++ /dev/null @@ -1,54 +0,0 @@ -import { module, test } from 'qunit'; -import { setupRenderingTest } from 'ember-qunit'; -import { render, find } from '@ember/test-helpers'; -import hbs from 'htmlbars-inline-precompile'; - -module('Integration | Component | phrase editor', function(hooks) { - setupRenderingTest(hooks); - - hooks.beforeEach(function() { - this.actions = {}; - this.send = (actionName, ...args) => this.actions[actionName].apply(this, args); - }); - - test('it renders a phrase', async function(assert) { - this.set('value', ['phrase']); - await render(hbs`{{phrase-editor value=value}}`); - assert.notEqual( - find('*') - .textContent.trim() - .indexOf('phrase'), - -1 - ); - }); - test('it calls onchange when a phrase is removed by clicking the phrase remove button and refocuses', async function(assert) { - assert.expect(3); - this.set('value', ['phrase']); - this.actions.change = function(e) { - assert.equal(e.target.value.length, 0); - }; - await render(hbs`{{phrase-editor value=value onchange=(action 'change')}}`); - assert.notEqual( - find('*') - .textContent.trim() - .indexOf('phrase'), - -1 - ); - const $input = this.$('input'); - const $button = this.$('button'); - $button.trigger('click'); - assert.equal(document.activeElement, $input.get(0)); - }); - test('it calls onchange when a phrase is added', async function(assert) { - assert.expect(1); - this.actions.change = function(e) { - assert.equal(e.target.value.length, 2); - }; - this.set('value', ['phrase']); - await render(hbs`{{phrase-editor value=value onchange=(action 'change')}}`); - const $input = this.$('input'); - $input.get(0).value = 'phrase 2'; - $input.trigger('input'); - $input.trigger('search'); - }); -}); diff --git a/ui-v2/tests/unit/utils/model/writable-test.js b/ui-v2/tests/unit/utils/model/writable-test.js deleted file mode 100644 index f17882d10f..0000000000 --- a/ui-v2/tests/unit/utils/model/writable-test.js +++ /dev/null @@ -1,43 +0,0 @@ -import writable from 'consul-ui/utils/model/writable'; -import { module, test } from 'qunit'; - -module('Unit | Utility | model/writable', function() { - test('it correctly marks attrs as serialize:true|false', function(assert) { - const yes = { - Props: true, - That: true, - Should: true, - Be: true, - Writable: true, - }; - const no = { - Others: true, - Read: true, - Only: true, - }; - const expectedYes = Object.keys(yes); - const expectedNo = Object.keys(no); - const model = { - eachAttribute: function(cb) { - expectedYes.concat(expectedNo).forEach(function(item) { - cb(item, {}); // we aren't testing the meta here, just use the same api - }); - }, - }; - let attrs = writable(model, Object.keys(yes)); - const actualYes = Object.keys(attrs).filter(item => attrs[item].serialize); - const actualNo = Object.keys(attrs).filter(item => !attrs[item].serialize); - assert.deepEqual(actualYes, expectedYes, 'writable props are marked as serializable'); - assert.deepEqual(actualNo, expectedNo, 'writable props are marked as not serializable'); - attrs = writable(model, Object.keys(yes), { - Props: { - another: 'property', - }, - }); - assert.equal( - attrs.Props.another, - 'property', - 'previous attrs objects can be passed without being overwritten' - ); - }); -});