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
b55f8215
Commit
b55f8215
authored
Jan 13, 2016
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(apps): work on plugin directives loading
parent
08caf4bb
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
25 additions
and
15 deletions
+25
-15
public/app/core/core.ts
+2
-1
public/app/core/services/dynamic_directive_srv.ts
+12
-6
public/app/features/apps/config_loader.ts
+2
-2
public/app/features/apps/partials/edit.html
+0
-2
public/app/grafana.ts
+4
-1
tasks/options/watch.js
+5
-3
No files found.
public/app/core/core.ts
View file @
b55f8215
...
...
@@ -25,5 +25,6 @@ import 'app/core/controllers/all';
import
'app/core/services/all'
;
import
'app/core/routes/all'
;
import
'./filters/filters'
;
import
coreModule
from
'./core_module'
;
export
{
arrayJoin
};
export
{
arrayJoin
,
coreModule
};
public/app/core/services/dynamic_directive_srv.ts
View file @
b55f8215
...
...
@@ -9,25 +9,31 @@ class DynamicDirectiveSrv {
constructor
(
private
$compile
,
private
$parse
)
{}
addDirective
(
element
,
name
,
scope
)
{
var
child
=
angular
.
element
(
document
.
createElement
(
name
));
this
.
$compile
(
child
)(
scope
);
element
.
empty
();
element
.
append
(
angular
.
element
(
document
.
createElement
(
name
)));
this
.
$compile
(
element
)(
scope
);
element
.
append
(
child
);
}
create
(
options
)
{
let
directiveDef
=
{
restrict
:
'E'
,
scope
:
options
.
scope
,
link
:
function
(
scope
,
elem
)
{
link
:
(
scope
,
elem
,
attrs
)
=>
{
options
.
directive
(
scope
).
then
(
directiveInfo
=>
{
if
(
!
directiveInfo
)
{
return
;
}
if
(
directiveInfo
.
fn
.
hasBeenR
egistered
)
{
coreModule
.
directive
(
directiveInfo
.
name
,
directiveInfo
.
fn
);
directiveInfo
.
fn
.
hasBeenR
egistered
=
true
;
if
(
!
directiveInfo
.
fn
.
r
egistered
)
{
coreModule
.
directive
(
attrs
.
$normalize
(
directiveInfo
.
name
)
,
directiveInfo
.
fn
);
directiveInfo
.
fn
.
r
egistered
=
true
;
}
this
.
addDirective
(
elem
,
directiveInfo
.
name
,
scope
);
}).
catch
(
function
(
err
)
{
console
.
log
(
'Dynamic directive load error: '
,
err
);
});
}
};
...
...
public/app/features/apps/config_loader.ts
View file @
b55f8215
...
...
@@ -11,8 +11,8 @@ function appConfigLoader(dynamicDirectiveSrv) {
directive
:
scope
=>
{
return
System
.
import
(
scope
.
appModel
.
module
).
then
(
function
(
appModule
)
{
return
{
name
:
'app
ConfigLoader
'
+
scope
.
appModel
.
appId
,
fn
:
scope
.
appModel
.
directives
.
configView
,
name
:
'app
-config-
'
+
scope
.
appModel
.
appId
,
fn
:
appModule
.
configView
,
};
});
},
...
...
public/app/features/apps/partials/edit.html
View file @
b55f8215
...
...
@@ -96,8 +96,6 @@
</div>
</section>
<nginx-config></nginx-config>
<div
ng-if=
"ctrl.appModel.appId"
>
<app-config-loader
app-model=
"ctrl.appModel"
></app-config-loader>
</div>
...
...
public/app/grafana.ts
View file @
b55f8215
...
...
@@ -8,12 +8,12 @@ import 'angular-sanitize';
import
'angular-dragdrop'
;
import
'angular-bindonce'
;
import
'angular-ui'
;
import
'app/core/core'
;
import
$
from
'jquery'
;
import
angular
from
'angular'
;
import
config
from
'app/core/config'
;
import
_
from
'lodash'
;
import
{
coreModule
}
from
'./core/core'
;
export
class
GrafanaApp
{
registerFunctions
:
any
;
...
...
@@ -67,6 +67,9 @@ export class GrafanaApp {
this
.
useModule
(
angular
.
module
(
moduleName
,
[]));
});
// makes it possible to add dynamic stuff
this
.
useModule
(
coreModule
);
var
preBootRequires
=
[
System
.
import
(
'app/features/all'
)];
var
pluginModules
=
config
.
bootData
.
pluginModules
||
[];
...
...
tasks/options/watch.js
View file @
b55f8215
...
...
@@ -27,15 +27,17 @@ module.exports = function(config, grunt) {
}
if
(
/
(\.
ts
)
$/
.
test
(
filepath
))
{
newPath
=
filepath
.
replace
(
/^public/
,
'public_gen'
);
grunt
.
log
.
writeln
(
'Copying to '
+
newPath
);
grunt
.
file
.
copy
(
filepath
,
newPath
);
// copy ts file also used by source maps
//changes changed file source to that of the changed file
var
option
=
'typescript.build.src'
;
var
result
=
filepath
;
grunt
.
config
(
option
,
result
);
grunt
.
task
.
run
(
'typescript:build'
);
grunt
.
task
.
run
(
'tslint'
);
// copy ts file also used by source maps
newPath
=
filepath
.
replace
(
/^public/
,
'public_gen'
);
grunt
.
file
.
copy
(
filepath
,
newPath
);
}
});
...
...
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