mirror of https://github.com/status-im/consul.git
ui: Remove some javascript files we no longer use (#6853)
This commit is contained in:
parent
8017b5ab6e
commit
7f2a1e8a54
|
@ -3,7 +3,6 @@ import Component from '@ember/component';
|
||||||
|
|
||||||
import SlotsMixin from 'block-slots';
|
import SlotsMixin from 'block-slots';
|
||||||
import { set } from '@ember/object';
|
import { set } from '@ember/object';
|
||||||
import { inject as service } from '@ember/service';
|
|
||||||
|
|
||||||
const cancel = function() {
|
const cancel = function() {
|
||||||
set(this, 'confirming', false);
|
set(this, 'confirming', false);
|
||||||
|
@ -15,25 +14,10 @@ const confirm = function() {
|
||||||
const [action, ...args] = arguments;
|
const [action, ...args] = arguments;
|
||||||
set(this, 'actionName', action);
|
set(this, 'actionName', action);
|
||||||
set(this, 'arguments', args);
|
set(this, 'arguments', args);
|
||||||
if (this._isRegistered('dialog')) {
|
set(this, 'confirming', true);
|
||||||
set(this, 'confirming', true);
|
|
||||||
} else {
|
|
||||||
this._confirm
|
|
||||||
.execute(this.message)
|
|
||||||
.then(confirmed => {
|
|
||||||
if (confirmed) {
|
|
||||||
this.execute();
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.catch(function() {
|
|
||||||
return this.error.execute(...arguments);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
export default Component.extend(SlotsMixin, {
|
export default Component.extend(SlotsMixin, {
|
||||||
classNameBindings: ['confirming'],
|
classNameBindings: ['confirming'],
|
||||||
_confirm: service('confirm'),
|
|
||||||
error: service('error'),
|
|
||||||
classNames: ['with-confirmation'],
|
classNames: ['with-confirmation'],
|
||||||
message: 'Are you sure?',
|
message: 'Are you sure?',
|
||||||
confirming: false,
|
confirming: false,
|
||||||
|
|
|
@ -24,6 +24,7 @@ const model = Model.extend({
|
||||||
CreateIndex: attr('number'),
|
CreateIndex: attr('number'),
|
||||||
ModifyIndex: attr('number'),
|
ModifyIndex: attr('number'),
|
||||||
});
|
});
|
||||||
|
// TODO: Remove this in favour of just specifying it in the Adapter
|
||||||
export const ATTRS = writable(model, [
|
export const ATTRS = writable(model, [
|
||||||
'Action',
|
'Action',
|
||||||
'SourceName',
|
'SourceName',
|
||||||
|
|
|
@ -29,5 +29,6 @@ const model = Model.extend({
|
||||||
defaultValue: '',
|
defaultValue: '',
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
// TODO: Remove this in favour of just specifying it in the Adapter
|
||||||
export const ATTRS = writable(model, ['Name', 'Description', 'Rules', 'Datacenters']);
|
export const ATTRS = writable(model, ['Name', 'Description', 'Rules', 'Datacenters']);
|
||||||
export default model;
|
export default model;
|
||||||
|
|
|
@ -43,6 +43,7 @@ const model = Model.extend({
|
||||||
CreateIndex: attr('number'),
|
CreateIndex: attr('number'),
|
||||||
ModifyIndex: 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
|
// Name and Rules is only for legacy tokens
|
||||||
export const ATTRS = writable(model, [
|
export const ATTRS = writable(model, [
|
||||||
'Name',
|
'Name',
|
||||||
|
|
|
@ -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);
|
|
||||||
},
|
|
||||||
});
|
|
|
@ -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);
|
|
||||||
},
|
|
||||||
});
|
|
|
@ -1,4 +0,0 @@
|
||||||
import { Promise } from 'rsvp';
|
|
||||||
export default function(message, confirmation = confirm) {
|
|
||||||
return Promise.resolve(confirmation(message));
|
|
||||||
}
|
|
|
@ -1,5 +0,0 @@
|
||||||
/* eslint no-console: "off" */
|
|
||||||
export default function(e) {
|
|
||||||
/* istanbul ignore next */
|
|
||||||
console.error(e);
|
|
||||||
}
|
|
|
@ -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;
|
|
||||||
}
|
|
|
@ -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];
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -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);
|
|
||||||
});
|
|
||||||
});
|
|
|
@ -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);
|
|
||||||
});
|
|
||||||
});
|
|
|
@ -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);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
|
@ -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'));
|
|
||||||
});
|
|
||||||
});
|
|
Loading…
Reference in New Issue