Icu 14403 add dropdown to select and save log verbosity (#2431)

* feat: 🎸 Add logging settings card

✅ Closes: https://hashicorp.atlassian.net/browse/ICU-14403
This commit is contained in:
Zhihe Li committed 2024-09-24 11:58:25 -04:00
1 parent 0b9357e9b3
commit e4f4394197
16 files changed
+481 -167

No files matched your search

+15 -5
View File
@@ -44,11 +44,6 @@ titles:
not-set: Not set
year: '{numberOfYears, plural, =1 {# year} other {# years}}'
days: '{days, plural, =1 {# day} other {# days}}'
application: Application
cli: CLI
cache-daemon: Cache Daemon
client: Client
color-theme: Color Theme
descriptions:
empty-set: There are no items to display yet. You may be able to add items or try back later.
cluster-url-initialization: To get started, please enter your cluster URL
@@ -110,3 +105,18 @@ unsupported-controller:
releases-page: Go to releases page
change-cluster-url: Change cluster URL
error: Unable to download supported version of desktop app. You’ll need to download version 1.7.1 from the releases page
settings:
application: Application
cli: CLI
cache-daemon: Cache Daemon
client: Client
color-theme: Color Theme
logs:
title: Logs
logging-level: Logging level
log-location: Log location
levels:
error: Error
warn: Warn
info: Info
debug: Debug
@@ -3,47 +3,45 @@
SPDX-License-Identifier: BUSL-1.1
}}
<SettingsCard @header={{t 'titles.application'}} @icon='boundary'>
<SettingsCard @header={{t 'settings.application'}} @icon='boundary'>
<:body>
<div class='app-information'>
<div>
<Hds::Text::Display>
{{t 'titles.client'}}
</Hds::Text::Display>
<Hds::Text::Body @tag='p' @weight='medium'>
{{@model.formattedDesktopVersion}}
</Hds::Text::Body>
</div>
<div>
<Hds::Text::Display>
{{t 'titles.cli'}}
</Hds::Text::Display>
<Hds::Text::Body @tag='p' @weight='medium'>
{{@model.formattedCliVersion}}
</Hds::Text::Body>
</div>
<div>
<Hds::Text::Display>
{{t 'titles.cache-daemon'}}
</Hds::Text::Display>
<Hds::Text::Body @tag='p' @weight='medium'>
{{#if @model.formattedCacheVersion}}
{{@model.formattedCacheVersion}}
<Hds::Badge
@text={{t 'states.running'}}
@icon='running'
@color='success'
/>
{{else}}
<Hds::Badge
@text={{t 'states.not-running'}}
@icon='stop-circle'
@color='neutral'
/>
{{/if}}
<div>
<Hds::Text::Display>
{{t 'settings.client'}}
</Hds::Text::Display>
<Hds::Text::Body @tag='p' @weight='medium'>
{{@model.formattedDesktopVersion}}
</Hds::Text::Body>
</div>
<div>
<Hds::Text::Display>
{{t 'settings.cli'}}
</Hds::Text::Display>
<Hds::Text::Body @tag='p' @weight='medium'>
{{@model.formattedCliVersion}}
</Hds::Text::Body>
</div>
<div>
<Hds::Text::Display>
{{t 'settings.cache-daemon'}}
</Hds::Text::Display>
<Hds::Text::Body @tag='p' @weight='medium'>
{{#if @model.formattedCacheVersion}}
{{@model.formattedCacheVersion}}
<Hds::Badge
@text={{t 'states.running'}}
@icon='running'
@color='success'
/>
{{else}}
<Hds::Badge
@text={{t 'states.not-running'}}
@icon='stop-circle'
@color='neutral'
/>
{{/if}}
</Hds::Text::Body>
</div>
</Hds::Text::Body>
</div>
{{#if @model.error}}
<Hds::Alert @type='inline' @color='warning' as |A|>
@@ -56,11 +54,11 @@
<Hds::Form::Select::Field
name='theme'
@width='30%'
@width='100%'
{{on 'change' @toggle}}
as |F|
>
<F.Label>{{t 'titles.color-theme'}}</F.Label>
<F.Label>{{t 'settings.color-theme'}}</F.Label>
<F.Options>
{{#each this.themes as |theme|}}
<option
@@ -0,0 +1,33 @@
{{!
Copyright (c) HashiCorp, Inc.
SPDX-License-Identifier: BUSL-1.1
}}
<SettingsCard @header={{t 'settings.logs.title'}} @icon='logs'>
<:body>
<Hds::Form::Select::Field
name='log_level'
@width='100%'
{{on 'change' this.selectLogLevel}}
as |F|
>
<F.Label>{{t 'settings.logs.logging-level'}}</F.Label>
<F.Options>
{{#each this.logLevels as |level|}}
<option value={{level}} selected={{eq @model.logLevel level}}>
{{t (concat 'settings.logs.levels.' level)}}
</option>
{{/each}}
</F.Options>
</Hds::Form::Select::Field>
<div class='large-column'>
<Hds::Text::Display>
{{t 'settings.logs.log-location'}}
</Hds::Text::Display>
<Hds::Copy::Snippet
@textToCopy={{@model.logPath}}
@isFullWidth={{true}}
/>
</div>
</:body>
</SettingsCard>
@@ -0,0 +1,25 @@
/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: BUSL-1.1
*/
import Component from '@glimmer/component';
import { action } from '@ember/object';
import { inject as service } from '@ember/service';
export default class SettingsCardLogsComponent extends Component {
// =services
@service ipc;
// =attributes
get logLevels() {
return ['error', 'warn', 'info', 'debug'];
}
// =methods
@action
async selectLogLevel({ target: { value } }) {
await this.ipc.invoke('setLogLevel', value);
}
}
@@ -16,23 +16,21 @@
{{/if}}
</:state>
<:body>
<div class='app-information'>
<div>
<Hds::Text::Display>
{{t 'resources.auth-method.title'}}
</Hds::Text::Display>
<Hds::Text::Body @tag='p' @weight='medium' data-test-auth-method>
{{this.authMethod}}
</Hds::Text::Body>
</div>
<div>
<Hds::Text::Display>
{{t 'form.username.label'}}
</Hds::Text::Display>
<Hds::Text::Body @tag='p' @weight='medium' data-test-username>
{{this.userInfo}}
</Hds::Text::Body>
</div>
<div>
<Hds::Text::Display>
{{t 'resources.auth-method.title'}}
</Hds::Text::Display>
<Hds::Text::Body @tag='p' @weight='medium' data-test-auth-method>
{{this.authMethod}}
</Hds::Text::Body>
</div>
<div>
<Hds::Text::Display>
{{t 'form.username.label'}}
</Hds::Text::Display>
<Hds::Text::Body @tag='p' @weight='medium' data-test-username>
{{this.userInfo}}
</Hds::Text::Body>
</div>
</:body>
@@ -13,28 +13,34 @@ export default class ScopesScopeProjectsSettingsIndexRoute extends Route {
let cacheDaemonStatus,
formattedCacheVersion,
formattedCliVersion,
formattedDesktopVersion;
formattedDesktopVersion,
error;
const { versionNumber: cliVersion } =
await this.ipc.invoke('getCliVersion');
formattedCliVersion = `v${cliVersion}`;
const { desktopVersion } = await this.ipc.invoke('getDesktopVersion');
formattedDesktopVersion = `v${desktopVersion}`;
try {
cacheDaemonStatus = await this.ipc.invoke('cacheDaemonStatus');
} catch (e) {
return {
formattedCliVersion,
formattedCacheVersion,
formattedDesktopVersion,
error: e,
};
error = e;
}
const { version } = cacheDaemonStatus;
formattedCacheVersion = version.match(/v\d+\.\d+\.\d+/)?.[0];
const { version } = cacheDaemonStatus ?? {};
formattedCacheVersion = version?.match(/v\d+\.\d+\.\d+/)?.[0];
const logLevel = await this.ipc.invoke('getLogLevel');
const logPath = await this.ipc.invoke('getLogPath');
return {
error,
formattedCliVersion,
formattedCacheVersion,
formattedDesktopVersion,
logLevel,
logPath,
};
}
}
+19 -15
View File
@@ -665,8 +665,6 @@ $chevron-down: url("data:image/svg+xml;utf-8,<svg viewBox='0 0 24 24' fill='%231
// Settings
.settings-card {
margin-bottom: 1rem;
.hds-card__container {
padding: 1rem;
margin-bottom: 1rem;
@@ -678,20 +676,26 @@ $chevron-down: url("data:image/svg+xml;utf-8,<svg viewBox='0 0 24 24' fill='%231
gap: 1rem;
}
.content {
padding-left: 2.2rem;
}
.app-information {
display: flex;
margin: 1rem 2rem 1rem 0;
> div {
flex-basis: 12rem;
}
}
.action {
margin-left: auto;
}
.content {
display: flex;
flex-wrap: wrap;
gap: 1rem;
margin: 1rem 0 1rem 2.8rem;
> div {
flex-basis: 30%;
}
.large-column {
flex-grow: 1;
}
.hds-alert {
flex-basis: 100%;
}
}
}
@@ -4,4 +4,5 @@
}}
<SettingsCard::Application @model={{@model}} @toggle={{this.toggleTheme}} />
<SettingsCard::User />
<SettingsCard::User />
<SettingsCard::Logs @model={{@model}} />
+1
View File
@@ -27,6 +27,7 @@
"electron-is-dev": "^2.0.0",
"electron-log": "^5.1.2",
"electron-squirrel-startup": "^1.0.0",
"electron-store": "^8.2.0",
"node-html-parser": "^5.3.3",
"node-pty": "^1.0.0",
"semver": "^7.5.3",
+2 -1
View File
@@ -28,6 +28,7 @@ const { generateCSPHeader } = require('./config/content-security-policy.js');
const runtimeSettings = require('./services/runtime-settings.js');
const sessionManager = require('./services/session-manager.js');
const cacheDaemonManager = require('./services/cache-daemon-manager');
const store = require('./services/electron-store-manager');
const menu = require('./config/menu.js');
const appUpdater = require('./helpers/app-updater.js');
@@ -61,7 +62,7 @@ fixPath();
// Setup logger
log.initialize();
log.transports.console.level = false;
log.transports.file.level = process.env.BOUNDARY_DESKTOP_LOG_LEVEL ?? 'info';
log.transports.file.level = store.get('logLevel');
log.transports.file.format =
'[{y}-{m}-{d}T{h}:{i}:{s}.{ms}{z}] [{level}] {text}';
log.transports.file.fileName = 'desktop-client.log';
+30 -4
View File
@@ -17,6 +17,7 @@ const which = require('which');
const cacheDaemonManager = require('../services/cache-daemon-manager');
const clientAgentDaemonManager = require('../services/client-agent-daemon-manager');
const { releaseVersion } = require('../../config/config.js');
const store = require('../services/electron-store-manager');
/**
* Returns the current runtime clusterUrl, which is used by the main thread to
@@ -211,6 +212,32 @@ handle('getDesktopVersion', async () => ({ desktopVersion: releaseVersion }));
*/
handle('cacheDaemonStatus', async () => await cacheDaemonManager.status());
/**
* Returns the current log level
*/
handle('getLogLevel', () => store.get('logLevel'));
/**
* Sets the log level
*/
handle('setLogLevel', (logLevel) => store.set('logLevel', logLevel));
/**
* Returns the path to the log file
*/
handle('getLogPath', () => {
switch (os.platform()) {
case 'win32':
return `${
process.env.USERPROFILE ?? '%USERPROFILE%'
}\\AppData\\Roaming\\Boundary\\logs\\desktop-client.log`;
case 'darwin':
return '~/Library/Logs/Boundary/desktop-client.log';
case 'linux':
return '~/.config/Boundary/logs/desktop-client.log';
}
});
/**
* Handler to help create terminal windows. We don't use the helper `handle` method
* as we need access to the event and don't need to be using `ipcMain.handle`.
@@ -218,10 +245,9 @@ handle('cacheDaemonStatus', async () => await cacheDaemonManager.status());
ipcMain.on('createTerminal', (event, payload) => {
const { id, cols, rows } = payload;
const { sender } = event;
const terminalShell =
os.platform() === 'win32'
? 'powershell.exe'
: process.env.SHELL || '/bin/bash';
const terminalShell = isWindows()
? 'powershell.exe'
: process.env.SHELL || '/bin/bash';
const ptyProcess = pty.spawn(terminalShell, [], {
name: 'xterm-color',
cols,
@@ -0,0 +1,20 @@
/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: BUSL-1.1
*/
const Store = require('electron-store');
const log = require('electron-log/main');
// Set the default log level to info when initiating the store
const store = new Store({ defaults: { logLevel: 'info' } });
// Set a handler to watch any changes in log level
store.onDidChange('logLevel', (newValue) => {
if (newValue) {
log.transports.file.level = newValue;
}
});
// Singleton for electron store
module.exports = store;
+136 -32
View File
@@ -522,6 +522,23 @@ aggregate-error@^3.0.0:
clean-stack "^2.0.0"
indent-string "^4.0.0"
ajv-formats@^2.1.1:
version "2.1.1"
resolved "https://registry.yarnpkg.com/ajv-formats/-/ajv-formats-2.1.1.tgz#6e669400659eb74973bbf2e33327180a0996b520"
integrity sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==
dependencies:
ajv "^8.0.0"
ajv@^8.0.0, ajv@^8.6.3:
version "8.17.1"
resolved "https://registry.yarnpkg.com/ajv/-/ajv-8.17.1.tgz#37d9a5c776af6bc92d7f4f9510eba4c0a60d11a6"
integrity sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==
dependencies:
fast-deep-equal "^3.1.3"
fast-uri "^3.0.1"
json-schema-traverse "^1.0.0"
require-from-string "^2.0.2"
ansi-escapes@^4.3.0:
version "4.3.2"
resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-4.3.2.tgz#6b2291d1db7d98b6521d5f1efa42d0f3a9feb65e"
@@ -628,6 +645,11 @@ at-least-node@^1.0.0:
resolved "https://registry.yarnpkg.com/at-least-node/-/at-least-node-1.0.0.tgz#602cd4b46e844ad4effc92a8011a3c46e0238dc2"
integrity sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==
atomically@^1.7.0:
version "1.7.0"
resolved "https://registry.yarnpkg.com/atomically/-/atomically-1.7.0.tgz#c07a0458432ea6dbc9a3506fffa424b48bccaafe"
integrity sha512-Xcz9l0z7y9yQ9rdDaxlmaI4uJHf/T8g9hOEzJcsEqX2SjCj4J20uK7+ldkDHMbpJDK76wF7xEIgxc/vSlsfw5w==
author-regex@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/author-regex/-/author-regex-1.0.0.tgz#d08885be6b9bbf9439fe087c76287245f0a81450"
@@ -912,6 +934,22 @@ concat-map@0.0.1:
resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b"
integrity sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=
conf@^10.2.0:
version "10.2.0"
resolved "https://registry.yarnpkg.com/conf/-/conf-10.2.0.tgz#838e757be963f1a2386dfe048a98f8f69f7b55d6"
integrity sha512-8fLl9F04EJqjSqH+QjITQfJF8BrOVaYr1jewVgSRAEWePfxT0sku4w2hrGQ60BC/TNLGQ2pgxNlTbWQmMPFvXg==
dependencies:
ajv "^8.6.3"
ajv-formats "^2.1.1"
atomically "^1.7.0"
debounce-fn "^4.0.0"
dot-prop "^6.0.1"
env-paths "^2.2.1"
json-schema-typed "^7.0.3"
onetime "^5.1.2"
pkg-up "^3.1.0"
semver "^7.3.5"
console-control-strings@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/console-control-strings/-/console-control-strings-1.1.0.tgz#3d7cf4464db6446ea644bf4b39507f9851008e8e"
@@ -977,6 +1015,13 @@ cuint@^0.2.2:
resolved "https://registry.yarnpkg.com/cuint/-/cuint-0.2.2.tgz#408086d409550c2631155619e9fa7bcadc3b991b"
integrity sha1-QICG1AlVDCYxFVYZ6fp7ytw7mRs=
debounce-fn@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/debounce-fn/-/debounce-fn-4.0.0.tgz#ed76d206d8a50e60de0dd66d494d82835ffe61c7"
integrity sha512-8pYCQiL9Xdcg0UPSD3d+0KMlOjp+KGU5EPwYddgzQ7DATsg4fuUDjQtsYLmWjnk2obnNHgV3vE2Y4jejSOJVBQ==
dependencies:
mimic-fn "^3.0.0"
debug@4, debug@^4.3.2, debug@^4.3.3, debug@^4.3.4:
version "4.3.4"
resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865"
@@ -1110,6 +1155,13 @@ domutils@^2.8.0:
domelementtype "^2.2.0"
domhandler "^4.2.0"
dot-prop@^6.0.1:
version "6.0.1"
resolved "https://registry.yarnpkg.com/dot-prop/-/dot-prop-6.0.1.tgz#fc26b3cf142b9e59b74dbd39ed66ce620c681083"
integrity sha512-tE7ztYzXHIeyvc7N+hR3oi7FIbf/NIjVP9hmAt3yMXzrQ072/fpjGLx2GxNxGxUl5V73MEqYzioOMoVhGMJ5cA==
dependencies:
is-obj "^2.0.0"
ds-store@^0.1.5:
version "0.1.6"
resolved "https://registry.yarnpkg.com/ds-store/-/ds-store-0.1.6.tgz#d1024ef746ed0c13f0f7fec85c7e858e8c4b7ca7"
@@ -1199,6 +1251,14 @@ electron-squirrel-startup@^1.0.0:
dependencies:
debug "^2.2.0"
electron-store@^8.2.0:
version "8.2.0"
resolved "https://registry.yarnpkg.com/electron-store/-/electron-store-8.2.0.tgz#114e6e453e8bb746ab4ccb542424d8c881ad2ca1"
integrity sha512-ukLL5Bevdil6oieAOXz3CMy+OgaItMiVBg701MNlG6W5RaC0AHN7rvlqTCmeb6O7jP0Qa1KKYTE0xV0xbhF4Hw==
dependencies:
conf "^10.2.0"
type-fest "^2.17.0"
electron-winstaller@^5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/electron-winstaller/-/electron-winstaller-5.0.0.tgz#0db968f34d498b16c69566a40848f562e70e7bcc"
@@ -1253,7 +1313,7 @@ entities@^2.0.0:
resolved "https://registry.yarnpkg.com/entities/-/entities-2.2.0.tgz#098dc90ebb83d8dffa089d55256b351d34c4da55"
integrity sha512-p92if5Nz619I0w+akJrLZH0MX0Pb5DX39XOwQTtXSdQQOaYH03S1uIQp4mhOZtAXrxq4ViO67YTiLBo2638o9A==
env-paths@^2.2.0:
env-paths@^2.2.0, env-paths@^2.2.1:
version "2.2.1"
resolved "https://registry.yarnpkg.com/env-paths/-/env-paths-2.2.1.tgz#420399d416ce1fbe9bc0a07c62fa68d67fd0f8f2"
integrity sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A==
@@ -1338,6 +1398,11 @@ extract-zip@^2.0.0, extract-zip@^2.0.1:
optionalDependencies:
"@types/yauzl" "^2.9.1"
fast-deep-equal@^3.1.3:
version "3.1.3"
resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525"
integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==
fast-glob@^3.2.7:
version "3.2.11"
resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.2.11.tgz#a1172ad95ceb8a16e20caa5c5e56480e5129c1d9"
@@ -1349,6 +1414,11 @@ fast-glob@^3.2.7:
merge2 "^1.3.0"
micromatch "^4.0.4"
fast-uri@^3.0.1:
version "3.0.1"
resolved "https://registry.yarnpkg.com/fast-uri/-/fast-uri-3.0.1.tgz#cddd2eecfc83a71c1be2cc2ef2061331be8a7134"
integrity sha512-MWipKbbYiYI0UC7cl8m/i/IWTqfC8YXsqjzybjddLsFjStroQzsHXkc73JutMvBiXmOvapk+axIl79ig5t55Bw==
fastq@^1.6.0:
version "1.13.0"
resolved "https://registry.yarnpkg.com/fastq/-/fastq-1.13.0.tgz#616760f88a7526bdfc596b7cab8c18938c36b98c"
@@ -1391,6 +1461,13 @@ find-up@^2.0.0:
dependencies:
locate-path "^2.0.0"
find-up@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/find-up/-/find-up-3.0.0.tgz#49169f1d7993430646da61ecc5ae355c21c97b73"
integrity sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==
dependencies:
locate-path "^3.0.0"
find-up@^4.0.0:
version "4.1.0"
resolved "https://registry.yarnpkg.com/find-up/-/find-up-4.1.0.tgz#97afe7d6cdc0bc5928584b7c8d7b16e8a9aa5d19"
@@ -1976,6 +2053,11 @@ is-number@^7.0.0:
resolved "https://registry.yarnpkg.com/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b"
integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==
is-obj@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/is-obj/-/is-obj-2.0.0.tgz#473fb05d973705e3fd9620545018ca8e22ef4982"
integrity sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w==
is-property@^1.0.0, is-property@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/is-property/-/is-property-1.0.2.tgz#57fe1c4e48474edd65b09911f26b1cd4095dda84"
@@ -2042,6 +2124,16 @@ json-buffer@3.0.1:
resolved "https://registry.yarnpkg.com/json-buffer/-/json-buffer-3.0.1.tgz#9338802a30d3b6605fbe0613e094008ca8c05a13"
integrity sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==
json-schema-traverse@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz#ae7bcb3656ab77a73ba5c49bf654f38e6b6860e2"
integrity sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==
json-schema-typed@^7.0.3:
version "7.0.3"
resolved "https://registry.yarnpkg.com/json-schema-typed/-/json-schema-typed-7.0.3.tgz#23ff481b8b4eebcd2ca123b4fa0409e66469a2d9"
integrity sha512-7DE8mpG+/fVw+dTpjbxnx47TaMnDfOI1jwft9g1VybltZCduyRQPJPvc+zzKY9WPHxhPWczyFuYa6I8Mw4iU5A==
json-stable-stringify@^1.0.2:
version "1.1.1"
resolved "https://registry.yarnpkg.com/json-stable-stringify/-/json-stable-stringify-1.1.1.tgz#52d4361b47d49168bcc4e564189a42e5a7439454"
@@ -2055,7 +2147,7 @@ json-stable-stringify@^1.0.2:
json-stringify-safe@^5.0.1:
version "5.0.1"
resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb"
integrity sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=
integrity sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==
jsonfile@^4.0.0:
version "4.0.0"
@@ -2151,6 +2243,14 @@ locate-path@^2.0.0:
p-locate "^2.0.0"
path-exists "^3.0.0"
locate-path@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-3.0.0.tgz#dbec3b3ab759758071b58fe59fc41871af21400e"
integrity sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==
dependencies:
p-locate "^3.0.0"
path-exists "^3.0.0"
locate-path@^5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-5.0.0.tgz#1afba396afd676a6d42504d0a67a3a7eb9f62aa0"
@@ -2306,6 +2406,11 @@ mimic-fn@^2.0.0, mimic-fn@^2.1.0:
resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b"
integrity sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==
mimic-fn@^3.0.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-3.1.0.tgz#65755145bbf3e36954b949c16450427451d5ca74"
integrity sha512-Ysbi9uYW9hFyfrThdDEQuykN4Ey6BuwPD2kpI5ES/nFTDn/98yxYNLZJcgUAKPT/mcrLLKaGzJR9YVxJrIdASQ==
mimic-response@^1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/mimic-response/-/mimic-response-1.0.1.tgz#4923538878eef42063cb8a3e3b0798781487ab1b"
@@ -2583,7 +2688,7 @@ once@^1.3.0, once@^1.3.1, once@^1.4.0:
dependencies:
wrappy "1"
onetime@^5.1.0:
onetime@^5.1.0, onetime@^5.1.2:
version "5.1.2"
resolved "https://registry.yarnpkg.com/onetime/-/onetime-5.1.2.tgz#d0e96ebb56b07476df1dd9c4806e5237985ca45e"
integrity sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==
@@ -2645,7 +2750,7 @@ p-limit@^1.1.0:
dependencies:
p-try "^1.0.0"
p-limit@^2.2.0:
p-limit@^2.0.0, p-limit@^2.2.0:
version "2.3.0"
resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.3.0.tgz#3dd33c647a214fdfffd835933eb086da0dc21db1"
integrity sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==
@@ -2666,6 +2771,13 @@ p-locate@^2.0.0:
dependencies:
p-limit "^1.1.0"
p-locate@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-3.0.0.tgz#322d69a05c0264b25997d9f40cd8a891ab0064a4"
integrity sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==
dependencies:
p-limit "^2.0.0"
p-locate@^4.1.0:
version "4.1.0"
resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-4.1.0.tgz#a3428bb7088b3a60292f66919278b7c297ad4f07"
@@ -2816,6 +2928,13 @@ pkg-dir@^4.2.0:
dependencies:
find-up "^4.0.0"
pkg-up@^3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/pkg-up/-/pkg-up-3.1.0.tgz#100ec235cc150e4fd42519412596a28512a0def5"
integrity sha512-nDywThFk1i4BQK4twPQ6TA4RT8bDY96yeuCVBWL3ePARCiEKDRSrNGbFIgUJpLp+XeIR65v8ra7WuJOFUBtkMA==
dependencies:
find-up "^3.0.0"
plist@^3.0.0, plist@^3.0.5:
version "3.0.5"
resolved "https://registry.yarnpkg.com/plist/-/plist-3.0.5.tgz#2cbeb52d10e3cdccccf0c11a63a85d830970a987"
@@ -2958,6 +3077,11 @@ require-directory@^2.1.1:
resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42"
integrity sha1-jGStX9MNqxyXbiNE/+f3kqam30I=
require-from-string@^2.0.2:
version "2.0.2"
resolved "https://registry.yarnpkg.com/require-from-string/-/require-from-string-2.0.2.tgz#89a7fdd938261267318eafe14f9c32e598c36909"
integrity sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==
resolve-alpn@^1.0.0:
version "1.1.1"
resolved "https://registry.yarnpkg.com/resolve-alpn/-/resolve-alpn-1.1.1.tgz#4a006a7d533c81a5dd04681612090fde227cd6e1"
@@ -3290,16 +3414,7 @@ stream-buffers@~2.2.0:
resolved "https://registry.yarnpkg.com/stream-buffers/-/stream-buffers-2.2.0.tgz#91d5f5130d1cef96dcfa7f726945188741d09ee4"
integrity sha1-kdX1Ew0c75bc+n9yaUUYh0HQnuQ=
"string-width-cjs@npm:string-width@^4.2.0":
version "4.2.3"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
dependencies:
emoji-regex "^8.0.0"
is-fullwidth-code-point "^3.0.0"
strip-ansi "^6.0.1"
"string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.2.3:
"string-width-cjs@npm:string-width@^4.2.0", "string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.2.3:
version "4.2.3"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
@@ -3340,7 +3455,7 @@ string_decoder@~1.1.1:
dependencies:
safe-buffer "~5.1.0"
"strip-ansi-cjs@npm:strip-ansi@^6.0.1":
"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.1:
version "6.0.1"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
@@ -3361,13 +3476,6 @@ strip-ansi@^6.0.0:
dependencies:
ansi-regex "^5.0.0"
strip-ansi@^6.0.1:
version "6.0.1"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
dependencies:
ansi-regex "^5.0.1"
strip-ansi@^7.0.1:
version "7.1.0"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-7.1.0.tgz#d5b6568ca689d8561370b0707685d22434faff45"
@@ -3533,6 +3641,11 @@ type-fest@^0.21.3:
resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.21.3.tgz#d260a24b0198436e133fa26a524a6d65fa3b2e37"
integrity sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==
type-fest@^2.17.0:
version "2.19.0"
resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-2.19.0.tgz#88068015bb33036a598b952e55e9311a60fd3a9b"
integrity sha512-RAH822pAdBgcNMAfWnCBU3CFZcfZ/i1eZjwFU/dsLKumyuuP3niueg2UAukXYF0E2AAoc82ZSSf9J0WQBinzHA==
undici-types@~5.26.4:
version "5.26.5"
resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-5.26.5.tgz#bcd539893d00b56e964fd2657a4866b221a65617"
@@ -3661,7 +3774,7 @@ word-wrap@^1.2.3:
resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.4.tgz#cb4b50ec9aca570abd1f52f33cd45b6c61739a9f"
integrity sha512-2V81OA4ugVo5pRo46hAoD2ivUJx8jXmWXfUkY4KFNw0hEptvN0QfH3K4nHiwzGeKl5rFKedV48QVoqYavy4YpA==
"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0":
"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0:
version "7.0.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
@@ -3679,15 +3792,6 @@ wrap-ansi@^6.2.0:
string-width "^4.1.0"
strip-ansi "^6.0.0"
wrap-ansi@^7.0.0:
version "7.0.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
dependencies:
ansi-styles "^4.0.0"
string-width "^4.1.0"
strip-ansi "^6.0.0"
wrap-ansi@^8.1.0:
version "8.1.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214"
@@ -8,15 +8,11 @@ import { setupRenderingTest } from 'ember-qunit';
import { render, find } from '@ember/test-helpers';
import { hbs } from 'ember-cli-htmlbars';
const USERNAME_SELECTOR = '[data-test-username]';
const AUTH_METHOD_SELECTOR = '[data-test-auth-method]';
const SIGNOUT_SELECTOR = '[data-test-signout-button]';
module('Integration | Component | settings card', function (hooks) {
setupRenderingTest(hooks);
test('it renders', async function (assert) {
await render(hbs`<SettingsCard
await render(hbs`<SettingsCard
@header='This is a heading test'
@icon='boundary'>
<:body></:body>
@@ -42,41 +38,4 @@ module('Integration | Component | settings card', function (hooks) {
'This is a heading test',
);
});
test('displays userinfo card correctly', async function (assert) {
this.authMethod = 'OIDC';
this.userInfo = 'testuser';
await render(hbs`
<SettingsCard
@header='This is a heading test'
@icon='boundary'>
<:body>
<div class='app-information'>
<div>
<Hds::Text::Body @tag='p' @weight='medium' data-test-auth-method>
{{this.authMethod}}
</Hds::Text::Body>
</div>
<div>
<Hds::Text::Body @tag='p' @weight='medium' data-test-username>
{{this.userInfo}}
</Hds::Text::Body>
</div>
</div>
</:body>
<:action>
<Hds::Button
data-test-signout-button
@text='sign out'
@color='critical'
@icon='sign-out'
@size='medium'
/>
</:action>
</SettingsCard>
`);
assert.dom(AUTH_METHOD_SELECTOR).hasText('OIDC');
assert.dom(USERNAME_SELECTOR).hasText('testuser');
assert.dom(SIGNOUT_SELECTOR).hasText('sign out');
});
});
@@ -0,0 +1,49 @@
/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: BUSL-1.1
*/
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render } from '@ember/test-helpers';
import { hbs } from 'ember-cli-htmlbars';
import { setupIntl } from 'ember-intl/test-support';
module('Integration | Component | settings-card/logs', function (hooks) {
setupRenderingTest(hooks);
setupIntl(hooks);
const SELECTED_OPTION = 'select option:checked';
const COPY_BUTTON_TEXT = '.hds-copy-snippet__text';
test('it renders and selects log levels correctly', async function (assert) {
const logPath = '/tmp/test.log';
this.set('model', {
logLevel: 'info',
logPath,
});
await render(hbs`<SettingsCard::Logs @model={{this.model}} />`);
assert.dom(SELECTED_OPTION).hasText('Info');
assert.dom(COPY_BUTTON_TEXT).hasText(logPath);
this.set('model', {
logLevel: 'error',
logPath,
});
assert.dom(SELECTED_OPTION).hasText('Error');
this.set('model', {
logLevel: 'warn',
logPath,
});
assert.dom(SELECTED_OPTION).hasText('Warn');
this.set('model', {
logLevel: 'debug',
logPath,
});
assert.dom(SELECTED_OPTION).hasText('Debug');
});
});
@@ -0,0 +1,79 @@
/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: BUSL-1.1
*/
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render } from '@ember/test-helpers';
import { hbs } from 'ember-cli-htmlbars';
import { setupIntl } from 'ember-intl/test-support';
import Service from '@ember/service';
const data = {
authenticated: {
username: 'admin',
authenticator: 'authenticator:password',
},
};
const USERNAME = '[data-test-username]';
const AUTH_METHOD_TYPE = '[data-test-auth-method]';
const AUTHENTICATION_BADGE = '.hds-badge__text';
module('Integration | Component | settings-card/user', function (hooks) {
setupRenderingTest(hooks);
setupIntl(hooks);
test('it renders password correctly', async function (assert) {
this.owner.register(
'service:session',
class extends Service {
data = data;
isAuthenticated = true;
},
);
await render(hbs`<SettingsCard::User />`);
assert.dom(AUTHENTICATION_BADGE).hasText('Authenticated');
assert.dom(AUTH_METHOD_TYPE).hasText('Password');
assert.dom(USERNAME).hasText('admin');
});
test('it renders OIDC correctly', async function (assert) {
let oidcData = structuredClone(data);
oidcData.authenticated.authenticator = 'authenticator:oidc';
this.owner.register(
'service:session',
class extends Service {
data = oidcData;
isAuthenticated = true;
},
);
await render(hbs`<SettingsCard::User />`);
assert.dom(AUTHENTICATION_BADGE).hasText('Authenticated');
assert.dom(AUTH_METHOD_TYPE).hasText('OIDC');
assert.dom(USERNAME).hasText('admin');
});
test('it renders LDAP correctly', async function (assert) {
let ldapData = structuredClone(data);
ldapData.authenticated.authenticator = 'authenticator:ldap';
this.owner.register(
'service:session',
class extends Service {
data = ldapData;
isAuthenticated = true;
},
);
await render(hbs`<SettingsCard::User />`);
assert.dom(AUTHENTICATION_BADGE).hasText('Authenticated');
assert.dom(AUTH_METHOD_TYPE).hasText('LDAP');
assert.dom(USERNAME).hasText('admin');
});
});