open-nomad/ui/app/templates/clients/client/index.hbs

480 lines
18 KiB
Handlebars
Raw Normal View History

{{title "Client " (or this.model.name this.model.shortId)}}
<ClientSubnav @client={{this.model}} />
2020-06-13 03:59:33 +00:00
<section class="section">
{{#if this.eligibilityError}}
2020-06-13 03:59:33 +00:00
<div data-test-eligibility-error class="columns">
<div class="column">
<div class="notification is-danger">
<h3 data-test-title class="title is-4">Eligibility Error</h3>
<p data-test-message>{{this.eligibilityError}}</p>
2020-06-13 03:59:33 +00:00
</div>
</div>
<div class="column is-centered is-minimum">
<button data-test-dismiss class="button is-danger" onclick={{action (mut this.eligibilityError) ""}} type="button">Okay</button>
2020-06-13 03:59:33 +00:00
</div>
</div>
{{/if}}
{{#if this.stopDrainError}}
2020-06-13 03:59:33 +00:00
<div data-test-stop-drain-error class="columns">
<div class="column">
<div class="notification is-danger">
<h3 data-test-title class="title is-4">Stop Drain Error</h3>
<p data-test-message>{{this.stopDrainError}}</p>
2020-06-13 03:59:33 +00:00
</div>
</div>
<div class="column is-centered is-minimum">
<button data-test-dismiss class="button is-danger" onclick={{action (mut this.stopDrainError) ""}} type="button">Okay</button>
2020-06-13 03:59:33 +00:00
</div>
</div>
{{/if}}
{{#if this.drainError}}
2020-06-13 03:59:33 +00:00
<div data-test-drain-error class="columns">
<div class="column">
<div class="notification is-danger">
<h3 data-test-title class="title is-4">Drain Error</h3>
<p data-test-message>{{this.drainError}}</p>
2020-06-13 03:59:33 +00:00
</div>
</div>
<div class="column is-centered is-minimum">
<button data-test-dismiss class="button is-danger" onclick={{action (mut this.drainError) ""}} type="button">Okay</button>
2020-06-13 03:59:33 +00:00
</div>
</div>
{{/if}}
{{#if this.showDrainStoppedNotification}}
2020-06-13 03:59:33 +00:00
<div class="notification is-info">
<div data-test-drain-stopped-notification class="columns">
<div class="column">
<h3 data-test-title class="title is-4">Drain Stopped</h3>
<p data-test-message>The drain has been stopped and the node has been set to ineligible.</p>
</div>
<div class="column is-centered is-minimum">
<button data-test-dismiss class="button is-info" onclick={{action (mut this.showDrainStoppedNotification) false}} type="button">Okay</button>
2020-06-13 03:59:33 +00:00
</div>
</div>
</div>
{{/if}}
{{#if this.showDrainUpdateNotification}}
2020-06-13 03:59:33 +00:00
<div class="notification is-info">
<div data-test-drain-updated-notification class="columns">
<div class="column">
<h3 data-test-title class="title is-4">Drain Updated</h3>
<p data-test-message>The new drain specification has been applied.</p>
</div>
<div class="column is-centered is-minimum">
<button data-test-dismiss class="button is-info" onclick={{action (mut this.showDrainUpdateNotification) false}} type="button">Okay</button>
2020-06-13 03:59:33 +00:00
</div>
</div>
</div>
{{/if}}
{{#if this.showDrainNotification}}
2020-06-13 03:59:33 +00:00
<div class="notification is-info">
<div data-test-drain-complete-notification class="columns">
<div class="column">
<h3 data-test-title class="title is-4">Drain Complete</h3>
<p data-test-message>Allocations have been drained and the node has been set to ineligible.</p>
</div>
<div class="column is-centered is-minimum">
<button data-test-dimiss class="button is-info" onclick={{action (mut this.showDrainNotification) false}} type="button">Okay</button>
2020-06-13 03:59:33 +00:00
</div>
</div>
</div>
{{/if}}
<div class="toolbar">
<div class="toolbar-item is-top-aligned is-minimum">
<span class="title">
<span data-test-node-status="{{this.model.compositeStatus}}" class="node-status-light {{this.model.compositeStatus}}">
{{x-icon this.model.compositeStatusIcon}}
2020-06-13 03:59:33 +00:00
</span>
</span>
</div>
<div class="toolbar-item">
<h1 data-test-title class="title with-subheading">
{{or this.model.name this.model.shortId}}
2020-06-13 03:59:33 +00:00
</h1>
<p>
<label class="is-interactive">
<Toggle
2020-06-13 03:59:33 +00:00
data-test-eligibility-toggle
@isActive={{this.model.isEligible}}
@isDisabled={{or this.setEligibility.isRunning this.model.isDraining (cannot "write client")}}
@onToggle={{perform this.setEligibility (not this.model.isEligible)}}>
2020-06-13 03:59:33 +00:00
Eligible
</Toggle>
2020-06-13 03:59:33 +00:00
<span class="tooltip" aria-label="Only eligible clients can receive allocations">
{{x-icon "info-circle-outline" class="is-faded"}}
</span>
</label>
<span data-test-node-id class="tag is-hollow is-small no-text-transform">
{{this.model.id}}
<CopyButton @clipboardText={{this.model.id}} />
2020-06-13 03:59:33 +00:00
</span>
</p>
</div>
<div class="toolbar-item is-right-aligned is-top-aligned">
{{#if this.model.isDraining}}
2020-06-13 03:59:33 +00:00
<TwoStepButton
data-test-drain-stop
@idleText="Stop Drain"
@cancelText="Cancel"
@confirmText="Yes, Stop"
@confirmationMessage="Are you sure you want to stop this drain?"
@awaitingConfirmation={{this.stopDrain.isRunning}}
@onConfirm={{perform this.stopDrain}} />
2020-06-13 03:59:33 +00:00
{{/if}}
</div>
<div class="toolbar-item is-right-aligned is-top-aligned">
<DrainPopover
@client={{this.model}}
2020-06-13 03:59:33 +00:00
@isDisabled={{cannot "write client"}}
@onDrain={{action "drainNotify"}}
@onError={{action "setDrainError"}} />
</div>
</div>
<div class="boxed-section is-small">
<div class="boxed-section-body inline-definitions">
<span class="label">Client Details</span>
<span class="pair" data-test-status-definition>
<span class="term">Status</span>
<span class="status-text node-{{this.model.status}}">{{this.model.status}}</span>
2020-06-13 03:59:33 +00:00
</span>
<span class="pair" data-test-address-definition>
<span class="term">Address</span>
{{this.model.httpAddr}}
2020-06-13 03:59:33 +00:00
</span>
<span class="pair" data-test-datacenter-definition>
<span class="term">Datacenter</span>
{{this.model.datacenter}}
2020-06-13 03:59:33 +00:00
</span>
<span class="pair" data-test-driver-health>
<span class="term">Drivers</span>
{{#if this.model.unhealthyDrivers.length}}
2020-06-13 03:59:33 +00:00
{{x-icon "warning" class="is-text is-warning"}}
{{this.model.unhealthyDrivers.length}} of {{this.model.detectedDrivers.length}} {{pluralize "driver" this.model.detectedDrivers.length}} unhealthy
2020-06-13 03:59:33 +00:00
{{else}}
All healthy
{{/if}}
</span>
</div>
</div>
{{#if this.model.drainStrategy}}
2020-06-13 03:59:33 +00:00
<div data-test-drain-details class="boxed-section is-info">
<div class="boxed-section-head">
<div class="boxed-section-row">Drain Strategy</div>
<div class="boxed-section-row">
<div class="inline-definitions is-small">
{{#unless this.model.drainStrategy.hasNoDeadline}}
2020-06-13 03:59:33 +00:00
<span class="pair">
<span class="term">Duration</span>
{{#if this.model.drainStrategy.isForced}}
2020-06-13 03:59:33 +00:00
<span data-test-duration>--</span>
{{else}}
<span data-test-duration class="tooltip" aria-label={{format-duration this.model.drainStrategy.deadline}}>
{{format-duration this.model.drainStrategy.deadline}}
2020-06-13 03:59:33 +00:00
</span>
{{/if}}
</span>
{{/unless}}
2020-06-13 03:59:33 +00:00
<span class="pair">
<span class="term">{{if this.model.drainStrategy.hasNoDeadline "Deadline" "Remaining"}}</span>
{{#if this.model.drainStrategy.hasNoDeadline}}
2020-06-13 03:59:33 +00:00
<span data-test-deadline>No deadline</span>
{{else if this.model.drainStrategy.isForced}}
2020-06-13 03:59:33 +00:00
<span data-test-deadline>--</span>
{{else}}
<span data-test-deadline class="tooltip" aria-label={{format-ts this.model.drainStrategy.forceDeadline}}>
{{moment-from-now this.model.drainStrategy.forceDeadline interval=1000 hideAffix=true}}
2020-06-13 03:59:33 +00:00
</span>
{{/if}}
</span>
<span data-test-force-drain-text class="pair">
<span class="term">Force Drain</span>
{{#if this.model.drainStrategy.isForced}}
2020-06-13 03:59:33 +00:00
{{x-icon "warning" class="is-text is-warning"}} Yes
{{else}}
No
{{/if}}
</span>
<span data-test-drain-system-jobs-text class="pair">
<span class="term">Drain System Jobs</span>
{{if this.model.drainStrategy.ignoreSystemJobs "No" "Yes"}}
2020-06-13 03:59:33 +00:00
</span>
</div>
{{#unless this.model.drainStrategy.isForced}}
2020-06-13 03:59:33 +00:00
<div class="pull-right">
<TwoStepButton
data-test-force
@alignRight={{true}}
@isInfoAction={{true}}
@idleText="Force Drain"
@cancelText="Cancel"
@confirmText="Yes, Force Drain"
@confirmationMessage="Are you sure you want to force drain?"
@awaitingConfirmation={{this.forceDrain.isRunning}}
@onConfirm={{perform this.forceDrain}} />
2020-06-13 03:59:33 +00:00
</div>
{{/unless}}
2020-06-13 03:59:33 +00:00
</div>
</div>
<div class="boxed-section-body">
<div class="columns">
<div class="column nowrap is-minimum">
<div class="metric-group">
<div class="metric is-primary">
<h3 class="label">Complete</h3>
<p data-test-complete-count class="value">{{this.model.completeAllocations.length}}</p>
2020-06-13 03:59:33 +00:00
</div>
</div>
<div class="metric-group">
<div class="metric">
<h3 class="label">Migrating</h3>
<p data-test-migrating-count class="value">{{this.model.migratingAllocations.length}}</p>
2020-06-13 03:59:33 +00:00
</div>
</div>
<div class="metric-group">
<div class="metric">
<h3 class="label">Remaining</h3>
<p data-test-remaining-count class="value">{{this.model.runningAllocations.length}}</p>
2020-06-13 03:59:33 +00:00
</div>
</div>
</div>
<div class="column">
<h3 class="title is-4">Status</h3>
{{#if this.model.lastMigrateTime}}
<p data-test-status>{{moment-to-now this.model.lastMigrateTime interval=1000 hideAffix=true}} since an allocation was successfully migrated.</p>
2020-06-13 03:59:33 +00:00
{{else}}
<p data-test-status>No allocations migrated.</p>
{{/if}}
</div>
</div>
</div>
</div>
{{/if}}
<div class="boxed-section">
<div class="boxed-section-head is-hollow">
Resource Utilization
</div>
<div class="boxed-section-body">
<div class="columns">
<div class="column">
<PrimaryMetric @resource={{this.model}} @metric="cpu" />
2020-06-13 03:59:33 +00:00
</div>
<div class="column">
<PrimaryMetric @resource={{this.model}} @metric="memory" />
2020-06-13 03:59:33 +00:00
</div>
</div>
</div>
</div>
<div class="boxed-section">
<div class="boxed-section-head">
<div>
Allocations
<button role="button" class="badge is-white" onclick={{action "setPreemptionFilter" false}} data-test-filter-all type="button">
{{this.model.allocations.length}}
2020-06-13 03:59:33 +00:00
</button>
{{#if this.preemptions.length}}
<button role="button" class="badge is-warning" onclick={{action "setPreemptionFilter" true}} data-test-filter-preemptions type="button">
{{this.preemptions.length}} {{pluralize "preemption" this.preemptions.length}}
2020-06-13 03:59:33 +00:00
</button>
{{/if}}
</div>
<SearchBox
@searchTerm={{mut this.searchTerm}}
@onChange={{action this.resetPagination}}
2020-06-13 03:59:33 +00:00
@placeholder="Search allocations..."
@class="is-inline pull-right"
@inputClass="is-compact" />
</div>
<div class="boxed-section-body is-full-bleed">
<ListPagination
@source={{this.sortedAllocations}}
@size={{this.pageSize}}
@page={{this.currentPage}} as |p|>
2020-06-13 03:59:33 +00:00
<ListTable
@source={{p.list}}
@sortProperty={{this.sortProperty}}
@sortDescending={{this.sortDescending}}
2020-06-13 03:59:33 +00:00
@class="with-foot" as |t|>
<t.head>
<th class="is-narrow"></th>
<t.sort-by @prop="shortId">ID</t.sort-by>
<t.sort-by @prop="modifyIndex" @title="Modify Index">Modified</t.sort-by>
<t.sort-by @prop="createIndex" @title="Create Index">Created</t.sort-by>
<t.sort-by @prop="statusIndex">Status</t.sort-by>
<t.sort-by @prop="job.name">Job</t.sort-by>
<t.sort-by @prop="jobVersion">Version</t.sort-by>
<th>Volume</th>
<th>CPU</th>
<th>Memory</th>
</t.head>
<t.body as |row|>
<AllocationRow
@allocation={{row.model}}
@context="node"
@onClick={{action "gotoAllocation" row.model}}
@data-test-allocation={{row.model.id}} />
</t.body>
</ListTable>
<div class="table-foot">
<nav class="pagination">
<div class="pagination-numbers">
{{p.startsAt}}&ndash;{{p.endsAt}} of {{this.sortedAllocations.length}}
2020-06-13 03:59:33 +00:00
</div>
<p.prev @class="pagination-previous"> &lt; </p.prev>
<p.next @class="pagination-next"> &gt; </p.next>
<ul class="pagination-list"></ul>
</nav>
</div>
</ListPagination>
</div>
</div>
<div data-test-client-events class="boxed-section">
<div class="boxed-section-head">
Client Events
</div>
<div class="boxed-section-body is-full-bleed">
<ListTable @source={{this.sortedEvents}} @class="is-striped" as |t|>
2020-06-13 03:59:33 +00:00
<t.head>
<th class="is-2">Time</th>
<th class="is-2">Subsystem</th>
<th>Message</th>
</t.head>
<t.body as |row|>
<tr data-test-client-event>
<td data-test-client-event-time>{{format-ts row.model.time}}</td>
<td data-test-client-event-subsystem>{{row.model.subsystem}}</td>
<td data-test-client-event-message>
{{#if row.model.message}}
{{#if row.model.driver}}
<span class="badge is-secondary is-small">{{row.model.driver}}</span>
{{/if}}
{{row.model.message}}
{{else}}
<em>No message</em>
{{/if}}
</td>
</tr>
</t.body>
</ListTable>
</div>
</div>
{{#if this.sortedHostVolumes.length}}
2020-06-13 03:59:33 +00:00
<div data-test-client-host-volumes class="boxed-section">
<div class="boxed-section-head">
Host Volumes
</div>
<div class="boxed-section-body is-full-bleed">
<ListTable @source={{this.sortedHostVolumes}} @class="is-striped" as |t|>
2020-06-13 03:59:33 +00:00
<t.head>
<th>Name</th>
<th>Source</th>
<th>Permissions</th>
</t.head>
<t.body as |row|>
<tr data-test-client-host-volume>
<td data-test-name>{{row.model.name}}</td>
<td data-test-path><code>{{row.model.path}}</code></td>
<td data-test-permissions>{{if row.model.readOnly "Read" "Read/Write"}}</td>
</tr>
</t.body>
</ListTable>
</div>
</div>
{{/if}}
<div data-test-driver-status class="boxed-section">
<div class="boxed-section-head">
Driver Status
</div>
<div class="boxed-section-body">
<ListAccordion @source={{this.sortedDrivers}} @key="name" as |a|>
2020-06-13 03:59:33 +00:00
<a.head @buttonLabel="details" @isExpandable={{a.item.detected}}>
<div class="columns inline-definitions {{unless a.item.detected "is-faded"}}">
<div class="column is-1">
<span data-test-name>{{a.item.name}}</span>
</div>
<div class="column is-2">
{{#if a.item.detected}}
<span data-test-health>
<span class="color-swatch {{a.item.healthClass}}"></span>
{{if a.item.healthy "Healthy" "Unhealthy"}}
</span>
{{/if}}
</div>
<div class="column">
<span class="pair">
<span class="term">Detected</span>
<span data-test-detected>{{if a.item.detected "Yes" "No"}}</span>
</span>
<span class="is-pulled-right">
<span class="pair">
<span class="term">Last Updated</span>
<span data-test-last-updated class="tooltip" aria-label="{{format-ts a.item.updateTime}}">
{{moment-from-now a.item.updateTime interval=1000}}
</span>
</span>
</span>
</div>
</div>
</a.head>
<a.body>
<p data-test-health-description class="message">{{a.item.healthDescription}}</p>
<div data-test-driver-attributes class="boxed-section">
<div class="boxed-section-head">
{{capitalize a.item.name}} Attributes
</div>
{{#if a.item.attributes.attributesStructured}}
<div class="boxed-section-body is-full-bleed">
<AttributesTable
@attributes={{a.item.attributesShort}}
@class="attributes-table" />
</div>
{{else}}
<div class="boxed-section-body">
<div class="empty-message">
<h3 class="empty-message-headline">No Driver Attributes</h3>
</div>
</div>
{{/if}}
</div>
</a.body>
</ListAccordion>
</div>
</div>
<div class="boxed-section">
<div class="boxed-section-head">
Attributes
</div>
<div class="boxed-section-body is-full-bleed">
<AttributesTable
data-test-attributes
@attributes={{this.model.attributes.attributesStructured}}
2020-06-13 03:59:33 +00:00
@class="attributes-table" />
</div>
<div class="boxed-section-head">
Meta
</div>
{{#if this.model.meta.attributesStructured}}
2020-06-13 03:59:33 +00:00
<div class="boxed-section-body is-full-bleed">
<AttributesTable
data-test-meta
@attributes={{this.model.meta.attributesStructured}}
2020-06-13 03:59:33 +00:00
@class="attributes-table" />
</div>
{{else}}
<div class="boxed-section-body">
<div data-test-empty-meta-message class="empty-message">
<h3 class="empty-message-headline">No Meta Attributes</h3>
<p class="empty-message-body">This client is configured with no meta attributes.</p>
</div>
</div>
{{/if}}
</div>
</section>