Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
52fe6b03
Unverified
Commit
52fe6b03
authored
Feb 11, 2019
by
Daniel Lee
Committed by
GitHub
Feb 11, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #15198 from CorpGlory/azure-monitor-refactor-#15087
Azure Monitor: refactor #15087
parents
8769b7aa
0cc9cbcb
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
4 additions
and
144 deletions
+4
-144
public/app/features/explore/slate-plugins/prism/index.tsx
+0
-0
public/app/plugins/datasource/grafana-azure-monitor-datasource/config_ctrl.ts
+1
-1
public/app/plugins/datasource/grafana-azure-monitor-datasource/editor/query_field.tsx
+3
-7
public/app/plugins/datasource/grafana-azure-monitor-datasource/editor/slate-plugins/newline.ts
+0
-35
public/app/plugins/datasource/grafana-azure-monitor-datasource/editor/slate-plugins/runner.ts
+0
-14
public/app/plugins/datasource/grafana-azure-monitor-datasource/version.test.ts
+0
-53
public/app/plugins/datasource/grafana-azure-monitor-datasource/version.ts
+0
-34
No files found.
public/app/
plugins/datasource/grafana-azure-monitor-datasource/editor
/slate-plugins/prism/index.tsx
→
public/app/
features/explore
/slate-plugins/prism/index.tsx
View file @
52fe6b03
File moved
public/app/plugins/datasource/grafana-azure-monitor-datasource/config_ctrl.ts
View file @
52fe6b03
import
AzureLogAnalyticsDatasource
from
'./azure_log_analytics/azure_log_analytics_datasource'
;
import
config
from
'app/core/config'
;
import
{
isVersionGtOrEq
}
from
'
.
/version'
;
import
{
isVersionGtOrEq
}
from
'
app/core/utils
/version'
;
export
class
AzureMonitorConfigCtrl
{
static
templateUrl
=
'public/app/plugins/datasource/grafana-azure-monitor-datasource/partials/config.html'
;
...
...
public/app/plugins/datasource/grafana-azure-monitor-datasource/editor/query_field.tsx
View file @
52fe6b03
import
PluginPrism
from
'./slate-plugins/prism'
;
// import PluginPrism from 'slate-prism';
// import Prism from 'prismjs';
import
PluginPrism
from
'app/features/explore/slate-plugins/prism'
;
import
BracesPlugin
from
'app/features/explore/slate-plugins/braces'
;
import
ClearPlugin
from
'app/features/explore/slate-plugins/clear'
;
// Custom plugins (new line on Enter and run on Shift+Enter)
import
NewlinePlugin
from
'./slate-plugins/newline'
;
import
RunnerPlugin
from
'./slate-plugins/runner'
;
import
NewlinePlugin
from
'app/features/explore/slate-plugins/newline'
;
import
RunnerPlugin
from
'app/features/explore/slate-plugins/runner'
;
import
Typeahead
from
'./typeahead'
;
import
{
getKeybindingSrv
,
KeybindingSrv
}
from
'app/core/services/keybindingSrv'
;
...
...
public/app/plugins/datasource/grafana-azure-monitor-datasource/editor/slate-plugins/newline.ts
deleted
100644 → 0
View file @
8769b7aa
function
getIndent
(
text
)
{
let
offset
=
text
.
length
-
text
.
trimLeft
().
length
;
if
(
offset
)
{
let
indent
=
text
[
0
];
while
(
--
offset
)
{
indent
+=
text
[
0
];
}
return
indent
;
}
return
''
;
}
export
default
function
NewlinePlugin
()
{
return
{
onKeyDown
(
event
,
change
)
{
const
{
value
}
=
change
;
if
(
!
value
.
isCollapsed
)
{
return
undefined
;
}
if
(
event
.
key
===
'Enter'
&&
!
event
.
shiftKey
)
{
event
.
preventDefault
();
const
{
startBlock
}
=
value
;
const
currentLineText
=
startBlock
.
text
;
const
indent
=
getIndent
(
currentLineText
);
return
change
.
splitBlock
()
.
insertText
(
indent
)
.
focus
();
}
},
};
}
public/app/plugins/datasource/grafana-azure-monitor-datasource/editor/slate-plugins/runner.ts
deleted
100644 → 0
View file @
8769b7aa
export
default
function
RunnerPlugin
({
handler
})
{
return
{
onKeyDown
(
event
)
{
// Handle enter
if
(
handler
&&
event
.
key
===
'Enter'
&&
event
.
shiftKey
)
{
// Submit on Enter
event
.
preventDefault
();
handler
(
event
);
return
true
;
}
return
undefined
;
},
};
}
public/app/plugins/datasource/grafana-azure-monitor-datasource/version.test.ts
deleted
100644 → 0
View file @
8769b7aa
import
{
SemVersion
,
isVersionGtOrEq
}
from
'./version'
;
describe
(
'SemVersion'
,
()
=>
{
let
version
=
'1.0.0-alpha.1'
;
describe
(
'parsing'
,
()
=>
{
it
(
'should parse version properly'
,
()
=>
{
const
semver
=
new
SemVersion
(
version
);
expect
(
semver
.
major
).
toBe
(
1
);
expect
(
semver
.
minor
).
toBe
(
0
);
expect
(
semver
.
patch
).
toBe
(
0
);
expect
(
semver
.
meta
).
toBe
(
'alpha.1'
);
});
});
describe
(
'comparing'
,
()
=>
{
beforeEach
(()
=>
{
version
=
'3.4.5'
;
});
it
(
'should detect greater version properly'
,
()
=>
{
const
semver
=
new
SemVersion
(
version
);
const
cases
=
[
{
value
:
'3.4.5'
,
expected
:
true
},
{
value
:
'3.4.4'
,
expected
:
true
},
{
value
:
'3.4.6'
,
expected
:
false
},
{
value
:
'4'
,
expected
:
false
},
{
value
:
'3.5'
,
expected
:
false
},
];
cases
.
forEach
(
testCase
=>
{
expect
(
semver
.
isGtOrEq
(
testCase
.
value
)).
toBe
(
testCase
.
expected
);
});
});
});
describe
(
'isVersionGtOrEq'
,
()
=>
{
it
(
'should compare versions properly (a >= b)'
,
()
=>
{
const
cases
=
[
{
values
:
[
'3.4.5'
,
'3.4.5'
],
expected
:
true
},
{
values
:
[
'3.4.5'
,
'3.4.4'
],
expected
:
true
},
{
values
:
[
'3.4.5'
,
'3.4.6'
],
expected
:
false
},
{
values
:
[
'3.4'
,
'3.4.0'
],
expected
:
true
},
{
values
:
[
'3'
,
'3.0.0'
],
expected
:
true
},
{
values
:
[
'3.1.1-beta1'
,
'3.1'
],
expected
:
true
},
{
values
:
[
'3.4.5'
,
'4'
],
expected
:
false
},
{
values
:
[
'3.4.5'
,
'3.5'
],
expected
:
false
},
];
cases
.
forEach
(
testCase
=>
{
expect
(
isVersionGtOrEq
(
testCase
.
values
[
0
],
testCase
.
values
[
1
])).
toBe
(
testCase
.
expected
);
});
});
});
});
public/app/plugins/datasource/grafana-azure-monitor-datasource/version.ts
deleted
100644 → 0
View file @
8769b7aa
import
_
from
'lodash'
;
const
versionPattern
=
/^
(\d
+
)(?:\.(\d
+
))?(?:\.(\d
+
))?(?:
-
([
0-9A-Za-z
\.]
+
))?
/
;
export
class
SemVersion
{
major
:
number
;
minor
:
number
;
patch
:
number
;
meta
:
string
;
constructor
(
version
:
string
)
{
const
match
=
versionPattern
.
exec
(
version
);
if
(
match
)
{
this
.
major
=
Number
(
match
[
1
]);
this
.
minor
=
Number
(
match
[
2
]
||
0
);
this
.
patch
=
Number
(
match
[
3
]
||
0
);
this
.
meta
=
match
[
4
];
}
}
isGtOrEq
(
version
:
string
):
boolean
{
const
compared
=
new
SemVersion
(
version
);
return
!
(
this
.
major
<
compared
.
major
||
this
.
minor
<
compared
.
minor
||
this
.
patch
<
compared
.
patch
);
}
isValid
():
boolean
{
return
_
.
isNumber
(
this
.
major
);
}
}
export
function
isVersionGtOrEq
(
a
:
string
,
b
:
string
):
boolean
{
const
aSemver
=
new
SemVersion
(
a
);
return
aSemver
.
isGtOrEq
(
b
);
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment