fixed errors
This commit is contained in:
parent
f3dbf6391f
commit
203a91f065
|
@ -489,7 +489,8 @@ class View extends \HTML
|
|||
break;
|
||||
|
||||
case SERVICE:
|
||||
// TODO:Enterprise item. It may not exist.
|
||||
$data['imageSrc'] = \get_parameter('imageSrc');
|
||||
$data['serviceId'] = \get_parameter('serviceId');
|
||||
break;
|
||||
|
||||
case LABEL:
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -278,7 +278,10 @@ if ($pure === false) {
|
|||
__('Color cloud'),
|
||||
'color_cloud_min link-create-item'
|
||||
);
|
||||
// TODO: SERVICE.
|
||||
enterprise_include_once('include/functions_visual_map_editor.php');
|
||||
enterprise_hook(
|
||||
'enterprise_visual_map_editor_print_toolbox_refactor'
|
||||
);
|
||||
echo '</div>';
|
||||
echo '<div class="visual-console-copy-delete">';
|
||||
visual_map_print_button_editor_refactor(
|
||||
|
|
|
@ -59,73 +59,6 @@ export function servicePropsDecoder(data: AnyObject): ServiceProps | never {
|
|||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Class to add item to the general items form
|
||||
* This item consists of a label and a Service List type select.
|
||||
*/
|
||||
class ServiceListInputGroup extends InputGroup<Partial<ServiceProps>> {
|
||||
protected createContent(): HTMLElement | HTMLElement[] {
|
||||
const serviceListLabel = document.createElement("label");
|
||||
serviceListLabel.textContent = t("Service");
|
||||
|
||||
const spinner = fontAwesomeIcon(faCircleNotch, t("Spinner"), {
|
||||
size: "small",
|
||||
spin: true
|
||||
});
|
||||
serviceListLabel.appendChild(spinner);
|
||||
|
||||
this.requestData("service-list", {}, (error, data) => {
|
||||
// Remove Spinner.
|
||||
spinner.remove();
|
||||
|
||||
if (error) {
|
||||
serviceListLabel.appendChild(
|
||||
fontAwesomeIcon(faExclamationCircle, t("Error"), {
|
||||
size: "small",
|
||||
color: "#e63c52"
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
if (data instanceof Array) {
|
||||
const serviceListSelect = document.createElement("select");
|
||||
serviceListSelect.required = true;
|
||||
|
||||
data.forEach(option => {
|
||||
const optionElement = document.createElement("option");
|
||||
optionElement.value = option.id;
|
||||
optionElement.textContent = option.name;
|
||||
serviceListSelect.appendChild(optionElement);
|
||||
});
|
||||
|
||||
serviceListSelect.value = `${this.currentData.serviceId ||
|
||||
this.initialData.serviceId ||
|
||||
0}`;
|
||||
|
||||
serviceListSelect.addEventListener("change", event => {
|
||||
if (typeof (event.target as HTMLSelectElement).value === "string") {
|
||||
const id = (event.target as HTMLSelectElement).value.split("|")[0];
|
||||
this.updateData({
|
||||
serviceId: parseIntOr(id, 0)
|
||||
});
|
||||
} else {
|
||||
this.updateData({
|
||||
serviceId: parseIntOr(
|
||||
(event.target as HTMLSelectElement).value,
|
||||
0
|
||||
)
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
serviceListLabel.appendChild(serviceListSelect);
|
||||
}
|
||||
});
|
||||
|
||||
return serviceListLabel;
|
||||
}
|
||||
}
|
||||
|
||||
export default class Service extends Item<ServiceProps> {
|
||||
public createDomElement(): HTMLElement {
|
||||
const element = document.createElement("div");
|
||||
|
|
Loading…
Reference in New Issue