mirror of
https://github.com/hashicorp/vault.git
synced 2025-08-18 12:37:02 +02:00
* improve overview test * Add custom waiter to maybe-query-record * add custom waiter to console/ui-panel * Add flash message check for better visibility into flakiness * trying to find what's wrong with PKI * create role happy path uses root token * make all policy names on pki workflow unique * some secret test cleanup, not the main offenders * remove uncessary settled * Update kv-run-commands.js * Update kv-run-commands.js * Update kv-data-fields-test.js * some missed fixes that were outside the original cherry pick * remove overview test things * move testWaiter to logAndOutput command * nope not working --------- Co-authored-by: Chelsea Shaw <cshaw@hashicorp.com>
46 lines
1.4 KiB
JavaScript
46 lines
1.4 KiB
JavaScript
/**
|
|
* Copyright (c) HashiCorp, Inc.
|
|
* SPDX-License-Identifier: BUSL-1.1
|
|
*/
|
|
|
|
import { computed } from '@ember/object';
|
|
import ObjectProxy from '@ember/object/proxy';
|
|
import PromiseProxyMixin from '@ember/object/promise-proxy-mixin';
|
|
import { resolve } from 'rsvp';
|
|
import { buildWaiter } from '@ember/test-waiters';
|
|
/**
|
|
* after upgrading to Ember 4.12 a secrets test was erroring with "Cannot create a new tag for `<model::capabilities:undefined>` after it has been destroyed"
|
|
* see this GH issue for information on the fix https://github.com/emberjs/ember.js/issues/16541#issuecomment-382403523
|
|
*/
|
|
ObjectProxy.reopen({
|
|
unknownProperty(key) {
|
|
if (this.isDestroying || this.isDestroyed) {
|
|
return;
|
|
}
|
|
|
|
if (this.content && (this.content.isDestroying || this.content.isDestroyed)) {
|
|
return;
|
|
}
|
|
|
|
return this._super(key);
|
|
},
|
|
});
|
|
|
|
const waiter = buildWaiter('capabilities');
|
|
|
|
export function maybeQueryRecord(modelName, options = {}, ...keys) {
|
|
return computed(...keys, 'store', {
|
|
get() {
|
|
const waiterToken = waiter.beginAsync();
|
|
const query = typeof options === 'function' ? options(this) : options;
|
|
const PromiseObject = ObjectProxy.extend(PromiseProxyMixin);
|
|
|
|
return PromiseObject.create({
|
|
promise: query
|
|
? this.store.queryRecord(modelName, query).finally(() => waiter.endAsync(waiterToken))
|
|
: resolve({}).finally(() => waiter.endAsync(waiterToken)),
|
|
});
|
|
},
|
|
});
|
|
}
|