Merge branch 'feature-host-selections' of https://github.com/hashicorp/boundary-ui into feature-host-selections

This commit is contained in:
Randall Morey committed 2020-08-21 17:28:15 -04:00
commit 9d2dbf8268
84 files changed
+1312 -37

No files matched your search

@@ -39,4 +39,9 @@ export default class GeneratedAuthMethodModel extends BaseModel {
})
disabled;
@attr('number', {
description: 'Current version number of this resource.',
})
version;
}
@@ -33,4 +33,10 @@ export default class GeneratedGroupModel extends BaseModel {
description: 'Whether the resource is disabled',
})
disabled;
@attr('number', {
description: 'Current version number of this resource.',
})
version;
}
@@ -38,4 +38,9 @@ export default class GeneratedHostCatalogModel extends BaseModel {
description: 'Attributes specific to the catalog type'
}) attributes;
@attr('number', {
description: 'Current version number of this resource.',
})
version;
}
@@ -34,4 +34,9 @@ export default class GeneratedScopeModel extends BaseModel {
})
updated_time;
@attr('number', {
description: 'Current version number of this resource.',
})
version;
}
@@ -0,0 +1,41 @@
import BaseModel from '../../models/base';
import { attr } from '@ember-data/model';
/**
* Target
*/
export default class GeneratedTargetModel extends BaseModel {
// =attributes
@attr('string', {
description: 'The protocol used in the target'
}) protocol;
@attr('string', {
description: 'Optional name for identification purposes'
}) name;
@attr('string', {
description: 'Optional user-set description for identification purposes'
}) description;
@attr('date', {
description: 'The time this resource was created\nOutput only.',
readOnly: true
}) created_time;
@attr('date', {
description: 'The time this resource was last updated\nOutput only.',
readOnly: true
}) updated_time;
@attr('boolean', {
description: 'Whether the catalog is disabled'
}) disabled;
@attr('number', {
description: 'Current version number of this resource.',
})
version;
}
@@ -33,4 +33,9 @@ export default class GeneratedUserModel extends BaseModel {
description: 'Whether the resource is disabled',
})
disabled;
@attr('number', {
description: 'Current version number of this resource.',
})
version;
}
+3
View File
@@ -0,0 +1,3 @@
import GeneratedTargetModel from '../generated/models/target';
export default class TargetModel extends GeneratedTargetModel {}
@@ -40,6 +40,10 @@ export default class ApplicationSerializer extends RESTSerializer {
let value = super.serializeAttribute(...arguments);
// Do not serialize read-only attributes.
if (options.readOnly) delete json[key];
// Version is sent only if it has a non-nullish value
if (key === 'version') {
if (json[key] === null || json[key] === undefined) delete json[key];
}
// Do not serialize `disabled` fields.
// TODO: disabled is temporarily disabled
if (key === 'disabled') delete json[key];
+1
View File
@@ -0,0 +1 @@
export { default } from 'api/models/target';
@@ -0,0 +1,13 @@
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
module('Unit | Model | target', function(hooks) {
setupTest(hooks);
// Replace this with your real tests.
test('it exists', function(assert) {
let store = this.owner.lookup('service:store');
let model = store.createRecord('target', {});
assert.ok(model);
});
});
@@ -29,6 +29,28 @@ module('Unit | Serializer | application', function (hooks) {
});
});
test('it serializes non-nullish version fields', function (assert) {
assert.expect(2);
const store = this.owner.lookup('service:store');
const record = store.createRecord('user', {
name: 'User',
description: 'Description',
version: null
});
let serializedRecord = record.serialize();
assert.deepEqual(serializedRecord, {
name: 'User',
description: 'Description'
});
record.version = 1;
serializedRecord = record.serialize();
assert.deepEqual(serializedRecord, {
name: 'User',
description: 'Description',
version: 1
});
});
test('it normalizes array records from an `items` root key', function (assert) {
assert.expect(1);
const store = this.owner.lookup('service:store');