fix: remove @ alias when import file

Remove @ alias when import file, can use folder in the src to short import

Change-Id: I9fa494cb93f152a03b6dcf3c0ecda0d31e747ea3
This commit is contained in:
Jingwei.Zhang 2022-04-25 09:53:46 +08:00
parent acedaa9868
commit 3eb091a54b
23 changed files with 177 additions and 186 deletions

View File

@ -27,10 +27,6 @@
"import/resolver": {
"alias": {
"map": [
[
"@",
"./src"
],
[
"src",
"./src"

View File

@ -113,7 +113,6 @@ module.exports = {
extensions: ['.js', '.jsx'],
modules: [root('src'), root('src/pages'), 'node_modules'],
alias: {
'@': root('src'),
src: root('src'),
asset: root('src/asset'),
image: root('src/asset/image'),

View File

@ -21,7 +21,6 @@ module.exports = {
moduleNameMapper: {
'.+\\.(css|styl|less|sass|scss)$': 'identity-obj-proxy',
'\\.svg': '<rootDir>/test/unit/svg-mock.js',
'^@/(.*)$': '<rootDir>/src/$1',
'^src(.*)$': '<rootDir>/src$1',
'^components(.*)$': '<rootDir>/src/components$1',
'^layouts(.*)$': '<rootDir>/src/layouts$1',

View File

@ -4,7 +4,6 @@
"baseUrl": ".",
"experimentalDecorators": true,
"paths": {
"@/*": ["./src/*"],
"client/*": ["./src/client/*"],
"src/*": ["./src/*"],
"asset/*": ["./src/asset/*"],

View File

@ -14,8 +14,8 @@
import { inject, observer } from 'mobx-react';
import Base from 'containers/TabDetail';
import { BackupsStore } from 'stores/trove/backups';
import BaseDetail from './BaseDetail';
import { BackupsStore } from '@/stores/trove/backups';
@inject('rootStore')
@observer
@ -25,7 +25,7 @@ export default class BackupsDetail extends Base {
}
get name() {
return "Backup Detail"
return 'Backup Detail';
}
get listUrl() {
@ -39,23 +39,23 @@ export default class BackupsDetail extends Base {
get detailInfos() {
return [
{
title: t("Name"),
dataIndex: "name"
title: t('Name'),
dataIndex: 'name',
},
{
title: t("Description"),
dataIndex: "description"
}
]
title: t('Description'),
dataIndex: 'description',
},
];
}
get tabs() {
return [
{
title: t("General Info"),
key: "general_info",
component: BaseDetail
}
]
title: t('General Info'),
key: 'general_info',
component: BaseDetail,
},
];
}
}
}

View File

@ -12,26 +12,25 @@
// See the License for the specific language governing permissions and
// limitations under the License.
import { ModalAction } from "@/containers/Action";
import { inject, observer } from "mobx-react";
import globalInstancesStore from "stores/trove/instances";
import globalBackupsStore from "stores/trove/backups";
import { ModalAction } from 'containers/Action';
import { inject, observer } from 'mobx-react';
import globalInstancesStore from 'stores/trove/instances';
import globalBackupsStore from 'stores/trove/backups';
@inject('rootStore')
@observer
export default class Create extends ModalAction {
init() {
this.store = globalBackupsStore;
this.getDatabaseInstance();
}
static id = "create-backups";
static id = 'create-backups';
static title = t("Create Backups");
static title = t('Create Backups');
static get modalSize() {
return "middle";
return 'middle';
}
getModalSize() {
@ -39,21 +38,20 @@ export default class Create extends ModalAction {
}
get name() {
return t("Create Backups");
return t('Create Backups');
}
static policy = "trove:backup:create";
static policy = 'trove:backup:create';
static allowed() {
return Promise.resolve(true);
}
get listInstanceName() {
return (globalInstancesStore.list.data || [])
.map((it) => ({
value: it.id,
label: it.name,
}));
return (globalInstancesStore.list.data || []).map((it) => ({
value: it.id,
label: it.name,
}));
}
async getDatabaseInstance() {
@ -63,24 +61,24 @@ export default class Create extends ModalAction {
get formItems() {
return [
{
name: "name",
label: t("Backup Name"),
type: "input",
required: true
name: 'name',
label: t('Backup Name'),
type: 'input',
required: true,
},
{
name: "instance",
label: t("Database Instance"),
type: "select",
name: 'instance',
label: t('Database Instance'),
type: 'select',
options: this.listInstanceName,
required: true
required: true,
},
{
name: "description",
label: t("Description"),
type: "input"
}
]
name: 'description',
label: t('Description'),
type: 'input',
},
];
}
onSubmit = (values) => {
@ -92,4 +90,4 @@ export default class Create extends ModalAction {
},
});
};
}
}

View File

@ -14,8 +14,8 @@
import { inject, observer } from 'mobx-react';
import Base from 'containers/TabDetail';
import globalConfigurationsStore from 'stores/trove/configurations';
import BaseDetail from './BaseDetail';
import globalConfigurationsStore from '@/stores/trove/configurations';
import Values from './Values';
import Instances from './Instances';
@ -27,7 +27,7 @@ export default class ConfigurationsDetail extends Base {
}
get name() {
return "Configurations Detail"
return 'Configurations Detail';
}
get listUrl() {
@ -41,27 +41,29 @@ export default class ConfigurationsDetail extends Base {
get detailInfos() {
return [
{
title: t("Name"),
dataIndex: "name"
}
]
title: t('Name'),
dataIndex: 'name',
},
];
}
get tabs() {
return [
{
title: t("General Info"),
key: "general_info",
component: BaseDetail
}, {
title: t("Values"),
key: "values",
component: Values
}, {
title: t("Instances"),
key: "instances",
component: Instances
}
]
title: t('General Info'),
key: 'general_info',
component: BaseDetail,
},
{
title: t('Values'),
key: 'values',
component: Values,
},
{
title: t('Instances'),
key: 'instances',
component: Instances,
},
];
}
}
}

View File

@ -12,28 +12,27 @@
// See the License for the specific language governing permissions and
// limitations under the License.
import { ModalAction } from "@/containers/Action";
import { inject, observer } from "mobx-react";
import globalInstancesStore from "stores/trove/instances";
import globalConfigurationsStore from "stores/trove/configurations";
import { ModalAction } from 'containers/Action';
import { inject, observer } from 'mobx-react';
import globalInstancesStore from 'stores/trove/instances';
import globalConfigurationsStore from 'stores/trove/configurations';
import { toJS } from 'mobx';
@inject('rootStore')
@observer
export default class Create extends ModalAction {
init() {
this.store = globalConfigurationsStore;
this.getDatastores();
this.state.datastore_type = null;
}
static id = "create-configurations";
static id = 'create-configurations';
static title = t("Create Configurations");
static title = t('Create Configurations');
static get modalSize() {
return "middle";
return 'middle';
}
getModalSize() {
@ -41,10 +40,10 @@ export default class Create extends ModalAction {
}
get name() {
return t("Create Configurations");
return t('Create Configurations');
}
static policy = "trove:configuration:create";
static policy = 'trove:configuration:create';
static allowed() {
return Promise.resolve(true);
@ -64,53 +63,54 @@ export default class Create extends ModalAction {
onChangeDatastoresTypeChange = (value) => {
this.setState({
datastore_type: value
})
datastore_type: value,
});
this.resetFormValue(['datastore_version']);
};
get datastoresVersion() {
var dizi = (this.datastores).filter((item) => item.label === this.state.datastoreType)
const dizi = this.datastores
.filter((item) => item.label === this.state.datastoreType)
.map((it) => {
return it.originData.versions.map((e) => ({
label: e.name,
value: e.name
}))
})
value: e.name,
}));
});
return dizi[0];
}
get formItems() {
return [
{
name: "name",
label: t("Name"),
type: "input",
required: true
name: 'name',
label: t('Name'),
type: 'input',
required: true,
},
{
name: "description",
label: t("Description"),
type: "input"
name: 'description',
label: t('Description'),
type: 'input',
},
{
name: "datastore_type",
label: t("Datastore Type"),
type: "select",
name: 'datastore_type',
label: t('Datastore Type'),
type: 'select',
options: this.datastores,
onChange: (value) => {
this.onChangeDatastoresTypeChange(value)
this.onChangeDatastoresTypeChange(value);
},
required: true,
},
{
name: "datastore_version",
label: t("Datastore Version"),
type: "select",
name: 'datastore_version',
label: t('Datastore Version'),
type: 'select',
options: this.datastoresVersion,
required: true,
},
]
];
}
onSubmit = (values) => {
@ -123,9 +123,9 @@ export default class Create extends ModalAction {
},
name: values.name,
values: {
connect_timeout: 200
}
}
})
connect_timeout: 200,
},
},
});
};
}
}

View File

@ -14,8 +14,8 @@
import { inject, observer } from 'mobx-react';
import Base from 'containers/TabDetail';
import globalInstancesStore from 'stores/trove/instances';
import BaseDetail from './BaseDetail';
import globalInstancesStore from '@/stores/trove/instances';
import Users from './Users';
import Databases from './Databases';
import Backups from './Backups';
@ -30,7 +30,7 @@ export default class InstancesDetail extends Base {
}
get name() {
return t("Backup Detail");
return t('Backup Detail');
}
get policy() {
@ -44,56 +44,56 @@ export default class InstancesDetail extends Base {
get detailInfos() {
return [
{
title: t("ID"),
dataIndex: "id"
title: t('ID'),
dataIndex: 'id',
},
{
title: t("Name"),
dataIndex: "name"
title: t('Name'),
dataIndex: 'name',
},
{
title: t("Status"),
dataIndex: "status"
title: t('Status'),
dataIndex: 'status',
},
{
title: t("Tenant Id"),
dataIndex: "tenant_id"
}
]
title: t('Tenant Id'),
dataIndex: 'tenant_id',
},
];
}
get tabs() {
return [
{
title: t("General Info"),
key: "general_info",
component: BaseDetail
title: t('General Info'),
key: 'general_info',
component: BaseDetail,
},
{
title: t("Users"),
key: "users",
component: Users
title: t('Users'),
key: 'users',
component: Users,
},
{
title: t("Databases"),
key: "databases",
component: Databases
title: t('Databases'),
key: 'databases',
component: Databases,
},
{
title: t("Backups"),
key: "backups",
component: Backups
title: t('Backups'),
key: 'backups',
component: Backups,
},
{
title: t("Logs"),
key: "logs",
component: Logs
title: t('Logs'),
key: 'logs',
component: Logs,
},
{
title: t("Defaults"),
key: "defaults",
component: Defaults
}
]
title: t('Defaults'),
key: 'defaults',
component: Defaults,
},
];
}
}
}

View File

@ -1,14 +1,14 @@
import { inject, observer } from 'mobx-react';
import Base from 'components/Form';
import globalInstancesStore from '@/stores/trove/instances';
import globalInstancesStore from 'stores/trove/instances';
@inject('rootStore')
@observer
export default class StepAdvanced extends Base {
init() {
this.getConfigurationGroups();
}
get title() {
return t('Initialize Databases');
}
@ -22,7 +22,7 @@ export default class StepAdvanced extends Base {
get configurationGroup() {
return (globalInstancesStore.list.data || []).map((it) => ({
label: it.name,
value: it.id
value: it.id,
}));
}
@ -33,19 +33,19 @@ export default class StepAdvanced extends Base {
get formItems() {
return [
{
name: "project",
label: t("Project"),
type: "label"
name: 'project',
label: t('Project'),
type: 'label',
},
{
type: "divider"
type: 'divider',
},
{
name: "configurationGroup",
label: t("Configuration Group"),
name: 'configurationGroup',
label: t('Configuration Group'),
type: 'select',
options: this.configurationGroup
}
]
options: this.configurationGroup,
},
];
}
}

View File

@ -16,9 +16,9 @@ import React from 'react';
import { inject, observer } from 'mobx-react';
import Base from 'components/Form';
import { toJS } from 'mobx';
import globalInstancesStore from '@/stores/trove/instances';
import globalInstancesStore from 'stores/trove/instances';
import globalAvailabilityZoneStore from 'stores/nova/zone';
import FlavorSelectTable from '@/pages/compute/containers/Instance/components/FlavorSelectTable';
import FlavorSelectTable from 'pages/compute/containers/Instance/components/FlavorSelectTable';
@inject('rootStore')
@observer
@ -45,7 +45,7 @@ export default class StepDetails extends Base {
get defaultValue() {
const values = {
project: this.currentProjectName
project: this.currentProjectName,
};
return values;
}
@ -77,19 +77,20 @@ export default class StepDetails extends Base {
onChangeDatastoresTypeChange = (value) => {
this.setState({
datastoreType: value
datastoreType: value,
});
this.resetFormValue(["datastore_version"]);
}
this.resetFormValue(['datastore_version']);
};
get datastoresVersion() {
var dizi = (this.datastores).filter((item) => item.label === this.state.datastore_type)
const dizi = this.datastores
.filter((item) => item.label === this.state.datastore_type)
.map((it) => {
return it.originData.versions.map((e) => ({
label: e.name,
value: e.name
}))
})
value: e.name,
}));
});
return dizi[0];
}
@ -113,7 +114,7 @@ export default class StepDetails extends Base {
getSystemDiskMinSize() {
const flavorSize = (this.state.flavor || {}).disk || 0;
let imageSize = 0;
const imageSize = 0;
return Math.max(flavorSize, imageSize, 1);
}

View File

@ -14,7 +14,7 @@
import { StepAction } from 'containers/Action';
import { inject, observer } from 'mobx-react';
import globalInstancesStore from '@/stores/trove/instances';
import globalInstancesStore from 'stores/trove/instances';
import StepDetails from './StepDetails';
import StepNetworking from './StepNetworking';
import StepInitializeDatabases from './StepInitializeDatabases';
@ -23,25 +23,24 @@ import StepAdvanced from './StepAdvanced';
@inject('rootStore')
@observer
export default class StepCreate extends StepAction {
init() {
this.store = globalInstancesStore;
}
static id = "create-instance";
static id = 'create-instance';
static title = t("Create Instance")
static title = t('Create Instance');
static path = '/database/instances/create';
static policy = "trove:instance:create";
static policy = 'trove:instance:create';
static allowed() {
return Promise.resolve(true);
}
get name() {
return t("Create Instance");
return t('Create Instance');
}
get listUrl() {
@ -74,11 +73,11 @@ export default class StepCreate extends StepAction {
}
onSubmit = (values) => {
let network = []
let network = [];
const { selectedRowKeys = [] } = values.network;
network = selectedRowKeys.map(it => ({ 'net-id': it }))
network = [{ 'net-id': selectedRowKeys[0] }]
network = selectedRowKeys.map((it) => ({ 'net-id': it }));
network = [{ 'net-id': selectedRowKeys[0] }];
return this.store.create({
instance: {
@ -114,4 +113,4 @@ export default class StepCreate extends StepAction {
},
});
};
}
}

View File

@ -14,7 +14,7 @@
import { observer, inject } from 'mobx-react';
import Base from 'containers/List';
import globalInstancesStore from '@/stores/trove/instances';
import globalInstancesStore from 'stores/trove/instances';
import { InstanceStatus } from 'resources/database';
import actions from './actions';

View File

@ -14,8 +14,8 @@
import { inject, observer } from 'mobx-react';
import { ModalAction } from 'containers/Action';
import globalShareGroupTypeStore from '@/stores/manila/share-group-type';
import globalShareTypeStore from '@/stores/manila/share-type';
import globalShareGroupTypeStore from 'stores/manila/share-group-type';
import globalShareTypeStore from 'stores/manila/share-type';
import { projectTableOptions } from 'resources/project';
import { ProjectStore } from 'stores/keystone/project';
import { updateAddSelectValueToObj } from 'utils/index';

View File

@ -13,7 +13,7 @@
// limitations under the License.
import { ConfirmAction } from 'containers/Action';
import globalShareGroupTypeStore from '@/stores/manila/share-group-type';
import globalShareGroupTypeStore from 'stores/manila/share-group-type';
export default class Delete extends ConfirmAction {
get id() {

View File

@ -15,7 +15,7 @@
import { inject, observer } from 'mobx-react';
import globalShareGroupTypeStore, {
ShareGroupTypeStore,
} from '@/stores/manila/share-group-type';
} from 'stores/manila/share-group-type';
import { ModalAction } from 'containers/Action';
import { ProjectStore } from 'stores/keystone/project';
import { projectTableOptions } from 'resources/project';

View File

@ -15,7 +15,7 @@
import React from 'react';
import { observer, inject } from 'mobx-react';
import Base from 'containers/List';
import globalShareGroupTypeStore from '@/stores/manila/share-group-type';
import globalShareGroupTypeStore from 'stores/manila/share-group-type';
import actionConfigs from './actions';
export class ShareGroupType extends Base {

View File

@ -14,7 +14,7 @@
import { observer, inject } from 'mobx-react';
import Base from 'containers/List';
import globalShareInstanceStore from '@/stores/manila/share-instance';
import globalShareInstanceStore from 'stores/manila/share-instance';
import { shareStatus } from 'resources/share';
export class ShareInstance extends Base {

View File

@ -14,7 +14,7 @@
import { inject, observer } from 'mobx-react';
import { ModalAction } from 'containers/Action';
import globalShareTypeStore from '@/stores/manila/share-type';
import globalShareTypeStore from 'stores/manila/share-type';
import { projectTableOptions } from 'resources/project';
import { ProjectStore } from 'stores/keystone/project';
import KeyValueInput from 'components/FormItem/KeyValueInput';

View File

@ -13,7 +13,7 @@
// limitations under the License.
import { ConfirmAction } from 'containers/Action';
import globalShareTypeStore from '@/stores/manila/share-type';
import globalShareTypeStore from 'stores/manila/share-type';
export default class Delete extends ConfirmAction {
get id() {

View File

@ -14,7 +14,7 @@
import { inject, observer } from 'mobx-react';
import { ModalAction } from 'containers/Action';
import globalShareTypeStore from '@/stores/manila/share-type';
import globalShareTypeStore from 'stores/manila/share-type';
export class Edit extends ModalAction {
static id = 'edit';

View File

@ -13,9 +13,7 @@
// limitations under the License.
import { inject, observer } from 'mobx-react';
import globalShareTypeStore, {
ShareTypeStore,
} from '@/stores/manila/share-type';
import globalShareTypeStore, { ShareTypeStore } from 'stores/manila/share-type';
import { ModalAction } from 'containers/Action';
import { ProjectStore } from 'stores/keystone/project';
import { projectTableOptions } from 'resources/project';

View File

@ -14,7 +14,7 @@
import { observer, inject } from 'mobx-react';
import Base from 'containers/List';
import globalShareTypeStore from '@/stores/manila/share-type';
import globalShareTypeStore from 'stores/manila/share-type';
import actionConfigs from './actions';
export class ShareType extends Base {