diff --git a/ui-v2/app/components/confirmation-dialog.js b/ui-v2/app/components/confirmation-dialog.js index d52b4cfaf47e..b53dcd68ed47 100644 --- a/ui-v2/app/components/confirmation-dialog.js +++ b/ui-v2/app/components/confirmation-dialog.js @@ -3,7 +3,6 @@ import Component from '@ember/component'; import SlotsMixin from 'block-slots'; import { set } from '@ember/object'; -import { inject as service } from '@ember/service'; const cancel = function() { set(this, 'confirming', false); @@ -15,25 +14,10 @@ const confirm = function() { const [action, ...args] = arguments; set(this, 'actionName', action); set(this, 'arguments', args); - if (this._isRegistered('dialog')) { - set(this, 'confirming', true); - } else { - this._confirm - .execute(this.message) - .then(confirmed => { - if (confirmed) { - this.execute(); - } - }) - .catch(function() { - return this.error.execute(...arguments); - }); - } + set(this, 'confirming', true); }; export default Component.extend(SlotsMixin, { classNameBindings: ['confirming'], - _confirm: service('confirm'), - error: service('error'), classNames: ['with-confirmation'], message: 'Are you sure?', confirming: false, diff --git a/ui-v2/app/models/intention.js b/ui-v2/app/models/intention.js index 8e5b01515d38..b0c4f033ea6a 100644 --- a/ui-v2/app/models/intention.js +++ b/ui-v2/app/models/intention.js @@ -24,6 +24,7 @@ const model = Model.extend({ CreateIndex: attr('number'), ModifyIndex: attr('number'), }); +// TODO: Remove this in favour of just specifying it in the Adapter export const ATTRS = writable(model, [ 'Action', 'SourceName', diff --git a/ui-v2/app/models/policy.js b/ui-v2/app/models/policy.js index d002d57cb869..9dfa92ed2889 100644 --- a/ui-v2/app/models/policy.js +++ b/ui-v2/app/models/policy.js @@ -29,5 +29,6 @@ const model = Model.extend({ defaultValue: '', }), }); +// TODO: Remove this in favour of just specifying it in the Adapter export const ATTRS = writable(model, ['Name', 'Description', 'Rules', 'Datacenters']); export default model; diff --git a/ui-v2/app/models/token.js b/ui-v2/app/models/token.js index 117b6dc79671..32625eab26bc 100644 --- a/ui-v2/app/models/token.js +++ b/ui-v2/app/models/token.js @@ -43,6 +43,7 @@ const model = Model.extend({ CreateIndex: attr('number'), ModifyIndex: attr('number'), }); +// TODO: Remove this in favour of just specifying it in the Adapter // Name and Rules is only for legacy tokens export const ATTRS = writable(model, [ 'Name', diff --git a/ui-v2/app/services/confirm.js b/ui-v2/app/services/confirm.js deleted file mode 100644 index a001a63ea022..000000000000 --- a/ui-v2/app/services/confirm.js +++ /dev/null @@ -1,8 +0,0 @@ -import Service from '@ember/service'; -import confirm from 'consul-ui/utils/confirm'; -// TODO: This can go? -export default Service.extend({ - execute: function(message) { - return confirm(message); - }, -}); diff --git a/ui-v2/app/services/error.js b/ui-v2/app/services/error.js deleted file mode 100644 index 87571178f873..000000000000 --- a/ui-v2/app/services/error.js +++ /dev/null @@ -1,8 +0,0 @@ -import Service from '@ember/service'; -// TODO: This can go? -import error from 'consul-ui/utils/error'; -export default Service.extend({ - execute: function(obj) { - return error(obj); - }, -}); diff --git a/ui-v2/app/utils/confirm.js b/ui-v2/app/utils/confirm.js deleted file mode 100644 index cb9bf7a9f190..000000000000 --- a/ui-v2/app/utils/confirm.js +++ /dev/null @@ -1,4 +0,0 @@ -import { Promise } from 'rsvp'; -export default function(message, confirmation = confirm) { - return Promise.resolve(confirmation(message)); -} diff --git a/ui-v2/app/utils/error.js b/ui-v2/app/utils/error.js deleted file mode 100644 index 76b62f93129c..000000000000 --- a/ui-v2/app/utils/error.js +++ /dev/null @@ -1,5 +0,0 @@ -/* eslint no-console: "off" */ -export default function(e) { - /* istanbul ignore next */ - console.error(e); -} diff --git a/ui-v2/app/utils/injectableRequestToJQueryAjaxHash.js b/ui-v2/app/utils/injectableRequestToJQueryAjaxHash.js deleted file mode 100644 index 86faeb749d31..000000000000 --- a/ui-v2/app/utils/injectableRequestToJQueryAjaxHash.js +++ /dev/null @@ -1,33 +0,0 @@ -// prettier-ignore -/* istanbul ignore file */ -export default function(JSON) { - // Has to be a property on an object so babel knocks the indentation in - return { - _requestToJQueryAjaxHash: function(request) { - let hash = {}; - - hash.type = request.method; - hash.url = request.url; - hash.dataType = 'json'; - hash.context = this; - - if (request.data) { - if (request.method !== 'GET') { - hash.contentType = 'application/json; charset=utf-8'; - hash.data = JSON.stringify(request.data); - } else { - hash.data = request.data; - } - } - - let headers = request.headers; - if (headers !== undefined) { - hash.beforeSend = function(xhr) { - Object.keys(headers).forEach((key) => xhr.setRequestHeader(key, headers[key])); - }; - } - - return hash; - } - }._requestToJQueryAjaxHash; -} diff --git a/ui-v2/app/utils/makeAttrable.js b/ui-v2/app/utils/makeAttrable.js deleted file mode 100644 index b6f6b85fd825..000000000000 --- a/ui-v2/app/utils/makeAttrable.js +++ /dev/null @@ -1,9 +0,0 @@ -// Used to make an pojo 'attr-able' -// i.e. you can call pojo.attr('key') on it -export default function(obj) { - return { - attr: function(prop) { - return obj[prop]; - }, - }; -} diff --git a/ui-v2/tests/unit/services/confirm-test.js b/ui-v2/tests/unit/services/confirm-test.js deleted file mode 100644 index c573fc2ed43d..000000000000 --- a/ui-v2/tests/unit/services/confirm-test.js +++ /dev/null @@ -1,12 +0,0 @@ -import { module, test } from 'qunit'; -import { setupTest } from 'ember-qunit'; - -module('Unit | Service | confirm', function(hooks) { - setupTest(hooks); - - // Replace this with your real tests. - test('it exists', function(assert) { - let service = this.owner.lookup('service:confirm'); - assert.ok(service); - }); -}); diff --git a/ui-v2/tests/unit/services/error-test.js b/ui-v2/tests/unit/services/error-test.js deleted file mode 100644 index 482375423589..000000000000 --- a/ui-v2/tests/unit/services/error-test.js +++ /dev/null @@ -1,12 +0,0 @@ -import { module, test } from 'qunit'; -import { setupTest } from 'ember-qunit'; - -module('Unit | Service | error', function(hooks) { - setupTest(hooks); - - // Replace this with your real tests. - test('it exists', function(assert) { - let service = this.owner.lookup('service:error'); - assert.ok(service); - }); -}); diff --git a/ui-v2/tests/unit/utils/confirm-test.js b/ui-v2/tests/unit/utils/confirm-test.js deleted file mode 100644 index 48cd0d455a3b..000000000000 --- a/ui-v2/tests/unit/utils/confirm-test.js +++ /dev/null @@ -1,17 +0,0 @@ -import { module } from 'qunit'; -import test from 'ember-sinon-qunit/test-support/test'; -import confirm from 'consul-ui/utils/confirm'; - -module('Unit | Utils | confirm', function() { - test('it resolves the result of the confirmation', function(assert) { - const expected = 'message'; - // split this off into separate testing - const confirmation = function(actual) { - assert.equal(actual, expected); - return true; - }; - return confirm(expected, confirmation).then(function(res) { - assert.ok(res); - }); - }); -}); diff --git a/ui-v2/tests/unit/utils/makeAttrable-test.js b/ui-v2/tests/unit/utils/makeAttrable-test.js deleted file mode 100644 index 2bd426fcd95a..000000000000 --- a/ui-v2/tests/unit/utils/makeAttrable-test.js +++ /dev/null @@ -1,14 +0,0 @@ -import { module } from 'qunit'; -import test from 'ember-sinon-qunit/test-support/test'; -import makeAttrable from 'consul-ui/utils/makeAttrable'; - -module('Unit | Utils | makeAttrable', function() { - test('it adds a `attr` method, which returns the value of the property', function(assert) { - const obj = { - prop: true, - }; - const actual = makeAttrable(obj); - assert.equal(typeof actual.attr, 'function'); - assert.ok(actual.attr('prop')); - }); -});