blob: 59386968afaad17a485915b062fba82c473a2f0d [file] [log] [blame]
/********************************************************************************
* Copyright (c) 2020 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
********************************************************************************/
import {createSelector} from "@ngrx/store";
import {IAPIProcessTask} from "../../../core/api/process";
import {EAPIProcessTaskDefinitionKey} from "../../../core/api/process/EAPIProcessTaskDefinitionKey";
import {statementTasksSelector} from "../../../store";
interface IStatementDetailsButton {
icon: string;
label: string;
task: IAPIProcessTask;
options?: any;
class?: string;
}
export const statementDetailsButtonSelector = createSelector(
statementTasksSelector,
(tasks): IStatementDetailsButton[] => {
const result: IStatementDetailsButton[] = [];
for (const task of tasks) {
if (task.taskDefinitionKey === EAPIProcessTaskDefinitionKey.ADD_BASIC_INFO_DATA) {
result.push({
icon: "description",
label: "details.button.createDraftForNegativeAnswer",
options: {negative: true},
task
});
}
result.push({
icon: "create",
label: "details.button." + task.taskDefinitionKey,
class: "openk-success",
task
});
}
return result;
}
);