Skip to content
This repository has been archived by the owner on Feb 12, 2022. It is now read-only.

Commit

Permalink
Merge pull request #818 from xizi-xu/develop
Browse files Browse the repository at this point in the history
Update dashboard markup editor and add attribute to ag-metric
  • Loading branch information
xizi-xu committed Jul 18, 2018
2 parents c6e07b0 + 01b66b4 commit e853b53
Show file tree
Hide file tree
Showing 9 changed files with 94 additions and 14 deletions.
10 changes: 9 additions & 1 deletion ArgusWeb/app/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -475,4 +475,12 @@ a.definition-tip, a.definition-tip:hover, a.definition-tip:visited {

.tooltip > .tooltip-inner {background-color: steelblue; text-align: left}
.tooltip.bottom > .tooltip-arrow {border-bottom-color: steelblue;}
.tooltip.in {opacity: 1}
.tooltip.in {opacity: 1}

/* dashboard markup editor fullscreen */
.CodeMirror-fullscreen {
position: fixed;
top: 55px; left: 0; right: 0; bottom: 0;
height: auto;
z-index: ;
}
15 changes: 15 additions & 0 deletions ArgusWeb/app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,23 @@
<!-- old bower utilities -->
<script src="node_modules/codemirror/lib/codemirror.js"></script>
<script src="node_modules/codemirror/mode/xml/xml.js"></script>
<script src="node_modules/codemirror/mode/javascript/javascript.js"></script>
<script src="node_modules/codemirror/mode/css/css.js"></script>
<script src="node_modules/codemirror/mode/properties/properties.js"></script>
<script src="node_modules/codemirror/mode/htmlmixed/htmlmixed.js"></script>
<script src="node_modules/codemirror/addon/hint/show-hint.js"></script>
<link href="node_modules/codemirror/addon/hint/show-hint.css" rel="stylesheet" />
<script src="node_modules/codemirror/addon/hint/xml-hint.js"></script>
<script src="node_modules/codemirror/addon/hint/html-hint.js"></script>
<script src="node_modules/codemirror/addon/hint/css-hint.js"></script>
<link href="node_modules/codemirror/addon/fold/foldgutter.css" rel="stylesheet">
<script src="node_modules/codemirror/addon/fold/foldcode.js"></script>
<script src="node_modules/codemirror/addon/fold/foldgutter.js"></script>
<script src="node_modules/codemirror/addon/fold/comment-fold.js"></script>
<script src="node_modules/codemirror/addon/fold/xml-fold.js"></script>
<script src="node_modules/codemirror/addon/edit/matchtags.js"></script>
<script src="node_modules/codemirror/addon/edit/closetag.js"></script>
<script src="node_modules/codemirror/addon/display/fullscreen.js"></script>
<script src="node_modules/angular-ui-codemirror/src/ui-codemirror.js"></script>
<script src="node_modules/ngstorage/ngStorage.js"></script>
<script src="node_modules/angular-table/dist/angular-table.js"></script>
Expand Down
18 changes: 16 additions & 2 deletions ArgusWeb/app/js/controllers/dashboardsDetail.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ angular.module('argus.controllers.dashboards.detail', ['ngResource', 'ui.codemir
};

$scope.editorLoaded = function (editor) {
editor.setSize(null, '30em');
editor.setSize(null, 'auto');
};

$scope.isTabSelected = function (tab) {
Expand Down Expand Up @@ -88,7 +88,21 @@ angular.module('argus.controllers.dashboards.detail', ['ngResource', 'ui.codemir
lineWrapping: true,
lineNumbers: true,
mode: 'htmlmixed',
viewportMargin: 500
viewportMargin: Infinity,
tabSize: 2,
foldGutter: true,
gutters: ['CodeMirror-linenumbers', 'CodeMirror-foldgutter'],
autoCloseTags: true,
matchTags: {bothTags: true},
extraKeys: { /* key board short cuts in the the editor */
'Alt-Space': 'autocomplete',
'Ctrl-Alt-F': function(editor) {
editor.setOption('fullScreen', !editor.getOption('fullScreen'));
},
'Esc': function(editor) {
if (editor.getOption('fullScreen')) editor.setOption('fullScreen', false);
}
}
};

if ($scope.dashboardId > 0) {
Expand Down
5 changes: 4 additions & 1 deletion ArgusWeb/app/js/controllers/viewElements.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ angular.module('argus.controllers.viewelements', [])
'name': seriesData.name,
'color': seriesData.color,
'extraYAxis': seriesData.extraYAxis,
'hideTags': seriesData.hideTags,
'hideScope': seriesData.hideScope,
'hideMetric': seriesData.hideMetric,
'expression': expression,
'metricSpecificOptions': metricSpecificOptions
};
Expand All @@ -25,4 +28,4 @@ angular.module('argus.controllers.viewelements', [])
this.updateOption = function(name, value) {
$scope.options[name] = value;
};
});
});
5 changes: 4 additions & 1 deletion ArgusWeb/app/js/directives/charts/metric.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ angular.module('argus.directives.charts.metric', [])
seriesData.color = attributes.seriescolor;
seriesData.name = attributes.seriesname;
seriesData.extraYAxis = attributes.extraYaxis;
seriesData.hideTags = attributes.hidetags;
seriesData.hideScope = attributes.hidescope;
seriesData.hideMetric = attributes.hidemetric;

if (attributes.value && attributes.value.length > 0) {
value = attributes.value;
Expand All @@ -45,4 +48,4 @@ angular.module('argus.directives.charts.metric', [])
element.html('<span> </span>');
}
};
}]);
}]);
32 changes: 27 additions & 5 deletions ArgusWeb/app/js/services/charts/dataProcessing.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,21 @@ angular.module('argus.services.charts.dataProcessing', [])

function createMetricWithScopeMetricAndTags(metric){
return {
scopeMetric: metric.scope + ":" + metric.metric,
scopeMetric: metric.scope + ':' + metric.metric,
tags: createTagString(metric.tags)
}
};
}

function createSeriesName(metric) {
if (metric.displayName !== null && metric.displayName !== undefined) {
return metric.displayName;
}

var scope = metric.scope;
var name = metric.metric;
var scope = metric.scope ? metric.scope: '';
var name = metric.metric ? metric.metric : '';
var tags = createTagString(metric.tags);
return scope + ':' + name + tags;
if (scope !== '' && name !== '') scope = scope + ':';
return scope + name + tags;
}

function createTagString(tags) {
Expand Down Expand Up @@ -227,6 +228,9 @@ angular.module('argus.services.charts.dataProcessing', [])
processedMetric['name'] = metrics.name;
processedMetric['color'] = metrics.color;
processedMetric['extraYAxis'] = metrics.extraYAxis;
processedMetric['hideTags'] = metrics.hideTags;
processedMetric['hideScope'] = metrics.hideScope;
processedMetric['hideMetric'] = metrics.hideMetric;
processedMetric['metricSpecificOptions'] = this.getMetricSpecificOptionsInArray(metricSpecificOptions);

// update metric list with new processed metric object
Expand Down Expand Up @@ -269,6 +273,24 @@ angular.module('argus.services.charts.dataProcessing', [])
series.push([timestamp, value]);
}
}
if (metricItem.hideTags !== undefined) {
if (metricItem.hideTags === 'true') {
// delete all tags
delete data[i].tags;
} else {
// delete provided tags
var droppedTags = metricItem.hideTags.split(',').map(function(tag) {
return tag.trim();
});
droppedTags.forEach(function(tag) {
delete data[i].tags[tag];
});
}
}

if (metricItem.hideScope) delete data[i].scope;
if (metricItem.hideMetric) delete data[i].metric;

var metricName = (metricItem.name) ? metricItem.name : createSeriesName(data[i]);
var metricColor = (metricItem.color) ? metricItem.color : null;
var metricExtraYAxis = (metricItem.extraYAxis) ? metricItem.extraYAxis : null;
Expand Down
6 changes: 3 additions & 3 deletions ArgusWeb/app/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ArgusWeb/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"angular-utils-pagination": "~0.11.1",
"angulartics": "~0.17.2",
"bootstrap": "~3.3.7",
"codemirror": "~5.28.0",
"codemirror": "~5.39.0",
"d3": "^4.2.1",
"d3fc-rebind": "^4.1.1",
"d3fc-sample": "^3.0.4",
Expand Down
15 changes: 15 additions & 0 deletions ArgusWeb/webpack_index.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,23 @@
<!-- old bower utilities -->
<script src="node_modules/codemirror/lib/codemirror.js"></script>
<script src="node_modules/codemirror/mode/xml/xml.js"></script>
<script src="node_modules/codemirror/mode/javascript/javascript.js"></script>
<script src="node_modules/codemirror/mode/css/css.js"></script>
<script src="node_modules/codemirror/mode/properties/properties.js"></script>
<script src="node_modules/codemirror/mode/htmlmixed/htmlmixed.js"></script>
<script src="node_modules/codemirror/addon/hint/show-hint.js"></script>
<link href="node_modules/codemirror/addon/hint/show-hint.css" rel="stylesheet" />
<script src="node_modules/codemirror/addon/hint/xml-hint.js"></script>
<script src="node_modules/codemirror/addon/hint/html-hint.js"></script>
<script src="node_modules/codemirror/addon/hint/css-hint.js"></script>
<link href="node_modules/codemirror/addon/fold/foldgutter.css" rel="stylesheet">
<script src="node_modules/codemirror/addon/fold/foldcode.js"></script>
<script src="node_modules/codemirror/addon/fold/foldgutter.js"></script>
<script src="node_modules/codemirror/addon/fold/comment-fold.js"></script>
<script src="node_modules/codemirror/addon/fold/xml-fold.js"></script>
<script src="node_modules/codemirror/addon/edit/matchtags.js"></script>
<script src="node_modules/codemirror/addon/edit/closetag.js"></script>
<script src="node_modules/codemirror/addon/display/fullscreen.js"></script>
<script src="node_modules/angular-ui-codemirror/src/ui-codemirror.js"></script>
<script src="node_modules/ngstorage/ngStorage.js"></script>
<script src="node_modules/angular-table/dist/angular-table.js"></script>
Expand Down

0 comments on commit e853b53

Please sign in to comment.