Github user ilgrosso commented on a diff in the pull request: https://github.com/apache/syncope/pull/6#discussion_r31246625 --- Diff: console/src/main/java/org/apache/syncope/console/pages/panels/RuntimePanel.java --- @@ -0,0 +1,108 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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. + */ +package org.apache.syncope.console.pages.panels; + +import org.apache.syncope.console.rest.JobRestClient; +import org.apache.syncope.console.wicket.ajax.markup.html.ClearIndicatingAjaxLink; +import org.apache.wicket.PageReference; +import org.apache.wicket.ajax.AbstractAjaxTimerBehavior; +import org.apache.wicket.ajax.AjaxRequestTarget; +import org.apache.wicket.markup.html.panel.Fragment; +import org.apache.wicket.model.IModel; +import org.apache.wicket.markup.html.panel.Panel; + +public class RuntimePanel extends Panel { + + private static final long serialVersionUID = 1L; + + private boolean latestStatus; + + protected Fragment fragmentStop, fragmentSpinner; + + public AbstractAjaxTimerBehavior timer; + + final PageReference pageRef; + + private final long jobId; + + private final JobRestClient jobRestClient; + + public RuntimePanel(final String componentId, final IModel<?> model, final PageReference pageRef, final long jobId, + final JobRestClient jobRestClient) { + super(componentId, model); + this.pageRef = pageRef; + this.jobId = jobId; + this.jobRestClient = jobRestClient; + latestStatus = false; + this.refresh(); + + } + + public void refresh() { + boolean currentStatus = jobRestClient.isJobRunning(jobId); + if (currentStatus == true && latestStatus == false) { + setRunning(); + } else if (currentStatus == false) { + setNotRunning(); + } + + latestStatus = currentStatus; + + } + + public void setRunning() { + fragmentStop = new Fragment("panelStop", "fragmentStop", this); + fragmentStop.addOrReplace(new ClearIndicatingAjaxLink<Void>("stopLink", pageRef) { + + private static final long serialVersionUID = -7978723352517770644L; + + @Override + protected void onClickInternal(final AjaxRequestTarget target) { + --- End diff -- Empty line
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---