Skip to content

Commit 996cc33

Browse files
Merge branch 'main' into wreck-cert
2 parents 85f2e41 + e760893 commit 996cc33

30 files changed

+272
-185
lines changed

.github/workflows/cd.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ jobs:
2929
id: kbn_version
3030
run: |
3131
echo "::set-output name=kbn_version::$(jq -r '.kibana.version' ./kibana/plugins/opendistro_security/package.json)"
32+
- name: Get plugin version
33+
id: plugin_version
34+
run: |
35+
echo "::set-output name=plugin_version::$(jq -r .version ./kibana/plugins/opendistro_security/kibana.json)"
3236
- name: Use kibana release commit
3337
run: |
3438
cd ./kibana
@@ -52,16 +56,12 @@ jobs:
5256
run: |
5357
cd ./kibana
5458
yarn kbn bootstrap --oss
55-
- name: Hack step to update kibana source to unblock tsc
56-
run: |
57-
cd ./kibana
58-
sed -i '170d' src/core/server/http/router/request.ts
5959
- name: build security plugin
6060
id: build_zip
6161
run: |
6262
cd ./kibana/plugins/opendistro_security
63-
node build_tools/build_plugin.js
64-
artifact_path=`ls $(pwd)/build/opendistro_security_kibana_plugin-*.zip`
63+
yarn build --kibana-version ${{ steps.kbn_version.outputs.kbn_version }}
64+
artifact_path=`ls $(pwd)/build/opendistroSecurity*.zip`
6565
artifact_name=`basename $artifact_path`
6666
echo "::set-output name=ARTIFACT_PATH::$artifact_path"
6767
echo "::set-output name=ARTIFACT_NAME::$artifact_name"
@@ -74,5 +74,5 @@ jobs:
7474
- name: Upload Artifacts to S3
7575
run: |
7676
s3_path=s3://artifacts.opendistroforelasticsearch.amazon.com/downloads
77-
aws s3 cp ${{ steps.build_zip.outputs.ARTIFACT_PATH }} $s3_path/kibana-plugins/opendistro-security/
77+
aws s3 cp ${{ steps.build_zip.outputs.ARTIFACT_PATH }} $s3_path/kibana-plugins/opendistro-security/opendistroSecurityKibana-${{ steps.plugin_version.outputs.plugin_version }}.zip
7878
aws cloudfront create-invalidation --distribution-id ${{ secrets.DISTRIBUTION_ID }} --paths '/downloads/*'

.github/workflows/ci.yml

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,6 @@ jobs:
5959
run: |
6060
cd ./kibana/plugins/opendistro_security
6161
yarn lint
62-
- name: Hack step to update kibana source to unblock tsc
63-
run: |
64-
cd ./kibana
65-
sed -i '170d' src/core/server/http/router/request.ts
66-
- name: Run check
67-
run: |
68-
cd ./kibana/plugins/opendistro_security
69-
yarn tsc
7062
- name: Run unit test
7163
run: |
7264
cd ./kibana/plugins/opendistro_security
@@ -79,8 +71,8 @@ jobs:
7971
id: build_zip
8072
run: |
8173
cd ./kibana/plugins/opendistro_security
82-
node build_tools/build_plugin.js
83-
artifact_path=`ls $(pwd)/build/opendistro_security_kibana_plugin-*.zip`
74+
yarn build --kibana-version ${{ steps.kbn_version.outputs.kbn_version }}
75+
artifact_path=`ls $(pwd)/build/opendistroSecurityKibana-*.zip`
8476
artifact_name=`basename $artifact_path`
8577
echo "::set-output name=ARTIFACT_PATH::$artifact_path"
8678
echo "::set-output name=ARTIFACT_NAME::$artifact_name"

.github/workflows/integration-test.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,11 @@ jobs:
1313
name: Run integration tests
1414
runs-on: ubuntu-latest
1515
steps:
16-
1716
- name: Set up JDK 14
1817
uses: actions/setup-java@v1
1918
with:
2019
java-version: 14
21-
20+
2221
- name: Checkout Kibana
2322
uses: actions/checkout@v2
2423
with:

.kibana-plugin-helpers.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"buildSourcePatterns": [
3+
"package.json",
4+
"yarn.lock",
5+
"kibana.json",
6+
"{common,lib,server,webpackShims,translations,utils,target}/**/*",
7+
"!*test*"
8+
]
9+
}

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ To build the security-kibana plugin from source follow these instructions:
3232
│ └── plugins
3333
│ └── opendistro_security
3434
```
35-
* run the build script to build the plugin inside `kibana/plugins/opendistro_security` directory
36-
`node build_tools/build_plugin.js`
35+
* run `yarn build` to build the plugin inside `kibana/plugins/opendistro_security` directory
3736

3837
The above builds the final artifacts in zip format. The artifacts can be found in the `kibana/plugins/opendistro_security/build` directory
3938

build_tools/build_plugin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* express or implied. See the License for the specific language governing
1313
* permissions and limitations under the License.
1414
*/
15-
require('../../../src/setup_node_env/prebuilt_dev_only_entry');
15+
require('../../../src/setup_node_env/no_transpilation');
1616

1717
const execa = require('execa');
1818
const optimizer = require('@kbn/optimizer');

kibana.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"id": "opendistroSecurity",
3-
"version": "1.11.0",
2+
"id": "opendistroSecurityKibana",
3+
"version": "1.12.0.0",
44
"kibanaVersion": "kibana",
55
"configPath": ["opendistro_security"],
66
"requiredPlugins": ["navigation"],

package.json

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
{
22
"name": "opendistro_security",
3-
"version": "1.11.0.0",
3+
"version": "1.12.0.0",
44
"main": "target/plugins/opendistro_security",
55
"kibana": {
6-
"version": "7.9.1",
6+
"version": "7.10.0",
77
"templateVersion": "1.0.0"
88
},
99
"license": "Apache-2.0",
1010
"scripts": {
11-
"kbn": "node ../../scripts/kbn.js",
12-
"build": "rm -rf './target' && tsc",
11+
"plugin-helpers": "node ../../scripts/plugin_helpers",
12+
"kbn": "node ../../scripts/kbn",
13+
"build": "yarn plugin-helpers build",
1314
"start": "node ../../scripts/kibana --dev",
1415
"lint:es": "node ../../scripts/eslint",
1516
"lint:sass": "node ../../scripts/sasslint",
@@ -18,12 +19,13 @@
1819
"test:jest_ui": "node ./test/run_jest_tests.js --config ./test/jest.config.ui.js"
1920
},
2021
"devDependencies": {
21-
"typescript": "3.9.5",
22+
"typescript": "4.0.2",
2223
"gulp-rename": "2.0.0",
23-
"@testing-library/react-hooks": "^3.4.1"
24+
"@testing-library/react-hooks": "^3.4.1",
25+
"@types/hapi__wreck": "^15.0.1"
2426
},
2527
"dependencies": {
26-
"@hapi/wreck": "17.0.0",
28+
"@hapi/wreck": "^15.0.2",
2729
"@hapi/cryptiles": "5.0.0",
2830
"html-entities": "1.3.1"
2931
}

public/apps/account/account-nav-button.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -139,20 +139,19 @@ export function AccountNavButton(props: {
139139
</div>
140140
);
141141
return (
142-
<EuiHeaderSectionItemButton
143-
data-test-subj="account-header-section-button"
144-
onClick={() => {
145-
setPopoverOpen((prevState) => !prevState);
146-
}}
147-
>
142+
<EuiHeaderSectionItemButton>
148143
<EuiPopover
144+
data-test-subj="account-popover"
149145
id="actionsMenu"
150146
button={<EuiAvatar name={username} />}
151147
isOpen={isPopoverOpen}
152148
closePopover={() => {
153149
setPopoverOpen(false);
154150
}}
155151
panelPaddingSize="s"
152+
onClick={() => {
153+
setPopoverOpen((prevState) => !prevState);
154+
}}
156155
>
157156
<EuiContextMenuPanel>{contextMenuPanel}</EuiContextMenuPanel>
158157
</EuiPopover>

public/apps/account/tenant-switch-panel.tsx

Lines changed: 29 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,14 @@ import {
1818
EuiButtonEmpty,
1919
EuiCallOut,
2020
EuiCheckbox,
21+
EuiComboBox,
22+
EuiComboBoxOptionOption,
2123
EuiModal,
2224
EuiModalBody,
2325
EuiModalFooter,
2426
EuiOverlayMask,
2527
EuiRadioGroup,
2628
EuiSpacer,
27-
EuiSuperSelect,
2829
EuiText,
2930
EuiTitle,
3031
} from '@elastic/eui';
@@ -59,7 +60,9 @@ export function TenantSwitchPanel(props: TenantSwitchPanelProps) {
5960
const [username, setUsername] = React.useState<string>('');
6061
const [errorCallOut, setErrorCallOut] = React.useState<string>('');
6162
const [tenantSwitchRadioIdSelected, setTenantSwitchRadioIdSelected] = React.useState<string>();
62-
const [selectedCustomTenantOption, setSelectedCustomTenantOption] = React.useState<string>('');
63+
const [selectedCustomTenantOption, setSelectedCustomTenantOption] = React.useState<
64+
EuiComboBoxOptionOption[]
65+
>([]);
6366

6467
// If saved tenant is present, set remember option to true
6568
const [rememberSelection, setRememberSelection] = React.useState<boolean>(
@@ -75,7 +78,7 @@ export function TenantSwitchPanel(props: TenantSwitchPanelProps) {
7578
setTenantSwitchRadioIdSelected(PRIVATE_TENANT_RADIO_ID);
7679
} else {
7780
setTenantSwitchRadioIdSelected(CUSTOM_TENANT_RADIO_ID);
78-
setSelectedCustomTenantOption(resolvedTenantName);
81+
setSelectedCustomTenantOption([{ label: resolvedTenantName }]);
7982
}
8083
};
8184

@@ -102,14 +105,19 @@ export function TenantSwitchPanel(props: TenantSwitchPanelProps) {
102105
}, [props.coreStart.http]);
103106

104107
// Custom tenant super select related.
105-
const onCustomTenantChange = (selectedOption: string) => {
108+
const onCustomTenantChange = (selectedOption: EuiComboBoxOptionOption[]) => {
106109
setSelectedCustomTenantOption(selectedOption);
107110
setTenantSwitchRadioIdSelected(CUSTOM_TENANT_RADIO_ID);
108111
setErrorCallOut('');
109112
};
110-
const customTenantOptions = tenants.filter((tenant) => {
111-
return tenant !== GLOBAL_TENANT_KEY_NAME && tenant !== username;
112-
});
113+
const customTenantOptions = tenants
114+
.filter((tenant) => {
115+
return tenant !== GLOBAL_TENANT_KEY_NAME && tenant !== username;
116+
})
117+
.sort()
118+
.map((option: string) => ({
119+
label: option,
120+
}));
113121

114122
const isMultiTenancyEnabled = props.config.multitenancy.enabled;
115123
const isGlobalEnabled = props.config.multitenancy.tenants.enable_global;
@@ -169,20 +177,7 @@ export function TenantSwitchPanel(props: TenantSwitchPanelProps) {
169177
},
170178
{
171179
id: CUSTOM_TENANT_RADIO_ID,
172-
label: (
173-
<>
174-
Choose from custom
175-
<EuiSuperSelect
176-
options={customTenantOptions.map((option: string) => ({
177-
value: option,
178-
inputDisplay: option,
179-
}))}
180-
valueOfSelected={selectedCustomTenantOption}
181-
onChange={onCustomTenantChange}
182-
style={{ width: 400 }}
183-
/>
184-
</>
185-
),
180+
label: <>Choose from custom</>,
186181
disabled: customTenantOptions.length === 0,
187182
},
188183
];
@@ -208,7 +203,7 @@ export function TenantSwitchPanel(props: TenantSwitchPanelProps) {
208203
tenantName = '__user__';
209204
} else if (tenantSwitchRadioIdSelected === CUSTOM_TENANT_RADIO_ID) {
210205
if (selectedCustomTenantOption) {
211-
tenantName = selectedCustomTenantOption;
206+
tenantName = selectedCustomTenantOption[0].label;
212207
}
213208
}
214209

@@ -244,6 +239,18 @@ export function TenantSwitchPanel(props: TenantSwitchPanelProps) {
244239
name="tenantSwitchRadios"
245240
/>
246241

242+
{/* This combo box has to be outside the radio group.
243+
In current EUI if put into the child of radio option, clicking in the combo box will not
244+
show the drop down list since the radio option consumes the click event. */}
245+
<EuiComboBox
246+
options={customTenantOptions}
247+
singleSelection={{ asPlainText: true }}
248+
selectedOptions={selectedCustomTenantOption}
249+
onChange={onCustomTenantChange}
250+
// For vertical alignment with the radio option.
251+
style={{ marginLeft: '24px' }}
252+
/>
253+
247254
<EuiSpacer />
248255

249256
{errorCallOut && (

public/apps/account/test/__snapshots__/account-nav-button.test.tsx.snap

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

33
exports[`Account navigation button renders 1`] = `
4-
<EuiHeaderSectionItemButton
5-
data-test-subj="account-header-section-button"
6-
onClick={[Function]}
7-
>
4+
<EuiHeaderSectionItemButton>
85
<EuiPopover
96
anchorPosition="downCenter"
107
button={
@@ -13,10 +10,12 @@ exports[`Account navigation button renders 1`] = `
1310
/>
1411
}
1512
closePopover={[Function]}
13+
data-test-subj="account-popover"
1614
display="inlineBlock"
1715
hasArrow={true}
1816
id="actionsMenu"
1917
isOpen={false}
18+
onClick={[Function]}
2019
ownFocus={false}
2120
panelPaddingSize="s"
2221
>

0 commit comments

Comments
 (0)