-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(System): new regexp shortname [YTFRONT-4386]
- Loading branch information
1 parent
c0445f3
commit 16637c2
Showing
5 changed files
with
27 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 2 additions & 4 deletions
6
packages/ui/src/ui/pages/system/helpers/makeShortSystemAddress.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,9 @@ | ||
import {makeRegexpFromSettings} from '../../../../shared/utils'; | ||
import {uiSettings} from '../../../config/ui-settings'; | ||
|
||
const reShortNameFromSystemAddress = makeRegexpFromSettings( | ||
uiSettings.reShortNameFromSystemAddress, | ||
); | ||
const reShortNameSystemPage = makeRegexpFromSettings(uiSettings.reShortNameSystemPage); | ||
|
||
export const makeShortSystemAddress = (address: string): string | undefined => { | ||
const res = reShortNameFromSystemAddress?.exec(address); | ||
const res = reShortNameSystemPage?.exec(address); | ||
return res?.groups?.shortname; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import {expect, test} from '@playwright/test'; | ||
import {makeClusterUrl} from '../../utils'; | ||
|
||
test('System: check short name', async ({page}) => { | ||
const url = makeClusterUrl(`system/general`); | ||
await page.goto(url); | ||
|
||
await page.waitForSelector('.system'); | ||
await page.evaluate(() => { | ||
const allMastersContainer = document.querySelector('.system-master__all-masters'); | ||
if (!allMastersContainer) { | ||
const button = document.querySelector<HTMLSpanElement>('.collapsible-section__title'); | ||
if (button) button.click(); | ||
} | ||
}); | ||
|
||
const mastersNameElements = await page.$$('.master-group__host-name'); | ||
const firstMasterName = await mastersNameElements[0].innerText(); | ||
expect(firstMasterName).toEqual('local'); | ||
}); |