Skip to content

Commit

Permalink
add instruction view for tenant list when multitenancy is disabled (o…
Browse files Browse the repository at this point in the history
…pensearch-project#546)

* add instruction view for tenant list when multitenancy is disabled

* wording update by UX
  • Loading branch information
tianleh authored Oct 21, 2020
1 parent dd5a0e0 commit c36fdd6
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/

import React from 'react';
import { EuiSpacer, EuiText, EuiTitle } from '@elastic/eui';

export function TenantInstructionView() {
return (
<>
<EuiTitle size="l">
<h1>Tenants</h1>
</EuiTitle>

<EuiSpacer size="xxl" />

<EuiText textAlign="center">
<h2>You have not enabled multi tenancy</h2>
</EuiText>

<EuiText textAlign="center" size="xs" color="subdued" className="instruction-text">
Contact your administrator to enable multi tenancy.
</EuiText>
</>
);
}
7 changes: 6 additions & 1 deletion public/apps/configuration/panels/tenant-list/tenant-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import {
EuiGlobalToastList,
Query,
} from '@elastic/eui';
import React, { ReactNode, useEffect, useState, useCallback } from 'react';
import React, { ReactNode, useState, useCallback } from 'react';
import { difference } from 'lodash';
import { getCurrentUser } from '../../../../utils/auth-info-utils';
import { AppDependencies } from '../../../types';
Expand Down Expand Up @@ -59,6 +59,7 @@ import { showTableStatusMessage } from '../../utils/loading-spinner-utils';
import { useContextMenuState } from '../../utils/context-menu';
import { generateResourceName } from '../../utils/resource-utils';
import { DocLinks } from '../../constants';
import { TenantInstructionView } from './tenant-instruction-view';

export function TenantList(props: AppDependencies) {
const [tenantData, setTenantData] = React.useState<Tenant[]>([]);
Expand Down Expand Up @@ -319,6 +320,10 @@ export function TenantList(props: AppDependencies) {
);
};

if (!props.config.multitenancy.enabled) {
return <TenantInstructionView />;
}

return (
<>
<EuiPageHeader>
Expand Down

0 comments on commit c36fdd6

Please sign in to comment.