2023-03-14 13:18:55 +00:00
|
|
|
/**
|
|
|
|
* Copyright (c) HashiCorp, Inc.
|
|
|
|
* SPDX-License-Identifier: MPL-2.0
|
|
|
|
*/
|
|
|
|
|
2022-09-15 08:43:17 +00:00
|
|
|
export default function (visitable, attribute, present, submitable, deletable, cancelable) {
|
2019-08-02 11:51:08 +00:00
|
|
|
return {
|
2022-09-15 08:43:17 +00:00
|
|
|
visit: visitable(['/:dc/kv/:kv/edit', '/:dc/kv/create'], function (str) {
|
2019-08-02 11:51:08 +00:00
|
|
|
// this will encode the parts of the key path but means you can no longer
|
|
|
|
// visit with path parts containing slashes
|
2022-09-15 08:43:17 +00:00
|
|
|
return str.split('/').map(encodeURIComponent).join('/');
|
2019-08-02 11:51:08 +00:00
|
|
|
}),
|
2020-05-11 15:37:11 +00:00
|
|
|
...submitable({}, 'main'),
|
2019-08-02 11:51:08 +00:00
|
|
|
...cancelable(),
|
|
|
|
...deletable(),
|
2022-01-04 16:08:06 +00:00
|
|
|
kv: {
|
2022-09-15 08:43:17 +00:00
|
|
|
Key: attribute('data-test-kv-key', '[data-test-kv-key]'),
|
2022-01-04 16:08:06 +00:00
|
|
|
},
|
2019-08-02 11:51:08 +00:00
|
|
|
session: {
|
2021-02-19 16:42:16 +00:00
|
|
|
warning: present('[data-test-session-warning]'),
|
2019-08-02 11:51:08 +00:00
|
|
|
ID: attribute('data-test-session', '[data-test-session]'),
|
|
|
|
...deletable({}, '[data-test-session]'),
|
|
|
|
},
|
|
|
|
};
|
2018-07-04 14:06:20 +00:00
|
|
|
}
|