ui: Fixup intention notifications and add SyncTime (#7702)

* ui: Specifically check for error rather than anything but success

* ui: Add SyncTime to intentions for reconciliation
This commit is contained in:
John Cowen 2020-04-24 14:37:35 +01:00 committed by John Cowen
parent bc74c7bbdf
commit 056a5d3090
3 changed files with 9 additions and 2 deletions

View File

@ -20,6 +20,7 @@ export default Model.extend({
DefaultPort: attr('number'),
//
Meta: attr(),
SyncTime: attr('number'),
Datacenter: attr('string'),
CreatedAt: attr('date'),
UpdatedAt: attr('date'),

View File

@ -9,13 +9,13 @@
{{else if (eq type 'update') }}
{{#if (eq status 'success') }}
Your intention has been saved.
{{else}}
{{else if (eq status 'error')}}
There was an error saving your intention.
{{/if}}
{{ else if (eq type 'delete')}}
{{#if (eq status 'success') }}
Your intention was deleted.
{{else}}
{{else if (eq status 'error')}}
There was an error deleting your intention.
{{/if}}
{{/if}}

View File

@ -1,14 +1,19 @@
import { moduleFor, test } from 'ember-qunit';
import repo from 'consul-ui/tests/helpers/repo';
import { get } from '@ember/object';
const NAME = 'intention';
moduleFor(`service:repository/${NAME}`, `Integration | Service | ${NAME}`, {
integration: true,
});
const now = new Date().getTime();
const dc = 'dc-1';
const id = 'token-name';
const nspace = 'default';
test('findAllByDatacenter returns the correct data for list endpoint', function(assert) {
get(this.subject(), 'store').serializerFor(NAME).timestamp = function() {
return now;
};
return repo(
'Intention',
'findAllByDatacenter',
@ -29,6 +34,7 @@ test('findAllByDatacenter returns the correct data for list endpoint', function(
Object.assign({}, item, {
CreatedAt: new Date(item.CreatedAt),
UpdatedAt: new Date(item.UpdatedAt),
SyncTime: now,
Datacenter: dc,
// TODO: nspace isn't required here, once we've
// refactored out our Serializer this can go