feat: support flavor to add cpu/memory search filters
1. Support cpu/memory fuzzy search in the flavor list page 2. Support flavor cpu/memory fuzzy search in the FlavorSelectTable component, which is used in: (1) create instance page (2) create ironic page (3) instance resize form (4) create database instance page (5) create cluster template page (6) edit cluster template page Change-Id: Iba1303a7641621a50b92e21e9173ba65fd7ac669
This commit is contained in:
parent
f9cc92a032
commit
5fc0635853
@ -0,0 +1,20 @@
|
||||
---
|
||||
features:
|
||||
- |
|
||||
Support Flavor add CPU and memory search filters:
|
||||
|
||||
* In the Console, Compute - Flavors page, support cpu and memory fuzzy search.
|
||||
|
||||
* In the Administrator, Compute - Flavors page, support cpu and memory fuzzy search.
|
||||
|
||||
* In the Console, Compute - Instances - Create Instance/Create Ironic, support cpu and
|
||||
memory fuzzy search in the Specification setting in the first step.
|
||||
|
||||
* In the Console, Compute - Instances - Resize, support cpu and memory fuzzy
|
||||
search in the Specification setting.
|
||||
|
||||
* In the Console, Database - Database Instances - Create Database Instance, support cpu
|
||||
and memory fuzzy search in the Database Flavor setting in the first step.
|
||||
|
||||
* In the Console, Capsules - Clusters - Create Cluster Template/Edit Cluster Template,
|
||||
support cpu and memory fuzzy search in the Flavor / Master Flavor setting in the Spec step.
|
@ -21,8 +21,8 @@ import {
|
||||
getBaseColumns,
|
||||
extraColumns,
|
||||
armCategoryList,
|
||||
getFlavorSearchFilters,
|
||||
} from 'resources/nova/flavor';
|
||||
import { getOptions } from 'utils/index';
|
||||
import actionConfigs from './actions';
|
||||
|
||||
export class Flavor extends Base {
|
||||
@ -54,17 +54,7 @@ export class Flavor extends Base {
|
||||
});
|
||||
|
||||
get searchFilters() {
|
||||
return [
|
||||
{
|
||||
label: t('Name'),
|
||||
name: 'name',
|
||||
},
|
||||
{
|
||||
label: t('Category'),
|
||||
name: 'category',
|
||||
options: getOptions(armCategoryList),
|
||||
},
|
||||
];
|
||||
return getFlavorSearchFilters(armCategoryList);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -20,6 +20,7 @@ import {
|
||||
flavorArchitectures,
|
||||
getBaseColumns,
|
||||
extraColumns,
|
||||
getFlavorSearchFilters,
|
||||
} from 'resources/nova/flavor';
|
||||
import actionConfigs from './actions';
|
||||
|
||||
@ -60,12 +61,7 @@ export class Flavor extends Base {
|
||||
});
|
||||
|
||||
get searchFilters() {
|
||||
return [
|
||||
{
|
||||
label: t('Name'),
|
||||
name: 'name',
|
||||
},
|
||||
];
|
||||
return getFlavorSearchFilters();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -22,8 +22,8 @@ import {
|
||||
extraColumns,
|
||||
heterogeneousCategoryList,
|
||||
gpuColumns,
|
||||
getFlavorSearchFilters,
|
||||
} from 'resources/nova/flavor';
|
||||
import { getOptions } from 'utils/index';
|
||||
import actionConfigs from './actions';
|
||||
|
||||
export class Flavor extends Base {
|
||||
@ -55,18 +55,7 @@ export class Flavor extends Base {
|
||||
});
|
||||
|
||||
get searchFilters() {
|
||||
return [
|
||||
{
|
||||
label: t('Name'),
|
||||
name: 'name',
|
||||
},
|
||||
{
|
||||
label: t('Category'),
|
||||
name: 'category',
|
||||
options: getOptions(heterogeneousCategoryList),
|
||||
include: false,
|
||||
},
|
||||
];
|
||||
return getFlavorSearchFilters(heterogeneousCategoryList);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -16,7 +16,11 @@ import { observer, inject } from 'mobx-react';
|
||||
import Base from 'containers/List';
|
||||
import { FlavorStore } from 'stores/nova/flavor';
|
||||
import { emptyActionConfig } from 'utils/constants';
|
||||
import { getBaseColumns, extraColumns } from 'resources/nova/flavor';
|
||||
import {
|
||||
getBaseColumns,
|
||||
extraColumns,
|
||||
getFlavorSearchFilters,
|
||||
} from 'resources/nova/flavor';
|
||||
import actionConfigs from './actions';
|
||||
|
||||
export class Flavor extends Base {
|
||||
@ -52,12 +56,7 @@ export class Flavor extends Base {
|
||||
}
|
||||
|
||||
get searchFilters() {
|
||||
return [
|
||||
{
|
||||
label: t('Name'),
|
||||
name: 'name',
|
||||
},
|
||||
];
|
||||
return getFlavorSearchFilters();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -21,8 +21,8 @@ import {
|
||||
getBaseColumns,
|
||||
extraColumns,
|
||||
x86CategoryList,
|
||||
getFlavorSearchFilters,
|
||||
} from 'resources/nova/flavor';
|
||||
import { getOptions } from 'utils/index';
|
||||
import actionConfigs from './actions';
|
||||
|
||||
export class Flavor extends Base {
|
||||
@ -54,17 +54,7 @@ export class Flavor extends Base {
|
||||
});
|
||||
|
||||
get searchFilters() {
|
||||
return [
|
||||
{
|
||||
label: t('Name'),
|
||||
name: 'name',
|
||||
},
|
||||
{
|
||||
label: t('Category'),
|
||||
name: 'category',
|
||||
options: getOptions(x86CategoryList),
|
||||
},
|
||||
];
|
||||
return getFlavorSearchFilters(x86CategoryList);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -29,6 +29,7 @@ import {
|
||||
isBareMetalFlavor,
|
||||
isBareMetal,
|
||||
getFlavorArchInfo,
|
||||
getFlavorSearchFilters,
|
||||
} from 'resources/nova/flavor';
|
||||
import styles from './index.less';
|
||||
|
||||
@ -326,12 +327,7 @@ export class FlavorSelectTable extends Component {
|
||||
data: this.flavors,
|
||||
tableHeader: this.renderTableHeader(),
|
||||
isLoading,
|
||||
filterParams: [
|
||||
{
|
||||
label: t('Name'),
|
||||
name: 'name',
|
||||
},
|
||||
],
|
||||
filterParams: getFlavorSearchFilters(),
|
||||
value,
|
||||
onChange: this.onChange,
|
||||
disabledFunc,
|
||||
|
@ -12,7 +12,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
import { formatSize } from 'utils';
|
||||
import { formatSize, getOptions } from 'utils';
|
||||
|
||||
export const cpuPolicyList = {
|
||||
dedicated: t('Dedicated'),
|
||||
@ -286,3 +286,35 @@ export const getFlavorArchInfo = (flavor) => {
|
||||
flavorCategoryList[category] || category
|
||||
}`;
|
||||
};
|
||||
|
||||
export const getFlavorSearchFilters = (category) => {
|
||||
const filters = [
|
||||
{
|
||||
label: t('Name'),
|
||||
name: 'name',
|
||||
},
|
||||
{
|
||||
label: t('CPU'),
|
||||
name: 'vcpus',
|
||||
filterFunc: (vcpus, value) => {
|
||||
return (`${vcpus}` || '').includes(value);
|
||||
},
|
||||
},
|
||||
{
|
||||
label: t('Memory'),
|
||||
name: 'ram',
|
||||
filterFunc: (ram, value) => {
|
||||
return (formatSize(ram, 2) || '').includes(value);
|
||||
},
|
||||
},
|
||||
];
|
||||
if (category) {
|
||||
filters.push({
|
||||
label: t('Category'),
|
||||
name: 'category',
|
||||
options: getOptions(armCategoryList),
|
||||
});
|
||||
}
|
||||
|
||||
return filters;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user