mirror of
https://github.com/apache/superset.git
synced 2026-06-05 15:49:27 +00:00
fix: Color consistency (#17089)
* Update label colors on the fly * Clean up * Improve getFormDataWithExtraFilters * Improve code structure * Remove labelColors from formData * Exclude label_colors from URL * Refactor color scheme implementation * Clean up * Refactor and simplify * Fix lint * Remove unnecessary ColorMapControl * Lint * Give json color scheme precedence * Add label_colors prop in metadata * Separate owners and dashboard meta requests * Remove label_colors control * bump superset-ui 0.18.19 * Fix end of file * Update tests * Fix lint * Update Cypress * Update setColorScheme method * Use Antd modal body
This commit is contained in:
@@ -16,7 +16,7 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import React, { useMemo, useState, useEffect, useCallback } from 'react';
|
||||
import React, { useMemo, useState, useCallback, useEffect } from 'react';
|
||||
import Modal from 'src/components/Modal';
|
||||
import { Row, Col, Input, TextArea } from 'src/common/components';
|
||||
import Button from 'src/components/Button';
|
||||
@@ -33,6 +33,8 @@ type PropertiesModalProps = {
|
||||
show: boolean;
|
||||
onHide: () => void;
|
||||
onSave: (chart: Chart) => void;
|
||||
permissionsError?: string;
|
||||
existingOwners?: SelectValue;
|
||||
};
|
||||
|
||||
export default function PropertiesModal({
|
||||
@@ -42,16 +44,15 @@ export default function PropertiesModal({
|
||||
show,
|
||||
}: PropertiesModalProps) {
|
||||
const [submitting, setSubmitting] = useState(false);
|
||||
|
||||
const [selectedOwners, setSelectedOwners] = useState<SelectValue | null>(
|
||||
null,
|
||||
);
|
||||
// values of form inputs
|
||||
const [name, setName] = useState(slice.slice_name || '');
|
||||
const [description, setDescription] = useState(slice.description || '');
|
||||
const [cacheTimeout, setCacheTimeout] = useState(
|
||||
slice.cache_timeout != null ? slice.cache_timeout : '',
|
||||
);
|
||||
const [selectedOwners, setSelectedOwners] = useState<SelectValue | null>(
|
||||
null,
|
||||
);
|
||||
|
||||
function showError({ error, statusText, message }: any) {
|
||||
let errorText = error || statusText || t('An error has occurred');
|
||||
@@ -65,8 +66,8 @@ export default function PropertiesModal({
|
||||
});
|
||||
}
|
||||
|
||||
const fetchChartData = useCallback(
|
||||
async function fetchChartData() {
|
||||
const fetchChartOwners = useCallback(
|
||||
async function fetchChartOwners() {
|
||||
try {
|
||||
const response = await SupersetClient.get({
|
||||
endpoint: `/api/v1/chart/${slice.slice_id}`,
|
||||
@@ -143,8 +144,8 @@ export default function PropertiesModal({
|
||||
|
||||
// get the owners of this slice
|
||||
useEffect(() => {
|
||||
fetchChartData();
|
||||
}, [fetchChartData]);
|
||||
fetchChartOwners();
|
||||
}, [fetchChartOwners]);
|
||||
|
||||
// update name after it's changed in another modal
|
||||
useEffect(() => {
|
||||
@@ -242,8 +243,8 @@ export default function PropertiesModal({
|
||||
mode="multiple"
|
||||
name="owners"
|
||||
value={selectedOwners || []}
|
||||
options={loadOptions}
|
||||
onChange={setSelectedOwners}
|
||||
options={loadOptions}
|
||||
disabled={!selectedOwners}
|
||||
allowClear
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user