-
Notifications
You must be signed in to change notification settings - Fork 563
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Telegraf configure view. (+1 squashed commit)
Squashed commits: [6a806b2] [WIP] Telegraf configure view.
- Loading branch information
Showing
41 changed files
with
3,458 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
scouter.client/src/scouter/client/configuration/actions/OpenTelegrafConfigureAction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* | ||
* Copyright 2015 the original author or authors. | ||
* @https://github.com/scouter-project/scouter | ||
* | ||
* 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. | ||
* | ||
*/ | ||
package scouter.client.configuration.actions; | ||
|
||
import org.eclipse.jface.action.Action; | ||
import org.eclipse.jface.dialogs.MessageDialog; | ||
import org.eclipse.ui.IWorkbenchPage; | ||
import org.eclipse.ui.IWorkbenchWindow; | ||
import org.eclipse.ui.PartInitException; | ||
import scouter.client.Images; | ||
import scouter.client.configuration.views.TelegrafConfigView; | ||
import scouter.client.util.ImageUtil; | ||
|
||
public class OpenTelegrafConfigureAction extends Action { | ||
public final static String ID = OpenTelegrafConfigureAction.class.getName(); | ||
|
||
private final IWorkbenchWindow win; | ||
private int serverId; | ||
public OpenTelegrafConfigureAction(IWorkbenchWindow win, String label, int serverId) { | ||
this.win = win; | ||
this.serverId = serverId; | ||
setText(label); | ||
setImageDescriptor(ImageUtil.getImageDescriptor(Images.config)); | ||
} | ||
|
||
public void run() { | ||
if (win != null) { | ||
try { | ||
TelegrafConfigView v = (TelegrafConfigView) win.getActivePage().showView(TelegrafConfigView.ID, "" + serverId, IWorkbenchPage.VIEW_ACTIVATE); | ||
if(v != null) | ||
v.setInput(serverId); | ||
} catch (PartInitException e) { | ||
MessageDialog.openError(win.getShell(), "Error", "Error opening view:" + e.getMessage()); | ||
} | ||
} | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
scouter.client/src/scouter/client/configuration/model/SingleString.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* Copyright 2015 the original author or authors. | ||
* @https://github.com/scouter-project/scouter | ||
* | ||
* 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. | ||
* | ||
*/ | ||
|
||
package scouter.client.configuration.model; | ||
|
||
import java.util.List; | ||
import java.util.stream.Collectors; | ||
|
||
/** | ||
* @author Gun Lee (gunlee01@gmail.com) on 06/01/2019 | ||
*/ | ||
public class SingleString { | ||
public String value; | ||
public SingleString() { | ||
} | ||
|
||
public SingleString(String value) { | ||
this.value = value; | ||
} | ||
|
||
public static List<SingleString> of(List<String> list) { | ||
return list.stream().map(v -> new SingleString(v)).collect(Collectors.toList()); | ||
} | ||
|
||
public static List<String> toOriginal(List<SingleString> singleStrings) { | ||
return singleStrings.stream().map(s -> s.value).collect(Collectors.toList()); | ||
} | ||
} |
71 changes: 71 additions & 0 deletions
71
scouter.client/src/scouter/client/configuration/model/TagFilterMapping.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
/* | ||
* Copyright 2015 the original author or authors. | ||
* @https://github.com/scouter-project/scouter | ||
* | ||
* 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. | ||
* | ||
*/ | ||
|
||
package scouter.client.configuration.model; | ||
|
||
import scouter.server.support.telegraf.TgmConfig; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.stream.Collectors; | ||
|
||
import static java.util.stream.Collectors.groupingBy; | ||
import static java.util.stream.Collectors.toList; | ||
|
||
/** | ||
* @author Gun Lee (gunlee01@gmail.com) on 06/01/2019 | ||
*/ | ||
public class TagFilterMapping { | ||
public String tag; | ||
public String mappingValue; | ||
|
||
public TagFilterMapping() { | ||
} | ||
|
||
public TagFilterMapping(String tag, String mappingValue) { | ||
this.tag = tag; | ||
this.mappingValue = mappingValue; | ||
} | ||
|
||
public static List<TagFilterMapping> of(List<TgmConfig.TagFilter> tfList) { | ||
List<TagFilterMapping> list = new ArrayList<>(); | ||
for (TgmConfig.TagFilter filter : tfList) { | ||
for (String match : filter.match) { | ||
TagFilterMapping mapping = new TagFilterMapping(filter.tag, match); | ||
list.add(mapping); | ||
} | ||
} | ||
return list; | ||
} | ||
|
||
public static List<TgmConfig.TagFilter> toOriginal(List<TagFilterMapping> mappings) { | ||
return mappings.stream() | ||
.collect(groupingBy(m -> m.tag)) | ||
.entrySet().stream() | ||
.map( | ||
e -> new TgmConfig.TagFilter( | ||
e.getKey(), | ||
e.getValue().stream() | ||
.map(m -> m.mappingValue) | ||
.collect(Collectors.toList()) | ||
.toArray(new String[0]) | ||
) | ||
) | ||
.collect(toList()); | ||
} | ||
} |
74 changes: 74 additions & 0 deletions
74
scouter.client/src/scouter/client/configuration/model/TreeModel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
/* | ||
* Copyright 2015 the original author or authors. | ||
* @https://github.com/scouter-project/scouter | ||
* | ||
* 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. | ||
* | ||
*/ | ||
|
||
package scouter.client.configuration.model; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
/** | ||
* @author Gun Lee (gunlee01@gmail.com) on 03/01/2019 | ||
*/ | ||
public class TreeModel { | ||
|
||
public TreeModel parent; | ||
public List<TreeModel> child = new ArrayList<>(); | ||
|
||
public String displayName; | ||
public Object element; | ||
|
||
public TreeModel(TreeModel parent, String displayName) { | ||
this(parent, displayName, new Object()); | ||
} | ||
|
||
public TreeModel(TreeModel parent, String displayName, Object element) { | ||
this.parent = parent; | ||
this.displayName = displayName; | ||
if (parent != null) { | ||
parent.addChild(this); | ||
} | ||
this.element = element; | ||
} | ||
|
||
public String getDisplayName() { | ||
return displayName; | ||
} | ||
|
||
public void setDisplayName(String displayName) { | ||
this.displayName = displayName; | ||
} | ||
|
||
public Object getElement() { | ||
return element; | ||
} | ||
|
||
public void setElement(Object element) { | ||
this.element = element; | ||
} | ||
|
||
private void addChild(TreeModel model) { | ||
child.add(model); | ||
} | ||
|
||
public void removeMe() { | ||
if (parent == null) { | ||
throw new IllegalStateException("Root Node!"); | ||
} | ||
parent.child.remove(this); | ||
} | ||
} |
Oops, something went wrong.