Merge "feat: Support force-delete && reset-status share istance"
This commit is contained in:
commit
020defa50b
@ -836,6 +836,8 @@
|
|||||||
"Forbidden Project": "Forbidden Project",
|
"Forbidden Project": "Forbidden Project",
|
||||||
"Forbidden User": "Forbidden User",
|
"Forbidden User": "Forbidden User",
|
||||||
"Forbidden the domain will have a negative impact, all project and user in domain will be forbidden": "Forbidden the domain will have a negative impact, all project and user in domain will be forbidden",
|
"Forbidden the domain will have a negative impact, all project and user in domain will be forbidden": "Forbidden the domain will have a negative impact, all project and user in domain will be forbidden",
|
||||||
|
"Force Delete": "Force Delete",
|
||||||
|
"Force Delete Share Instance": "Force Delete Share Instance",
|
||||||
"Force release": "Force release",
|
"Force release": "Force release",
|
||||||
"Forced Shutdown": "Forced Shutdown",
|
"Forced Shutdown": "Forced Shutdown",
|
||||||
"Forced shutdown may result in data loss or file system damage. You can also take the initiative to shut down and perform operations.": "Forced shutdown may result in data loss or file system damage. You can also take the initiative to shut down and perform operations.",
|
"Forced shutdown may result in data loss or file system damage. You can also take the initiative to shut down and perform operations.": "Forced shutdown may result in data loss or file system damage. You can also take the initiative to shut down and perform operations.",
|
||||||
|
@ -836,6 +836,8 @@
|
|||||||
"Forbidden Project": "禁用项目",
|
"Forbidden Project": "禁用项目",
|
||||||
"Forbidden User": "禁用用户",
|
"Forbidden User": "禁用用户",
|
||||||
"Forbidden the domain will have a negative impact, all project and user in domain will be forbidden": "禁用域后,该域下面的项目和用户都会被禁止,用户将无法登陆",
|
"Forbidden the domain will have a negative impact, all project and user in domain will be forbidden": "禁用域后,该域下面的项目和用户都会被禁止,用户将无法登陆",
|
||||||
|
"Force Delete": "强制删除",
|
||||||
|
"Force Delete Share Instance": "强制删除共享实例",
|
||||||
"Force release": "强制释放",
|
"Force release": "强制释放",
|
||||||
"Forced Shutdown": "强制关机",
|
"Forced Shutdown": "强制关机",
|
||||||
"Forced shutdown may result in data loss or file system damage. You can also take the initiative to shut down and perform operations.": "强制关机可能会导致数据丢失或文件系统损坏,您也可以主动关机后再进行操作。",
|
"Forced shutdown may result in data loss or file system damage. You can also take the initiative to shut down and perform operations.": "强制关机可能会导致数据丢失或文件系统损坏,您也可以主动关机后再进行操作。",
|
||||||
|
@ -17,6 +17,7 @@ import { ShareInstanceStore } from 'stores/manila/share-instance';
|
|||||||
import Base from 'containers/TabDetail';
|
import Base from 'containers/TabDetail';
|
||||||
import { shareStatus } from 'resources/manila/share';
|
import { shareStatus } from 'resources/manila/share';
|
||||||
import BaseDetail from './BaseDetail';
|
import BaseDetail from './BaseDetail';
|
||||||
|
import actionConfigs from '../actions';
|
||||||
|
|
||||||
export class Detail extends Base {
|
export class Detail extends Base {
|
||||||
get name() {
|
get name() {
|
||||||
@ -31,6 +32,10 @@ export class Detail extends Base {
|
|||||||
return this.getRoutePath('shareInstance');
|
return this.getRoutePath('shareInstance');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get actionConfigs() {
|
||||||
|
return actionConfigs;
|
||||||
|
}
|
||||||
|
|
||||||
get detailInfos() {
|
get detailInfos() {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
|
42
src/pages/share/containers/ShareInstance/actions/Delete.jsx
Normal file
42
src/pages/share/containers/ShareInstance/actions/Delete.jsx
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
// 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 globalShareInstanceStore from 'stores/manila/share-instance';
|
||||||
|
|
||||||
|
export default class Delete extends ConfirmAction {
|
||||||
|
get id() {
|
||||||
|
return 'delete';
|
||||||
|
}
|
||||||
|
|
||||||
|
get title() {
|
||||||
|
return t('Force Delete Share Instance');
|
||||||
|
}
|
||||||
|
|
||||||
|
get buttonType() {
|
||||||
|
return 'danger';
|
||||||
|
}
|
||||||
|
|
||||||
|
get buttonText() {
|
||||||
|
return t('Force Delete');
|
||||||
|
}
|
||||||
|
|
||||||
|
get actionName() {
|
||||||
|
return t('Force Delete Share Instance');
|
||||||
|
}
|
||||||
|
|
||||||
|
policy = 'manila:share_instance:force_delete';
|
||||||
|
|
||||||
|
onSubmit = (data) => globalShareInstanceStore.forceDelete(data);
|
||||||
|
}
|
@ -0,0 +1,89 @@
|
|||||||
|
// 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 { ModalAction } from 'containers/Action';
|
||||||
|
import globalShareInstanceStore from 'stores/manila/share-instance';
|
||||||
|
import { shareStatus } from 'resources/manila/share';
|
||||||
|
import { getOptions } from 'utils/index';
|
||||||
|
|
||||||
|
export class ResetStatus extends ModalAction {
|
||||||
|
static id = 'reset';
|
||||||
|
|
||||||
|
static title = t('Reset Status');
|
||||||
|
|
||||||
|
get name() {
|
||||||
|
return t('Reset Status');
|
||||||
|
}
|
||||||
|
|
||||||
|
get defaultValue() {
|
||||||
|
const { id, status } = this.item;
|
||||||
|
const value = {
|
||||||
|
id,
|
||||||
|
oldStatus: shareStatus[status] || status,
|
||||||
|
};
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
get instanceName() {
|
||||||
|
return (this.item || {}).id;
|
||||||
|
}
|
||||||
|
|
||||||
|
static policy = 'manila:share_instance:reset_status';
|
||||||
|
|
||||||
|
static allowed = () => Promise.resolve(true);
|
||||||
|
|
||||||
|
get statusOptions() {
|
||||||
|
const statusList = ['available', 'error'];
|
||||||
|
const { status } = this.item;
|
||||||
|
const leftStatusList = statusList.filter((it) => it !== status);
|
||||||
|
const options = getOptions(shareStatus).filter((it) =>
|
||||||
|
leftStatusList.includes(it.value)
|
||||||
|
);
|
||||||
|
return options;
|
||||||
|
}
|
||||||
|
|
||||||
|
get formItems() {
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
name: 'id',
|
||||||
|
label: t('Share Instance'),
|
||||||
|
type: 'label',
|
||||||
|
iconType: 'instance',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'oldStatus',
|
||||||
|
label: t('Current Status'),
|
||||||
|
type: 'label',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'status',
|
||||||
|
label: t('New Status'),
|
||||||
|
type: 'select',
|
||||||
|
options: this.statusOptions,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
init() {
|
||||||
|
this.store = globalShareInstanceStore;
|
||||||
|
}
|
||||||
|
|
||||||
|
onSubmit = (values) => {
|
||||||
|
const { id } = this.item;
|
||||||
|
return this.store.resetStatus(id, values);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export default inject('rootStore')(observer(ResetStatus));
|
31
src/pages/share/containers/ShareInstance/actions/index.jsx
Normal file
31
src/pages/share/containers/ShareInstance/actions/index.jsx
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
// 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 Delete from './Delete';
|
||||||
|
import ResetStatus from './ResetStatus';
|
||||||
|
|
||||||
|
const actionConfigs = {
|
||||||
|
rowActions: {
|
||||||
|
firstAction: Delete,
|
||||||
|
moreActions: [
|
||||||
|
{
|
||||||
|
action: ResetStatus,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
primaryActions: [],
|
||||||
|
batchActions: [Delete],
|
||||||
|
};
|
||||||
|
|
||||||
|
export default actionConfigs;
|
@ -16,6 +16,7 @@ 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/manila/share';
|
import { shareStatus } from 'resources/manila/share';
|
||||||
|
import actionConfigs from './actions';
|
||||||
|
|
||||||
export class ShareInstance extends Base {
|
export class ShareInstance extends Base {
|
||||||
init() {
|
init() {
|
||||||
@ -34,6 +35,10 @@ export class ShareInstance extends Base {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get actionConfigs() {
|
||||||
|
return actionConfigs;
|
||||||
|
}
|
||||||
|
|
||||||
getColumns = () => [
|
getColumns = () => [
|
||||||
{
|
{
|
||||||
title: t('ID'),
|
title: t('ID'),
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
// 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 { action } from 'mobx';
|
||||||
import client from 'client';
|
import client from 'client';
|
||||||
import Base from 'stores/base';
|
import Base from 'stores/base';
|
||||||
|
|
||||||
@ -32,6 +33,22 @@ export class ShareInstanceStore extends Base {
|
|||||||
item.exportLocations = export_locations;
|
item.exportLocations = export_locations;
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@action
|
||||||
|
forceDelete = ({ id }) => {
|
||||||
|
const body = {
|
||||||
|
force_delete: null,
|
||||||
|
};
|
||||||
|
return this.submitting(this.client.action(id, body));
|
||||||
|
};
|
||||||
|
|
||||||
|
@action
|
||||||
|
resetStatus(id, data) {
|
||||||
|
const body = {
|
||||||
|
reset_status: data,
|
||||||
|
};
|
||||||
|
return this.submitting(this.client.action(id, body));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const globalShareInstanceStore = new ShareInstanceStore();
|
const globalShareInstanceStore = new ShareInstanceStore();
|
||||||
|
Loading…
Reference in New Issue
Block a user