open-vault/ui/app/adapters/cluster.js

216 lines
5.9 KiB
JavaScript
Raw Normal View History

Ember-cli upgrade from ~3.8 to ~3.20 (#9972) * Update ember-cli to ~3.20 * Remove bad optional-feature * Remove ember-fetch dep * re-install ember-fetch * update model fragments pr * update ember model fragments correct package name * update ember composable helpers to solve array helper error * update ember-concurrency * add back engine dependencies, automatically removed during ember-cli-upgrade * make author-form-options component js file otherwise error * for now comment out withTestWaiter * add eslint-node and fix if not with unless in templates * fix linting for tab index of false is now -1 and add type button to all buttons without types * fix href errors for linting, likely have to come back and fix * using eslint fix flag to fix all this.gets * ember modules codemode removed files that had module twice, will fix in next commit * finish codemode ember-data-codemod needed to rename const model * more this.get removal codemode did not work * cont. removal of this.get * stop mixin rules until figure out how to reconfig them all * smaller eslint ignores * get codemode * testing app small fixes to bring it back after all the changes * small changes to eslint * test removal of getProperties * fix issue with baseKey because value could be unknown needed to add a question mark in nested get * smaller linting fixes * get nested fixes * small linting error fixes * small linting changes * working through more small linting changes * another round of linting modifications * liniting fixes * ember module codemod * quinit dom codemod * angle bracket codemod * discovered that components must have js files * ran all codemods this is all that's left * small changes to fix get needs two object, should not have been using get. * fix issue with one input in form field * fun times with set and onChange from oninput * fix issue with model not being passed through on secret-edit-display * fix issue with yarn run test not working, revert without npm run all * linting and small fix when loading without a selectAuthBackend * fix failing test with ui-wizard issue * fix test failure due to model not being asked for correctly with new changes, probably run into this more. * fix issue with component helper and at props specific to wizard * rename log to clilog due to conflict with new eslint rule * small changes for test failures * component helper at fixes * Revert to old component style something with new one broke this and can't figure it out for now * small fishy smelling test fixes will revisit * small test changes * more small test changes, appears upgrade treats spaces differently * comment out code and test that no longer seems relevant but confirm * clean run on component test though still some potential timing issues on ui-console test * fixing one auth test issue and timing issue on enable-test * small mods * fix this conditional check from upgrade * linting fixes after master merge * package updates using yarn upgrade-interactive * update libraries that did not effect any of the test failures. * update ember truth helpers library * settling tests * Fix ui-panel control group output * fix features selection test failures * Fix auth tests (x-vault-token) * fix shared test * fix issue with data null on backend * Revert "Fix auth tests (x-vault-token)" This reverts commit 89cb174b2f1998efa56d9604d14131415ae65d6f. * Fix auth tests (x-vault-token) without updating this.set * Update redirect-to tests * fix wrapped token test * skip some flaky test * fix issue with href and a tags vs buttons * fix linting * updates to get tests running (#10409) * yarn isntall * increasing resource_class * whoops * trying large * back to xlarge * Fix param issue on transform item routes * test fixes * settle on policies (old) test * fix browserstack test warning and skips of test confirmed worked * Fix redirect-to test * skips * fix transformation test and skip some kmip * Skip tests * Add meep marker to remaining failing tests * Skip test with failing component * rever skip on secret-create test * Skip piece of test that fails due to navigation-input * fix settings test where can and skip in others after confirming * fix circle ci test failures * ssh role settle * Fix navigate-input and add settled to test * Remove extra import * secret cubbyhole and alicloud * Add settled to gcpkms test * settles on redirect to test * Bump browserstack test resource to large * Update browserstack resource size to xlarge * update todos * add back in withTestWaiter * try and fix credentials conditional action added comment instead * Update volatile computed properies to get functions * this step was never reached and we never defined secretType anywhere so I removed * add settled to policy old test * Fix navigate-input on policies and leases * replace ssh test with no var hoping that helps and add settled to other failing tests, unskip console tests * kmip, transit, role test remove a skip and add in settled * fix hover copy button, had to remove some testing functionality * Remove private router service * remove skip on control ssh and ui panel, fix search select by restructuring how to read the error * final bit of working through skipped test * Replace clearNonGlobalModels by linking directly to namespace with href-to * Remove unused var * Fix role-ssh id bug by updating form-field-from-model to form-field-group-loop * Fix transit create id would not update * Update option toggle selector for ssh-role * Fix ssh selector * cleanup pt1 * small clean up * cleanup part2 * Fix computed on pricing-metrics-form * small cleanup based on chelseas comments. Co-authored-by: Chelsea Shaw <chelshaw.dev@gmail.com> Co-authored-by: Sarah Thompson <sthompson@hashicorp.com>
2020-12-03 23:00:22 +00:00
import AdapterError from '@ember-data/adapter/error';
import { inject as service } from '@ember/service';
import { assign } from '@ember/polyfills';
import { hash, resolve } from 'rsvp';
import { assert } from '@ember/debug';
import { pluralize } from 'ember-inflector';
2018-04-03 14:16:57 +00:00
import ApplicationAdapter from './application';
const ENDPOINTS = [
'health',
'seal-status',
'tokens',
'token',
'seal',
'unseal',
'init',
'capabilities-self',
'license',
];
2018-04-03 14:16:57 +00:00
const REPLICATION_ENDPOINTS = {
reindex: 'reindex',
recover: 'recover',
status: 'status',
primary: ['enable', 'disable', 'demote', 'secondary-token', 'revoke-secondary'],
secondary: ['enable', 'disable', 'promote', 'update-primary'],
};
const REPLICATION_MODES = ['dr', 'performance'];
export default ApplicationAdapter.extend({
version: service(),
namespaceService: service('namespace'),
2018-04-03 14:16:57 +00:00
shouldBackgroundReloadRecord() {
return true;
},
2018-04-03 14:16:57 +00:00
findRecord(store, type, id, snapshot) {
let fetches = {
health: this.health(),
Ember Upgrade to 3.24 (#13443) * Update browserslist * Add browserslistrc * ember-cli-update --to 3.26, fix conflicts * Run codemodes that start with ember-* * More codemods - before cp* * More codemods (curly data-test-*) * WIP ember-basic-dropdown template errors * updates ember-basic-dropdown and related deps to fix build issues * updates basic dropdown instances to new version API * updates more deps -- ember-template-lint is working again * runs no-implicit-this codemod * creates and runs no-quoteless-attributes codemod * runs angle brackets codemod * updates lint:hbs globs to only touch hbs files * removes yield only templates * creates and runs deprecated args transform * supresses lint error for invokeAction on LinkTo component * resolves remaining ambiguous path lint errors * resolves simple-unless lint errors * adds warnings for deprecated tagName arg on LinkTo components * adds warnings for remaining curly component invocation * updates global template lint rules * resolves remaining template lint errors * disables some ember specfic lint rules that target pre octane patterns * js lint fix run * resolves remaining js lint errors * fixes test run * adds npm-run-all dep * fixes test attribute issues * fixes console acceptance tests * fixes tests * adds yield only wizard/tutorial-active template * fixes more tests * attempts to fix more flaky tests * removes commented out settled in transit test * updates deprecations workflow and adds initializer to filter by version * updates flaky policies acl old test * updates to flaky transit test * bumps ember deps down to LTS version * runs linters after main merge * fixes client count tests after bad merge conflict fixes * fixes client count history test * more updates to lint config * another round of hbs lint fixes after extending stylistic rule * updates lint-staged commands * removes indent eslint rule since it seems to break things * fixes bad attribute in transform-edit-form template * test fixes * fixes enterprise tests * adds changelog * removes deprecated ember-concurrency-test-waiters dep and adds @ember/test-waiters * flaky test fix Co-authored-by: hashishaw <cshaw@hashicorp.com>
2021-12-17 03:44:29 +00:00
sealStatus: this.sealStatus().catch((e) => e),
2018-04-03 14:16:57 +00:00
};
Ember-cli upgrade from ~3.8 to ~3.20 (#9972) * Update ember-cli to ~3.20 * Remove bad optional-feature * Remove ember-fetch dep * re-install ember-fetch * update model fragments pr * update ember model fragments correct package name * update ember composable helpers to solve array helper error * update ember-concurrency * add back engine dependencies, automatically removed during ember-cli-upgrade * make author-form-options component js file otherwise error * for now comment out withTestWaiter * add eslint-node and fix if not with unless in templates * fix linting for tab index of false is now -1 and add type button to all buttons without types * fix href errors for linting, likely have to come back and fix * using eslint fix flag to fix all this.gets * ember modules codemode removed files that had module twice, will fix in next commit * finish codemode ember-data-codemod needed to rename const model * more this.get removal codemode did not work * cont. removal of this.get * stop mixin rules until figure out how to reconfig them all * smaller eslint ignores * get codemode * testing app small fixes to bring it back after all the changes * small changes to eslint * test removal of getProperties * fix issue with baseKey because value could be unknown needed to add a question mark in nested get * smaller linting fixes * get nested fixes * small linting error fixes * small linting changes * working through more small linting changes * another round of linting modifications * liniting fixes * ember module codemod * quinit dom codemod * angle bracket codemod * discovered that components must have js files * ran all codemods this is all that's left * small changes to fix get needs two object, should not have been using get. * fix issue with one input in form field * fun times with set and onChange from oninput * fix issue with model not being passed through on secret-edit-display * fix issue with yarn run test not working, revert without npm run all * linting and small fix when loading without a selectAuthBackend * fix failing test with ui-wizard issue * fix test failure due to model not being asked for correctly with new changes, probably run into this more. * fix issue with component helper and at props specific to wizard * rename log to clilog due to conflict with new eslint rule * small changes for test failures * component helper at fixes * Revert to old component style something with new one broke this and can't figure it out for now * small fishy smelling test fixes will revisit * small test changes * more small test changes, appears upgrade treats spaces differently * comment out code and test that no longer seems relevant but confirm * clean run on component test though still some potential timing issues on ui-console test * fixing one auth test issue and timing issue on enable-test * small mods * fix this conditional check from upgrade * linting fixes after master merge * package updates using yarn upgrade-interactive * update libraries that did not effect any of the test failures. * update ember truth helpers library * settling tests * Fix ui-panel control group output * fix features selection test failures * Fix auth tests (x-vault-token) * fix shared test * fix issue with data null on backend * Revert "Fix auth tests (x-vault-token)" This reverts commit 89cb174b2f1998efa56d9604d14131415ae65d6f. * Fix auth tests (x-vault-token) without updating this.set * Update redirect-to tests * fix wrapped token test * skip some flaky test * fix issue with href and a tags vs buttons * fix linting * updates to get tests running (#10409) * yarn isntall * increasing resource_class * whoops * trying large * back to xlarge * Fix param issue on transform item routes * test fixes * settle on policies (old) test * fix browserstack test warning and skips of test confirmed worked * Fix redirect-to test * skips * fix transformation test and skip some kmip * Skip tests * Add meep marker to remaining failing tests * Skip test with failing component * rever skip on secret-create test * Skip piece of test that fails due to navigation-input * fix settings test where can and skip in others after confirming * fix circle ci test failures * ssh role settle * Fix navigate-input and add settled to test * Remove extra import * secret cubbyhole and alicloud * Add settled to gcpkms test * settles on redirect to test * Bump browserstack test resource to large * Update browserstack resource size to xlarge * update todos * add back in withTestWaiter * try and fix credentials conditional action added comment instead * Update volatile computed properies to get functions * this step was never reached and we never defined secretType anywhere so I removed * add settled to policy old test * Fix navigate-input on policies and leases * replace ssh test with no var hoping that helps and add settled to other failing tests, unskip console tests * kmip, transit, role test remove a skip and add in settled * fix hover copy button, had to remove some testing functionality * Remove private router service * remove skip on control ssh and ui panel, fix search select by restructuring how to read the error * final bit of working through skipped test * Replace clearNonGlobalModels by linking directly to namespace with href-to * Remove unused var * Fix role-ssh id bug by updating form-field-from-model to form-field-group-loop * Fix transit create id would not update * Update option toggle selector for ssh-role * Fix ssh selector * cleanup pt1 * small clean up * cleanup part2 * Fix computed on pricing-metrics-form * small cleanup based on chelseas comments. Co-authored-by: Chelsea Shaw <chelshaw.dev@gmail.com> Co-authored-by: Sarah Thompson <sthompson@hashicorp.com>
2020-12-03 23:00:22 +00:00
if (this.version.isEnterprise && this.namespaceService.inRootNamespace) {
Ember Upgrade to 3.24 (#13443) * Update browserslist * Add browserslistrc * ember-cli-update --to 3.26, fix conflicts * Run codemodes that start with ember-* * More codemods - before cp* * More codemods (curly data-test-*) * WIP ember-basic-dropdown template errors * updates ember-basic-dropdown and related deps to fix build issues * updates basic dropdown instances to new version API * updates more deps -- ember-template-lint is working again * runs no-implicit-this codemod * creates and runs no-quoteless-attributes codemod * runs angle brackets codemod * updates lint:hbs globs to only touch hbs files * removes yield only templates * creates and runs deprecated args transform * supresses lint error for invokeAction on LinkTo component * resolves remaining ambiguous path lint errors * resolves simple-unless lint errors * adds warnings for deprecated tagName arg on LinkTo components * adds warnings for remaining curly component invocation * updates global template lint rules * resolves remaining template lint errors * disables some ember specfic lint rules that target pre octane patterns * js lint fix run * resolves remaining js lint errors * fixes test run * adds npm-run-all dep * fixes test attribute issues * fixes console acceptance tests * fixes tests * adds yield only wizard/tutorial-active template * fixes more tests * attempts to fix more flaky tests * removes commented out settled in transit test * updates deprecations workflow and adds initializer to filter by version * updates flaky policies acl old test * updates to flaky transit test * bumps ember deps down to LTS version * runs linters after main merge * fixes client count tests after bad merge conflict fixes * fixes client count history test * more updates to lint config * another round of hbs lint fixes after extending stylistic rule * updates lint-staged commands * removes indent eslint rule since it seems to break things * fixes bad attribute in transform-edit-form template * test fixes * fixes enterprise tests * adds changelog * removes deprecated ember-concurrency-test-waiters dep and adds @ember/test-waiters * flaky test fix Co-authored-by: hashishaw <cshaw@hashicorp.com>
2021-12-17 03:44:29 +00:00
fetches.replicationStatus = this.replicationStatus().catch((e) => e);
2018-04-03 14:16:57 +00:00
}
return hash(fetches).then(({ health, sealStatus, replicationStatus }) => {
2018-04-03 14:16:57 +00:00
let ret = {
id,
name: snapshot.attr('name'),
};
ret = assign(ret, health);
2018-04-03 14:16:57 +00:00
if (sealStatus instanceof AdapterError === false) {
ret = assign(ret, { nodes: [sealStatus] });
2018-04-03 14:16:57 +00:00
}
if (replicationStatus && replicationStatus instanceof AdapterError === false) {
ret = assign(ret, replicationStatus.data);
2018-04-03 14:16:57 +00:00
}
return resolve(ret);
2018-04-03 14:16:57 +00:00
});
},
pathForType(type) {
return type === 'cluster' ? 'clusters' : pluralize(type);
2018-04-03 14:16:57 +00:00
},
health() {
return this.ajax(this.urlFor('health'), 'GET', {
data: {
standbycode: 200,
sealedcode: 200,
uninitcode: 200,
drsecondarycode: 200,
performancestandbycode: 200,
},
2018-04-03 14:16:57 +00:00
unauthenticated: true,
});
},
features() {
return this.ajax(`${this.urlFor('license')}/features`, 'GET', {
2018-04-03 14:16:57 +00:00
unauthenticated: true,
});
},
sealStatus() {
return this.ajax(this.urlFor('seal-status'), 'GET', { unauthenticated: true });
},
seal() {
return this.ajax(this.urlFor('seal'), 'PUT');
},
unseal(data) {
return this.ajax(this.urlFor('unseal'), 'PUT', {
data,
unauthenticated: true,
});
},
initCluster(data) {
return this.ajax(this.urlFor('init'), 'PUT', {
data,
unauthenticated: true,
});
},
authenticate({ backend, data }) {
UI - jwt auth (#6188) * fix default rendering of svg and allow plugins access to mount tune form * add auth-jwt component * add callback route, and allow it to be navigated to on load * add jwt as a supported auth method * use auth-jwt component and implement intial oidc flow * allow wrapping un-authed requests * pass redirect_url and properly redirect with the wrapped token * popup for login * center popup window and move to localStorage events for cross window communication because of IE11 * access window via a getter on the auth-form component * show OIDC provider name on the button * fetch default role on render of the auth-jwt component * simplify auth-form template * style callback page * refetch auth_url when path changes for auth-jwt component * fix glimmer error on alias metadata, and add back popup-metadata component * fix link in metadata page * add logo-edition component and remove use of partial for logo svg * render oidc callback template on the loading page if we're going there * add docs icon and change timeout on the auth form * move OIDC auth specific things to auth-jwt component * start to add branded buttons for OIDC providers * add google button * finish branded buttons * update glyph for error messages * update tests for auth screen not showing tabs, add adapter tests and new auth jwt tests * start auth-jwt tests * simplify auth-jwt * remove negative top margin on AlertInline * only preventDefault if there's an event * fill out tests * sort out some naming * feedback on templates and styles * clear error when starting OIDC auth and call for new auth_url * also allow 'oidc' as the auth method type * handle namespaces with OIDC auth * review feedback * use new getters in popup-metadata
2019-02-14 15:39:19 +00:00
const { role, jwt, token, password, username, path } = data;
2018-04-03 14:16:57 +00:00
const url = this.urlForAuth(backend, username, path);
const verb = backend === 'token' ? 'GET' : 'POST';
let options = {
unauthenticated: true,
};
if (backend === 'token') {
options.headers = {
'X-Vault-Token': token,
};
} else if (backend === 'jwt' || backend === 'oidc') {
UI - jwt auth (#6188) * fix default rendering of svg and allow plugins access to mount tune form * add auth-jwt component * add callback route, and allow it to be navigated to on load * add jwt as a supported auth method * use auth-jwt component and implement intial oidc flow * allow wrapping un-authed requests * pass redirect_url and properly redirect with the wrapped token * popup for login * center popup window and move to localStorage events for cross window communication because of IE11 * access window via a getter on the auth-form component * show OIDC provider name on the button * fetch default role on render of the auth-jwt component * simplify auth-form template * style callback page * refetch auth_url when path changes for auth-jwt component * fix glimmer error on alias metadata, and add back popup-metadata component * fix link in metadata page * add logo-edition component and remove use of partial for logo svg * render oidc callback template on the loading page if we're going there * add docs icon and change timeout on the auth form * move OIDC auth specific things to auth-jwt component * start to add branded buttons for OIDC providers * add google button * finish branded buttons * update glyph for error messages * update tests for auth screen not showing tabs, add adapter tests and new auth jwt tests * start auth-jwt tests * simplify auth-jwt * remove negative top margin on AlertInline * only preventDefault if there's an event * fill out tests * sort out some naming * feedback on templates and styles * clear error when starting OIDC auth and call for new auth_url * also allow 'oidc' as the auth method type * handle namespaces with OIDC auth * review feedback * use new getters in popup-metadata
2019-02-14 15:39:19 +00:00
options.data = { role, jwt };
2018-04-03 14:16:57 +00:00
} else {
options.data = token ? { token, password } : { password };
}
return this.ajax(url, verb, options);
},
urlFor(endpoint) {
if (!ENDPOINTS.includes(endpoint)) {
throw new Error(
`Calls to a ${endpoint} endpoint are not currently allowed in the vault cluster adapater`
);
}
return `${this.buildURL()}/${endpoint}`;
},
urlForAuth(type, username, path) {
const authBackend = type.toLowerCase();
const authURLs = {
github: 'login',
UI - jwt auth (#6188) * fix default rendering of svg and allow plugins access to mount tune form * add auth-jwt component * add callback route, and allow it to be navigated to on load * add jwt as a supported auth method * use auth-jwt component and implement intial oidc flow * allow wrapping un-authed requests * pass redirect_url and properly redirect with the wrapped token * popup for login * center popup window and move to localStorage events for cross window communication because of IE11 * access window via a getter on the auth-form component * show OIDC provider name on the button * fetch default role on render of the auth-jwt component * simplify auth-form template * style callback page * refetch auth_url when path changes for auth-jwt component * fix glimmer error on alias metadata, and add back popup-metadata component * fix link in metadata page * add logo-edition component and remove use of partial for logo svg * render oidc callback template on the loading page if we're going there * add docs icon and change timeout on the auth form * move OIDC auth specific things to auth-jwt component * start to add branded buttons for OIDC providers * add google button * finish branded buttons * update glyph for error messages * update tests for auth screen not showing tabs, add adapter tests and new auth jwt tests * start auth-jwt tests * simplify auth-jwt * remove negative top margin on AlertInline * only preventDefault if there's an event * fill out tests * sort out some naming * feedback on templates and styles * clear error when starting OIDC auth and call for new auth_url * also allow 'oidc' as the auth method type * handle namespaces with OIDC auth * review feedback * use new getters in popup-metadata
2019-02-14 15:39:19 +00:00
jwt: 'login',
oidc: 'login',
2018-04-03 14:16:57 +00:00
userpass: `login/${encodeURIComponent(username)}`,
ldap: `login/${encodeURIComponent(username)}`,
okta: `login/${encodeURIComponent(username)}`,
radius: `login/${encodeURIComponent(username)}`,
2018-04-03 14:16:57 +00:00
token: 'lookup-self',
};
const urlSuffix = authURLs[authBackend];
const urlPrefix = path && authBackend !== 'token' ? path : authBackend;
if (!urlSuffix) {
throw new Error(`There is no auth url for ${type}.`);
}
return `/v1/auth/${urlPrefix}/${urlSuffix}`;
},
urlForReplication(replicationMode, clusterMode, endpoint) {
let suffix;
const errString = `Calls to replication ${endpoint} endpoint are not currently allowed in the vault cluster adapater`;
if (clusterMode) {
assert(errString, REPLICATION_ENDPOINTS[clusterMode].includes(endpoint));
suffix = `${replicationMode}/${clusterMode}/${endpoint}`;
} else {
assert(errString, REPLICATION_ENDPOINTS[endpoint]);
suffix = `${endpoint}`;
}
return `${this.buildURL()}/replication/${suffix}`;
},
replicationStatus() {
return this.ajax(`${this.buildURL()}/replication/status`, 'GET', { unauthenticated: true });
},
replicationDrPromote(data, options) {
const verb = options && options.checkStatus ? 'GET' : 'PUT';
return this.ajax(`${this.buildURL()}/replication/dr/secondary/promote`, verb, {
data,
unauthenticated: true,
});
},
generateDrOperationToken(data, options) {
Ui/replication status discoverability (#8705) * Sidebranch: add new route on DR secondary (#8640) * setup, not complete * update routing * clean up * add test * add link from status menu * clean up * fixes per pr comments * revert back to two if statements due to refresh bug * Sidebranch: Setup Replication Page as component to be consumed in all pages for project (#8661) * setup, not complete * update routing * clean up * add test * add link from status menu * clean up * fixes per pr comments * setup dashboard with contextual components, and toggle * setup option to show tabs or not * handle conditional nav menu * pass in whole model object * rename to replication-page * clean up * clean up based on pr feedback * fix linting error * Sidebranch: setup replication dashboard with scss and initial card components (#8670) * setup replication dashboard with scss and initial card components * sync with Noelles changes and clean up the inner grid container inside the selectable card * set up nested contextual components for selectable-cards * setup component for table row * address walk through notes * remove name selectable from card component as it is not selectable * add missing space * Ui/dr primary/initial page setup (#8671) * add helperText param to InfoTableRow * initial page setup * format card with padding and correct number of rows * style card titles with margin * move styles inside replication class; add todos * move replication-summary styles into core app so hot reloading works * prevent known secondaries card from being cut off on the right hand side * make cards have the correct column span * make code elements inside tables black * WIP - start VltTable component * simplify css * renamed VltTable to ReplicationTable and use divs instead of table elements * fix position of known secondaries * use table element for secondaries card * add todo * move replication components to replication engine * Revert "move replication components to replication engine" This reverts commit 2228b8392199a1376815dc8b7642de438aad68b5. * move ReplicationPrimaryCards to components * remove hover box shadow since cards are not selectable yet * only apply padding to replication selectable-cards * specify replication vlt-table in classname * move replication toggle and toggle into core addon * remove extra toolbar border * remove duplicate css * move ReplicationTableRows to core addon and use them on DR primary page * clean up todos * add jsdoc comments * rename ReplicationTable to KnownSecondaries * update replicaiton table api to accept flexible data * rename replicationAttrs to data * move replication components to core addon * Ui/dr primary components (#8711) * populate table with actual secondary ids * add todo * make KnownSecondariesCard component * move KnownSecondariesCard styles to own file * add EmptyState when there are no known secondaries * fix known secondaries manage link * fix Add Secondary link; bring in capabilities model to repliation index route so we can check for adding secondaries * fix JSDOC comments and updata data to replicationAttrs * Sidebranch: DR Secondary Dashboard - pr4 (#8706) * setup styling for delta * clean up * replication table remove and rename model to data * remove old replication header component now that it is in addons * move replication secondary card component * calc delta * clean up * remove unused components that are now in addon * address pr comments * remove test * fix failing test * address pr comments * attempting to fix test * move to computed components * fix test error * fix state of null error * Sidebranch: DR Secondary Dashboard state message handlers (#8741) * setup styling for delta * clean up * replication table remove and rename model to data * remove old replication header component now that it is in addons * move replication secondary card component * calc delta * clean up * remove unused components that are now in addon * address pr comments * remove test * fix failing test * address pr comments * attempting to fix test * initial setup before merge updates * move to computed components * fix test error * fix state of null error * clean up * setup alert banner and documentation link * setup alert banner with second icon * remove underscore to dash * add in missing error messages * add connection-state shutdown * add storybook update to alert banner * pr comments * move css class to helper class * address pr comments * add in connection states correct endpoint * Ui/dr dashboard tests (#8732) * initial test setup * use margin when there are no knownsecondaries * set up replication tests in ember engine * set knownSecondaries * move tests to host app and set resolver * finish known-secondaries-card-test * make knownSecondaries array match the API response * add known secondaries table test * oops, remove stories directory * wip - replication table rows test * remove extra code * finish replication table rows tests * add | Enterprise | to test module * remove unncessary assertion: * show dynamic state glyph (#8747) * show dynamic state glyph * show state glyph after state * move LearnLink into core addon * make ReplicationDocLink component * prevent double lines at the bottom of the dashboard * Sidebranch: dr-secondary-dashboard-pr7 (#8792) * move dr to higher level component and setup isDisabled for error state when dr mode is disabled. * add in error messages final * refactor transistion on submit handler focused on dr secondary * handle transition * update empty state component to include icon and add empty state to details page * fix spelling * address pr comments * merge with replication branch * remove component structure for replication-secondary-card * compute title and error message * make specific empty state messages * fix test * address pr comments * regenerate the storyboook for empty state * Replication Primary Dashboard: handle errors (#8845) * use h3 instead of code elements * use correct property names for StateDisplay * WIP * remove todo * move cluster states into a map; make status menu icon match cluster state * show error in state card using the same state map in the cluster model * whitespace * move cluster-states into a helper and update usage * use circle success icon for stream-wals because that is the ideal state * more refactoring of cluster state display * use new cluster-states helper * whitespace * use clusterStates helper in replication secondary card * remove extra import * add default values for when state isn't recognized * make sure that state exists before getting state details from clusterStates helper * be more strict when state cannot be found * use brace expansion to fix linting error * add tests for error states * fix text wrapping issue on secondary cards; make titles match mocks * use unknown if metric isn't foudn * remove extra border on selectable card when there is an error * use outline square in status menu for error * Ui/replication/refactor dashboard components (#8878) * use ReplicationDashboard component * move syncing and alert banners into dashboard component * only show primary cluster addr if dashboard is for a secondary * use ReplicationPage and Dashboard * move isSecondary to page component * remove duplication * remove dead code * refactored table rows * make sure dashboards update data when we are switching between mclusterModes and replicationTypes * clarified replicationMode and clusterMode * remove extra margin * get rid of data * remove syncProgress * remove Enterprise filter from tests so component tests are run * Ui/replication/primary reindexing (#8906) * fix typo * fetch replication/mode/status and pass to dashboard component * add reindexing stage to AlertBanner; use real value for isReindexing * remove dr since we don't need it anymore * add indentation * remove TODO * capitalize reindexing_stage and make progress 0 by default * remove Toggle since we don't need it anymore * get allllll the variables at once * only run secondary details test on enterprise * Sidebranch: component and acceptance tests (#8903) * address secondary card overflow issue * setup replicaiton header test * address secondary card overflow issue * setup replication secondary card test * setup replicaiton header test * setup replicaiton page test * setup replication secondary card test * setup replication dashboard test * setup replicaiton page test * remove unused code * fix overflow * finish test for rep dashboard * update rep secondary card test * finish rep header test * fix rep table rows and header test * fix header test * fix missing data-test-primary-cluster * add to secondary test * remove pauseTest * add to enterprise replication test * add mode to dr secondary test * remove pauseTest * add enterprise to test * amend per pr commments * re organize rep secondary card test * adjust error heights with design input * move const around in rep secondary card test * move const around and message for rep dashboard test * amend per pr review comments * remove styling from grid-item-left * remove dup hasErrorClass key * quick fix * test failure fix * fix test due to merge * remove hasErrorClass * modify test message * Sidebranch: remove delta, toggle, and make auto-refresh (#8945) * change styling * remove replication toggle * modifications for auto refresh and final removal of delta and last wal * fix refresh issue by removing replicationMode on this.reset which conflicts with the same property being set on the cluster model * remove comments * add unknown placeholder * add auto refresh to other components and remove mention of toggle * remove meep and primary cluster heading area * ensure status menu displays replication state, not just one (#8959) * Add Replication Reindexing Progress Bar (#8975) * whitespace * rename consts * rename variables * test that dashboard shows a reindexing alert banner * standardize shamir and ui wizard progress bar * make new progressbar component * just kidding, we can use the html5 progress bar * make top margins consistent across primary and secondary dashboards * clean up AlertBanner JSDocs and markdown * show a progress bar inside an AlertBanner if cluster is reindexing * add example AlertBanner with Progress Bar * add reindexing tests * add a tiny left margin to progress bars inside alert banners * keep old class names in wizard to prevent bug, but keep consistent progress background color * use spacing variables * remove extra border when secondary card has an error * make card header sizes and weight consistent * Sidebranch: Performance Secondary Dashboard (#8956) * setup rep dashboard to dynamically take in the component to render and dynamically setup the css based on mode of cluster * conditional pass in the correct props to the Dashboard.card component and add margin to reindexing alertBanner * update replication dashboard test * add performance secondary test and clean up replication-secondary-card test * fix message * replace cluster-id with secondaryId * remove reindexing test as its a duplicate of the branch noelle is working on * cleanup * address pr comments * small test fixes * add secondaryId to header test * fix tests description * Ui/replication/test update (#8995) * make sure progress bar updates and animates * ensure dashboard updates when replication mode has changed * make sure we update isSyncing when state has changed * wip - console log statements to see if components are getting new attrs * Revert "wip - console log statements to see if components are getting new attrs" This reverts commit d05219ba6c14c64a9f2e867892476faf7dad4659. * style progress bar in mozilla; allow testing the progress bar in storybook * test that primary and secondary card container don't display at the same time * prepare KnownSecondariesTable for backend compatibility (#9029) * Ui/replication mgmt action block (#9053) This does some low-impact work to prepare for the refactor of replication-actions. Includes: - Move modal to addon in lib/core - Update modal to take a "type" param which changes the header color + icon - Add tests for modal changes - Add action-block style only component - Add styles-only replication-action grid that the action-blocks will live inside of * Sidebranch: address transition issues on replication engine and actions (#9010) * small formatting changes * change findRecord to peekRecord so it keeps track of the changing data. * add styling such that when page is loading it does not spread across the whole page * help with reload and styling on replication route * initial setup for new flow that handles adding a perf secondary, and also some on a dr secondary * clean up * add loader on rep page for situations when data is still loading, and add loading mode in header, seperate from the modeForUrl used in other places to help transistion * fix transitionTo when coming from different replication.mode vs replication.index route * set default of mode for radio checkboxes after removing from DEFAULTS var * reset and cont using onEnable because TransitionTo is not working inside of component * remove console * the reason we were getting transition errors :( * remove modeObjecT * fix error by removing peek record from application and moving it lower down in a property replicationAttrs * Readd back space * this one really does fix the issue * add back peek record and add conditional to isLoadingData * figure out cluster id from service instead of hardcoded * fix capabilities-self error by adding a 1 sceond delay for when transition from replication.index to replication.mode.index on enable performance secondary * remove attempt to circumvent the peekRecord in application * add to replication page tests and clarify replicationMode to formattedReplicationMode, it's super confusing when seeing replicationMode being duplicated throughout the computed components. this clarifies its computed only for formatting * fix repetive conditional * capture the state when either dr.mode or performance.mode are undefined, which happens during a transition. If this is the case add a loader on the replicationindex page. * address some pr comments * small change * add bootstrapping mode to test * add Replication Learn Links to wizard (#9106) * Ui/summary dashboard (#9079) * move key value to lib/core/addon so I can use inside replication engine * setup summary dasbhoard on replication summary component * set title for summary dashboard * do not show replication table rows on summary dashboard * show that last_wal updates every 10 seconds * show replication table rows on individual dashboards, but not summary * remove extra bottom border on replication-dashboard * add replicationDetailsSummary object and replication-summary-card * setup structure and data calcs of replication summary card * fix links and styling on summary card * breadcrumbs * match state title on summary dashboard to individual dashboards * add margin below replication header * update breadcrumbs to show replication mode * align details link right * add margin below tabs in replication header * user helper-text to make card text styling consistent across dashboards * remove unneeded code * add bottom border to summary state * add bottom margin to summary dashboard * add negative margins to bring values closer to related cell * fix failing test due to data-test attribute change and make storybook component for replication-summary-card * setup replication summary card test. I suspect we'll move the hasError test to the dashboard where the error will show around the state display * add to replication acceptance test for new summary dashboard * remove pauseTest * add is-active to li element * clean up * dashboard test and clean up * addressing pr comments * fix replication/null/status error * add JSDocs for rep page and rep dash * more pr cleanup * remove conditional and fix styling blue link * fix conditional on when loading summary dashboard to check for primary on both. wrap code in div so it lands on another line. Co-authored-by: Noelle Daley <adriannenoelle@gmail.com> * change message with bold 'not' if primary (#9112) * Add JSDocs to components (#9125) * jsdocs * remove todo that is no longer relevant * clean up wording * wordsmithing * fix spelling * example for clusterMode * Replication Management Sidebranch: Replication Action Disable (#9061) Set up dr-secondary management page with new action flow * Create confirmation-modal component * Refactor replication-dr-secondary splash page to replication manage page * Refactor replication-action-disable component to use confirmation modal * Add details/manage tab to replication-dr-secondary section * Refactor Replication Action: Promote to use modal flow (#9122) * Ui/replication mgmt/reindex action (#9126) * Replication Management Sidebranch: Replication Action Disable (#9061) * Ui/replication mgmt/recover action (#9127) * Replication Management Sidebranch: Replication Action Recover (#9061) * Close link-to tag in header (#9139) Fixes bad merge conflict * UI: Fix replication management tests (#9136) * do not show replication mode or id when replication isn't enabled * fix broken tag * fill in confirmation text when disabling replication in tests * fix typo * fix demote primary test selector * add test selectors and update tests to match new format * fill in Performance when disabling performance secondary * Ui/replication mgmt/update primary action (#9149) * Update Primary replication action uses modal flow * Update modal max-height to accommodate for the navbar * Ui/secondary token flow dr (#9150) * setup token modal flow * calc expirationDate * fix date-format test after moving it in addon * fix icon conditional in modal title * decode token to get epoch expiration date and convert * handle clicking outside of modal * remove extra copy button * add modal check in rep acceptance test * look only at day and month and remove console * fix spelling * cleanup * replace dr with variable * make string check longer in test * fix test variables * refactor enterprise test for secondary token flow * make cluster model property replicationModeForDisplay to handle all cases where we were either conditionally displaying the DR, Disaster Recovery, etc. or where we were hardcoding it into the hbs. For situations where it was DR before, I am now keeping it more consistent and using Disaster Recovery as on the manage page we do not show the Diaster Recovery (DR) anywhere. * set initial value for ttl picker to fix issue where itwas setting seconds to minutes * clean up * add comment about ttl picker * Add known primaries info table (#9152) * replace primaryClusterAddr with knownPrimaryClusterAddrs * rename state to Status; fix css layout * add InfoTable component * only show label column if there is a label * add grid-item-middle class * whitespace * fix grid layout * die tagName, die * set table max-height * prep InfoTable for Storybook * ensure cards always have the same height * remove duplicate max height since vlt-table already has max-height * add InfoTable tests * add InfoTable to Storybook * organize grid item css; rename for consistency * add sticky header to table * add sticky-header class to keep table styles in scope * whoops, do not use fake data * Ui/rep design updates (#9169) * show secondaryId in table rows * show primary_cluster_addr in table rows * remove cluster Ids from replication headers * Ui/fix enable overflow (#9173) * only show primary_cluster_addr for primary * fix overflow on replication index * remove display from cluster-states because it is not used anywhere * fix missing replication mode from description * add comments * use helper to consolidate replication descriptions * fix text wrapping on medium screen sizes * Ui/replication mgmt/demote action (#9168) * Replication demote action uses modal flow Co-authored-by: Noelle Daley <adriannenoelle@gmail.com> Co-authored-by: Angel Garbarino <argarbarino@gmail.com> * Ui/replication merge cleanup 2 (#9212) * replace with replicationModeForDisplay that is defined on the cluster * fix spelling on replication and confirmed with design for placeholder when Not defined * remove extra div with box class * change manage link to take you to the secondaries manage as it's within the known secondaries card * fix scroll always showing by adding auto, and decreasing the height. WIP * add empty state to known_primary_cluster_addrs * address pr comments * Add real connected state and API address (#9219) * fix title of secondary card * show connected status * fix tests * fix enterprise test (#9229) * fix enterprise test * add n * add another n * Ui/replication mgmt/generate token action (#9187) Generate operation token flow from replication DR Secondary. Clicking 'Cancel' on the modal after the operation has started results in cancelling generate operation and restarting the process. * use none set instead of not defined Co-authored-by: Noelle Daley <noelledaley@users.noreply.github.com> Co-authored-by: Chelsea Shaw <chelshaw.dev@gmail.com> Co-authored-by: Noelle Daley <adriannenoelle@gmail.com>
2020-06-18 21:52:43 +00:00
let verb = options && options.checkStatus ? 'GET' : 'PUT';
if (options.cancel) {
verb = 'DELETE';
}
2018-04-03 14:16:57 +00:00
let url = `${this.buildURL()}/replication/dr/secondary/generate-operation-token/`;
if (!data || data.pgp_key || data.attempt) {
2018-04-03 14:16:57 +00:00
// start the generation
url = url + 'attempt';
} else {
// progress the operation
url = url + 'update';
}
return this.ajax(url, verb, {
data,
unauthenticated: true,
});
},
replicationAction(action, replicationMode, clusterMode, data) {
assert(
`${replicationMode} is an unsupported replication mode.`,
replicationMode && REPLICATION_MODES.includes(replicationMode)
);
const url =
action === 'recover' || action === 'reindex'
? this.urlForReplication(replicationMode, null, action)
: this.urlForReplication(replicationMode, clusterMode, action);
return this.ajax(url, 'POST', { data });
},
});