mirror of https://github.com/status-im/consul.git
ui: Amends to the data-sink service/component (#7740)
1. Fix conditional typo 2. Code style changes 3. Don't use URL for parsing, Safari only likes http like URLs
This commit is contained in:
parent
dd6506e994
commit
067ed448e3
|
@ -17,8 +17,7 @@ export default Service.extend({
|
|||
instance = repo.peek(slug);
|
||||
}
|
||||
}
|
||||
setProperties(instance, data);
|
||||
return instance;
|
||||
return setProperties(instance, data);
|
||||
},
|
||||
persist: function(sink, instance) {
|
||||
const [, , , /*dc*/ /*nspace*/ model] = sink.split('/');
|
||||
|
|
|
@ -3,12 +3,11 @@ import { setProperties } from '@ember/object';
|
|||
|
||||
export default Service.extend({
|
||||
settings: service('settings'),
|
||||
prepare: function(sink, data, instance) {
|
||||
if (data === null || data || '') {
|
||||
prepare: function(sink, data, instance = {}) {
|
||||
if (data === null || data === '') {
|
||||
return instance;
|
||||
}
|
||||
setProperties(instance, data);
|
||||
return instance;
|
||||
return setProperties(instance, data);
|
||||
},
|
||||
persist: function(sink, instance) {
|
||||
const slug = sink.split(':').pop();
|
||||
|
|
|
@ -1,16 +1,7 @@
|
|||
import Service, { inject as service } from '@ember/service';
|
||||
|
||||
const parts = function(uri) {
|
||||
if (uri.indexOf('://') === -1) {
|
||||
uri = `data://${uri}`;
|
||||
}
|
||||
const url = new URL(uri);
|
||||
let pathname = url.pathname;
|
||||
if (pathname.startsWith('//')) {
|
||||
pathname = pathname.substr(2);
|
||||
}
|
||||
const providerName = url.protocol.substr(0, url.protocol.length - 1);
|
||||
return [providerName, pathname];
|
||||
return uri.split('://');
|
||||
};
|
||||
export default Service.extend({
|
||||
data: service('data-sink/protocols/http'),
|
||||
|
|
Loading…
Reference in New Issue