Skip to content

Commit

Permalink
Merge pull request #2627 from flyinprogrammer/fix_gchart_loader
Browse files Browse the repository at this point in the history
use Google Charts loader and not jsapi
  • Loading branch information
dashpole authored Jul 29, 2020
2 parents 33463ad + ddaf1cb commit 492345a
Show file tree
Hide file tree
Showing 8 changed files with 248 additions and 1,509 deletions.
6 changes: 2 additions & 4 deletions cmd/internal/pages/assets/html/containers.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,8 @@
<!-- Latest compiled and minified JavaScript -->
<script src="{{.Root}}static/jquery-3.5.1.min.js"></script>
<script src="{{.Root}}static/bootstrap-4.0.0-beta.2.min.js"></script>
<script type="text/javascript" src="{{.Root}}static/google-jsapi.js"></script>

<script type="text/javascript" src="{{.Root}}static/loader.js"></script>
<script type="text/javascript" src="{{.Root}}static/containers.js"></script>
<script type="text/javascript" src="{{.Root}}static/gcharts.js"></script>
</head>
<body>
<div class="container theme-showcase" >
Expand Down Expand Up @@ -263,7 +261,7 @@ <h4>Top Memory Usage:
{{end}}
</div>
<script type="text/javascript">
startPage({{.ContainerName}}, {{.CpuAvailable}}, {{.MemoryAvailable}}, {{.Root}}, {{.IsRoot}});
google.charts.setOnLoadCallback(startPage({{.ContainerName}}, {{.CpuAvailable}}, {{.MemoryAvailable}}, {{.Root}}, {{.IsRoot}}));
drawImages({{.DockerImages}});
</script>
</body>
Expand Down
2 changes: 2 additions & 0 deletions cmd/internal/pages/assets/js/containers.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

google.charts.load('current', {packages: ['corechart', 'gauge', 'default', 'format', 'ui', 'table']});

function humanize(num, size, units) {
var unit;
for (unit = units.pop(); units.length && num >= size; unit = units.pop()) {
Expand Down
1,378 changes: 0 additions & 1,378 deletions cmd/internal/pages/assets/js/gcharts.js

This file was deleted.

39 changes: 0 additions & 39 deletions cmd/internal/pages/assets/js/google-jsapi.js

This file was deleted.

142 changes: 142 additions & 0 deletions cmd/internal/pages/assets/js/loader.js

Large diffs are not rendered by default.

178 changes: 97 additions & 81 deletions cmd/internal/pages/static/assets.go

Large diffs are not rendered by default.

6 changes: 2 additions & 4 deletions cmd/internal/pages/static/static.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ const StaticResource = "/static/"
var popper, _ = Asset("cmd/internal/pages/assets/js/popper.min.js")
var bootstrapJs, _ = Asset("cmd/internal/pages/assets/js/bootstrap-4.0.0-beta.2.min.js")
var containersJs, _ = Asset("cmd/internal/pages/assets/js/containers.js")
var gchartsJs, _ = Asset("cmd/internal/pages/assets/js/gcharts.js")
var googleJsapiJs, _ = Asset("cmd/internal/pages/assets/js/google-jsapi.js")
var loaderJs, _ = Asset("cmd/internal/pages/assets/js/loader.js")
var jqueryJs, _ = Asset("cmd/internal/pages/assets/js/jquery-3.5.1.min.js")

var bootstrapCss, _ = Asset("cmd/internal/pages/assets/styles/bootstrap-4.0.0-beta.2.min.css")
Expand All @@ -46,8 +45,7 @@ var staticFiles = map[string][]byte{
"bootstrap-theme-3.1.1.min.css": bootstrapThemeCss,
"containers.css": containersCss,
"containers.js": containersJs,
"gcharts.js": gchartsJs,
"google-jsapi.js": googleJsapiJs,
"loader.js": loaderJs,
"jquery-3.5.1.min.js": jqueryJs,
}

Expand Down
6 changes: 3 additions & 3 deletions cmd/internal/pages/templates.go

Large diffs are not rendered by default.

0 comments on commit 492345a

Please sign in to comment.