Merge pull request #173 from hashicorp/add-target-type

Add type of 'tcp' to target resource
This commit is contained in:
Randall Morey authored and GitHub committed 2020-09-11 11:30:30 -04:00
commit 494a331d5c
8 files changed
+21 -12

No files matched your search

+2 -2
View File
@@ -9,8 +9,8 @@ export default class GeneratedTargetModel extends BaseModel {
// =attributes
@attr('string', {
description: 'The protocol used in the target'
}) protocol;
description: 'The type of the resource, to help differentiate schemas'
}) type;
@attr('string', {
description: 'Optional name for identification purposes'
@@ -19,7 +19,8 @@ module('Unit | Serializer | target', function(hooks) {
scope_id: 'org_1',
type: 'org'
},
version: 1
version: 1,
type: 'tcp'
});
const snapshot = record._createSnapshot();
snapshot.adapterOptions = {};
@@ -28,7 +29,7 @@ module('Unit | Serializer | target', function(hooks) {
name: 'User',
description: 'Description',
version: 1,
protocol: null,
type: 'tcp',
scope_id: 'org_1'
});
@@ -6,6 +6,12 @@
as |form|
>
<form.input
@value={{t (concat 'target.types.' @model.type)}}
@label={{t "form.label.type"}}
readonly={{true}}
@disabled={{true}} />
<form.input
@name="name"
@type="name"
@@ -10,7 +10,10 @@ export default class ScopesScopeProjectsProjectTargetsNewRoute extends Route {
*/
model() {
const scopeModel = this.modelFor('scopes.scope.projects.project');
return this.store.createRecord('target', { scopeModel });
return this.store.createRecord('target', {
type: 'tcp',
scopeModel
});
}
}
@@ -11,8 +11,7 @@ export default class ScopesScopeProjectsProjectTargetsTargetRoute extends Route
* @return {TargetModel}
*/
async model({ target_id }) {
const { id: scopeID } = this.modelFor('scopes.scope.projects.project');
return this.store.findRecord('target', target_id, { adapterOptions: { scopeID } });
return this.store.findRecord('target', target_id, { reload: true });
}
/**
@@ -24,7 +24,7 @@
<table.header as |header|>
<header.row as |row|>
<row.headerCell>{{t "form.label.name"}}</row.headerCell>
<row.headerCell>{{t "form.label.protocol"}}</row.headerCell>
<row.headerCell>{{t "form.label.type"}}</row.headerCell>
<row.headerCell>{{t "form.label.id"}}</row.headerCell>
</header.row>
</table.header>
@@ -41,9 +41,9 @@
<p>{{target.description}}</p>
</row.headerCell>
<row.cell>
{{#if target.protocol}}
{{#if target.type}}
<Rose::Badge>
{{t (concat "target.protocols." target.protocol)}}
{{t (concat "target.types." target.type)}}
</Rose::Badge>
{{/if}}
</row.cell>
+1 -1
View File
@@ -6,7 +6,7 @@ import { random, date } from 'faker';
*/
export default Factory.extend({
protocol: 'tcp',
type: 'tcp',
name: () => random.words(),
description: () => random.words(),
created_time: () => date.recent(),
+1 -1
View File
@@ -42,7 +42,7 @@ host-set:
types:
static: Static
target:
protocols:
types:
tcp: TCP
host:
types: