-
Notifications
You must be signed in to change notification settings - Fork 121
fix(hubble): harden frontend validation and update license dependencies #741
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
f35ea2a
51ab8b3
8a4e8d6
c171bae
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| /* | ||
| * | ||
| * Licensed to the Apache Software Foundation (ASF) under one or more | ||
| * contributor license agreements. See the NOTICE file distributed with this | ||
| * work for additional information regarding copyright ownership. The ASF | ||
| * licenses this file to You under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License 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 {fireEvent, render, screen} from '@testing-library/react'; | ||
|
|
||
| import * as api from '../../../../api/index'; | ||
| import GraphAnalysisContext from '../../../Context'; | ||
| import ContentCommon from './index'; | ||
|
|
||
| jest.mock('../../../../api/index', () => ({ | ||
| analysis: {addFavoriate: jest.fn().mockResolvedValue({status: 200})}, | ||
| })); | ||
| jest.mock('antd', () => ({ | ||
| ...jest.requireActual('antd'), | ||
| message: {success: jest.fn(), error: jest.fn()}, | ||
| })); | ||
| jest.mock('react-i18next', () => ({ | ||
| initReactI18next: {type: '3rdParty', init: jest.fn()}, | ||
| useTranslation: () => ({t: key => key}), | ||
| })); | ||
|
|
||
| const renderContent = () => render( | ||
| <GraphAnalysisContext.Provider value={{graphSpace: 'DEFAULT', graph: 'hugegraph'}}> | ||
| <ContentCommon | ||
| codeEditorContent='g.V()' | ||
| setCodeEditorContent={jest.fn()} | ||
| executeMode='QUERY' | ||
| onExecuteModeChange={jest.fn()} | ||
| activeTab='Gremlin' | ||
| onExecute={jest.fn()} | ||
| onRefresh={jest.fn()} | ||
| isEmptyQuery={false} | ||
| favoriteCardVisible | ||
| setFavoriteCardVisible={jest.fn()} | ||
| /> | ||
| </GraphAnalysisContext.Provider> | ||
| ); | ||
|
|
||
| beforeEach(() => { | ||
| api.analysis.addFavoriate.mockResolvedValue({status: 200}); | ||
| }); | ||
|
|
||
| test('keeps favorite submission disabled until the name is backend-compatible', () => { | ||
| renderContent(); | ||
| const input = screen.getByPlaceholderText('analysis.query.favorite_name_placeholder'); | ||
| const submit = screen.getAllByRole('button', {name: 'analysis.query.favorite'}) | ||
| .find(button => button.closest('.ant-popover')); | ||
| expect(submit).toBeDefined(); | ||
|
|
||
| fireEvent.change(input, {target: {value: 'query-name'}}); | ||
| expect(submit).toBeDisabled(); | ||
| fireEvent.click(submit); | ||
| expect(api.analysis.addFavoriate).not.toHaveBeenCalled(); | ||
|
|
||
| fireEvent.change(input, {target: {value: 'query_name'}}); | ||
| expect(submit).toBeEnabled(); | ||
| fireEvent.click(submit); | ||
| expect(api.analysis.addFavoriate).toHaveBeenCalledTimes(1); | ||
| }); |
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -31,3 +31,10 @@ | |||||||
| width: 160px; | ||||||||
| margin-bottom: 10px; | ||||||||
| } | ||||||||
|
|
||||||||
| .reason { | ||||||||
| width: 160px; | ||||||||
| color: #8c8c8c; | ||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||||||||
| Metric | Observed | Required / target |
|---|---|---|
| Text contrast | 3.36:1 | >= 4.5:1 |
The changed 12px reason text uses #8c8c8c over the white navigation background, producing a 3.36:1 contrast ratio.
References: WCAG 2.2 contrast minimum
Warning
Impact: Low-vision users may be unable to read the persistent explanation of why Dashboard operations are disabled.
🛠️ Suggested change
Use a darker text color that reaches at least 4.5:1, such as #595959, which provides approximately 7.00:1 contrast.
🤖 Codex review · GPT-5.6 Sol · effort: xhigh
Uh oh!
There was an error while loading. Please reload this page.