mirror of
https://github.com/ceph/ceph
synced 2025-01-30 06:53:38 +00:00
mgr/dashboard: Readd pool notifications
As of the merge of cleaner notifications, the notification component was refactored and move this caused a loss of previously added notifications. Fixes: https://tracker.ceph.com/issues/36355 Signed-off-by: Stephan Müller <smueller@suse.com>
This commit is contained in:
parent
e5a04a3d48
commit
039a01d824
@ -35,6 +35,7 @@ describe('TaskManagerMessageService', () => {
|
||||
});
|
||||
|
||||
describe('defined tasks messages', () => {
|
||||
let defaultMsg: string;
|
||||
const testMessages = (operation: TaskMessageOperation, involves: string) => {
|
||||
expect(service.getRunningTitle(finishedTask)).toBe(operation.running + ' ' + involves);
|
||||
expect(service.getErrorTitle(finishedTask)).toBe(
|
||||
@ -62,8 +63,34 @@ describe('TaskManagerMessageService', () => {
|
||||
expect(service.getErrorMessage(finishedTask)).toBe(msg);
|
||||
};
|
||||
|
||||
describe('pool tasks', () => {
|
||||
beforeEach(() => {
|
||||
const metadata = {
|
||||
pool_name: 'somePool'
|
||||
};
|
||||
defaultMsg = `pool '${metadata.pool_name}'`;
|
||||
finishedTask.metadata = metadata;
|
||||
});
|
||||
|
||||
it('tests pool/create messages', () => {
|
||||
finishedTask.name = 'pool/create';
|
||||
testCreate(defaultMsg);
|
||||
testErrorCode(17, `Name is already used by ${defaultMsg}.`);
|
||||
});
|
||||
|
||||
it('tests pool/edit messages', () => {
|
||||
finishedTask.name = 'pool/edit';
|
||||
testUpdate(defaultMsg);
|
||||
testErrorCode(17, `Name is already used by ${defaultMsg}.`);
|
||||
});
|
||||
|
||||
it('tests pool/delete messages', () => {
|
||||
finishedTask.name = 'pool/delete';
|
||||
testDelete(defaultMsg);
|
||||
});
|
||||
});
|
||||
|
||||
describe('rbd tasks', () => {
|
||||
let defaultMsg: string;
|
||||
let childMsg: string;
|
||||
let destinationMsg: string;
|
||||
let snapMsg: string;
|
||||
|
@ -49,6 +49,8 @@ class TaskMessage {
|
||||
providedIn: ServicesModule
|
||||
})
|
||||
export class TaskMessageService {
|
||||
constructor() {}
|
||||
|
||||
defaultMessage = new TaskMessage(
|
||||
new TaskMessageOperation('Executing', 'execute', 'Executed'),
|
||||
(metadata) => {
|
||||
@ -74,6 +76,13 @@ export class TaskMessageService {
|
||||
};
|
||||
|
||||
messages = {
|
||||
'pool/create': new TaskMessage(this.commonOperations.create, this.pool, (metadata) => ({
|
||||
'17': `Name is already used by ${this.pool(metadata)}.`
|
||||
})),
|
||||
'pool/edit': new TaskMessage(this.commonOperations.update, this.pool, (metadata) => ({
|
||||
'17': `Name is already used by ${this.pool(metadata)}.`
|
||||
})),
|
||||
'pool/delete': new TaskMessage(this.commonOperations.delete, this.pool),
|
||||
'rbd/create': new TaskMessage(this.commonOperations.create, this.rbd.default, (metadata) => ({
|
||||
'17': `Name is already used by ${this.rbd.default(metadata)}.`
|
||||
})),
|
||||
@ -159,7 +168,9 @@ export class TaskMessageService {
|
||||
)
|
||||
};
|
||||
|
||||
constructor() {}
|
||||
pool(metadata) {
|
||||
return `pool '${metadata.pool_name}'`;
|
||||
}
|
||||
|
||||
_getTaskTitle(task: Task) {
|
||||
return this.messages[task.name] || this.defaultMessage;
|
||||
|
Loading…
Reference in New Issue
Block a user