Skip to content

Commit

Permalink
UI: removeember-fetch which used vulnerable version of rollup (#2…
Browse files Browse the repository at this point in the history
  • Loading branch information
hellobontempo authored Oct 3, 2024
1 parent baf794b commit e8a432c
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 273 deletions.
1 change: 0 additions & 1 deletion ui/app/adapters/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { service } from '@ember/service';
import { set } from '@ember/object';
import RSVP from 'rsvp';
import config from '../config/environment';
import fetch from 'fetch';

const { APP } = config;
const { POLLING_URLS, NAMESPACE_ROOT_URLS } = APP;
Expand Down
1 change: 0 additions & 1 deletion ui/app/components/raft-storage-restore.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { task } from 'ember-concurrency';
import { getOwner } from '@ember/owner';
import { service } from '@ember/service';
import { alias } from '@ember/object/computed';
import { AbortController } from 'fetch';

export default Component.extend({
file: null,
Expand Down
1 change: 0 additions & 1 deletion ui/app/services/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import { computed, get } from '@ember/object';
import { alias } from '@ember/object/computed';
import Service, { inject as service } from '@ember/service';
import { capitalize } from '@ember/string';
import fetch from 'fetch';
import { resolve, reject } from 'rsvp';

import getStorage from 'vault/lib/token-storage';
Expand Down
1 change: 0 additions & 1 deletion ui/mirage/handlers/mfa-login.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

import { Response } from 'miragejs';
import Ember from 'ember';
import fetch from 'fetch';

// initial auth response cache -- lookup by mfa_request_id key
const authResponses = {};
Expand Down
1 change: 0 additions & 1 deletion ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@
"ember-data": "~4.12.4",
"ember-engines": "0.8.23",
"ember-exam": "^9.0.0",
"ember-fetch": "^8.1.2",
"ember-inflector": "4.0.2",
"ember-load-initializers": "^2.1.2",
"ember-modal-dialog": "^4.0.1",
Expand Down
12 changes: 11 additions & 1 deletion ui/tests/integration/components/clients/page-header-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import { module, test } from 'qunit';
import { setupRenderingTest } from 'vault/tests/helpers';
import { click, fillIn, render } from '@ember/test-helpers';
import { click, fillIn, render, waitFor, waitUntil } from '@ember/test-helpers';
import { hbs } from 'ember-cli-htmlbars';
import { setupMirage } from 'ember-cli-mirage/test-support';
import { Response } from 'miragejs';
Expand Down Expand Up @@ -79,6 +79,7 @@ module('Integration | Component | clients/page-header', function (hooks) {

await click(CLIENT_COUNT.exportButton);
await click(GENERAL.confirmButton);
await waitFor('[data-test-export-error]');
assert.dom('[data-test-export-error]').hasText('permission denied');
});

Expand All @@ -98,6 +99,7 @@ module('Integration | Component | clients/page-header', function (hooks) {
await click(CLIENT_COUNT.exportButton);
await fillIn('[data-test-download-format]', 'jsonl');
await click(GENERAL.confirmButton);
await waitUntil(() => this.downloadStub.calledOnce);
const extension = this.downloadStub.lastCall.args[2];
assert.strictEqual(extension, 'jsonl');
});
Expand All @@ -119,6 +121,7 @@ module('Integration | Component | clients/page-header', function (hooks) {
await click(CLIENT_COUNT.exportButton);
await fillIn('[data-test-download-format]', 'csv');
await click(GENERAL.confirmButton);
await waitUntil(() => this.downloadStub.calledOnce);
const extension = this.downloadStub.lastCall.args[2];
assert.strictEqual(extension, 'csv');
});
Expand Down Expand Up @@ -175,6 +178,7 @@ module('Integration | Component | clients/page-header', function (hooks) {

await click(CLIENT_COUNT.exportButton);
await click(GENERAL.confirmButton);
await waitFor('[data-test-export-error]');
assert.dom('[data-test-export-error]').hasText('no data to export in provided time range.');
});

Expand All @@ -184,6 +188,7 @@ module('Integration | Component | clients/page-header', function (hooks) {
];
await this.renderComponent();
await click(CLIENT_COUNT.exportButton);
await waitFor('[data-test-export-upgrade-warning]');
assert.dom('[data-test-export-upgrade-warning]').includesText('1.10.1 (Nov 18, 2021)');
});

Expand All @@ -202,6 +207,7 @@ module('Integration | Component | clients/page-header', function (hooks) {
await this.renderComponent();
await click(CLIENT_COUNT.exportButton);
await click(GENERAL.confirmButton);
await waitUntil(() => this.downloadStub.calledOnce);
const args = this.downloadStub.lastCall.args;
const [filename] = args;
assert.strictEqual(filename, 'clients_export_June 2022-December 2022', 'csv has expected filename');
Expand All @@ -222,6 +228,7 @@ module('Integration | Component | clients/page-header', function (hooks) {

await click(CLIENT_COUNT.exportButton);
await click(GENERAL.confirmButton);
await waitUntil(() => this.downloadStub.calledOnce);
const [filename] = this.downloadStub.lastCall.args;
assert.strictEqual(filename, 'clients_export_June 2022', 'csv has single month in filename');
});
Expand All @@ -241,6 +248,7 @@ module('Integration | Component | clients/page-header', function (hooks) {

await click(CLIENT_COUNT.exportButton);
await click(GENERAL.confirmButton);
await waitUntil(() => this.downloadStub.calledOnce);
const [filename] = this.downloadStub.lastCall.args;
assert.strictEqual(filename, 'clients_export');
});
Expand All @@ -263,6 +271,7 @@ module('Integration | Component | clients/page-header', function (hooks) {

await click(CLIENT_COUNT.exportButton);
await click(GENERAL.confirmButton);
await waitUntil(() => this.downloadStub.calledOnce);
const [filename] = this.downloadStub.lastCall.args;
assert.strictEqual(filename, 'clients_export_bar');
});
Expand All @@ -284,6 +293,7 @@ module('Integration | Component | clients/page-header', function (hooks) {

await click(CLIENT_COUNT.exportButton);
await click(GENERAL.confirmButton);
await waitUntil(() => this.downloadStub.calledOnce);
const [filename] = this.downloadStub.lastCall.args;
assert.strictEqual(filename, 'clients_export_foo');
});
Expand Down
3 changes: 2 additions & 1 deletion ui/tests/integration/components/raft-storage-restore-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { setupMirage } from 'ember-cli-mirage/test-support';
import { render, triggerEvent, click } from '@ember/test-helpers';
import { render, triggerEvent, click, waitFor } from '@ember/test-helpers';
import hbs from 'htmlbars-inline-precompile';

module('Integration | Component | raft-storage-restore', function (hooks) {
Expand All @@ -30,6 +30,7 @@ module('Integration | Component | raft-storage-restore', function (hooks) {
files: [new Blob(['Raft Snapshot'])],
});
await click('[data-test-edit-form-submit]');
await waitFor('#force-restore');
await click('#force-restore');
await click('[data-test-edit-form-submit]');
});
Expand Down
Loading

0 comments on commit e8a432c

Please sign in to comment.