Skip to content

Commit

Permalink
Updates variable name and fixes indentation
Browse files Browse the repository at this point in the history
Signed-off-by: Darshit Chanpura <[email protected]>
  • Loading branch information
DarshitChanpura committed Aug 7, 2024
1 parent d4e5da3 commit f4f6278
Show file tree
Hide file tree
Showing 12 changed files with 42 additions and 49 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ export function AuditLogging(props: AuditLoggingProps) {
</>
);
}
const updatedUX = props.coreStart.uiSettings.get('home:useNewHomePage');
const useUpdatedUX = props.coreStart.uiSettings.get('home:useNewHomePage');

return (
<div className="panel-restrict-width">
Expand All @@ -260,7 +260,7 @@ export function AuditLogging(props: AuditLoggingProps) {
setDataSource={setDataSource}
selectedDataSource={dataSource}
/>
{updatedUX ? (
{useUpdatedUX ? (
<HeaderTitle
navigation={props.depsStart.navigation}
pageHeader="Audit Logs"
Expand Down
6 changes: 3 additions & 3 deletions public/apps/configuration/panels/auth-view/auth-view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export function AuthView(props: AppDependencies) {
fetchData();
}, [props.coreStart.http, dataSource]);

const updatedUX = props.coreStart.uiSettings.get('home:useNewHomePage');
const useUpdatedUX = props.coreStart.uiSettings.get('home:useNewHomePage');

const buttonData = [
{
Expand All @@ -84,7 +84,7 @@ export function AuthView(props: AppDependencies) {
setDataSource={setDataSource}
selectedDataSource={dataSource}
/>
{updatedUX ? (
{useUpdatedUX ? (
<>
<HeaderTitle
navigation={props.depsStart.navigation}
Expand Down Expand Up @@ -127,7 +127,7 @@ export function AuthView(props: AppDependencies) {
setDataSource={setDataSource}
selectedDataSource={dataSource}
/>
{updatedUX ? (
{useUpdatedUX ? (
<>
<HeaderTitle
navigation={props.depsStart.navigation}
Expand Down
4 changes: 2 additions & 2 deletions public/apps/configuration/panels/get-started.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ export function GetStarted(props: AppDependencies) {
const dataSourceEnabled = !!props.depsStart.dataSource?.dataSourceEnabled;
const { dataSource, setDataSource } = useContext(DataSourceContext)!;

const updatedUX = props.coreStart.uiSettings.get('home:useNewHomePage');
const useUpdatedUX = props.coreStart.uiSettings.get('home:useNewHomePage');

let steps;
if (props.config.ui.backend_configurable) {
Expand Down Expand Up @@ -196,7 +196,7 @@ export function GetStarted(props: AppDependencies) {
setDataSource={setDataSource}
selectedDataSource={dataSource}
/>
{updatedUX ? (
{useUpdatedUX ? (
<>
<HeaderTitle
navigation={props.depsStart.navigation}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ export function InternalUserEdit(props: InternalUserEditDeps) {
}
};

const updatedUX = props.coreStart.uiSettings.get('home:useNewHomePage');
const useUpdatedUX = props.coreStart.uiSettings.get('home:useNewHomePage');

const descriptionData = [
{
Expand All @@ -170,7 +170,7 @@ export function InternalUserEdit(props: InternalUserEditDeps) {
setDataSource={setDataSource}
selectedDataSource={dataSource}
/>
{updatedUX ? (
{useUpdatedUX ? (
<>
<HeaderTitle
navigation={props.depsStart.navigation}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -354,13 +354,13 @@ export function PermissionList(props: AppDependencies) {
</EuiSmallButtonEmpty>,
];

const updatedUX = props.coreStart.uiSettings.get('home:useNewHomePage');
const useUpdatedUX = props.coreStart.uiSettings.get('home:useNewHomePage');

const [createActionGroupMenu] = useContextMenuState(
'Create action group',
{ fill: true },
createActionGroupMenuItems,
updatedUX
useUpdatedUX
);

const buttonData = [
Expand Down Expand Up @@ -397,7 +397,7 @@ export function PermissionList(props: AppDependencies) {
setDataSource={setDataSource}
selectedDataSource={dataSource}
/>
{updatedUX ? (
{useUpdatedUX ? (
<>
<HeaderTitle
navigation={props.depsStart.navigation}
Expand Down Expand Up @@ -431,7 +431,7 @@ export function PermissionList(props: AppDependencies) {
<AccessErrorComponent loading={loading} dataSourceLabel={dataSource && dataSource.label} />
) : (
<EuiPageContent>
{updatedUX ? null : (
{useUpdatedUX ? null : (
<EuiPageContentHeader>
<EuiPageContentHeaderSection>
<EuiTitle size="s">
Expand Down Expand Up @@ -478,7 +478,7 @@ export function PermissionList(props: AppDependencies) {
setQuery(arg.query);
return true;
},
toolsRight: updatedUX ? [<EuiFlexItem>{actionsMenu}</EuiFlexItem>] : undefined,
toolsRight: useUpdatedUX ? [<EuiFlexItem>{actionsMenu}</EuiFlexItem>] : undefined,
}}
selection={{ onSelectionChange: setSelection }}
sorting={{ sort: { field: 'type', direction: 'asc' } }}
Expand Down
4 changes: 2 additions & 2 deletions public/apps/configuration/panels/role-edit/role-edit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ export function RoleEdit(props: RoleEditDeps) {

const tenantOptions = tenantNames.map(stringToComboBoxOption);

const updatedUX = props.coreStart.uiSettings.get('home:useNewHomePage');
const useUpdatedUX = props.coreStart.uiSettings.get('home:useNewHomePage');

const descriptionData = [
{
Expand All @@ -259,7 +259,7 @@ export function RoleEdit(props: RoleEditDeps) {
setDataSource={setDataSource}
selectedDataSource={dataSource}
/>
{updatedUX ? (
{useUpdatedUX ? (
<>
<HeaderTitle
navigation={props.depsStart.navigation}
Expand Down
14 changes: 5 additions & 9 deletions public/apps/configuration/panels/role-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,6 @@ export function RoleList(props: AppDependencies) {
const [searchOptions, setSearchOptions] = useState<EuiSearchBarProps>({});
const [query, setQuery] = useState<Query | null>(null);

const updatedUX = props.coreStart.uiSettings.get('home:useNewHomePage');

useEffect(() => {
setSearchOptions({
onChange: (arg) => {
Expand Down Expand Up @@ -264,6 +262,7 @@ export function RoleList(props: AppDependencies) {
});
}, [roleData]);

const useUpdatedUX = props.coreStart.uiSettings.get('home:useNewHomePage');
const buttonData = [
{
label: 'Create role',
Expand Down Expand Up @@ -303,7 +302,7 @@ export function RoleList(props: AppDependencies) {
setDataSource={setDataSource}
selectedDataSource={dataSource}
/>
{updatedUX ? (
{useUpdatedUX ? (
<>
<HeaderTitle
navigation={props.depsStart.navigation}
Expand Down Expand Up @@ -337,16 +336,13 @@ export function RoleList(props: AppDependencies) {
<AccessErrorComponent loading={loading} dataSourceLabel={dataSource && dataSource.label} />
) : (
<EuiPageContent>
{updatedUX ? null : (
{useUpdatedUX ? null : (
<EuiPageContentHeader id="role-table-container">
<EuiPageContentHeaderSection>
<EuiTitle size="s">
<h3>
Roles
<span className="panel-header-count">
{' '}
({Query.execute(query || '', roleData).length})
</span>
<span className="panel-header-count"> ({roleLen})</span>
</h3>
</EuiTitle>
<EuiText size="xs" color="subdued">
Expand Down Expand Up @@ -385,7 +381,7 @@ export function RoleList(props: AppDependencies) {
sorting={true}
search={{
...searchOptions,
toolsRight: updatedUX ? [<EuiFlexItem>{actionsMenu}</EuiFlexItem>] : undefined,
toolsRight: useUpdatedUX ? [<EuiFlexItem>{actionsMenu}</EuiFlexItem>] : undefined,
}}
error={errorFlag ? 'Load data failed, please check console log for more detail.' : ''}
message={showTableStatusMessage(loading, roleData)}
Expand Down
4 changes: 2 additions & 2 deletions public/apps/configuration/panels/role-view/role-view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ export function RoleView(props: RoleViewProps) {
</EuiSmallButtonEmpty>,
];
const [actionsMenu] = useContextMenuState('Actions', {}, actionsMenuItems);
const updatedUX = props.coreStart.uiSettings.get('home:useNewHomePage');
const useUpdatedUX = props.coreStart.uiSettings.get('home:useNewHomePage');

if (isReserved) {
pageActions = <EuiSmallButton href={duplicateRoleLink}>Duplicate role</EuiSmallButton>;
Expand Down Expand Up @@ -456,7 +456,7 @@ export function RoleView(props: RoleViewProps) {
setDataSource={setDataSource}
selectedDataSource={dataSource}
/>
{updatedUX ? (
{useUpdatedUX ? (
<>
<HeaderTitle
navigation={props.depsStart.navigation}
Expand Down
4 changes: 2 additions & 2 deletions public/apps/configuration/panels/tenant-list/manage_tab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ export function ManageTab(props: AppDependencies) {
/>
);
}
const updatedUX = props.coreStart.uiSettings.get('home:useNewHomePage');
const useUpdatedUX = props.coreStart.uiSettings.get('home:useNewHomePage');
const createTenantButton = [
{
id: 'createTenant',
Expand Down Expand Up @@ -543,7 +543,7 @@ export function ManageTab(props: AppDependencies) {
<EuiPageContentHeaderSection>
<EuiFlexGroup>
<EuiFlexItem>{actionsMenu}</EuiFlexItem>
{ updatedUX ?
{ useUpdatedUX ?
<HeaderButtonOrLink
navigation={props.depsStart.navigation}
controls={createTenantButton}
Expand Down
18 changes: 9 additions & 9 deletions public/apps/configuration/panels/tenant-list/tenant-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,15 +128,16 @@ export function TenantList(props: TenantListProps) {
));
};

const updatedUX = props.coreStart.uiSettings.get('home:useNewHomePage');
const useUpdatedUX = props.coreStart.uiSettings.get('home:useNewHomePage');
const descriptionData = [
{
renderComponent: (
<EuiText size="s" color="subdued" grow={true} textAlign={'left'}>
Tenants in OpenSearch Dashboards are spaces for saving index patterns, visualizations,
dashboards, and other OpenSearch Dashboards objects. Tenants are useful for safely sharing
your work with other OpenSearch Dashboards users. You can control which roles have access
to a tenant and whether those roles have read or write access.{' '}
dashboards, and other OpenSearch
<br /> Dashboards objects. Tenants are useful for safely sharing your work with other
OpenSearch Dashboards users. You can control <br />
which roles have access to a tenant and whether those roles have read or write access.{' '}
<ExternalLink href={DocLinks.MultiTenancyDoc} />
</EuiText>
),
Expand All @@ -151,7 +152,7 @@ export function TenantList(props: TenantListProps) {
setDataSource={() => {}}
selectedDataSource={LocalCluster}
/>
{updatedUX ? (
{useUpdatedUX ? (
<>
<HeaderTitle
navigation={props.depsStart.navigation}
Expand All @@ -174,10 +175,9 @@ export function TenantList(props: TenantListProps) {
</EuiPageHeader>
<EuiText size="s" color="subdued" grow={true} textAlign={'left'}>
Tenants in OpenSearch Dashboards are spaces for saving index patterns, visualizations,
dashboards, and other OpenSearch
<br /> Dashboards objects. Tenants are useful for safely sharing your work with other
OpenSearch Dashboards users. You can control <br />
which roles have access to a tenant and whether those roles have read or write access.{' '}
dashboards, and other OpenSearch Dashboards objects. Tenants are useful for safely
sharing your work with other OpenSearch Dashboards users. You can control which roles
have access to a tenant and whether those roles have read or write access.{' '}
<ExternalLink href={DocLinks.MultiTenancyDoc} />
</EuiText>
</>
Expand Down
13 changes: 5 additions & 8 deletions public/apps/configuration/panels/user-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ export function UserList(props: AppDependencies) {

const [actionsMenu, closeActionsMenu] = useContextMenuState('Actions', {}, actionsMenuItems);

const updatedUX = props.coreStart.uiSettings.get('home:useNewHomePage');
const useUpdatedUX = props.coreStart.uiSettings.get('home:useNewHomePage');
const buttonData = [
{
label: 'Create internal user',
Expand Down Expand Up @@ -244,7 +244,7 @@ export function UserList(props: AppDependencies) {
setDataSource={setDataSource}
selectedDataSource={dataSource}
/>
{updatedUX ? (
{useUpdatedUX ? (
<>
<HeaderTitle
navigation={props.depsStart.navigation}
Expand Down Expand Up @@ -278,16 +278,13 @@ export function UserList(props: AppDependencies) {
<AccessErrorComponent loading={loading} dataSourceLabel={dataSource && dataSource.label} />
) : (
<EuiPageContent>
{updatedUX ? null : (
{useUpdatedUX ? null : (
<EuiPageContentHeader>
<EuiPageContentHeaderSection>
<EuiTitle size="s">
<h3>
Internal users
<span className="panel-header-count">
{' '}
({Query.execute(query || '', userData).length})
</span>
<span className="panel-header-count"> ({userLen})</span>
</h3>
</EuiTitle>
<EuiText size="xs" color="subdued">
Expand Down Expand Up @@ -330,7 +327,7 @@ export function UserList(props: AppDependencies) {
setQuery(arg.query);
return true;
},
toolsRight: updatedUX ? [<EuiFlexItem>{actionsMenu}</EuiFlexItem>] : undefined,
toolsRight: useUpdatedUX ? [<EuiFlexItem>{actionsMenu}</EuiFlexItem>] : undefined,
}}
// @ts-ignore
selection={{ onSelectionChange: setSelection }}
Expand Down
6 changes: 3 additions & 3 deletions public/apps/configuration/utils/context-menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ export function useContextMenuState(
buttonText: string,
buttonProps: EuiButtonProps,
children: React.ReactElement[],
updatedUX?: boolean
useUpdatedUX?: boolean
): [React.ReactElement, () => void] {
const [isContextMenuOpen, setContextMenuOpen] = useState<boolean>(false);
const closeContextMenu = () => setContextMenuOpen(false);

const button = (
<EuiSmallButton
iconType={updatedUX ? 'plus' : 'arrowDown'}
iconSide={updatedUX ? 'left' : 'right'}
iconType={useUpdatedUX ? 'plus' : 'arrowDown'}
iconSide={useUpdatedUX ? 'left' : 'right'}
onClick={() => {
setContextMenuOpen(!isContextMenuOpen);
}}
Expand Down

0 comments on commit f4f6278

Please sign in to comment.