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": { "import/resolver": {
"alias": { "alias": {
"map": [ "map": [
[
"@",
"./src"
],
[ [
"src", "src",
"./src" "./src"

View File

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

View File

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

View File

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

View File

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

View File

@ -12,26 +12,25 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
import { ModalAction } from "@/containers/Action"; import { ModalAction } from 'containers/Action';
import { inject, observer } from "mobx-react"; import { inject, observer } from 'mobx-react';
import globalInstancesStore from "stores/trove/instances"; import globalInstancesStore from 'stores/trove/instances';
import globalBackupsStore from "stores/trove/backups"; import globalBackupsStore from 'stores/trove/backups';
@inject('rootStore') @inject('rootStore')
@observer @observer
export default class Create extends ModalAction { export default class Create extends ModalAction {
init() { init() {
this.store = globalBackupsStore; this.store = globalBackupsStore;
this.getDatabaseInstance(); this.getDatabaseInstance();
} }
static id = "create-backups"; static id = 'create-backups';
static title = t("Create Backups"); static title = t('Create Backups');
static get modalSize() { static get modalSize() {
return "middle"; return 'middle';
} }
getModalSize() { getModalSize() {
@ -39,21 +38,20 @@ export default class Create extends ModalAction {
} }
get name() { get name() {
return t("Create Backups"); return t('Create Backups');
} }
static policy = "trove:backup:create"; static policy = 'trove:backup:create';
static allowed() { static allowed() {
return Promise.resolve(true); return Promise.resolve(true);
} }
get listInstanceName() { get listInstanceName() {
return (globalInstancesStore.list.data || []) return (globalInstancesStore.list.data || []).map((it) => ({
.map((it) => ({ value: it.id,
value: it.id, label: it.name,
label: it.name, }));
}));
} }
async getDatabaseInstance() { async getDatabaseInstance() {
@ -63,24 +61,24 @@ export default class Create extends ModalAction {
get formItems() { get formItems() {
return [ return [
{ {
name: "name", name: 'name',
label: t("Backup Name"), label: t('Backup Name'),
type: "input", type: 'input',
required: true required: true,
}, },
{ {
name: "instance", name: 'instance',
label: t("Database Instance"), label: t('Database Instance'),
type: "select", type: 'select',
options: this.listInstanceName, options: this.listInstanceName,
required: true required: true,
}, },
{ {
name: "description", name: 'description',
label: t("Description"), label: t('Description'),
type: "input" type: 'input',
} },
] ];
} }
onSubmit = (values) => { 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 { inject, observer } from 'mobx-react';
import Base from 'containers/TabDetail'; import Base from 'containers/TabDetail';
import globalConfigurationsStore from 'stores/trove/configurations';
import BaseDetail from './BaseDetail'; import BaseDetail from './BaseDetail';
import globalConfigurationsStore from '@/stores/trove/configurations';
import Values from './Values'; import Values from './Values';
import Instances from './Instances'; import Instances from './Instances';
@ -27,7 +27,7 @@ export default class ConfigurationsDetail extends Base {
} }
get name() { get name() {
return "Configurations Detail" return 'Configurations Detail';
} }
get listUrl() { get listUrl() {
@ -41,27 +41,29 @@ export default class ConfigurationsDetail extends Base {
get detailInfos() { get detailInfos() {
return [ return [
{ {
title: t("Name"), title: t('Name'),
dataIndex: "name" dataIndex: 'name',
} },
] ];
} }
get tabs() { get tabs() {
return [ return [
{ {
title: t("General Info"), title: t('General Info'),
key: "general_info", key: 'general_info',
component: BaseDetail component: BaseDetail,
}, { },
title: t("Values"), {
key: "values", title: t('Values'),
component: Values key: 'values',
}, { component: Values,
title: t("Instances"), },
key: "instances", {
component: Instances title: t('Instances'),
} key: 'instances',
] component: Instances,
},
];
} }
} }

View File

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

View File

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

View File

@ -1,14 +1,14 @@
import { inject, observer } from 'mobx-react'; import { inject, observer } from 'mobx-react';
import Base from 'components/Form'; import Base from 'components/Form';
import globalInstancesStore from '@/stores/trove/instances'; import globalInstancesStore from 'stores/trove/instances';
@inject('rootStore') @inject('rootStore')
@observer @observer
export default class StepAdvanced extends Base { export default class StepAdvanced extends Base {
init() { init() {
this.getConfigurationGroups(); this.getConfigurationGroups();
} }
get title() { get title() {
return t('Initialize Databases'); return t('Initialize Databases');
} }
@ -22,7 +22,7 @@ export default class StepAdvanced extends Base {
get configurationGroup() { get configurationGroup() {
return (globalInstancesStore.list.data || []).map((it) => ({ return (globalInstancesStore.list.data || []).map((it) => ({
label: it.name, label: it.name,
value: it.id value: it.id,
})); }));
} }
@ -33,19 +33,19 @@ export default class StepAdvanced extends Base {
get formItems() { get formItems() {
return [ return [
{ {
name: "project", name: 'project',
label: t("Project"), label: t('Project'),
type: "label" type: 'label',
}, },
{ {
type: "divider" type: 'divider',
}, },
{ {
name: "configurationGroup", name: 'configurationGroup',
label: t("Configuration Group"), label: t('Configuration Group'),
type: 'select', 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 { inject, observer } from 'mobx-react';
import Base from 'components/Form'; import Base from 'components/Form';
import { toJS } from 'mobx'; import { toJS } from 'mobx';
import globalInstancesStore from '@/stores/trove/instances'; import globalInstancesStore from 'stores/trove/instances';
import globalAvailabilityZoneStore from 'stores/nova/zone'; 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') @inject('rootStore')
@observer @observer
@ -45,7 +45,7 @@ export default class StepDetails extends Base {
get defaultValue() { get defaultValue() {
const values = { const values = {
project: this.currentProjectName project: this.currentProjectName,
}; };
return values; return values;
} }
@ -77,19 +77,20 @@ export default class StepDetails extends Base {
onChangeDatastoresTypeChange = (value) => { onChangeDatastoresTypeChange = (value) => {
this.setState({ this.setState({
datastoreType: value datastoreType: value,
}); });
this.resetFormValue(["datastore_version"]); this.resetFormValue(['datastore_version']);
} };
get datastoresVersion() { 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) => { .map((it) => {
return it.originData.versions.map((e) => ({ return it.originData.versions.map((e) => ({
label: e.name, label: e.name,
value: e.name value: e.name,
})) }));
}) });
return dizi[0]; return dizi[0];
} }
@ -113,7 +114,7 @@ export default class StepDetails extends Base {
getSystemDiskMinSize() { getSystemDiskMinSize() {
const flavorSize = (this.state.flavor || {}).disk || 0; const flavorSize = (this.state.flavor || {}).disk || 0;
let imageSize = 0; const imageSize = 0;
return Math.max(flavorSize, imageSize, 1); return Math.max(flavorSize, imageSize, 1);
} }

View File

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

View File

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

View File

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

View File

@ -13,7 +13,7 @@
// limitations under the License. // limitations under the License.
import { ConfirmAction } from 'containers/Action'; 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 { export default class Delete extends ConfirmAction {
get id() { get id() {

View File

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

View File

@ -15,7 +15,7 @@
import React from 'react'; import React from 'react';
import { observer, inject } from 'mobx-react'; import { observer, inject } from 'mobx-react';
import Base from 'containers/List'; 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'; import actionConfigs from './actions';
export class ShareGroupType extends Base { export class ShareGroupType extends Base {

View File

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

View File

@ -14,7 +14,7 @@
import { inject, observer } from 'mobx-react'; import { inject, observer } from 'mobx-react';
import { ModalAction } from 'containers/Action'; 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 { projectTableOptions } from 'resources/project';
import { ProjectStore } from 'stores/keystone/project'; import { ProjectStore } from 'stores/keystone/project';
import KeyValueInput from 'components/FormItem/KeyValueInput'; import KeyValueInput from 'components/FormItem/KeyValueInput';

View File

@ -13,7 +13,7 @@
// limitations under the License. // limitations under the License.
import { ConfirmAction } from 'containers/Action'; 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 { export default class Delete extends ConfirmAction {
get id() { get id() {

View File

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

View File

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

View File

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