open-nomad/ui/tests/pages/jobs/detail.js

132 lines
3.6 KiB
JavaScript
Raw Normal View History

2018-07-11 02:20:02 +00:00
import {
attribute,
create,
collection,
clickable,
hasClass,
2018-07-11 02:20:02 +00:00
isPresent,
property,
2018-07-11 02:20:02 +00:00
text,
2022-01-20 15:39:02 +00:00
visitable,
2018-07-11 02:20:02 +00:00
} from 'ember-cli-page-object';
2018-07-24 03:13:16 +00:00
import allocations from 'nomad-ui/tests/pages/components/allocations';
ui: fix an error when navigating to a task group (#12832) Clicking in a task group row in the job details page would throw the error: Uncaught Error: You didn't provide enough string/numeric parameters to satisfy all of the dynamic segments for route jobs.job.task-group. Missing params: name createParamHandlerInfo http://localhost:4646/ui/assets/vendor-194b1e0d68d11ef7a4bf334eb30ba74d.js:4814 applyToHandlers http://localhost:4646/ui/assets/vendor-194b1e0d68d11ef7a4bf334eb30ba74d.js:4804 applyToState http://localhost:4646/ui/assets/vendor-194b1e0d68d11ef7a4bf334eb30ba74d.js:4801 getTransitionByIntent http://localhost:4646/ui/assets/vendor-194b1e0d68d11ef7a4bf334eb30ba74d.js:4843 transitionByIntent http://localhost:4646/ui/assets/vendor-194b1e0d68d11ef7a4bf334eb30ba74d.js:4836 refresh http://localhost:4646/ui/assets/vendor-194b1e0d68d11ef7a4bf334eb30ba74d.js:4885 refresh http://localhost:4646/ui/assets/vendor-194b1e0d68d11ef7a4bf334eb30ba74d.js:2254 queryParamsDidChange http://localhost:4646/ui/assets/vendor-194b1e0d68d11ef7a4bf334eb30ba74d.js:2326 k http://localhost:4646/ui/assets/vendor-194b1e0d68d11ef7a4bf334eb30ba74d.js:2423 triggerEvent http://localhost:4646/ui/assets/vendor-194b1e0d68d11ef7a4bf334eb30ba74d.js:2349 fireQueryParamDidChange http://localhost:4646/ui/assets/vendor-194b1e0d68d11ef7a4bf334eb30ba74d.js:4863 getTransitionByIntent http://localhost:4646/ui/assets/vendor-194b1e0d68d11ef7a4bf334eb30ba74d.js:4848 transitionByIntent http://localhost:4646/ui/assets/vendor-194b1e0d68d11ef7a4bf334eb30ba74d.js:4836 doTransition http://localhost:4646/ui/assets/vendor-194b1e0d68d11ef7a4bf334eb30ba74d.js:4853 transitionTo http://localhost:4646/ui/assets/vendor-194b1e0d68d11ef7a4bf334eb30ba74d.js:4882 _doTransition http://localhost:4646/ui/assets/vendor-194b1e0d68d11ef7a4bf334eb30ba74d.js:2392 transitionTo http://localhost:4646/ui/assets/vendor-194b1e0d68d11ef7a4bf334eb30ba74d.js:2177 gotoTaskGroup http://localhost:4646/ui/assets/nomad-ui-4a2c1941e03e60e1feef715f23cf268c.js:623 ... This was caused because the attribute being passed to the transitionTo function was not the task group name, but the whole model.
2022-05-02 15:01:19 +00:00
import taskGroups from 'nomad-ui/tests/pages/components/task-groups';
import twoStepButton from 'nomad-ui/tests/pages/components/two-step-button';
import recommendationAccordion from 'nomad-ui/tests/pages/components/recommendation-accordion';
import jobClientStatusBar from 'nomad-ui/tests/pages/components/job-client-status-bar';
2018-07-24 03:13:16 +00:00
2018-07-11 02:20:02 +00:00
export default create({
visit: visitable('/jobs/:id'),
jobName: text('[data-test-job-name]'),
2018-07-11 02:20:02 +00:00
tabs: collection('[data-test-tab]', {
id: attribute('data-test-tab'),
2022-01-20 15:39:02 +00:00
visit: clickable('a'),
2018-07-11 02:20:02 +00:00
}),
tabFor(id) {
return this.tabs.toArray().findBy('id', id);
},
2021-12-28 16:08:12 +00:00
recommendations: collection(
'[data-test-recommendation-accordion]',
recommendationAccordion
),
stop: twoStepButton('[data-test-stop]'),
start: twoStepButton('[data-test-start]'),
2021-10-12 20:36:10 +00:00
packTag: isPresent('[data-test-pack-tag]'),
metaTable: isPresent('[data-test-meta]'),
execButton: {
scope: '[data-test-exec-button]',
isDisabled: property('disabled'),
hasTooltip: hasClass('tooltip'),
2022-01-20 15:39:02 +00:00
tooltipText: attribute('aria-label'),
},
incrementButton: {
scope: '[data-test-scale-controls-increment]',
2022-01-20 15:39:02 +00:00
isDisabled: property('disabled'),
},
ui: add parameterized dispatch interface (#10675) * ui: add parameterized dispatch interface This commit adds a new interface for dispatching parameteried jobs, if the user has the right permissions. The UI can be accessed by viewing a parameterized job and clicking on the "Dispatch Job" button located in the "Job Launches" section. * fix failing lint test * clean up dispatch and remove meta This commit cleans up a few things that had typos and inconsistent naming. In line with this, the custom `meta` view was removed in favor of using the included `AttributesTable`. * ui: encode dispatch job payload and start adding tests * ui: remove unused test imports * ui: redesign job dispatch form * ui: initial acceptance tests for dispatch job * ui: generate parameterized job children with correct id format * ui: fix job dispatch breadcrumb link * ui: refactor job dispatch component into glimmer component and add form validation * ui: remove unused CSS class * ui: align job dispatch button * ui: handle namespace-specific requests on job dispatch * ui: rename payloadMissing to payloadHasError * ui: don't re-fetch job spec on dispatch job * ui: keep overview tab selected on job dispatch page * ui: fix task and task-group linting * ui: URL encode job id on dispatch job tests * ui: fix error when job meta is null * ui: handle job dispatch from adapter * ui: add more tests for dispatch job page * ui: add "job dispatch" capability check * ui: update job dispatch from code review Co-authored-by: Luiz Aoqui <luiz@hashicorp.com>
2021-07-20 22:27:41 +00:00
dispatchButton: {
scope: '[data-test-dispatch-button]',
2022-01-20 15:39:02 +00:00
isDisabled: property('disabled'),
ui: add parameterized dispatch interface (#10675) * ui: add parameterized dispatch interface This commit adds a new interface for dispatching parameteried jobs, if the user has the right permissions. The UI can be accessed by viewing a parameterized job and clicking on the "Dispatch Job" button located in the "Job Launches" section. * fix failing lint test * clean up dispatch and remove meta This commit cleans up a few things that had typos and inconsistent naming. In line with this, the custom `meta` view was removed in favor of using the included `AttributesTable`. * ui: encode dispatch job payload and start adding tests * ui: remove unused test imports * ui: redesign job dispatch form * ui: initial acceptance tests for dispatch job * ui: generate parameterized job children with correct id format * ui: fix job dispatch breadcrumb link * ui: refactor job dispatch component into glimmer component and add form validation * ui: remove unused CSS class * ui: align job dispatch button * ui: handle namespace-specific requests on job dispatch * ui: rename payloadMissing to payloadHasError * ui: don't re-fetch job spec on dispatch job * ui: keep overview tab selected on job dispatch page * ui: fix task and task-group linting * ui: URL encode job id on dispatch job tests * ui: fix error when job meta is null * ui: handle job dispatch from adapter * ui: add more tests for dispatch job page * ui: add "job dispatch" capability check * ui: update job dispatch from code review Co-authored-by: Luiz Aoqui <luiz@hashicorp.com>
2021-07-20 22:27:41 +00:00
},
2018-07-11 02:20:02 +00:00
stats: collection('[data-test-job-stat]', {
id: attribute('data-test-job-stat'),
2022-01-20 15:39:02 +00:00
text: text(),
2018-07-11 02:20:02 +00:00
}),
statFor(id) {
return this.stats.toArray().findBy('id', id);
},
2021-10-12 20:36:10 +00:00
packStats: collection('[data-test-pack-stat]', {
id: attribute('data-test-pack-stat'),
2022-01-20 15:39:02 +00:00
text: text(),
2021-10-12 20:36:10 +00:00
}),
packStatFor(id) {
return this.packStats.toArray().findBy('id', id);
},
jobClientStatusSummary: {
scope: '[data-test-job-client-summary]',
statusBar: jobClientStatusBar('[data-test-job-client-status-bar]'),
toggle: {
scope: '[data-test-accordion-head] [data-test-accordion-toggle]',
click: clickable(),
isDisabled: attribute('disabled'),
2022-01-20 15:39:02 +00:00
tooltip: attribute('aria-label'),
},
},
2021-12-28 16:08:12 +00:00
childrenSummary: jobClientStatusBar(
'[data-test-job-summary] [data-test-children-status-bar]'
),
allocationsSummary: jobClientStatusBar(
'[data-test-job-summary] [data-test-allocation-status-bar]'
),
ui: fix an error when navigating to a task group (#12832) Clicking in a task group row in the job details page would throw the error: Uncaught Error: You didn't provide enough string/numeric parameters to satisfy all of the dynamic segments for route jobs.job.task-group. Missing params: name createParamHandlerInfo http://localhost:4646/ui/assets/vendor-194b1e0d68d11ef7a4bf334eb30ba74d.js:4814 applyToHandlers http://localhost:4646/ui/assets/vendor-194b1e0d68d11ef7a4bf334eb30ba74d.js:4804 applyToState http://localhost:4646/ui/assets/vendor-194b1e0d68d11ef7a4bf334eb30ba74d.js:4801 getTransitionByIntent http://localhost:4646/ui/assets/vendor-194b1e0d68d11ef7a4bf334eb30ba74d.js:4843 transitionByIntent http://localhost:4646/ui/assets/vendor-194b1e0d68d11ef7a4bf334eb30ba74d.js:4836 refresh http://localhost:4646/ui/assets/vendor-194b1e0d68d11ef7a4bf334eb30ba74d.js:4885 refresh http://localhost:4646/ui/assets/vendor-194b1e0d68d11ef7a4bf334eb30ba74d.js:2254 queryParamsDidChange http://localhost:4646/ui/assets/vendor-194b1e0d68d11ef7a4bf334eb30ba74d.js:2326 k http://localhost:4646/ui/assets/vendor-194b1e0d68d11ef7a4bf334eb30ba74d.js:2423 triggerEvent http://localhost:4646/ui/assets/vendor-194b1e0d68d11ef7a4bf334eb30ba74d.js:2349 fireQueryParamDidChange http://localhost:4646/ui/assets/vendor-194b1e0d68d11ef7a4bf334eb30ba74d.js:4863 getTransitionByIntent http://localhost:4646/ui/assets/vendor-194b1e0d68d11ef7a4bf334eb30ba74d.js:4848 transitionByIntent http://localhost:4646/ui/assets/vendor-194b1e0d68d11ef7a4bf334eb30ba74d.js:4836 doTransition http://localhost:4646/ui/assets/vendor-194b1e0d68d11ef7a4bf334eb30ba74d.js:4853 transitionTo http://localhost:4646/ui/assets/vendor-194b1e0d68d11ef7a4bf334eb30ba74d.js:4882 _doTransition http://localhost:4646/ui/assets/vendor-194b1e0d68d11ef7a4bf334eb30ba74d.js:2392 transitionTo http://localhost:4646/ui/assets/vendor-194b1e0d68d11ef7a4bf334eb30ba74d.js:2177 gotoTaskGroup http://localhost:4646/ui/assets/nomad-ui-4a2c1941e03e60e1feef715f23cf268c.js:623 ... This was caused because the attribute being passed to the transitionTo function was not the task group name, but the whole model.
2022-05-02 15:01:19 +00:00
...taskGroups(),
2018-07-24 03:13:16 +00:00
...allocations(),
viewAllAllocations: text('[data-test-view-all-allocations]'),
jobsHeader: {
scope: '[data-test-jobs-header]',
hasSubmitTime: isPresent('[data-test-jobs-submit-time-header]'),
2022-01-20 15:39:02 +00:00
hasNamespace: isPresent('[data-test-jobs-namespace-header]'),
},
jobs: collection('[data-test-job-row]', {
id: attribute('data-test-job-row'),
name: text('[data-test-job-name]'),
namespace: text('[data-test-job-namespace]'),
link: attribute('href', '[data-test-job-name] a'),
submitTime: text('[data-test-job-submit-time]'),
status: text('[data-test-job-status]'),
type: text('[data-test-job-type]'),
priority: text('[data-test-job-priority]'),
taskGroups: text('[data-test-job-task-groups]'),
clickRow: clickable(),
2022-01-20 15:39:02 +00:00
clickName: clickable('[data-test-job-name] a'),
}),
2018-07-11 02:20:02 +00:00
error: {
isPresent: isPresent('[data-test-error]'),
title: text('[data-test-error-title]'),
message: text('[data-test-error-message]'),
2022-01-20 15:39:02 +00:00
seekHelp: clickable('[data-test-error-message] a'),
2018-07-11 02:20:02 +00:00
},
2018-07-24 03:13:16 +00:00
recentAllocationsEmptyState: {
2022-01-20 15:39:02 +00:00
headline: text('[data-test-empty-recent-allocations-headline]'),
},
2018-07-11 02:20:02 +00:00
});