Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions addons/api/tests/unit/models/credential-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@ import {
TYPE_CREDENTIAL_JSON,
TYPE_CREDENTIAL_SSH_PRIVATE_KEY,
TYPE_CREDENTIAL_USERNAME_PASSWORD_DOMAIN,
TYPE_CREDENTIAL_USERNAME_PASSWORD
TYPE_CREDENTIAL_USERNAME_PASSWORD,
} from 'api/models/credential';


module('Unit | Model | credential', function (hooks) {
setupTest(hooks);

Expand All @@ -35,7 +34,9 @@ module('Unit | Model | credential', function (hooks) {

test('it has isJSON property and returns the expected values', async function (assert) {
const store = this.owner.lookup('service:store');
const modelA = store.createRecord('credential', { type: TYPE_CREDENTIAL_JSON });
const modelA = store.createRecord('credential', {
type: TYPE_CREDENTIAL_JSON,
});
const modelB = store.createRecord('credential', {
type: TYPE_CREDENTIAL_USERNAME_PASSWORD,
});
Expand All @@ -51,13 +52,15 @@ module('Unit | Model | credential', function (hooks) {
test('it has isUnknown property and returns the expected values', async function (assert) {
const store = this.owner.lookup('service:store');
const modelA = store.createRecord('credential', {
type: TYPE_CREDENTIAL_USERNAME_PASSWORD
type: TYPE_CREDENTIAL_USERNAME_PASSWORD,
});
const modelB = store.createRecord('credential', {
type: TYPE_CREDENTIAL_SSH_PRIVATE_KEY
type: TYPE_CREDENTIAL_SSH_PRIVATE_KEY,
});
const modelC = store.createRecord('credential', { type: 'unknown' });
const modelD = store.createRecord('credential', { type: TYPE_CREDENTIAL_USERNAME_PASSWORD_DOMAIN });
const modelD = store.createRecord('credential', {
type: TYPE_CREDENTIAL_USERNAME_PASSWORD_DOMAIN,
});

assert.false(modelA.isUnknown);
assert.false(modelB.isUnknown);
Expand Down
9 changes: 6 additions & 3 deletions addons/api/tests/unit/utils/sqlite-query-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ module('Unit | Utility | sqlite-query', function (hooks) {
{ field: 'name', alias: 'resource_name' },
{ field: 'type', alias: 'resource_type' },
],
expectedSelect: '"target".name as resource_name, "target".type as resource_type',
expectedSelect:
'"target".name as resource_name, "target".type as resource_type',
},
'count with alias': {
select: [{ field: 'id', isCount: true, alias: 'total_count' }],
Expand Down Expand Up @@ -118,7 +119,8 @@ module('Unit | Utility | sqlite-query', function (hooks) {
{ field: 'type', isDistinct: true, isCount: true },
{ field: 'status', isDistinct: true, isCount: true },
],
expectedSelect: 'count(DISTINCT "target".type), count(DISTINCT "target".status)',
expectedSelect:
'count(DISTINCT "target".type), count(DISTINCT "target".status)',
},
'distinct with alias': {
select: [{ field: 'type', isDistinct: true, alias: 'unique_type' }],
Expand All @@ -129,7 +131,8 @@ module('Unit | Utility | sqlite-query', function (hooks) {
{ field: 'type', isDistinct: true, alias: 'unique_type' },
{ field: 'status', isDistinct: true, alias: 'unique_status' },
],
expectedSelect: 'DISTINCT "target".type as unique_type, "target".status as unique_status',
expectedSelect:
'DISTINCT "target".type as unique_type, "target".status as unique_status',
},
'count distinct multiple fields': {
select: [
Expand Down
17 changes: 0 additions & 17 deletions addons/core/addon/helpers/format-date-iso-human.js

This file was deleted.

14 changes: 0 additions & 14 deletions addons/core/addon/helpers/format-date-iso.js

This file was deleted.

6 changes: 0 additions & 6 deletions addons/core/app/helpers/format-date-iso-human.js

This file was deleted.

6 changes: 0 additions & 6 deletions addons/core/app/helpers/format-date-iso.js

This file was deleted.

This file was deleted.

32 changes: 0 additions & 32 deletions addons/core/tests/integration/helpers/format-date-iso-test.js

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ module('Integration | Helper | format-day-year', function (hooks) {
});
test('it renders when null', async function (assert) {
this.set('inputValue', null);
await render(hbs`{{format-date-iso this.inputValue}}`);
await render(hbs`{{format-day-year this.inputValue}}`);
assert.strictEqual(this.element.textContent.trim(), '');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,10 @@
<B.Td>
{{#if data.created_time}}
<Hds::Text::Body @color='faint'>
<time datetime={{format-date-iso data.created_time}}>
{{format-date-iso data.created_time}}
</time>
<Hds::Time
@date={{data.created_time}}
@display='friendly-local'
/>
</Hds::Text::Body>
{{/if}}
</B.Td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,10 @@
{{#if @model.channelRecording.start_time}}
<list.Item @icon='calendar' @color='faint'>
{{t 'form.started.label'}}
<time
datetime={{format-date-iso
@model.channelRecording.start_time
}}
>
{{format-date-iso @model.channelRecording.start_time}}
</time>
<Hds::Time
@display='friendly-local'
@date={{@model.channelRecording.start_time}}
/>
</list.Item>
{{/if}}
{{! Duration }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,13 +216,10 @@
{{#if @model.sessionRecording.created_time}}
<list.Item @icon='calendar' @color='faint'>
{{t 'form.created.label'}}
<time
datetime={{format-date-iso
@model.sessionRecording.created_time
}}
>
{{format-date-iso @model.sessionRecording.created_time}}
</time>
<Hds::Time
@date={{@model.sessionRecording.created_time}}
@display='friendly-local'
/>
</list.Item>
{{/if}}
{{! Duration }}
Expand Down Expand Up @@ -257,32 +254,27 @@
{{#if @model.sessionRecording.retain_until}}
<list.Item @icon='hourglass' @color='faint'>
{{t 'resources.policy.titles.retain_until'}}
<time
data-test-retain-until
datetime={{format-date-iso
@model.sessionRecording.retain_until
}}
>
<div data-test-retain-until>
{{#if @model.sessionRecording.retainForever}}
{{t 'resources.policy.titles.forever'}}
{{else}}
{{format-date-iso @model.sessionRecording.retain_until}}
<Hds::Time
@date={{@model.sessionRecording.retain_until}}
@display='friendly-local'
/>
{{/if}}
</time>
</div>
</list.Item>
{{/if}}

{{#if @model.sessionRecording.delete_after}}
<list.Item @icon='hourglass' @color='faint'>
{{t 'resources.policy.titles.delete_after'}}
<time
<Hds::Time
data-test-delete-after
datetime={{format-date-iso
@model.sessionRecording.delete_after
}}
>
{{format-date-iso @model.sessionRecording.delete_after}}
</time>
@date={{@model.sessionRecording.delete_after}}
@display='friendly-local'
/>
</list.Item>
{{/if}}
</Rose::MetadataList>
Expand Down
7 changes: 4 additions & 3 deletions ui/admin/app/templates/scopes/scope/sessions/index.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,10 @@
{{data.target.displayName}}
</B.Td>
<B.Td>
<time datetime={{format-date-iso data.created_time}}>
{{format-date-iso-human data.created_time}}
</time>
<Hds::Time
@date={{data.created_time}}
@display='friendly-local'
/>
</B.Td>
<B.Td>
<SessionStatus @model={{data}} />
Expand Down
3 changes: 1 addition & 2 deletions ui/admin/tests/acceptance/host-catalogs/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ export const MANAGE_DROPDOWN_HOST_CATALOG_DELETE =
export const FIELD_ROLE_ARN = '[name="role_arn"]';
export const FIELD_ROLE_ARN_VALUE = 'arn:aws:iam';

export const FIELD_CREDENTIAL_TYPE =
'.credential-selection input:checked';
export const FIELD_CREDENTIAL_TYPE = '.credential-selection input:checked';
export const FIELD_DYNAMIC_CREDENTIAL = '[name="dynamic-credential"]';
export const FIELD_DYNAMIC_CREDENTIAL_VALUE = 'dynamic-credentials';
export const FIELD_STATIC_CREDENTIAL = '[name="static-credential"]';
11 changes: 9 additions & 2 deletions ui/admin/tests/acceptance/session-recordings/list-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { setupSqlite } from 'api/test-support/helpers/sqlite';
import { faker } from '@faker-js/faker';
import * as commonSelectors from 'admin/tests/helpers/selectors';
import * as selectors from './selectors';
import { formatDateUserFriendly } from 'admin/tests/helpers/format-date-user-friendly';
import {
STATE_SESSION_RECORDING_STARTED,
STATE_SESSION_RECORDING_AVAILABLE,
Expand All @@ -31,6 +32,10 @@ module('Acceptance | session-recordings | list', function (hooks) {
'2020-01-01T00:01:00.000Z',
];

const CREATED_TIME_VALUES_FORMATTED = CREATED_TIME_VALUES_ARRAY.map(
formatDateUserFriendly,
);

let featuresService;
let createdTimeValues;

Expand Down Expand Up @@ -325,6 +330,8 @@ module('Acceptance | session-recordings | list', function (hooks) {

this.server.schema.sessionRecordings.all().destroy();
const expectedDescendingSort = CREATED_TIME_VALUES_ARRAY.toReversed();
const expectedDescendingFormattedSort =
CREATED_TIME_VALUES_FORMATTED.toReversed();
faker.helpers.shuffle(expectedDescendingSort).forEach((value) => {
this.server.create('session-recording', {
created_time: value,
Expand All @@ -337,7 +344,7 @@ module('Acceptance | session-recordings | list', function (hooks) {
assert
.dom(commonSelectors.TABLE_ROWS)
.isVisible({ count: CREATED_TIME_VALUES_ARRAY.length });
expectedDescendingSort.forEach((expected, index) => {
expectedDescendingFormattedSort.forEach((expected, index) => {
// nth-child index starts at 1
assert.dom(commonSelectors.TABLE_ROW(index + 1)).containsText(expected);
});
Expand All @@ -351,7 +358,7 @@ module('Acceptance | session-recordings | list', function (hooks) {
key: 'created_time',
values: CREATED_TIME_VALUES_ARRAY,
},
expectedAscendingSort: CREATED_TIME_VALUES_ARRAY,
expectedAscendingSort: CREATED_TIME_VALUES_FORMATTED,
column: 1,
},
'on state': {
Expand Down
16 changes: 6 additions & 10 deletions ui/admin/tests/acceptance/sessions/list-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
} from 'api/models/session';
import * as commonSelectors from 'admin/tests/helpers/selectors';
import * as selectors from './selectors';
import { formatDateUserFriendly } from 'admin/tests/helpers/format-date-user-friendly';
import { setRunOptions } from 'ember-a11y-testing/test-support';

module('Acceptance | sessions | list', function (hooks) {
Expand All @@ -31,14 +32,9 @@ module('Acceptance | sessions | list', function (hooks) {
'2020-01-01T01:00:10.000Z',
'2020-01-01T10:00:00.000Z',
];

const CREATED_TIME_ISO_VALUES_ARRAY = [
'2020-01-01 00:00:01',
'2020-01-01 00:00:10',
'2020-01-01 00:10:01',
'2020-01-01 01:00:10',
'2020-01-01 10:00:00',
];
const CREATED_TIME_VALUES_FORMATTED = CREATED_TIME_VALUES_ARRAY.map(
formatDateUserFriendly,
);
const ID_VALUES_ARRAY = ['i_0001', 'i_0010', 'i_0100', 'i_1000', 'i_10000'];

const instances = {
Expand Down Expand Up @@ -485,7 +481,7 @@ module('Acceptance | sessions | list', function (hooks) {
});

this.server.schema.sessions.all().destroy();
const expectedDescendingSort = CREATED_TIME_ISO_VALUES_ARRAY.toReversed();
const expectedDescendingSort = CREATED_TIME_VALUES_FORMATTED.toReversed();
faker.helpers.shuffle(CREATED_TIME_VALUES_ARRAY).forEach((value) => {
this.server.create('session', {
created_time: value,
Expand Down Expand Up @@ -520,7 +516,7 @@ module('Acceptance | sessions | list', function (hooks) {
key: 'created_time',
values: CREATED_TIME_VALUES_ARRAY,
},
expectedAscendingSort: CREATED_TIME_ISO_VALUES_ARRAY,
expectedAscendingSort: CREATED_TIME_VALUES_FORMATTED,
column: 4,
},
'on status': {
Expand Down
Loading
Loading