Add different host types in Mirage. Add conditional in admin host-catalog hosts list to just show type=static
This commit is contained in:
1 parent
c8b49beba6
commit
aaa205b4e0
3 files changed
+65
-64
No files matched your search
@@ -5,7 +5,7 @@ import { random, date, internet, datatype } from 'faker';
|
||||
* GeneratedHostModelFactory
|
||||
*/
|
||||
export default Factory.extend({
|
||||
type: 'static',
|
||||
type: () => random.arrayElement(['static', 'plugin']),
|
||||
name: () => random.words(),
|
||||
description: () => random.words(),
|
||||
created_time: () => date.recent(),
|
||||
|
||||
@@ -11,38 +11,41 @@
|
||||
</table.header>
|
||||
<table.body as |body|>
|
||||
{{#each @model as |host|}}
|
||||
<body.row as |row|>
|
||||
<row.headerCell>
|
||||
{{#if (can 'read model' host)}}
|
||||
<LinkTo
|
||||
@route='scopes.scope.host-catalogs.host-catalog.hosts.host'
|
||||
@model={{host.id}}
|
||||
>
|
||||
{{#if host.isStatic}}
|
||||
<body.row as |row|>
|
||||
<row.headerCell>
|
||||
{{#if (can 'read model' host)}}
|
||||
<LinkTo
|
||||
@route='scopes.scope.host-catalogs.host-catalog.hosts.host'
|
||||
@model={{host.id}}
|
||||
>
|
||||
|
||||
{{host.displayName}}
|
||||
</LinkTo>
|
||||
{{else}}
|
||||
{{host.displayName}}
|
||||
</LinkTo>
|
||||
{{else}}
|
||||
{{host.displayName}}
|
||||
{{/if}}
|
||||
<p>{{host.description}}</p>
|
||||
</row.headerCell>
|
||||
<row.cell>
|
||||
<Rose::Badge>
|
||||
{{t (concat 'resources.host.types.' host.type)}}
|
||||
</Rose::Badge>
|
||||
</row.cell>
|
||||
<row.cell>
|
||||
<Copyable
|
||||
@text={{host.id}}
|
||||
@buttonText={{t 'actions.copy-to-clipboard'}}
|
||||
@acknowledgeText={{t 'states.copied'}}
|
||||
>
|
||||
<code>{{host.id}}</code>
|
||||
</Copyable>
|
||||
</row.cell>
|
||||
<row.cell>
|
||||
<code>{{host.attributes.address}}</code>
|
||||
</row.cell>
|
||||
</body.row>
|
||||
{{/if}}
|
||||
<p>{{host.description}}</p>
|
||||
</row.headerCell>
|
||||
<row.cell>
|
||||
<Rose::Badge>
|
||||
{{t (concat 'resources.host.types.' host.type)}}
|
||||
</Rose::Badge>
|
||||
</row.cell>
|
||||
<row.cell>
|
||||
<Copyable
|
||||
@text={{host.id}}
|
||||
@buttonText={{t 'actions.copy-to-clipboard'}}
|
||||
@acknowledgeText={{t 'states.copied'}}
|
||||
>
|
||||
<code>{{host.id}}</code>
|
||||
</Copyable>
|
||||
</row.cell>
|
||||
<row.cell>
|
||||
<code>{{host.attributes.address}}</code>
|
||||
</row.cell>
|
||||
</body.row>
|
||||
{{/if}}
|
||||
{{/each}}
|
||||
</table.body>
|
||||
</Rose::Table>
|
||||
|
||||
@@ -5,37 +5,35 @@
|
||||
<Rose::Table as |table|>
|
||||
<table.body as |body|>
|
||||
{{#each @model.hosts as |host|}}
|
||||
{{#if host.isStatic}}
|
||||
<body.row as |row|>
|
||||
<row.cell>
|
||||
{{host.displayName}}
|
||||
<p>{{host.description}}</p>
|
||||
</row.cell>
|
||||
<row.cell>
|
||||
<Copyable
|
||||
@text={{host.id}}
|
||||
@buttonText={{t 'actions.copy-to-clipboard'}}
|
||||
@acknowledgeText={{t 'states.copied'}}
|
||||
>
|
||||
<code>{{host.id}}</code>
|
||||
</Copyable>
|
||||
</row.cell>
|
||||
<row.cell>{{host.attributes.address}}</row.cell>
|
||||
<row.cell>
|
||||
<Rose::Badge>{{t
|
||||
(concat 'resources.host.types.' host.type)
|
||||
}}</Rose::Badge>
|
||||
</row.cell>
|
||||
<row.cell>
|
||||
<Rose::Button
|
||||
@style='secondary'
|
||||
{{on 'click' (route-action 'connect' @model.target host)}}
|
||||
>
|
||||
{{t 'resources.session.actions.connect'}}
|
||||
</Rose::Button>
|
||||
</row.cell>
|
||||
</body.row>
|
||||
{{/if}}
|
||||
<body.row as |row|>
|
||||
<row.cell>
|
||||
{{host.displayName}}
|
||||
<p>{{host.description}}</p>
|
||||
</row.cell>
|
||||
<row.cell>
|
||||
<Copyable
|
||||
@text={{host.id}}
|
||||
@buttonText={{t 'actions.copy-to-clipboard'}}
|
||||
@acknowledgeText={{t 'states.copied'}}
|
||||
>
|
||||
<code>{{host.id}}</code>
|
||||
</Copyable>
|
||||
</row.cell>
|
||||
<row.cell>{{host.attributes.address}}</row.cell>
|
||||
<row.cell>
|
||||
<Rose::Badge>{{t
|
||||
(concat 'resources.host.types.' host.type)
|
||||
}}</Rose::Badge>
|
||||
</row.cell>
|
||||
<row.cell>
|
||||
<Rose::Button
|
||||
@style='secondary'
|
||||
{{on 'click' (route-action 'connect' @model.target host)}}
|
||||
>
|
||||
{{t 'resources.session.actions.connect'}}
|
||||
</Rose::Button>
|
||||
</row.cell>
|
||||
</body.row>
|
||||
{{/each}}
|
||||
</table.body>
|
||||
</Rose::Table>
|
||||
@@ -53,4 +51,4 @@
|
||||
</Rose::Message>
|
||||
</Rose::Layout::Centered>
|
||||
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
Reference in new issue
Block a user