diff --git a/src/client/trove/index.js b/src/client/trove/index.js index 8104665b..8f3aa8c4 100644 --- a/src/client/trove/index.js +++ b/src/client/trove/index.js @@ -46,7 +46,7 @@ class TroveClient extends Base { { key: 'log', responseKey: 'log', - } + }, ], }, { diff --git a/src/pages/database/containers/Backups/Detail/BaseDetail.jsx b/src/pages/database/containers/Backups/Detail/BaseDetail.jsx index 34c15eed..bce0a03f 100644 --- a/src/pages/database/containers/Backups/Detail/BaseDetail.jsx +++ b/src/pages/database/containers/Backups/Detail/BaseDetail.jsx @@ -12,53 +12,51 @@ // See the License for the specific language governing permissions and // limitations under the License. -import { inject, observer } from "mobx-react"; +import { inject, observer } from 'mobx-react'; import Base from 'containers/BaseDetail'; -@inject("rootStore") -@observer -export default class BaseDetail extends Base { - +export class BaseDetail extends Base { get leftCards() { - return [this.baseInfoCard] + return [this.baseInfoCard]; } get baseInfoCard() { const options = [ { - label: t("Datastore"), - dataIndex: "datastore.type" + label: t('Datastore'), + dataIndex: 'datastore.type', }, { - label: t("Datastore Version"), - dataIndex: "datastore.version" + label: t('Datastore Version'), + dataIndex: 'datastore.version', }, { - label: t("Backup File Location"), - dataIndex: "locationRef", + label: t('Backup File Location'), + dataIndex: 'locationRef', }, { - label: t("Initial Volume Size"), - dataIndex: "size", + label: t('Initial Volume Size'), + dataIndex: 'size', }, { - label: t("Created"), - dataIndex: "created", + label: t('Created'), + dataIndex: 'created', }, { - label: t("Updated"), - dataIndex: "updated", - } - , - { - label: t("Status"), - dataIndex: "status" + label: t('Updated'), + dataIndex: 'updated', }, - ] + { + label: t('Status'), + dataIndex: 'status', + }, + ]; return { - title: t("Base Info"), - options - } + title: t('Base Info'), + options, + }; } -} \ No newline at end of file +} + +export default inject('rootStore')(observer(BaseDetail)); diff --git a/src/pages/database/containers/Backups/Detail/index.jsx b/src/pages/database/containers/Backups/Detail/index.jsx index 452cb771..a1fbcfd1 100644 --- a/src/pages/database/containers/Backups/Detail/index.jsx +++ b/src/pages/database/containers/Backups/Detail/index.jsx @@ -17,9 +17,7 @@ import Base from 'containers/TabDetail'; import { BackupsStore } from 'stores/trove/backups'; import BaseDetail from './BaseDetail'; -@inject('rootStore') -@observer -export default class BackupsDetail extends Base { +export class BackupsDetail extends Base { init() { this.store = new BackupsStore(); } @@ -59,3 +57,5 @@ export default class BackupsDetail extends Base { ]; } } + +export default inject('rootStore')(observer(BackupsDetail)); diff --git a/src/pages/database/containers/Backups/actions/Create.jsx b/src/pages/database/containers/Backups/actions/Create.jsx index 28b1e186..7b91af9e 100644 --- a/src/pages/database/containers/Backups/actions/Create.jsx +++ b/src/pages/database/containers/Backups/actions/Create.jsx @@ -17,9 +17,7 @@ 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 { +export class Create extends ModalAction { init() { this.store = globalBackupsStore; this.getDatabaseInstance(); @@ -91,3 +89,5 @@ export default class Create extends ModalAction { }); }; } + +export default inject('rootStore')(observer(Create)); diff --git a/src/pages/database/containers/Backups/actions/index.jsx b/src/pages/database/containers/Backups/actions/index.jsx index 5d425806..20d36fd1 100644 --- a/src/pages/database/containers/Backups/actions/index.jsx +++ b/src/pages/database/containers/Backups/actions/index.jsx @@ -1,3 +1,16 @@ +// Copyright 2021 99cloud +// +// Licensed 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 Create from './Create'; import Delete from './Delete'; diff --git a/src/pages/database/containers/Backups/index.jsx b/src/pages/database/containers/Backups/index.jsx index b7571292..9bff92ab 100644 --- a/src/pages/database/containers/Backups/index.jsx +++ b/src/pages/database/containers/Backups/index.jsx @@ -15,12 +15,10 @@ import Base from 'containers/List'; import { inject, observer } from 'mobx-react'; -import actions from './actions'; import globalBackupsStore from 'stores/trove/backups'; +import actions from './actions'; -@inject('rootStore') -@observer -export default class Backups extends Base { +export class Backups extends Base { init() { this.store = globalBackupsStore; } @@ -50,7 +48,7 @@ export default class Backups extends Base { { title: t('Backup Name'), dataIndex: 'name', - routeName: this.getRouteName("databaseBackupDetail") + routeName: this.getRouteName('databaseBackupDetail'), }, { title: t('Description'), @@ -58,4 +56,6 @@ export default class Backups extends Base { dataIndex: 'description', }, ]; -} \ No newline at end of file +} + +export default inject('rootStore')(observer(Backups)); diff --git a/src/pages/database/containers/Configurations/Detail/BaseDetail.jsx b/src/pages/database/containers/Configurations/Detail/BaseDetail.jsx index 904028ab..fbde546e 100644 --- a/src/pages/database/containers/Configurations/Detail/BaseDetail.jsx +++ b/src/pages/database/containers/Configurations/Detail/BaseDetail.jsx @@ -12,13 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. -import { inject, observer } from "mobx-react"; +import { inject, observer } from 'mobx-react'; import Base from 'containers/BaseDetail'; -@inject("rootStore") -@observer -export default class BaseDetail extends Base { - +export class BaseDetail extends Base { get leftCards() { return [this.baseInfoCard]; } @@ -26,37 +23,36 @@ export default class BaseDetail extends Base { get baseInfoCard() { const options = [ { - label: t("Name"), - dataIndex: "name" + label: t('Name'), + dataIndex: 'name', }, { - label: t("Description"), - dataIndex: "description" + label: t('Description'), + dataIndex: 'description', }, { - label: t("Datastore"), - dataIndex: "datastore_name" - } - , + label: t('Datastore'), + dataIndex: 'datastore_name', + }, { - label: t("Datastore Version"), - dataIndex: "datastore_version_name" - } - , + label: t('Datastore Version'), + dataIndex: 'datastore_version_name', + }, { - label: t("Created"), - dataIndex: "created" - } - , + label: t('Created'), + dataIndex: 'created', + }, { - label: t("Updated"), - dataIndex: "updated" - } + label: t('Updated'), + dataIndex: 'updated', + }, ]; return { - title: t("Base Info"), - options - } + title: t('Base Info'), + options, + }; } -} \ No newline at end of file +} + +export default inject('rootStore')(observer(BaseDetail)); diff --git a/src/pages/database/containers/Configurations/Detail/Instances.jsx b/src/pages/database/containers/Configurations/Detail/Instances.jsx index 249b012d..a2bee559 100644 --- a/src/pages/database/containers/Configurations/Detail/Instances.jsx +++ b/src/pages/database/containers/Configurations/Detail/Instances.jsx @@ -12,13 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. -import Base from "containers/BaseDetail" -import { inject, observer } from "mobx-react"; - -@inject("rootStore") -@observer -export default class Instances extends Base { +import Base from 'containers/BaseDetail'; +import { inject, observer } from 'mobx-react'; +export class Instances extends Base { get leftCards() { return [this.baseInfoCard]; } @@ -26,14 +23,16 @@ export default class Instances extends Base { get baseInfoCard() { const options = [ { - label: t("Instances"), - dataIndex: "instance_count" - } - ] + label: t('Instances'), + dataIndex: 'instance_count', + }, + ]; return { - title: t("Defaults"), - options - } + title: t('Defaults'), + options, + }; } -} \ No newline at end of file +} + +export default inject('rootStore')(observer(Instances)); diff --git a/src/pages/database/containers/Configurations/Detail/Values.jsx b/src/pages/database/containers/Configurations/Detail/Values.jsx index 77c4b7e8..22910151 100644 --- a/src/pages/database/containers/Configurations/Detail/Values.jsx +++ b/src/pages/database/containers/Configurations/Detail/Values.jsx @@ -12,13 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. -import Base from "containers/BaseDetail" -import { inject, observer } from "mobx-react"; - -@inject("rootStore") -@observer -export default class Values extends Base { +import Base from 'containers/BaseDetail'; +import { inject, observer } from 'mobx-react'; +export class Values extends Base { get leftCards() { return [this.baseInfoCard]; } @@ -36,4 +33,6 @@ export default class Values extends Base { options, }; } -} \ No newline at end of file +} + +export default inject('rootStore')(observer(Values)); diff --git a/src/pages/database/containers/Configurations/Detail/index.jsx b/src/pages/database/containers/Configurations/Detail/index.jsx index 9e9275bb..1342a37d 100644 --- a/src/pages/database/containers/Configurations/Detail/index.jsx +++ b/src/pages/database/containers/Configurations/Detail/index.jsx @@ -19,9 +19,7 @@ import BaseDetail from './BaseDetail'; import Values from './Values'; import Instances from './Instances'; -@inject('rootStore') -@observer -export default class ConfigurationsDetail extends Base { +export class ConfigurationsDetail extends Base { init() { this.store = globalConfigurationsStore; } @@ -67,3 +65,5 @@ export default class ConfigurationsDetail extends Base { ]; } } + +export default inject('rootStore')(observer(ConfigurationsDetail)); diff --git a/src/pages/database/containers/Configurations/actions/Create.jsx b/src/pages/database/containers/Configurations/actions/Create.jsx index aacb0bd7..64392d0d 100644 --- a/src/pages/database/containers/Configurations/actions/Create.jsx +++ b/src/pages/database/containers/Configurations/actions/Create.jsx @@ -18,9 +18,7 @@ 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 { +export class Create extends ModalAction { init() { this.store = globalConfigurationsStore; this.getDatastores(); @@ -129,3 +127,5 @@ export default class Create extends ModalAction { }); }; } + +export default inject('rootStore')(observer(Create)); diff --git a/src/pages/database/containers/Configurations/actions/Delete.jsx b/src/pages/database/containers/Configurations/actions/Delete.jsx index b5e9d6b0..7ea54b8f 100644 --- a/src/pages/database/containers/Configurations/actions/Delete.jsx +++ b/src/pages/database/containers/Configurations/actions/Delete.jsx @@ -13,7 +13,7 @@ // limitations under the License. import { ConfirmAction } from 'containers/Action'; -import globalConfigurationsStore from "stores/trove/configurations"; +import globalConfigurationsStore from 'stores/trove/configurations'; export default class Delete extends ConfirmAction { get id() { diff --git a/src/pages/database/containers/Configurations/actions/index.jsx b/src/pages/database/containers/Configurations/actions/index.jsx index 4530be61..20d36fd1 100644 --- a/src/pages/database/containers/Configurations/actions/index.jsx +++ b/src/pages/database/containers/Configurations/actions/index.jsx @@ -1,3 +1,16 @@ +// Copyright 2021 99cloud +// +// Licensed 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 Create from './Create'; import Delete from './Delete'; @@ -7,7 +20,7 @@ const actionConfigs = { firstAction: Delete, }, batchActions: [Delete], - primaryActions: [Create] + primaryActions: [Create], }; export default { actionConfigs }; diff --git a/src/pages/database/containers/Configurations/index.jsx b/src/pages/database/containers/Configurations/index.jsx index 0982ed31..b260371f 100644 --- a/src/pages/database/containers/Configurations/index.jsx +++ b/src/pages/database/containers/Configurations/index.jsx @@ -15,13 +15,10 @@ import Base from 'containers/List'; import { inject, observer } from 'mobx-react'; -import actions from './actions'; import globalConfigurationsStore from 'stores/trove/configurations'; +import actions from './actions'; -@inject('rootStore') -@observer -export default class Configurations extends Base { - +export class Configurations extends Base { init() { this.store = globalConfigurationsStore; } @@ -51,7 +48,7 @@ export default class Configurations extends Base { { title: t('Configuration Group Name'), dataIndex: 'name', - routeName: this.getRouteName("configurationsDetail") + routeName: this.getRouteName('configurationsDetail'), }, { title: t('Description'), @@ -67,4 +64,6 @@ export default class Configurations extends Base { dataIndex: 'datastoreVersion', }, ]; -} \ No newline at end of file +} + +export default inject('rootStore')(observer(Configurations)); diff --git a/src/pages/database/containers/Instances/Detail/Backups.jsx b/src/pages/database/containers/Instances/Detail/Backups.jsx index 7ac0be6f..9adf47cb 100644 --- a/src/pages/database/containers/Instances/Detail/Backups.jsx +++ b/src/pages/database/containers/Instances/Detail/Backups.jsx @@ -12,48 +12,47 @@ // See the License for the specific language governing permissions and // limitations under the License. -import Base from "containers/List" -import { inject, observer } from "mobx-react"; -import { InstanceBackupsStore } from "stores/trove/instanceBackups"; - -@inject("rootStore") -@observer -export default class Backups extends Base { +import Base from 'containers/List'; +import { inject, observer } from 'mobx-react'; +import { InstanceBackupsStore } from 'stores/trove/instanceBackups'; +export class Backups extends Base { init() { - this.store = new InstanceBackupsStore() + this.store = new InstanceBackupsStore(); } get name() { - return t("Backups") + return t('Backups'); } get policy() { - return "trove:instance:backups"; + return 'trove:instance:backups'; } getColumns = () => { return [ { - title: t("Name"), - dataIndex: "name" + title: t('Name'), + dataIndex: 'name', }, { - title: t("Created"), - dataIndex: "created" + title: t('Created'), + dataIndex: 'created', }, { - title: t("Backup File"), - dataIndex: "locationRef" + title: t('Backup File'), + dataIndex: 'locationRef', }, { - title: t("Incremental"), - dataIndex: "incremental" + title: t('Incremental'), + dataIndex: 'incremental', }, { - title: t("Status"), - dataIndex: "status" - } - ] - } -} \ No newline at end of file + title: t('Status'), + dataIndex: 'status', + }, + ]; + }; +} + +export default inject('rootStore')(observer(Backups)); diff --git a/src/pages/database/containers/Instances/Detail/BaseDetail.jsx b/src/pages/database/containers/Instances/Detail/BaseDetail.jsx index 43980532..acaa929c 100644 --- a/src/pages/database/containers/Instances/Detail/BaseDetail.jsx +++ b/src/pages/database/containers/Instances/Detail/BaseDetail.jsx @@ -12,49 +12,46 @@ // See the License for the specific language governing permissions and // limitations under the License. -import { inject, observer } from "mobx-react"; +import { inject, observer } from 'mobx-react'; import Base from 'containers/BaseDetail'; -@inject("rootStore") -@observer -export default class BaseDetail extends Base { - +export class BaseDetail extends Base { get leftCards() { return [this.baseInfoCard, this.specsCard, this.connectionInfoCard]; } get rightCards() { - return [this.faultCard] + return [this.faultCard]; } get baseInfoCard() { const options = [ { - label: t("Name"), - dataIndex: "name" + label: t('Name'), + dataIndex: 'name', }, { - label: t("Datastore"), - dataIndex: "datastore.type" + label: t('Datastore'), + dataIndex: 'datastore.type', }, { - label: t("Datastore Version"), - dataIndex: "datastore.version" + label: t('Datastore Version'), + dataIndex: 'datastore.version', }, { - label: t("Status"), - dataIndex: "status" + label: t('Status'), + dataIndex: 'status', }, { - label: t("Locality"), - dataIndex: "locality" - } + label: t('Locality'), + dataIndex: 'locality', + }, ]; return { - title: t("Base Info"), - options - } + title: t('Base Info'), + options, + }; } get specsCard() { @@ -63,47 +60,52 @@ export default class BaseDetail extends Base { label: t('Flavor'), dataIndex: 'flavor.id', render: (value) => { - return this.getLinkRender('flavorDetail', value, { - id: value, - }, null) + return this.getLinkRender( + 'flavorDetail', + value, + { + id: value, + }, + null + ); }, }, { - label: t("Volume Size"), - dataIndex: "volume.size" + label: t('Volume Size'), + dataIndex: 'volume.size', }, { - label: t("Created"), - dataIndex: "created", - valueRender: "toLocalTime" + label: t('Created'), + dataIndex: 'created', + valueRender: 'toLocalTime', }, { - label: t("Updated"), - dataIndex: "updated", - valueRender: "toLocalTime" + label: t('Updated'), + dataIndex: 'updated', + valueRender: 'toLocalTime', }, { - label: t("Service Status Updated"), - dataIndex: "service_status_update" - } + label: t('Service Status Updated'), + dataIndex: 'service_status_update', + }, ]; return { - title: t("Specs"), - options - } + title: t('Specs'), + options, + }; } get connectionInfoCard() { const options = [ { - label: t("Host"), - dataIndex: "ip", - render: (value) => value ? value.map(it => it) : "-", + label: t('Host'), + dataIndex: 'ip', + render: (value) => (value ? value.map((it) => it) : '-'), }, { - label: t("Database Port"), - dataIndex: "datastore.type", + label: t('Database Port'), + dataIndex: 'datastore.type', render: (value) => { switch (value) { case 'mysql': @@ -115,41 +117,43 @@ export default class BaseDetail extends Base { default: break; } - } + }, }, { - label: t("Connection Examples"), - dataIndex: "connection_examples" - } + label: t('Connection Examples'), + dataIndex: 'connection_examples', + }, ]; return { - title: t("Connection Information"), - options - } + title: t('Connection Information'), + options, + }; } get faultCard() { const options = [ { - label: t("Created"), - dataIndex: "created", - valueRender: "toLocalTime" + label: t('Created'), + dataIndex: 'created', + valueRender: 'toLocalTime', }, { - label: t("Message"), - dataIndex: "fault.message" + label: t('Message'), + dataIndex: 'fault.message', }, { - label: t("Message Details"), - dataIndex: "fault.details" - } + label: t('Message Details'), + dataIndex: 'fault.details', + }, ]; return { - title: t("Fault"), + title: t('Fault'), labelCol: 2, - options - } + options, + }; } -} \ No newline at end of file +} + +export default inject('rootStore')(observer(BaseDetail)); diff --git a/src/pages/database/containers/Instances/Detail/DatabaseAction.jsx b/src/pages/database/containers/Instances/Detail/DatabaseAction.jsx index 3b832378..e13ed39d 100644 --- a/src/pages/database/containers/Instances/Detail/DatabaseAction.jsx +++ b/src/pages/database/containers/Instances/Detail/DatabaseAction.jsx @@ -1,3 +1,17 @@ +// Copyright 2021 99cloud +// +// Licensed 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 DeleteDatabase from './DatabaseDelete'; const actionConfigs = { @@ -5,7 +19,7 @@ const actionConfigs = { firstAction: DeleteDatabase, }, batchActions: [DeleteDatabase], - primaryActions: [] + primaryActions: [], }; export default actionConfigs; diff --git a/src/pages/database/containers/Instances/Detail/DatabaseDelete.jsx b/src/pages/database/containers/Instances/Detail/DatabaseDelete.jsx index e4202774..cadecc19 100644 --- a/src/pages/database/containers/Instances/Detail/DatabaseDelete.jsx +++ b/src/pages/database/containers/Instances/Detail/DatabaseDelete.jsx @@ -1,3 +1,17 @@ +// Copyright 2021 99cloud +// +// Licensed 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 { ConfirmAction } from 'containers/Action'; import globalInstancesDatabases from 'stores/trove/instances-database'; @@ -20,11 +34,11 @@ export default class DatabaseDelete extends ConfirmAction { allowedCheckFunction = () => true; - policy = "trove:instance:extension:database:delete"; + policy = 'trove:instance:extension:database:delete'; onSubmit = (item) => { - const id = this.containerProps.detail.id; + const { id } = this.containerProps.detail; const name = item.name || this.item.name; return globalInstancesDatabases.deleteDatabase({ id, name }); }; -} \ No newline at end of file +} diff --git a/src/pages/database/containers/Instances/Detail/Databases.jsx b/src/pages/database/containers/Instances/Detail/Databases.jsx index f395bd4d..557fecd0 100644 --- a/src/pages/database/containers/Instances/Detail/Databases.jsx +++ b/src/pages/database/containers/Instances/Detail/Databases.jsx @@ -12,24 +12,22 @@ // See the License for the specific language governing permissions and // limitations under the License. -import Base from "containers/List" -import { inject, observer } from "mobx-react"; -import { InstancesDatabasesStore } from "stores/trove/instances-database"; -import actions from "./DatabaseAction"; - -@inject("rootStore") -@observer -export default class Databases extends Base { +import Base from 'containers/List'; +import { inject, observer } from 'mobx-react'; +import { InstancesDatabasesStore } from 'stores/trove/instances-database'; +import actions from './DatabaseAction'; +export class Databases extends Base { init() { - this.store = new InstancesDatabasesStore() + this.store = new InstancesDatabasesStore(); } + get name() { - return "Databases" + return 'Databases'; } get policy() { - return "trove:instance:detail" + return 'trove:instance:detail'; } get actionConfigs() { @@ -43,9 +41,11 @@ export default class Databases extends Base { getColumns = () => { return [ { - title: t("Database Name"), - dataIndex: "name" - } - ] - } -} \ No newline at end of file + title: t('Database Name'), + dataIndex: 'name', + }, + ]; + }; +} + +export default inject('rootStore')(observer(Databases)); diff --git a/src/pages/database/containers/Instances/Detail/Defaults.jsx b/src/pages/database/containers/Instances/Detail/Defaults.jsx index d35d623a..6ff62397 100644 --- a/src/pages/database/containers/Instances/Detail/Defaults.jsx +++ b/src/pages/database/containers/Instances/Detail/Defaults.jsx @@ -12,28 +12,29 @@ // See the License for the specific language governing permissions and // limitations under the License. -import Base from "containers/BaseDetail" -import { inject, observer } from "mobx-react"; - -@inject("rootStore") -@observer -export default class Defaults extends Base { +import Base from 'containers/BaseDetail'; +import { inject, observer } from 'mobx-react'; +import { get as _get } from 'lodash'; +export class Defaults extends Base { get leftCards() { - return [this.baseInfoCard] + return [this.baseInfoCard]; } get baseInfoCard() { const options = [ { - label: t("Number of Nodes"), - dataIndex: "node_groups[0].count" - } + label: t('Number of Nodes'), + dataIndex: 'node_groups', + render: (value) => _get(value, ['0', 'count'], '-'), + }, ]; return { - title: t("Defaults"), - options + title: t('Defaults'), + options, }; } -} \ No newline at end of file +} + +export default inject('rootStore')(observer(Defaults)); diff --git a/src/pages/database/containers/Instances/Detail/Logs.jsx b/src/pages/database/containers/Instances/Detail/Logs.jsx index 6499724d..70c8b487 100644 --- a/src/pages/database/containers/Instances/Detail/Logs.jsx +++ b/src/pages/database/containers/Instances/Detail/Logs.jsx @@ -12,32 +12,31 @@ // See the License for the specific language governing permissions and // limitations under the License. -import Base from "containers/List" -import { inject, observer } from "mobx-react"; -import { InstancesLogStore } from "stores/trove/instancesLogs"; - -@inject("rootStore") -@observer -export default class Logs extends Base { +import Base from 'containers/List'; +import { inject, observer } from 'mobx-react'; +import { InstancesLogStore } from 'stores/trove/instancesLogs'; +export class Logs extends Base { init() { - this.store = new InstancesLogStore() + this.store = new InstancesLogStore(); } get name() { - return t("Log") + return t('Log'); } get policy() { - return "trove:instance:guest_log_list"; + return 'trove:instance:guest_log_list'; } getColumns = () => { return [ { - title: t("Name"), - dataIndex: "name" - } - ] - } -} \ No newline at end of file + title: t('Name'), + dataIndex: 'name', + }, + ]; + }; +} + +export default inject('rootStore')(observer(Logs)); diff --git a/src/pages/database/containers/Instances/Detail/UserAction.jsx b/src/pages/database/containers/Instances/Detail/UserAction.jsx index d2262787..fdd7fe52 100644 --- a/src/pages/database/containers/Instances/Detail/UserAction.jsx +++ b/src/pages/database/containers/Instances/Detail/UserAction.jsx @@ -1,3 +1,17 @@ +// Copyright 2021 99cloud +// +// Licensed 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 DeleteUser from './UserDelete'; const actionConfigs = { @@ -5,7 +19,7 @@ const actionConfigs = { firstAction: DeleteUser, }, batchActions: [DeleteUser], - primaryActions: [] + primaryActions: [], }; export default actionConfigs; diff --git a/src/pages/database/containers/Instances/Detail/UserDelete.jsx b/src/pages/database/containers/Instances/Detail/UserDelete.jsx index 617d292b..14374ff3 100644 --- a/src/pages/database/containers/Instances/Detail/UserDelete.jsx +++ b/src/pages/database/containers/Instances/Detail/UserDelete.jsx @@ -1,3 +1,17 @@ +// Copyright 2021 99cloud +// +// Licensed 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 { ConfirmAction } from 'containers/Action'; import globalInstancesUsersStore from 'stores/trove/instances-user'; @@ -23,8 +37,8 @@ export default class UserDelete extends ConfirmAction { policy = 'trove:instance:extension:user:delete'; onSubmit = (item) => { - const id = this.containerProps.detail.id; + const { id } = this.containerProps.detail; const name = item.name || this.item.name; - return globalInstancesUsersStore.deleteUser({id, name}); + return globalInstancesUsersStore.deleteUser({ id, name }); }; -} \ No newline at end of file +} diff --git a/src/pages/database/containers/Instances/Detail/Users.jsx b/src/pages/database/containers/Instances/Detail/Users.jsx index 4199760a..a801b5f2 100644 --- a/src/pages/database/containers/Instances/Detail/Users.jsx +++ b/src/pages/database/containers/Instances/Detail/Users.jsx @@ -15,11 +15,10 @@ import Base from 'containers/List'; import { inject, observer } from 'mobx-react'; import { InstancesUsersStore } from 'stores/trove/instances-user'; +import { get as _get } from 'lodash'; import actions from './UserAction'; -@inject('rootStore') -@observer -export default class Users extends Base { +export class Users extends Base { init() { this.store = new InstancesUsersStore(); } @@ -52,8 +51,11 @@ export default class Users extends Base { }, { title: t('Databases'), - dataIndex: 'databases.name', + dataIndex: 'databases', + render: (value) => _get(value, 'name', '-'), }, ]; }; } + +export default inject('rootStore')(observer(Users)); diff --git a/src/pages/database/containers/Instances/Detail/index.jsx b/src/pages/database/containers/Instances/Detail/index.jsx index 05646f85..2d19478b 100644 --- a/src/pages/database/containers/Instances/Detail/index.jsx +++ b/src/pages/database/containers/Instances/Detail/index.jsx @@ -22,9 +22,7 @@ import Backups from './Backups'; import Logs from './Logs'; import Defaults from './Defaults'; -@inject('rootStore') -@observer -export default class InstancesDetail extends Base { +export class InstancesDetail extends Base { init() { this.store = globalInstancesStore; } @@ -97,3 +95,5 @@ export default class InstancesDetail extends Base { ]; } } + +export default inject('rootStore')(observer(InstancesDetail)); diff --git a/src/pages/database/containers/Instances/actions/Delete.jsx b/src/pages/database/containers/Instances/actions/Delete.jsx index 3acce35b..7fe87dea 100644 --- a/src/pages/database/containers/Instances/actions/Delete.jsx +++ b/src/pages/database/containers/Instances/actions/Delete.jsx @@ -39,4 +39,4 @@ export default class Delete extends ConfirmAction { onSubmit = (item) => { return globalInstancesStore.delete({ id: item.id }); }; -} \ No newline at end of file +} diff --git a/src/pages/database/containers/Instances/actions/StepCreate/StepAdvanced/index.jsx b/src/pages/database/containers/Instances/actions/StepCreate/StepAdvanced/index.jsx index 1aca0e17..36d529c1 100644 --- a/src/pages/database/containers/Instances/actions/StepCreate/StepAdvanced/index.jsx +++ b/src/pages/database/containers/Instances/actions/StepCreate/StepAdvanced/index.jsx @@ -1,10 +1,22 @@ +// Copyright 2021 99cloud +// +// Licensed 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 { inject, observer } from 'mobx-react'; import Base from 'components/Form'; import globalInstancesStore from 'stores/trove/instances'; -@inject('rootStore') -@observer -export default class StepAdvanced extends Base { +export class StepAdvanced extends Base { init() { this.getConfigurationGroups(); } @@ -49,3 +61,5 @@ export default class StepAdvanced extends Base { ]; } } + +export default inject('rootStore')(observer(StepAdvanced)); diff --git a/src/pages/database/containers/Instances/actions/StepCreate/StepDetails/index.jsx b/src/pages/database/containers/Instances/actions/StepCreate/StepDetails/index.jsx index 0f43e3fa..e2159ace 100644 --- a/src/pages/database/containers/Instances/actions/StepCreate/StepDetails/index.jsx +++ b/src/pages/database/containers/Instances/actions/StepCreate/StepDetails/index.jsx @@ -20,9 +20,7 @@ import globalInstancesStore from 'stores/trove/instances'; import globalAvailabilityZoneStore from 'stores/nova/zone'; import FlavorSelectTable from 'pages/compute/containers/Instance/components/FlavorSelectTable'; -@inject('rootStore') -@observer -export default class StepDetails extends Base { +export class StepDetails extends Base { init() { this.instancesStore = globalInstancesStore; this.getDatastores(); @@ -226,3 +224,5 @@ export default class StepDetails extends Base { ]; } } + +export default inject('rootStore')(observer(StepDetails)); diff --git a/src/pages/database/containers/Instances/actions/StepCreate/StepInitializeDatabases/index.jsx b/src/pages/database/containers/Instances/actions/StepCreate/StepInitializeDatabases/index.jsx index 2456ace2..6138349f 100644 --- a/src/pages/database/containers/Instances/actions/StepCreate/StepInitializeDatabases/index.jsx +++ b/src/pages/database/containers/Instances/actions/StepCreate/StepInitializeDatabases/index.jsx @@ -1,11 +1,21 @@ +// Copyright 2021 99cloud +// +// Licensed 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 { inject, observer } from 'mobx-react'; import Base from 'components/Form'; -@inject('rootStore') -@observer -export default class StepInitializeDatabases extends Base { - +export class StepInitializeDatabases extends Base { get title() { return t('Initialize Databases'); } @@ -18,7 +28,7 @@ export default class StepInitializeDatabases extends Base { get defaultValue() { const values = { - project: this.currentProjectName + project: this.currentProjectName, }; return values; } @@ -54,3 +64,5 @@ export default class StepInitializeDatabases extends Base { ]; } } + +export default inject('rootStore')(observer(StepInitializeDatabases)); diff --git a/src/pages/database/containers/Instances/actions/StepCreate/StepNetworking/index.jsx b/src/pages/database/containers/Instances/actions/StepCreate/StepNetworking/index.jsx index b7965696..eb525439 100644 --- a/src/pages/database/containers/Instances/actions/StepCreate/StepNetworking/index.jsx +++ b/src/pages/database/containers/Instances/actions/StepCreate/StepNetworking/index.jsx @@ -1,15 +1,27 @@ +// Copyright 2021 99cloud +// +// Licensed 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 { inject, observer } from 'mobx-react'; import Base from 'components/Form'; import globalNetworkStore from 'stores/neutron/network'; -@inject('rootStore') -@observer -export default class StepNetworking extends Base { - +export class StepNetworking extends Base { init() { this.getNetworkStore(); this.selectedNetwork = []; } + get title() { return t('Networking *'); } @@ -17,10 +29,11 @@ export default class StepNetworking extends Base { get name() { return 'Networking'; } + get networking() { return (globalNetworkStore.list.data || []).map((it) => ({ label: it.name, - value: it.id + value: it.id, })); } @@ -32,11 +45,11 @@ export default class StepNetworking extends Base { onChangeNetworkGroup = (checkedValues) => { this.selectedNetwork = checkedValues; - } + }; get defaultValue() { const values = { - project: this.currentProjectName + project: this.currentProjectName, }; return values; } @@ -60,3 +73,5 @@ export default class StepNetworking extends Base { ]; } } + +export default inject('rootStore')(observer(StepNetworking)); diff --git a/src/pages/database/containers/Instances/actions/StepCreate/index.jsx b/src/pages/database/containers/Instances/actions/StepCreate/index.jsx index 1aac5ea4..39c313f5 100644 --- a/src/pages/database/containers/Instances/actions/StepCreate/index.jsx +++ b/src/pages/database/containers/Instances/actions/StepCreate/index.jsx @@ -20,9 +20,7 @@ import StepNetworking from './StepNetworking'; import StepInitializeDatabases from './StepInitializeDatabases'; import StepAdvanced from './StepAdvanced'; -@inject('rootStore') -@observer -export default class StepCreate extends StepAction { +export class StepCreate extends StepAction { init() { this.store = globalInstancesStore; } @@ -114,3 +112,5 @@ export default class StepCreate extends StepAction { }); }; } + +export default inject('rootStore')(observer(StepCreate)); diff --git a/src/pages/database/containers/Instances/index.jsx b/src/pages/database/containers/Instances/index.jsx index dab2b8fc..da1778c7 100644 --- a/src/pages/database/containers/Instances/index.jsx +++ b/src/pages/database/containers/Instances/index.jsx @@ -16,11 +16,10 @@ import { observer, inject } from 'mobx-react'; import Base from 'containers/List'; import globalInstancesStore from 'stores/trove/instances'; import { InstanceStatus } from 'resources/database'; +import { get as _get } from 'lodash'; import actions from './actions'; -@inject('rootStore') -@observer -export default class Instances extends Base { +export class Instances extends Base { init() { this.store = globalInstancesStore; } @@ -54,11 +53,13 @@ export default class Instances extends Base { }, { title: t('Datastore'), - dataIndex: 'datastore.type', + dataIndex: 'datastore', + render: (value) => _get(value, 'type', '-'), }, { title: t('Datastore Version'), - dataIndex: 'datastore.version', + dataIndex: 'datastore', + render: (value) => _get(value, 'version', '-'), isHideable: true, }, { @@ -79,3 +80,5 @@ export default class Instances extends Base { }, ]; } + +export default inject('rootStore')(observer(Instances)); diff --git a/src/pages/database/routes/index.jsx b/src/pages/database/routes/index.jsx index 4b89f3db..368a559d 100644 --- a/src/pages/database/routes/index.jsx +++ b/src/pages/database/routes/index.jsx @@ -31,11 +31,27 @@ export default [ { path: `${PATH}/instances`, component: Instances, exact: true }, { path: `${PATH}/instances/create`, component: StepCreate, exact: true }, { path: `${PATH}/backups`, component: Backups, exact: true }, - { path: `${PATH}/configurations`, component: Configurations, exact: true }, - { path: `${PATH}/instances/detail/:id`, component: InstancesDetail, exact: true }, - { path: `${PATH}/backups/detail/:id`, component: BackupsDetail, exact: true }, - { path: `${PATH}/configurations/detail/:id`, component: ConfigurationsDetail, exact: true }, + { + path: `${PATH}/configurations`, + component: Configurations, + exact: true, + }, + { + path: `${PATH}/instances/detail/:id`, + component: InstancesDetail, + exact: true, + }, + { + path: `${PATH}/backups/detail/:id`, + component: BackupsDetail, + exact: true, + }, + { + path: `${PATH}/configurations/detail/:id`, + component: ConfigurationsDetail, + exact: true, + }, { path: '*', component: E404 }, - ] - } -] \ No newline at end of file + ], + }, +]; diff --git a/src/stores/trove/configurations.js b/src/stores/trove/configurations.js index 53d87881..e9aa851d 100644 --- a/src/stores/trove/configurations.js +++ b/src/stores/trove/configurations.js @@ -19,4 +19,4 @@ export class ConfigurationsStore extends Base { } const globalConfigurationsStore = new ConfigurationsStore(); -export default globalConfigurationsStore; \ No newline at end of file +export default globalConfigurationsStore; diff --git a/src/stores/trove/instanceBackups.js b/src/stores/trove/instanceBackups.js index 46eb86de..2a20cb1d 100644 --- a/src/stores/trove/instanceBackups.js +++ b/src/stores/trove/instanceBackups.js @@ -29,9 +29,9 @@ export class InstanceBackupsStore extends Base { } get paramsFunc() { - return () => { }; + return () => {}; } } const globalInstanceBackups = new InstanceBackupsStore(); -export default globalInstanceBackups; \ No newline at end of file +export default globalInstanceBackups; diff --git a/src/stores/trove/instances-user.js b/src/stores/trove/instances-user.js index 820418f5..50ddf3ef 100644 --- a/src/stores/trove/instances-user.js +++ b/src/stores/trove/instances-user.js @@ -43,4 +43,4 @@ export class InstancesUsersStore extends Base { } const globalInstancesUsersStore = new InstancesUsersStore(); -export default globalInstancesUsersStore; \ No newline at end of file +export default globalInstancesUsersStore; diff --git a/src/stores/trove/instances.js b/src/stores/trove/instances.js index f0ac0490..61105cad 100644 --- a/src/stores/trove/instances.js +++ b/src/stores/trove/instances.js @@ -65,4 +65,4 @@ export class InstancesStore extends Base { } const globalInstancesStore = new InstancesStore(); -export default globalInstancesStore; \ No newline at end of file +export default globalInstancesStore; diff --git a/src/stores/trove/instancesLogs.js b/src/stores/trove/instancesLogs.js index ce0db35f..948faa0d 100644 --- a/src/stores/trove/instancesLogs.js +++ b/src/stores/trove/instancesLogs.js @@ -29,9 +29,9 @@ export class InstancesLogStore extends Base { } get paramsFunc() { - return () => { }; + return () => {}; } } const globalInstancesLog = new InstancesLogStore(); -export default globalInstancesLog; \ No newline at end of file +export default globalInstancesLog;