mirror of
https://github.com/status-im/consul.git
synced 2025-02-12 05:36:55 +00:00
This sounds a bit 'backwards' as the end goal here is to add an improved UX to partitions, not namespaces. The reason for doing it this way is that Namespaces already has a type of 'improved UX' CRUD in that it has one to many relationship in the form when saving your namespaces (the end goal for partitions). In moving Namespaces to use the same approach as partitions we: - Ensure the new approach works with one-to-many forms. - Test the new approach without writing a single test (we already have a bunch of tests for namespaces which are now testing the approach used by both namespaces and partitions) Additionally: - Fixes issue with missing default nspace in the nspace selector - In doing when checking to see that things where consistent between the two, I found a few little minor problems with the Admin Partition CRUD so fixed those up here also. - Removed the old style Nspace notifications
36 lines
1.3 KiB
JavaScript
36 lines
1.3 KiB
JavaScript
import Service, { inject as service } from '@ember/service';
|
|
import { setProperties } from '@ember/object';
|
|
|
|
export default class HttpService extends Service {
|
|
@service('settings') settings;
|
|
@service('repository/intention') intention;
|
|
@service('repository/kv') kv;
|
|
@service('repository/nspace') nspace;
|
|
@service('repository/partition') partition;
|
|
@service('repository/session') session;
|
|
|
|
prepare(sink, data, instance) {
|
|
return setProperties(instance, data);
|
|
}
|
|
|
|
// TODO: Currently we don't use the other properties here So dc, nspace and
|
|
// partition, but confusingly they currently are in a different order to all
|
|
// our @dataSource uris @dataSource uses /:partition/:nspace/:dc/thing whilst
|
|
// here DataSink uses /:parition/:dc/:nspace/thing We should change DataSink
|
|
// to also use a @dataSink decorator and make sure the order of the parameters
|
|
// is the same throughout the app As it stands right now, if we do need to use
|
|
// those parameters for DataSink it will be very easy to introduce a bug due
|
|
// to this inconsistency
|
|
persist(sink, instance) {
|
|
const [, , , , model] = sink.split('/');
|
|
const repo = this[model];
|
|
return repo.persist(instance);
|
|
}
|
|
|
|
remove(sink, instance) {
|
|
const [, , , , model] = sink.split('/');
|
|
const repo = this[model];
|
|
return repo.remove(instance);
|
|
}
|
|
}
|