diff --git a/public/apps/dashboard/styles/main.css b/public/apps/dashboard/styles/main.css deleted file mode 100644 index da964e6..0000000 --- a/public/apps/dashboard/styles/main.css +++ /dev/null @@ -1,209 +0,0 @@ -.thumbnail > img, -.thumbnail a > img, -.carousel-inner > .item > img, -.carousel-inner > .item > a > img { - display: block; - max-width: 100%; - height: auto; -} -.btn-group-lg > .btn { - padding: 18px 27px; - font-size: 17px; - line-height: 1.33; - border-radius: 6px; -} -.btn-group-sm > .btn { - padding: 6px 9px; - font-size: 12px; - line-height: 1.5; - border-radius: 3px; -} -.btn-group-xs > .btn { - padding: 1px 5px; - font-size: 12px; - line-height: 1.5; - border-radius: 3px; -} -.container:before, -.container:after, -.container-fluid:before, -.container-fluid:after, -.row:before, -.row:after, -.form-horizontal .form-group:before, -.form-horizontal .form-group:after, -.btn-toolbar:before, -.btn-toolbar:after, -.btn-group-vertical > .btn-group:before, -.btn-group-vertical > .btn-group:after, -.nav:before, -.nav:after, -.navbar:before, -.navbar:after, -.navbar-header:before, -.navbar-header:after, -.navbar-collapse:before, -.navbar-collapse:after, -.pager:before, -.pager:after, -.panel-body:before, -.panel-body:after, -.modal-footer:before, -.modal-footer:after { - content: " "; - display: table; -} -.container:after, -.container-fluid:after, -.row:after, -.form-horizontal .form-group:after, -.btn-toolbar:after, -.btn-group-vertical > .btn-group:after, -.nav:after, -.navbar:after, -.navbar-header:after, -.navbar-collapse:after, -.pager:after, -.panel-body:after, -.modal-footer:after { - clear: both; -} -body.application-dashboard { - background-color: #b4bcc2; -} -dashboard-grid { - display: block; - margin: 0; - padding: 5px; -} -.start-screen { - margin: 20px; - background-color: #ecf0f1; - padding: 20px; -} -.gridster { - list-style-type: none; - display: block; - background-color: #b4bcc2; - margin: 0; - padding: 0; -} -.gridster .gs-resize-handle { - background-position: 50% 50% !important; - bottom: 0 !important; - right: 0 !important; - padding: 4px; - height: 25px; - width: 25px; -} -.gridster i.remove { - cursor: pointer; -} -.gridster dashboard-panel { - display: block; - height: 100%; - background: #ffffff; - color: #444444; - padding: 0; - overflow: hidden; - position: relative; -} -.gridster dashboard-panel .panel { - margin: 0; - height: 100%; - display: -webkit-box; - display: -moz-box; - display: -webkit-flex; - display: -ms-flexbox; - display: flex; - -webkit-box-direction: normal; - -moz-box-direction: normal; - -webkit-box-orient: vertical; - -moz-box-orient: vertical; - -webkit-flex-direction: column; - -ms-flex-direction: column; - flex-direction: column; - -webkit-box-pack: start; - -moz-box-pack: start; - -ms-flex-pack: start; - -webkit-justify-content: flex-start; - justify-content: flex-start; -} -.gridster dashboard-panel .panel .panel-heading { - -webkit-box-flex: 0; - -moz-box-flex: 0; - -webkit-flex: 0 0 auto; - -ms-flex: 0 0 auto; - flex: 0 0 auto; - white-space: nowrap; - display: flex; -} -.gridster dashboard-panel .panel .panel-heading div.btn-group { - white-space: nowrap; - -webkit-box-flex: 0; - -moz-box-flex: 0; - -webkit-flex: 0 0 auto; - -ms-flex: 0 0 auto; - flex: 0 0 auto; -} -.gridster dashboard-panel .panel .panel-heading .panel-title { - font-size: inherit; - white-space: nowrap; - text-overflow: ellipsis; - overflow: hidden; - -webkit-box-flex: 1; - -moz-box-flex: 1; - -webkit-flex: 1 1 0; - -ms-flex: 1 1 0; - flex: 1 1 0; -} -.gridster dashboard-panel .panel .panel-heading a { - color: #444444; - border: none; - background: none; - padding: 0px 3px; -} -.gridster dashboard-panel .panel .panel-heading a:hover { - color: #298fa3; -} -.gridster dashboard-panel .panel .load-error { - text-align: center; - font-size: 1em; - display: -webkit-box; - display: -moz-box; - display: -webkit-flex; - display: -ms-flexbox; - display: flex; - -webkit-box-flex: 1; - -moz-box-flex: 1; - -webkit-flex: 1 0 auto; - -ms-flex: 1 0 auto; - flex: 1 0 auto; - -webkit-box-pack: center; - -moz-box-pack: center; - -ms-flex-pack: center; - -webkit-justify-content: center; - justify-content: center; - -webkit-box-direction: normal; - -moz-box-direction: normal; - -webkit-box-orient: vertical; - -moz-box-orient: vertical; - -webkit-flex-direction: column; - -ms-flex-direction: column; - flex-direction: column; -} -.gridster dashboard-panel .panel .load-error .fa-exclamation-triangle { - font-size: 2em; - color: #e74c3c; -} -.gridster dashboard-panel .panel visualize { - -webkit-box-flex: 1; - -moz-box-flex: 1; - -webkit-flex: 1 1 100%; - -ms-flex: 1 1 100%; - flex: 1 1 100%; - height: auto; -} -.dashboard-load { - margin: 10px; -} diff --git a/public/apps/discover/styles/main.css b/public/apps/discover/styles/main.css deleted file mode 100644 index 02aad02..0000000 --- a/public/apps/discover/styles/main.css +++ /dev/null @@ -1,241 +0,0 @@ -.thumbnail > img, -.thumbnail a > img, -.carousel-inner > .item > img, -.carousel-inner > .item > a > img { - display: block; - max-width: 100%; - height: auto; -} -.btn-group-lg > .btn { - padding: 18px 27px; - font-size: 17px; - line-height: 1.33; - border-radius: 6px; -} -.btn-group-sm > .btn { - padding: 6px 9px; - font-size: 12px; - line-height: 1.5; - border-radius: 3px; -} -.btn-group-xs > .btn { - padding: 1px 5px; - font-size: 12px; - line-height: 1.5; - border-radius: 3px; -} -.container:before, -.container:after, -.container-fluid:before, -.container-fluid:after, -.row:before, -.row:after, -.form-horizontal .form-group:before, -.form-horizontal .form-group:after, -.btn-toolbar:before, -.btn-toolbar:after, -.btn-group-vertical > .btn-group:before, -.btn-group-vertical > .btn-group:after, -.nav:before, -.nav:after, -.navbar:before, -.navbar:after, -.navbar-header:before, -.navbar-header:after, -.navbar-collapse:before, -.navbar-collapse:after, -.pager:before, -.pager:after, -.panel-body:before, -.panel-body:after, -.modal-footer:before, -.modal-footer:after { - content: " "; - display: table; -} -.container:after, -.container-fluid:after, -.row:after, -.form-horizontal .form-group:after, -.btn-toolbar:after, -.btn-group-vertical > .btn-group:after, -.nav:after, -.navbar:after, -.navbar-header:after, -.navbar-collapse:after, -.pager:after, -.panel-body:after, -.modal-footer:after { - clear: both; -} -.application-discover { - overflow-x: hidden; -} -.discover-timechart { - margin-bottom: 20px; - display: block; - position: relative; -} -.discover-timechart visualize { - height: 200px; - max-height: 600px; -} -.discover-timechart visualize.only-spy { - height: auto; -} -.discover-timechart visualize.only-spy .visualize-table { - height: auto; -} -.discover-timechart .chartwrapper { - position: absolute; - top: 0; - left: 0; - width: 100%; - height: 100%; -} -.discover-overlay { - position: absolute; - top: 0; - left: 0; - bottom: 0; - right: 0; - z-index: 20; - opacity: 0.75; - text-align: center; - background-color: #ffffff; -} -.discover-overlay > div { - text-align: center; -} -.discover-hits { - background-color: #ecf0f1; - float: right; - padding: 5px 10px; - border-bottom-left-radius: 4px; -} -.discover-table { - overflow-y: auto; - overflow-x: auto; - padding-left: 0px !important; - padding-right: 0px !important; -} -.discover-table-timefield { - white-space: nowrap; -} -.discover-table-open-icon { - width: 7px; -} -.discover-table-footer { - background-color: #ecf0f1; - padding: 5px 10px; -} -.discover-table-details-toggle { - margin-bottom: 3px; -} -.discover-table-details-buttons, -.discover-table-details-field { - white-space: nowrap; -} -.discover-table-details-value, -.discover-table-details pre { - word-break: break-all; - word-wrap: break-word; - white-space: pre-wrap; -} -.discover-field-filter { - background-color: #ecf0f1; - margin-right: 10px; -} -.discover-field-filter .form-group { - margin-bottom: 0px; -} -.discover-field-filter-toggle { - color: #ffffff; - font-size: 9px; -} -.sidebar-item button.discover-field-toggle { - display: none; - font-size: 9px; - position: absolute; - right: 0; - top: 0; - margin: 5px 10px; -} -.sidebar-item:hover:hover button.discover-field-toggle { - display: block; -} -.discover-field-details-close { - text-align: center; - border-top: 1px solid transparent; - background-color: #ecf0f1; -} -.discover-field-details-close:hover { - background-color: #cfd9db; - color: #444444; -} -.discover-field-details { - border-top: 1px solid transparent; - padding: 5px 10px; - background-color: #ffffff; - color: #444444; -} -.discover-field-details .discover-field-details-count { - white-space: nowrap; -} -.discover-field-details a { - color: #1f6b7a !important; -} -.discover-field-details a.btn { - color: #444444 !important; -} -.discover-field-details .discover-field-details-error { - margin-top: 5px; -} -.discover-field-details .discover-field-details-item { - margin-top: 5px; -} -.discover-field-details .discover-field-details-filter { - cursor: pointer; -} -.discover-field-details .progress { - margin-bottom: 0px; -} -.discover-field-details .progress .progress-bar { - padding-left: 10px; - text-align: right; - line-height: 18px; - max-width: 100%; - border-radius: 4px; -} -.discover-field-details .progress .progress-bar span { - background-color: #95a5a6; - padding: 3px; - border-radius: 4px; - margin-left: 3px; - margin-right: 3px; -} -field-name > i, -[field-name] > i { - margin-right: 5px; - text-align: center; - display: inline-block; - width: 12px; - color: #b4bcc2; -} -field-name.no-results, -[field-name].no-results { - color: #b4bcc2; -} -disc-field-chooser ul.discover-selected-fields { - /* If only _source is presend in the selected fields list, hide its toggle button */ -} -disc-field-chooser ul.discover-selected-fields li:first-child:nth-last-child(1)[field=_source] button.discover-field-toggle { - display: none; -} -disc-field-chooser .sidebar-item-title { - position: relative; -} -.results h3 { - margin: -20px 0 10px 0; - text-align: center; -} diff --git a/public/apps/settings/styles/main.css b/public/apps/settings/styles/main.css deleted file mode 100644 index a9f08e4..0000000 --- a/public/apps/settings/styles/main.css +++ /dev/null @@ -1,156 +0,0 @@ -.thumbnail > img, -.thumbnail a > img, -.carousel-inner > .item > img, -.carousel-inner > .item > a > img { - display: block; - max-width: 100%; - height: auto; -} -.btn-group-lg > .btn { - padding: 18px 27px; - font-size: 17px; - line-height: 1.33; - border-radius: 6px; -} -.btn-group-sm > .btn { - padding: 6px 9px; - font-size: 12px; - line-height: 1.5; - border-radius: 3px; -} -.btn-group-xs > .btn { - padding: 1px 5px; - font-size: 12px; - line-height: 1.5; - border-radius: 3px; -} -.container:before, -.container:after, -.container-fluid:before, -.container-fluid:after, -.row:before, -.row:after, -.form-horizontal .form-group:before, -.form-horizontal .form-group:after, -.btn-toolbar:before, -.btn-toolbar:after, -.btn-group-vertical > .btn-group:before, -.btn-group-vertical > .btn-group:after, -.nav:before, -.nav:after, -.navbar:before, -.navbar:after, -.navbar-header:before, -.navbar-header:after, -.navbar-collapse:before, -.navbar-collapse:after, -.pager:before, -.pager:after, -.panel-body:before, -.panel-body:after, -.modal-footer:before, -.modal-footer:after { - content: " "; - display: table; -} -.container:after, -.container-fluid:after, -.row:after, -.form-horizontal .form-group:after, -.btn-toolbar:after, -.btn-group-vertical > .btn-group:after, -.nav:after, -.navbar:after, -.navbar-header:after, -.navbar-collapse:after, -.pager:after, -.panel-body:after, -.modal-footer:after { - clear: both; -} -kibana-settings-app, -kbn-settings-indices, -kbn-settings-indices-edit, -kbn-settings-indices-create, -kbn-settings-advanced, -kbn-settings-objects, -kbn-settings-objects-view { - display: block; -} -.settings-nav { - text-transform: capitalize; -} -li.kbn-settings-tab { - text-transform: capitalize; -} -kbn-settings-objects form { - margin-bottom: 18px; -} -kbn-settings-objects .list-unstyled li { - border-bottom: 1px solid #ecf0f1; - padding: 8px; -} -kbn-settings-objects .empty { - color: #b4bcc2; -} -kbn-settings-objects .action-bar { - margin-top: 10px; - background-color: #ecf0f1; - padding: 4px 12px; -} -kbn-settings-objects .action-bar .btn-xs { - font-size: 10px; -} -kbn-settings-advanced .table > tbody > tr > td { - vertical-align: middle; -} -kbn-settings-objects-view label { - font-family: Menlo, Monaco, Consolas, "Courier New", monospace; -} -kbn-settings-objects-view .ace_editor { - height: 300px; -} -.kbn-settings-about { - margin-top: 30px; -} -.kbn-settings-about .jumbotron h1 { - font-weight: bold; -} -.kbn-settings-about-versions td { - width: 50%; -} -.kbn-settings-about-versions td:first-child { - font-weight: bold; - text-align: right; -} -.advanced-settings table { - width: 100%; -} -.advanced-settings table tr.default td.value { - color: #acb6c0; -} -.advanced-settings table td { - font-family: Menlo, Monaco, Consolas, "Courier New", monospace; -} -.advanced-settings table td.actions { - width: 150px; -} -.objects-settings .item { - padding: 12px; -} -.objects-settings .item .item-title { - margin-left: 30px; -} -.objects-settings .item .actions { - margin-top: -6px; -} -.indices-settings i.active { - color: #31c471; -} -.indices-settings tr.field-settings .field-popularize { - margin-left: 5px; - display: none; -} -.indices-settings tr.field-settings:hover .field-popularize { - display: inline; -} diff --git a/public/apps/visualize/styles/main.css b/public/apps/visualize/styles/main.css deleted file mode 100644 index 96edbea..0000000 --- a/public/apps/visualize/styles/main.css +++ /dev/null @@ -1,486 +0,0 @@ -.thumbnail > img, -.thumbnail a > img, -.carousel-inner > .item > img, -.carousel-inner > .item > a > img { - display: block; - max-width: 100%; - height: auto; -} -.btn-group-lg > .btn { - padding: 18px 27px; - font-size: 17px; - line-height: 1.33; - border-radius: 6px; -} -.btn-group-sm > .btn { - padding: 6px 9px; - font-size: 12px; - line-height: 1.5; - border-radius: 3px; -} -.btn-group-xs > .btn { - padding: 1px 5px; - font-size: 12px; - line-height: 1.5; - border-radius: 3px; -} -.container:before, -.container:after, -.container-fluid:before, -.container-fluid:after, -.row:before, -.row:after, -.form-horizontal .form-group:before, -.form-horizontal .form-group:after, -.btn-toolbar:before, -.btn-toolbar:after, -.btn-group-vertical > .btn-group:before, -.btn-group-vertical > .btn-group:after, -.nav:before, -.nav:after, -.navbar:before, -.navbar:after, -.navbar-header:before, -.navbar-header:after, -.navbar-collapse:before, -.navbar-collapse:after, -.pager:before, -.pager:after, -.panel-body:before, -.panel-body:after, -.modal-footer:before, -.modal-footer:after { - content: " "; - display: table; -} -.container:after, -.container-fluid:after, -.row:after, -.form-horizontal .form-group:after, -.btn-toolbar:after, -.btn-group-vertical > .btn-group:after, -.nav:after, -.navbar:after, -.navbar-header:after, -.navbar-collapse:after, -.pager:after, -.panel-body:after, -.modal-footer:after { - clear: both; -} -.vis-wizard h1 { - margin-top: 45px; -} -.visualizations .visualization i { - margin-right: 15px; - font-size: 1.5em; -} -.visualizations { - font-size: 1.2em; -} -.vis-editor { - -webkit-box-flex: 1; - -moz-box-flex: 1; - -webkit-flex: 1 1 auto; - -ms-flex: 1 1 auto; - flex: 1 1 auto; - display: -webkit-box; - display: -moz-box; - display: -webkit-flex; - display: -ms-flexbox; - display: flex; - -webkit-box-direction: normal; - -moz-box-direction: normal; - -webkit-box-orient: vertical; - -moz-box-orient: vertical; - -webkit-flex-direction: column; - -ms-flex-direction: column; - flex-direction: column; -} -.vis-editor > * { - -webkit-flex-shrink: 0; - flex-shrink: 0; -} -.vis-editor navbar .bitty-modal-container { - position: relative; -} -.vis-editor navbar .bitty-modal-container .bitty-modal { - position: absolute; - cursor: pointer; - top: 0px; - left: 0px; - right: 0px; - bottom: 0px; - z-index: 10; - background: rgba(61, 99, 107, 0.9); - color: white; - text-align: center; - padding-top: 6px; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; -} -.vis-editor navbar .bitty-modal-container a { - color: white; -} -.vis-editor-content { - -webkit-box-flex: 1; - -moz-box-flex: 1; - -webkit-flex: 1 1 auto; - -ms-flex: 1 1 auto; - flex: 1 1 auto; - display: -webkit-box; - display: -moz-box; - display: -webkit-flex; - display: -ms-flexbox; - display: flex; - -webkit-box-direction: normal; - -moz-box-direction: normal; - -webkit-box-orient: vertical; - -moz-box-orient: vertical; - -webkit-flex-direction: column; - -ms-flex-direction: column; - flex-direction: column; -} -.vis-editor-content > * { - -webkit-flex-shrink: 0; - flex-shrink: 0; -} -@media (min-width: 992px) { - .vis-editor-content { - -webkit-box-direction: normal; - -moz-box-direction: normal; - -webkit-box-orient: horizontal; - -moz-box-orient: horizontal; - -webkit-flex-direction: row; - -ms-flex-direction: row; - flex-direction: row; - } -} -.vis-editor-sidebar { - -webkit-box-flex: 0; - -moz-box-flex: 0; - -webkit-flex: 0 0 auto; - -ms-flex: 0 0 auto; - flex: 0 0 auto; - display: -webkit-box; - display: -moz-box; - display: -webkit-flex; - display: -ms-flexbox; - display: flex; - -webkit-box-direction: normal; - -moz-box-direction: normal; - -webkit-box-orient: vertical; - -moz-box-orient: vertical; - -webkit-flex-direction: column; - -ms-flex-direction: column; - flex-direction: column; - overflow: auto; -} -.vis-editor-sidebar > * { - -webkit-flex-shrink: 0; - flex-shrink: 0; -} -@media (min-width: 992px) { - .vis-editor-sidebar { - -webkit-flex-basis: 16.666666666666668%; - flex-basis: 16.666666666666668%; - min-width: 350px; - max-width: 350px; - margin-bottom: 57px; - } -} -@media (min-width: 992px) { - .vis-editor-sidebar-buttons { - position: absolute; - bottom: 0; - min-width: 350px; - } -} -.vis-editor-sidebar .sidebar-item { - border-top: 0 !important; -} -.vis-editor-sidebar .sidebar-container { - -webkit-box-flex: 1; - -moz-box-flex: 1; - -webkit-flex: 1 0 auto; - -ms-flex: 1 0 auto; - flex: 1 0 auto; - background-color: #ffffff; - border-right-color: #ecf0f1; -} -.vis-editor-sidebar .sidebar-item-title { - background: #ecf0f1; -} -.vis-editor-sidebar .sidebar-item-title:hover { - color: #444444 !important; - background-color: #ecf0f1 !important; -} -.vis-editor nesting-indicator { - display: -webkit-box; - display: -moz-box; - display: -webkit-flex; - display: -ms-flexbox; - display: flex; - -webkit-box-flex: 0; - -moz-box-flex: 0; - -webkit-flex: 0 0 auto; - -ms-flex: 0 0 auto; - flex: 0 0 auto; -} -.vis-editor nesting-indicator > span { - width: 8px; - background-color: #31c471; -} -.vis-editor-agg { - -webkit-box-flex: 1; - -moz-box-flex: 1; - -webkit-flex: 1 1 auto; - -ms-flex: 1 1 auto; - flex: 1 1 auto; - display: -webkit-box; - display: -moz-box; - display: -webkit-flex; - display: -ms-flexbox; - display: flex; - -webkit-box-direction: normal; - -moz-box-direction: normal; - -webkit-box-orient: vertical; - -moz-box-orient: vertical; - -webkit-flex-direction: column; - -ms-flex-direction: column; - flex-direction: column; - padding: 5px; - border-bottom: 1px solid #ecf0f1; -} -.vis-editor-agg > * { - -webkit-flex-shrink: 0; - flex-shrink: 0; -} -.vis-editor-agg-wrapper { - display: -webkit-box; - display: -moz-box; - display: -webkit-flex; - display: -ms-flexbox; - display: flex; -} -.vis-editor-agg-group { - -webkit-box-flex: 1; - -moz-box-flex: 1; - -webkit-flex: 1 1 auto; - -ms-flex: 1 1 auto; - flex: 1 1 auto; - display: -webkit-box; - display: -moz-box; - display: -webkit-flex; - display: -ms-flexbox; - display: flex; - -webkit-box-direction: normal; - -moz-box-direction: normal; - -webkit-box-orient: vertical; - -moz-box-orient: vertical; - -webkit-flex-direction: column; - -ms-flex-direction: column; - flex-direction: column; - color: #444444; -} -.vis-editor-agg-group > * { - -webkit-flex-shrink: 0; - flex-shrink: 0; -} -.vis-editor-agg-header { - display: -webkit-box; - display: -moz-box; - display: -webkit-flex; - display: -ms-flexbox; - display: flex; - -webkit-box-align: center; - -moz-box-align: center; - -webkit-align-items: center; - -ms-flex-align: center; - align-items: center; - -webkit-box-flex: 1; - -moz-box-flex: 1; - -webkit-flex: 1; - -ms-flex: 1; - flex: 1; -} -.vis-editor-agg-header-toggle { - -webkit-box-flex: 0; - -moz-box-flex: 0; - -webkit-flex: 0 0 auto; - -ms-flex: 0 0 auto; - flex: 0 0 auto; - margin-right: 5px; -} -.vis-editor-agg-header-subagg-icon { - -webkit-box-flex: 0; - -moz-box-flex: 0; - -webkit-flex: 0 1 auto; - -ms-flex: 0 1 auto; - flex: 0 1 auto; - padding-right: 5px; -} -.vis-editor-agg-header-title { - -webkit-box-flex: 1; - -moz-box-flex: 1; - -webkit-flex: 1 1 auto; - -ms-flex: 1 1 auto; - flex: 1 1 auto; - white-space: nowrap; - text-overflow: ellipsis; - overflow: hidden; - font-weight: bold; -} -.vis-editor-agg-header-description { - font-weight: normal; - padding-right: 5px; -} -.vis-editor-agg-header-description.danger { - color: #ffffff; - color: #e74c3c; - font-weight: bold; -} -a.vis-editor-agg-header-description.danger:hover { - color: #e6e6e6; -} -.vis-editor-agg-header-controls { - -webkit-box-flex: 0; - -moz-box-flex: 0; - -webkit-flex: 0 0 auto; - -ms-flex: 0 0 auto; - flex: 0 0 auto; -} -.vis-editor-agg-error { - margin: 5px 0; - padding: 5px; - text-align: center; - background: #e74c3c; - color: #ffffff; -} -.vis-editor-agg-editor { - margin-top: 5px; -} -.vis-editor-agg-editor-ranges td { - padding: 0 5px 5px 0; -} -.vis-editor-agg-editor-ranges td:last-child { - padding-right: 0; -} -.vis-editor-agg-editor .regex .flags .docs { - text-align: right; -} -.vis-editor-agg-editor .regex .flags a { - color: #1f6b7a; -} -.vis-editor-agg-form-row { - display: -webkit-box; - display: -moz-box; - display: -webkit-flex; - display: -ms-flexbox; - display: flex; -} -.vis-editor-agg-form-row > * { - -webkit-box-flex: 1; - -moz-box-flex: 1; - -webkit-flex: 1 1 auto; - -ms-flex: 1 1 auto; - flex: 1 1 auto; - margin-right: 5px; -} -.vis-editor-agg-form-row > *:last-child { - margin-right: 0px; -} -.vis-editor-agg-form-row > .btn { - -webkit-align-self: center; - -ms-flex-item-align: center; - align-self: center; -} -.vis-editor-agg-wide-btn { - -webkit-border-radius: 0; - -webkit-background-clip: padding-box; - -moz-border-radius: 0; - -moz-background-clip: padding; - border-radius: 0; - background-clip: padding-box; -} -.vis-editor-agg-add-form { - margin: 15px; - padding: 5px; -} -.vis-editor-agg-add-form > button { - display: block; - text-align: left; - width: 100%; - margin: 0 0 5px 0; -} -.vis-editor-canvas { - -webkit-box-flex: 1; - -moz-box-flex: 1; - -webkit-flex: 1 0 975.3333333333334px; - -ms-flex: 1 0 975.3333333333334px; - flex: 1 0 975.3333333333334px; - display: -webkit-box; - display: -moz-box; - display: -webkit-flex; - display: -ms-flexbox; - display: flex; - -webkit-box-direction: normal; - -moz-box-direction: normal; - -webkit-box-orient: vertical; - -moz-box-orient: vertical; - -webkit-flex-direction: column; - -ms-flex-direction: column; - flex-direction: column; - overflow: auto; -} -@media (min-width: 992px) { - .vis-editor-canvas { - -webkit-flex-shrink: 1; - flex-shrink: 1; - -webkit-flex-basis: 100%; - flex-basis: 100%; - } -} -.vis-editor-canvas-title { - text-align: center; - margin: 10px 0 0; -} -.vis-editor-canvas visualize { - -webkit-flex: 1 1 auto; - -ms-flex: 1 1 auto; - flex: 1 1 auto; - display: -webkit-box; - display: -moz-box; - display: -webkit-flex; - display: -ms-flexbox; - display: flex; - -webkit-box-direction: normal; - -moz-box-direction: normal; - -webkit-box-orient: vertical; - -moz-box-orient: vertical; - -webkit-flex-direction: column; - -ms-flex-direction: column; - flex-direction: column; - -webkit-box-flex: 1; - -moz-box-flex: 1; - -webkit-flex: 1 0 auto; - -ms-flex: 1 0 auto; - flex: 1 0 auto; -} -.vis-editor-canvas visualize > * { - -webkit-flex-shrink: 0; - flex-shrink: 0; -} -.vis-editor-canvas .visualize-chart { - -webkit-box-flex: 1; - -moz-box-flex: 1; - -webkit-flex: 1 0 100%; - -ms-flex: 1 0 100%; - flex: 1 0 100%; - position: relative; -} -form.vis-share div.form-control { - height: inherit; -} diff --git a/public/bower_components/leaflet-draw/dist/images/spritesheet-2x.png b/public/bower_components/leaflet-draw/dist/images/spritesheet-2x.png new file mode 100644 index 0000000..1525c9f Binary files /dev/null and b/public/bower_components/leaflet-draw/dist/images/spritesheet-2x.png differ diff --git a/public/bower_components/leaflet-draw/dist/images/spritesheet.png b/public/bower_components/leaflet-draw/dist/images/spritesheet.png new file mode 100644 index 0000000..f7035a1 Binary files /dev/null and b/public/bower_components/leaflet-draw/dist/images/spritesheet.png differ diff --git a/public/bower_components/leaflet-draw/dist/leaflet.draw-src.js b/public/bower_components/leaflet-draw/dist/leaflet.draw-src.js new file mode 100644 index 0000000..80f2028 --- /dev/null +++ b/public/bower_components/leaflet-draw/dist/leaflet.draw-src.js @@ -0,0 +1,2942 @@ +/* + Leaflet.draw, a plugin that adds drawing and editing tools to Leaflet powered maps. + (c) 2012-2013, Jacob Toye, Smartrak + + https://github.com/Leaflet/Leaflet.draw + http://leafletjs.com + https://github.com/jacobtoye +*/ +(function (window, document, undefined) {/* + * Leaflet.draw assumes that you have already included the Leaflet library. + */ + +L.drawVersion = '0.2.4-dev'; + +L.drawLocal = { + draw: { + toolbar: { + actions: { + title: 'Cancel drawing', + text: 'Cancel' + }, + undo: { + title: 'Delete last point drawn', + text: 'Delete last point' + }, + buttons: { + polyline: 'Draw a polyline', + polygon: 'Draw a polygon', + rectangle: 'Draw a rectangle', + circle: 'Draw a circle', + marker: 'Draw a marker' + } + }, + handlers: { + circle: { + tooltip: { + start: 'Click and drag to draw circle.' + }, + radius: 'Radius' + }, + marker: { + tooltip: { + start: 'Click map to place marker.' + } + }, + polygon: { + tooltip: { + start: 'Click to start drawing shape.', + cont: 'Click to continue drawing shape.', + end: 'Click first point to close this shape.' + } + }, + polyline: { + error: 'Error: shape edges cannot cross!', + tooltip: { + start: 'Click to start drawing line.', + cont: 'Click to continue drawing line.', + end: 'Click last point to finish line.' + } + }, + rectangle: { + tooltip: { + start: 'Click and drag to draw rectangle.' + } + }, + simpleshape: { + tooltip: { + end: 'Release mouse to finish drawing.' + } + } + } + }, + edit: { + toolbar: { + actions: { + save: { + title: 'Save changes.', + text: 'Save' + }, + cancel: { + title: 'Cancel editing, discards all changes.', + text: 'Cancel' + } + }, + buttons: { + edit: 'Edit layers.', + editDisabled: 'No layers to edit.', + remove: 'Delete layers.', + removeDisabled: 'No layers to delete.' + } + }, + handlers: { + edit: { + tooltip: { + text: 'Drag handles, or marker to edit feature.', + subtext: 'Click cancel to undo changes.' + } + }, + remove: { + tooltip: { + text: 'Click on a feature to remove' + } + } + } + } +}; + + +L.Draw = {}; + +L.Draw.Feature = L.Handler.extend({ + includes: L.Mixin.Events, + + initialize: function (map, options) { + this._map = map; + this._container = map._container; + this._overlayPane = map._panes.overlayPane; + this._popupPane = map._panes.popupPane; + + // Merge default shapeOptions options with custom shapeOptions + if (options && options.shapeOptions) { + options.shapeOptions = L.Util.extend({}, this.options.shapeOptions, options.shapeOptions); + } + L.setOptions(this, options); + }, + + enable: function () { + if (this._enabled) { return; } + + L.Handler.prototype.enable.call(this); + + this.fire('enabled', { handler: this.type }); + + this._map.fire('draw:drawstart', { layerType: this.type }); + }, + + disable: function () { + if (!this._enabled) { return; } + + L.Handler.prototype.disable.call(this); + + this._map.fire('draw:drawstop', { layerType: this.type }); + + this.fire('disabled', { handler: this.type }); + }, + + addHooks: function () { + var map = this._map; + + if (map) { + L.DomUtil.disableTextSelection(); + + map.getContainer().focus(); + + this._tooltip = new L.Tooltip(this._map); + + L.DomEvent.on(this._container, 'keyup', this._cancelDrawing, this); + } + }, + + removeHooks: function () { + if (this._map) { + L.DomUtil.enableTextSelection(); + + this._tooltip.dispose(); + this._tooltip = null; + + L.DomEvent.off(this._container, 'keyup', this._cancelDrawing, this); + } + }, + + setOptions: function (options) { + L.setOptions(this, options); + }, + + _fireCreatedEvent: function (layer) { + this._map.fire('draw:created', { layer: layer, layerType: this.type }); + }, + + // Cancel drawing when the escape key is pressed + _cancelDrawing: function (e) { + if (e.keyCode === 27) { + this.disable(); + } + } +}); + +L.Draw.Polyline = L.Draw.Feature.extend({ + statics: { + TYPE: 'polyline' + }, + + Poly: L.Polyline, + + options: { + allowIntersection: true, + repeatMode: false, + drawError: { + color: '#b00b00', + timeout: 2500 + }, + icon: new L.DivIcon({ + iconSize: new L.Point(8, 8), + className: 'leaflet-div-icon leaflet-editing-icon' + }), + guidelineDistance: 20, + maxGuideLineLength: 4000, + shapeOptions: { + stroke: true, + color: '#f06eaa', + weight: 4, + opacity: 0.5, + fill: false, + clickable: true + }, + metric: true, // Whether to use the metric meaurement system or imperial + showLength: true, // Whether to display distance in the tooltip + zIndexOffset: 2000 // This should be > than the highest z-index any map layers + }, + + initialize: function (map, options) { + // Need to set this here to ensure the correct message is used. + this.options.drawError.message = L.drawLocal.draw.handlers.polyline.error; + + // Merge default drawError options with custom options + if (options && options.drawError) { + options.drawError = L.Util.extend({}, this.options.drawError, options.drawError); + } + + // Save the type so super can fire, need to do this as cannot do this.TYPE :( + this.type = L.Draw.Polyline.TYPE; + + L.Draw.Feature.prototype.initialize.call(this, map, options); + }, + + addHooks: function () { + L.Draw.Feature.prototype.addHooks.call(this); + if (this._map) { + this._markers = []; + + this._markerGroup = new L.LayerGroup(); + this._map.addLayer(this._markerGroup); + + this._poly = new L.Polyline([], this.options.shapeOptions); + + this._tooltip.updateContent(this._getTooltipText()); + + // Make a transparent marker that will used to catch click events. These click + // events will create the vertices. We need to do this so we can ensure that + // we can create vertices over other map layers (markers, vector layers). We + // also do not want to trigger any click handlers of objects we are clicking on + // while drawing. + if (!this._mouseMarker) { + this._mouseMarker = L.marker(this._map.getCenter(), { + icon: L.divIcon({ + className: 'leaflet-mouse-marker', + iconAnchor: [20, 20], + iconSize: [40, 40] + }), + opacity: 0, + zIndexOffset: this.options.zIndexOffset + }); + } + + this._mouseMarker + .on('mousedown', this._onMouseDown, this) + .addTo(this._map); + + this._map + .on('mousemove', this._onMouseMove, this) + .on('mouseup', this._onMouseUp, this) + .on('zoomend', this._onZoomEnd, this); + } + }, + + removeHooks: function () { + L.Draw.Feature.prototype.removeHooks.call(this); + + this._clearHideErrorTimeout(); + + this._cleanUpShape(); + + // remove markers from map + this._map.removeLayer(this._markerGroup); + delete this._markerGroup; + delete this._markers; + + this._map.removeLayer(this._poly); + delete this._poly; + + this._mouseMarker + .off('mousedown', this._onMouseDown, this) + .off('mouseup', this._onMouseUp, this); + this._map.removeLayer(this._mouseMarker); + delete this._mouseMarker; + + // clean up DOM + this._clearGuides(); + + this._map + .off('mousemove', this._onMouseMove, this) + .off('zoomend', this._onZoomEnd, this); + }, + + deleteLastVertex: function () { + if (this._markers.length <= 1) { + return; + } + + var lastMarker = this._markers.pop(), + poly = this._poly, + latlng = this._poly.spliceLatLngs(poly.getLatLngs().length - 1, 1)[0]; + + this._markerGroup.removeLayer(lastMarker); + + if (poly.getLatLngs().length < 2) { + this._map.removeLayer(poly); + } + + this._vertexChanged(latlng, false); + }, + + addVertex: function (latlng) { + var markersLength = this._markers.length; + + if (markersLength > 0 && !this.options.allowIntersection && this._poly.newLatLngIntersects(latlng)) { + this._showErrorTooltip(); + return; + } + else if (this._errorShown) { + this._hideErrorTooltip(); + } + + this._markers.push(this._createMarker(latlng)); + + this._poly.addLatLng(latlng); + + if (this._poly.getLatLngs().length === 2) { + this._map.addLayer(this._poly); + } + + this._vertexChanged(latlng, true); + }, + + _finishShape: function () { + var intersects = this._poly.newLatLngIntersects(this._poly.getLatLngs()[0], true); + + if ((!this.options.allowIntersection && intersects) || !this._shapeIsValid()) { + this._showErrorTooltip(); + return; + } + + this._fireCreatedEvent(); + this.disable(); + if (this.options.repeatMode) { + this.enable(); + } + }, + + //Called to verify the shape is valid when the user tries to finish it + //Return false if the shape is not valid + _shapeIsValid: function () { + return true; + }, + + _onZoomEnd: function () { + this._updateGuide(); + }, + + _onMouseMove: function (e) { + var newPos = e.layerPoint, + latlng = e.latlng; + + // Save latlng + // should this be moved to _updateGuide() ? + this._currentLatLng = latlng; + + this._updateTooltip(latlng); + + // Update the guide line + this._updateGuide(newPos); + + // Update the mouse marker position + this._mouseMarker.setLatLng(latlng); + + L.DomEvent.preventDefault(e.originalEvent); + }, + + _vertexChanged: function (latlng, added) { + this._updateFinishHandler(); + + this._updateRunningMeasure(latlng, added); + + this._clearGuides(); + + this._updateTooltip(); + }, + + _onMouseDown: function (e) { + var originalEvent = e.originalEvent; + this._mouseDownOrigin = L.point(originalEvent.clientX, originalEvent.clientY); + }, + + _onMouseUp: function (e) { + if (this._mouseDownOrigin) { + // We detect clicks within a certain tolerance, otherwise let it + // be interpreted as a drag by the map + var distance = L.point(e.originalEvent.clientX, e.originalEvent.clientY) + .distanceTo(this._mouseDownOrigin); + if (Math.abs(distance) < 9 * (window.devicePixelRatio || 1)) { + this.addVertex(e.latlng); + } + } + this._mouseDownOrigin = null; + }, + + _updateFinishHandler: function () { + var markerCount = this._markers.length; + // The last marker should have a click handler to close the polyline + if (markerCount > 1) { + this._markers[markerCount - 1].on('click', this._finishShape, this); + } + + // Remove the old marker click handler (as only the last point should close the polyline) + if (markerCount > 2) { + this._markers[markerCount - 2].off('click', this._finishShape, this); + } + }, + + _createMarker: function (latlng) { + var marker = new L.Marker(latlng, { + icon: this.options.icon, + zIndexOffset: this.options.zIndexOffset * 2 + }); + + this._markerGroup.addLayer(marker); + + return marker; + }, + + _updateGuide: function (newPos) { + var markerCount = this._markers.length; + + if (markerCount > 0) { + newPos = newPos || this._map.latLngToLayerPoint(this._currentLatLng); + + // draw the guide line + this._clearGuides(); + this._drawGuide( + this._map.latLngToLayerPoint(this._markers[markerCount - 1].getLatLng()), + newPos + ); + } + }, + + _updateTooltip: function (latLng) { + var text = this._getTooltipText(); + + if (latLng) { + this._tooltip.updatePosition(latLng); + } + + if (!this._errorShown) { + this._tooltip.updateContent(text); + } + }, + + _drawGuide: function (pointA, pointB) { + var length = Math.floor(Math.sqrt(Math.pow((pointB.x - pointA.x), 2) + Math.pow((pointB.y - pointA.y), 2))), + guidelineDistance = this.options.guidelineDistance, + maxGuideLineLength = this.options.maxGuideLineLength, + // Only draw a guideline with a max length + i = length > maxGuideLineLength ? length - maxGuideLineLength : guidelineDistance, + fraction, + dashPoint, + dash; + + //create the guides container if we haven't yet + if (!this._guidesContainer) { + this._guidesContainer = L.DomUtil.create('div', 'leaflet-draw-guides', this._overlayPane); + } + + //draw a dash every GuildeLineDistance + for (; i < length; i += this.options.guidelineDistance) { + //work out fraction along line we are + fraction = i / length; + + //calculate new x,y point + dashPoint = { + x: Math.floor((pointA.x * (1 - fraction)) + (fraction * pointB.x)), + y: Math.floor((pointA.y * (1 - fraction)) + (fraction * pointB.y)) + }; + + //add guide dash to guide container + dash = L.DomUtil.create('div', 'leaflet-draw-guide-dash', this._guidesContainer); + dash.style.backgroundColor = + !this._errorShown ? this.options.shapeOptions.color : this.options.drawError.color; + + L.DomUtil.setPosition(dash, dashPoint); + } + }, + + _updateGuideColor: function (color) { + if (this._guidesContainer) { + for (var i = 0, l = this._guidesContainer.childNodes.length; i < l; i++) { + this._guidesContainer.childNodes[i].style.backgroundColor = color; + } + } + }, + + // removes all child elements (guide dashes) from the guides container + _clearGuides: function () { + if (this._guidesContainer) { + while (this._guidesContainer.firstChild) { + this._guidesContainer.removeChild(this._guidesContainer.firstChild); + } + } + }, + + _getTooltipText: function () { + var showLength = this.options.showLength, + labelText, distanceStr; + + if (this._markers.length === 0) { + labelText = { + text: L.drawLocal.draw.handlers.polyline.tooltip.start + }; + } else { + distanceStr = showLength ? this._getMeasurementString() : ''; + + if (this._markers.length === 1) { + labelText = { + text: L.drawLocal.draw.handlers.polyline.tooltip.cont, + subtext: distanceStr + }; + } else { + labelText = { + text: L.drawLocal.draw.handlers.polyline.tooltip.end, + subtext: distanceStr + }; + } + } + return labelText; + }, + + _updateRunningMeasure: function (latlng, added) { + var markersLength = this._markers.length, + previousMarkerIndex, distance; + + if (this._markers.length === 1) { + this._measurementRunningTotal = 0; + } else { + previousMarkerIndex = markersLength - (added ? 2 : 1); + distance = latlng.distanceTo(this._markers[previousMarkerIndex].getLatLng()); + + this._measurementRunningTotal += distance * (added ? 1 : -1); + } + }, + + _getMeasurementString: function () { + var currentLatLng = this._currentLatLng, + previousLatLng = this._markers[this._markers.length - 1].getLatLng(), + distance; + + // calculate the distance from the last fixed point to the mouse position + distance = this._measurementRunningTotal + currentLatLng.distanceTo(previousLatLng); + + return L.GeometryUtil.readableDistance(distance, this.options.metric); + }, + + _showErrorTooltip: function () { + this._errorShown = true; + + // Update tooltip + this._tooltip + .showAsError() + .updateContent({ text: this.options.drawError.message }); + + // Update shape + this._updateGuideColor(this.options.drawError.color); + this._poly.setStyle({ color: this.options.drawError.color }); + + // Hide the error after 2 seconds + this._clearHideErrorTimeout(); + this._hideErrorTimeout = setTimeout(L.Util.bind(this._hideErrorTooltip, this), this.options.drawError.timeout); + }, + + _hideErrorTooltip: function () { + this._errorShown = false; + + this._clearHideErrorTimeout(); + + // Revert tooltip + this._tooltip + .removeError() + .updateContent(this._getTooltipText()); + + // Revert shape + this._updateGuideColor(this.options.shapeOptions.color); + this._poly.setStyle({ color: this.options.shapeOptions.color }); + }, + + _clearHideErrorTimeout: function () { + if (this._hideErrorTimeout) { + clearTimeout(this._hideErrorTimeout); + this._hideErrorTimeout = null; + } + }, + + _cleanUpShape: function () { + if (this._markers.length > 1) { + this._markers[this._markers.length - 1].off('click', this._finishShape, this); + } + }, + + _fireCreatedEvent: function () { + var poly = new this.Poly(this._poly.getLatLngs(), this.options.shapeOptions); + L.Draw.Feature.prototype._fireCreatedEvent.call(this, poly); + } +}); + + +L.Draw.Polygon = L.Draw.Polyline.extend({ + statics: { + TYPE: 'polygon' + }, + + Poly: L.Polygon, + + options: { + showArea: false, + shapeOptions: { + stroke: true, + color: '#f06eaa', + weight: 4, + opacity: 0.5, + fill: true, + fillColor: null, //same as color by default + fillOpacity: 0.2, + clickable: true + } + }, + + initialize: function (map, options) { + L.Draw.Polyline.prototype.initialize.call(this, map, options); + + // Save the type so super can fire, need to do this as cannot do this.TYPE :( + this.type = L.Draw.Polygon.TYPE; + }, + + _updateFinishHandler: function () { + var markerCount = this._markers.length; + + // The first marker should have a click handler to close the polygon + if (markerCount === 1) { + this._markers[0].on('click', this._finishShape, this); + } + + // Add and update the double click handler + if (markerCount > 2) { + this._markers[markerCount - 1].on('dblclick', this._finishShape, this); + // Only need to remove handler if has been added before + if (markerCount > 3) { + this._markers[markerCount - 2].off('dblclick', this._finishShape, this); + } + } + }, + + _getTooltipText: function () { + var text, subtext; + + if (this._markers.length === 0) { + text = L.drawLocal.draw.handlers.polygon.tooltip.start; + } else if (this._markers.length < 3) { + text = L.drawLocal.draw.handlers.polygon.tooltip.cont; + } else { + text = L.drawLocal.draw.handlers.polygon.tooltip.end; + subtext = this._getMeasurementString(); + } + + return { + text: text, + subtext: subtext + }; + }, + + _getMeasurementString: function () { + var area = this._area; + + if (!area) { + return null; + } + + return L.GeometryUtil.readableArea(area, this.options.metric); + }, + + _shapeIsValid: function () { + return this._markers.length >= 3; + }, + + _vertexChanged: function (latlng, added) { + var latLngs; + + // Check to see if we should show the area + if (!this.options.allowIntersection && this.options.showArea) { + latLngs = this._poly.getLatLngs(); + + this._area = L.GeometryUtil.geodesicArea(latLngs); + } + + L.Draw.Polyline.prototype._vertexChanged.call(this, latlng, added); + }, + + _cleanUpShape: function () { + var markerCount = this._markers.length; + + if (markerCount > 0) { + this._markers[0].off('click', this._finishShape, this); + + if (markerCount > 2) { + this._markers[markerCount - 1].off('dblclick', this._finishShape, this); + } + } + } +}); + + +L.SimpleShape = {}; + +L.Draw.SimpleShape = L.Draw.Feature.extend({ + options: { + repeatMode: false + }, + + initialize: function (map, options) { + this._endLabelText = L.drawLocal.draw.handlers.simpleshape.tooltip.end; + + L.Draw.Feature.prototype.initialize.call(this, map, options); + }, + + addHooks: function () { + L.Draw.Feature.prototype.addHooks.call(this); + if (this._map) { + this._mapDraggable = this._map.dragging.enabled(); + + if (this._mapDraggable) { + this._map.dragging.disable(); + } + + //TODO refactor: move cursor to styles + this._container.style.cursor = 'crosshair'; + + this._tooltip.updateContent({ text: this._initialLabelText }); + + this._map + .on('mousedown', this._onMouseDown, this) + .on('mousemove', this._onMouseMove, this); + } + }, + + removeHooks: function () { + L.Draw.Feature.prototype.removeHooks.call(this); + if (this._map) { + if (this._mapDraggable) { + this._map.dragging.enable(); + } + + //TODO refactor: move cursor to styles + this._container.style.cursor = ''; + + this._map + .off('mousedown', this._onMouseDown, this) + .off('mousemove', this._onMouseMove, this); + + L.DomEvent.off(document, 'mouseup', this._onMouseUp, this); + + // If the box element doesn't exist they must not have moved the mouse, so don't need to destroy/return + if (this._shape) { + this._map.removeLayer(this._shape); + delete this._shape; + } + } + this._isDrawing = false; + }, + + _getTooltipText: function () { + return { + text: this._endLabelText + }; + }, + + _onMouseDown: function (e) { + this._isDrawing = true; + this._startLatLng = e.latlng; + + L.DomEvent + .on(document, 'mouseup', this._onMouseUp, this) + .preventDefault(e.originalEvent); + }, + + _onMouseMove: function (e) { + var latlng = e.latlng; + + this._tooltip.updatePosition(latlng); + if (this._isDrawing) { + this._tooltip.updateContent(this._getTooltipText()); + this._drawShape(latlng); + } + }, + + _onMouseUp: function () { + if (this._shape) { + this._fireCreatedEvent(); + } + + this.disable(); + if (this.options.repeatMode) { + this.enable(); + } + } +}); + +L.Draw.Rectangle = L.Draw.SimpleShape.extend({ + statics: { + TYPE: 'rectangle' + }, + + options: { + shapeOptions: { + stroke: true, + color: '#f06eaa', + weight: 4, + opacity: 0.5, + fill: true, + fillColor: null, //same as color by default + fillOpacity: 0.2, + clickable: true + }, + metric: true // Whether to use the metric meaurement system or imperial + }, + + initialize: function (map, options) { + // Save the type so super can fire, need to do this as cannot do this.TYPE :( + this.type = L.Draw.Rectangle.TYPE; + + this._initialLabelText = L.drawLocal.draw.handlers.rectangle.tooltip.start; + + L.Draw.SimpleShape.prototype.initialize.call(this, map, options); + }, + + _drawShape: function (latlng) { + if (!this._shape) { + this._shape = new L.Rectangle(new L.LatLngBounds(this._startLatLng, latlng), this.options.shapeOptions); + this._map.addLayer(this._shape); + } else { + this._shape.setBounds(new L.LatLngBounds(this._startLatLng, latlng)); + } + }, + + _fireCreatedEvent: function () { + var rectangle = new L.Rectangle(this._shape.getBounds(), this.options.shapeOptions); + L.Draw.SimpleShape.prototype._fireCreatedEvent.call(this, rectangle); + }, + + _getTooltipText: function () { + var tooltipText = L.Draw.SimpleShape.prototype._getTooltipText.call(this), + shape = this._shape, + latLngs, area, subtext; + + if (shape) { + latLngs = this._shape.getLatLngs(); + area = L.GeometryUtil.geodesicArea(latLngs); + subtext = L.GeometryUtil.readableArea(area, this.options.metric); + } + + return { + text: tooltipText.text, + subtext: subtext + }; + } +}); + + +L.Draw.Circle = L.Draw.SimpleShape.extend({ + statics: { + TYPE: 'circle' + }, + + options: { + shapeOptions: { + stroke: true, + color: '#f06eaa', + weight: 4, + opacity: 0.5, + fill: true, + fillColor: null, //same as color by default + fillOpacity: 0.2, + clickable: true + }, + showRadius: true, + metric: true // Whether to use the metric meaurement system or imperial + }, + + initialize: function (map, options) { + // Save the type so super can fire, need to do this as cannot do this.TYPE :( + this.type = L.Draw.Circle.TYPE; + + this._initialLabelText = L.drawLocal.draw.handlers.circle.tooltip.start; + + L.Draw.SimpleShape.prototype.initialize.call(this, map, options); + }, + + _drawShape: function (latlng) { + if (!this._shape) { + this._shape = new L.Circle(this._startLatLng, this._startLatLng.distanceTo(latlng), this.options.shapeOptions); + this._map.addLayer(this._shape); + } else { + this._shape.setRadius(this._startLatLng.distanceTo(latlng)); + } + }, + + _fireCreatedEvent: function () { + var circle = new L.Circle(this._startLatLng, this._shape.getRadius(), this.options.shapeOptions); + L.Draw.SimpleShape.prototype._fireCreatedEvent.call(this, circle); + }, + + _onMouseMove: function (e) { + var latlng = e.latlng, + showRadius = this.options.showRadius, + useMetric = this.options.metric, + radius; + + this._tooltip.updatePosition(latlng); + if (this._isDrawing) { + this._drawShape(latlng); + + // Get the new radius (rounded to 1 dp) + radius = this._shape.getRadius().toFixed(1); + + this._tooltip.updateContent({ + text: this._endLabelText, + subtext: showRadius ? L.drawLocal.draw.handlers.circle.radius + ': ' + L.GeometryUtil.readableDistance(radius, useMetric) : '' + }); + } + } +}); + + +L.Draw.Marker = L.Draw.Feature.extend({ + statics: { + TYPE: 'marker' + }, + + options: { + icon: new L.Icon.Default(), + repeatMode: false, + zIndexOffset: 2000 // This should be > than the highest z-index any markers + }, + + initialize: function (map, options) { + // Save the type so super can fire, need to do this as cannot do this.TYPE :( + this.type = L.Draw.Marker.TYPE; + + L.Draw.Feature.prototype.initialize.call(this, map, options); + }, + + addHooks: function () { + L.Draw.Feature.prototype.addHooks.call(this); + + if (this._map) { + this._tooltip.updateContent({ text: L.drawLocal.draw.handlers.marker.tooltip.start }); + + // Same mouseMarker as in Draw.Polyline + if (!this._mouseMarker) { + this._mouseMarker = L.marker(this._map.getCenter(), { + icon: L.divIcon({ + className: 'leaflet-mouse-marker', + iconAnchor: [20, 20], + iconSize: [40, 40] + }), + opacity: 0, + zIndexOffset: this.options.zIndexOffset + }); + } + + this._mouseMarker + .on('click', this._onClick, this) + .addTo(this._map); + + this._map.on('mousemove', this._onMouseMove, this); + } + }, + + removeHooks: function () { + L.Draw.Feature.prototype.removeHooks.call(this); + + if (this._map) { + if (this._marker) { + this._marker.off('click', this._onClick, this); + this._map + .off('click', this._onClick, this) + .removeLayer(this._marker); + delete this._marker; + } + + this._mouseMarker.off('click', this._onClick, this); + this._map.removeLayer(this._mouseMarker); + delete this._mouseMarker; + + this._map.off('mousemove', this._onMouseMove, this); + } + }, + + _onMouseMove: function (e) { + var latlng = e.latlng; + + this._tooltip.updatePosition(latlng); + this._mouseMarker.setLatLng(latlng); + + if (!this._marker) { + this._marker = new L.Marker(latlng, { + icon: this.options.icon, + zIndexOffset: this.options.zIndexOffset + }); + // Bind to both marker and map to make sure we get the click event. + this._marker.on('click', this._onClick, this); + this._map + .on('click', this._onClick, this) + .addLayer(this._marker); + } + else { + latlng = this._mouseMarker.getLatLng(); + this._marker.setLatLng(latlng); + } + }, + + _onClick: function () { + this._fireCreatedEvent(); + + this.disable(); + if (this.options.repeatMode) { + this.enable(); + } + }, + + _fireCreatedEvent: function () { + var marker = new L.Marker(this._marker.getLatLng(), { icon: this.options.icon }); + L.Draw.Feature.prototype._fireCreatedEvent.call(this, marker); + } +}); + + +L.Edit = L.Edit || {}; + +L.Edit.Marker = L.Handler.extend({ + initialize: function (marker, options) { + this._marker = marker; + L.setOptions(this, options); + }, + + addHooks: function () { + var marker = this._marker; + + marker.dragging.enable(); + marker.on('dragend', this._onDragEnd, marker); + this._toggleMarkerHighlight(); + }, + + removeHooks: function () { + var marker = this._marker; + + marker.dragging.disable(); + marker.off('dragend', this._onDragEnd, marker); + this._toggleMarkerHighlight(); + }, + + _onDragEnd: function (e) { + var layer = e.target; + layer.edited = true; + }, + + _toggleMarkerHighlight: function () { + + // Don't do anything if this layer is a marker but doesn't have an icon. Markers + // should usually have icons. If using Leaflet.draw with Leafler.markercluster there + // is a chance that a marker doesn't. + if (!this._icon) { + return; + } + + // This is quite naughty, but I don't see another way of doing it. (short of setting a new icon) + var icon = this._icon; + + icon.style.display = 'none'; + + if (L.DomUtil.hasClass(icon, 'leaflet-edit-marker-selected')) { + L.DomUtil.removeClass(icon, 'leaflet-edit-marker-selected'); + // Offset as the border will make the icon move. + this._offsetMarker(icon, -4); + + } else { + L.DomUtil.addClass(icon, 'leaflet-edit-marker-selected'); + // Offset as the border will make the icon move. + this._offsetMarker(icon, 4); + } + + icon.style.display = ''; + }, + + _offsetMarker: function (icon, offset) { + var iconMarginTop = parseInt(icon.style.marginTop, 10) - offset, + iconMarginLeft = parseInt(icon.style.marginLeft, 10) - offset; + + icon.style.marginTop = iconMarginTop + 'px'; + icon.style.marginLeft = iconMarginLeft + 'px'; + } +}); + +L.Marker.addInitHook(function () { + if (L.Edit.Marker) { + this.editing = new L.Edit.Marker(this); + + if (this.options.editable) { + this.editing.enable(); + } + } +}); + + +L.Edit = L.Edit || {}; + +/* + * L.Edit.Poly is an editing handler for polylines and polygons. + */ + +L.Edit.Poly = L.Handler.extend({ + options: { + icon: new L.DivIcon({ + iconSize: new L.Point(8, 8), + className: 'leaflet-div-icon leaflet-editing-icon' + }) + }, + + initialize: function (poly, options) { + this._poly = poly; + L.setOptions(this, options); + }, + + addHooks: function () { + var poly = this._poly; + + if (!(poly instanceof L.Polygon)) { + poly.options.editing.fill = false; + } + + poly.setStyle(poly.options.editing); + + if (this._poly._map) { + if (!this._markerGroup) { + this._initMarkers(); + } + this._poly._map.addLayer(this._markerGroup); + } + }, + + removeHooks: function () { + var poly = this._poly; + + poly.setStyle(poly.options.original); + + if (poly._map) { + poly._map.removeLayer(this._markerGroup); + delete this._markerGroup; + delete this._markers; + } + }, + + updateMarkers: function () { + this._markerGroup.clearLayers(); + this._initMarkers(); + }, + + _initMarkers: function () { + if (!this._markerGroup) { + this._markerGroup = new L.LayerGroup(); + } + this._markers = []; + + var latlngs = this._poly._latlngs, + i, j, len, marker; + + // TODO refactor holes implementation in Polygon to support it here + + for (i = 0, len = latlngs.length; i < len; i++) { + + marker = this._createMarker(latlngs[i], i); + marker.on('click', this._onMarkerClick, this); + this._markers.push(marker); + } + + var markerLeft, markerRight; + + for (i = 0, j = len - 1; i < len; j = i++) { + if (i === 0 && !(L.Polygon && (this._poly instanceof L.Polygon))) { + continue; + } + + markerLeft = this._markers[j]; + markerRight = this._markers[i]; + + this._createMiddleMarker(markerLeft, markerRight); + this._updatePrevNext(markerLeft, markerRight); + } + }, + + _createMarker: function (latlng, index) { + var marker = new L.Marker(latlng, { + draggable: true, + icon: this.options.icon + }); + + marker._origLatLng = latlng; + marker._index = index; + + marker.on('drag', this._onMarkerDrag, this); + marker.on('dragend', this._fireEdit, this); + + this._markerGroup.addLayer(marker); + + return marker; + }, + + _removeMarker: function (marker) { + var i = marker._index; + + this._markerGroup.removeLayer(marker); + this._markers.splice(i, 1); + this._poly.spliceLatLngs(i, 1); + this._updateIndexes(i, -1); + + marker + .off('drag', this._onMarkerDrag, this) + .off('dragend', this._fireEdit, this) + .off('click', this._onMarkerClick, this); + }, + + _fireEdit: function () { + this._poly.edited = true; + this._poly.fire('edit'); + }, + + _onMarkerDrag: function (e) { + var marker = e.target; + + L.extend(marker._origLatLng, marker._latlng); + + if (marker._middleLeft) { + marker._middleLeft.setLatLng(this._getMiddleLatLng(marker._prev, marker)); + } + if (marker._middleRight) { + marker._middleRight.setLatLng(this._getMiddleLatLng(marker, marker._next)); + } + + this._poly.redraw(); + }, + + _onMarkerClick: function (e) { + var minPoints = L.Polygon && (this._poly instanceof L.Polygon) ? 4 : 3, + marker = e.target; + + // If removing this point would create an invalid polyline/polygon don't remove + if (this._poly._latlngs.length < minPoints) { + return; + } + + // remove the marker + this._removeMarker(marker); + + // update prev/next links of adjacent markers + this._updatePrevNext(marker._prev, marker._next); + + // remove ghost markers near the removed marker + if (marker._middleLeft) { + this._markerGroup.removeLayer(marker._middleLeft); + } + if (marker._middleRight) { + this._markerGroup.removeLayer(marker._middleRight); + } + + // create a ghost marker in place of the removed one + if (marker._prev && marker._next) { + this._createMiddleMarker(marker._prev, marker._next); + + } else if (!marker._prev) { + marker._next._middleLeft = null; + + } else if (!marker._next) { + marker._prev._middleRight = null; + } + + this._fireEdit(); + }, + + _updateIndexes: function (index, delta) { + this._markerGroup.eachLayer(function (marker) { + if (marker._index > index) { + marker._index += delta; + } + }); + }, + + _createMiddleMarker: function (marker1, marker2) { + var latlng = this._getMiddleLatLng(marker1, marker2), + marker = this._createMarker(latlng), + onClick, + onDragStart, + onDragEnd; + + marker.setOpacity(0.6); + + marker1._middleRight = marker2._middleLeft = marker; + + onDragStart = function () { + var i = marker2._index; + + marker._index = i; + + marker + .off('click', onClick, this) + .on('click', this._onMarkerClick, this); + + latlng.lat = marker.getLatLng().lat; + latlng.lng = marker.getLatLng().lng; + this._poly.spliceLatLngs(i, 0, latlng); + this._markers.splice(i, 0, marker); + + marker.setOpacity(1); + + this._updateIndexes(i, 1); + marker2._index++; + this._updatePrevNext(marker1, marker); + this._updatePrevNext(marker, marker2); + + this._poly.fire('editstart'); + }; + + onDragEnd = function () { + marker.off('dragstart', onDragStart, this); + marker.off('dragend', onDragEnd, this); + + this._createMiddleMarker(marker1, marker); + this._createMiddleMarker(marker, marker2); + }; + + onClick = function () { + onDragStart.call(this); + onDragEnd.call(this); + this._fireEdit(); + }; + + marker + .on('click', onClick, this) + .on('dragstart', onDragStart, this) + .on('dragend', onDragEnd, this); + + this._markerGroup.addLayer(marker); + }, + + _updatePrevNext: function (marker1, marker2) { + if (marker1) { + marker1._next = marker2; + } + if (marker2) { + marker2._prev = marker1; + } + }, + + _getMiddleLatLng: function (marker1, marker2) { + var map = this._poly._map, + p1 = map.project(marker1.getLatLng()), + p2 = map.project(marker2.getLatLng()); + + return map.unproject(p1._add(p2)._divideBy(2)); + } +}); + +L.Polyline.addInitHook(function () { + + // Check to see if handler has already been initialized. This is to support versions of Leaflet that still have L.Handler.PolyEdit + if (this.editing) { + return; + } + + if (L.Edit.Poly) { + this.editing = new L.Edit.Poly(this); + + if (this.options.editable) { + this.editing.enable(); + } + } + + this.on('add', function () { + if (this.editing && this.editing.enabled()) { + this.editing.addHooks(); + } + }); + + this.on('remove', function () { + if (this.editing && this.editing.enabled()) { + this.editing.removeHooks(); + } + }); +}); + + +L.Edit = L.Edit || {}; + +L.Edit.SimpleShape = L.Handler.extend({ + options: { + moveIcon: new L.DivIcon({ + iconSize: new L.Point(8, 8), + className: 'leaflet-div-icon leaflet-editing-icon leaflet-edit-move' + }), + resizeIcon: new L.DivIcon({ + iconSize: new L.Point(8, 8), + className: 'leaflet-div-icon leaflet-editing-icon leaflet-edit-resize' + }) + }, + + initialize: function (shape, options) { + this._shape = shape; + L.Util.setOptions(this, options); + }, + + addHooks: function () { + var shape = this._shape; + + shape.setStyle(shape.options.editing); + + if (shape._map) { + this._map = shape._map; + + if (!this._markerGroup) { + this._initMarkers(); + } + this._map.addLayer(this._markerGroup); + } + }, + + removeHooks: function () { + var shape = this._shape; + + shape.setStyle(shape.options.original); + + if (shape._map) { + this._unbindMarker(this._moveMarker); + + for (var i = 0, l = this._resizeMarkers.length; i < l; i++) { + this._unbindMarker(this._resizeMarkers[i]); + } + this._resizeMarkers = null; + + this._map.removeLayer(this._markerGroup); + delete this._markerGroup; + } + + this._map = null; + }, + + updateMarkers: function () { + this._markerGroup.clearLayers(); + this._initMarkers(); + }, + + _initMarkers: function () { + if (!this._markerGroup) { + this._markerGroup = new L.LayerGroup(); + } + + // Create center marker + this._createMoveMarker(); + + // Create edge marker + this._createResizeMarker(); + }, + + _createMoveMarker: function () { + // Children override + }, + + _createResizeMarker: function () { + // Children override + }, + + _createMarker: function (latlng, icon) { + var marker = new L.Marker(latlng, { + draggable: true, + icon: icon, + zIndexOffset: 10 + }); + + this._bindMarker(marker); + + this._markerGroup.addLayer(marker); + + return marker; + }, + + _bindMarker: function (marker) { + marker + .on('dragstart', this._onMarkerDragStart, this) + .on('drag', this._onMarkerDrag, this) + .on('dragend', this._onMarkerDragEnd, this); + }, + + _unbindMarker: function (marker) { + marker + .off('dragstart', this._onMarkerDragStart, this) + .off('drag', this._onMarkerDrag, this) + .off('dragend', this._onMarkerDragEnd, this); + }, + + _onMarkerDragStart: function (e) { + var marker = e.target; + marker.setOpacity(0); + + this._shape.fire('editstart'); + }, + + _fireEdit: function () { + this._shape.edited = true; + this._shape.fire('edit'); + }, + + _onMarkerDrag: function (e) { + var marker = e.target, + latlng = marker.getLatLng(); + + if (marker === this._moveMarker) { + this._move(latlng); + } else { + this._resize(latlng); + } + + this._shape.redraw(); + }, + + _onMarkerDragEnd: function (e) { + var marker = e.target; + marker.setOpacity(1); + + this._fireEdit(); + }, + + _move: function () { + // Children override + }, + + _resize: function () { + // Children override + } +}); + + +L.Edit = L.Edit || {}; + +L.Edit.Rectangle = L.Edit.SimpleShape.extend({ + _createMoveMarker: function () { + var bounds = this._shape.getBounds(), + center = bounds.getCenter(); + + this._moveMarker = this._createMarker(center, this.options.moveIcon); + }, + + _createResizeMarker: function () { + var corners = this._getCorners(); + + this._resizeMarkers = []; + + for (var i = 0, l = corners.length; i < l; i++) { + this._resizeMarkers.push(this._createMarker(corners[i], this.options.resizeIcon)); + // Monkey in the corner index as we will need to know this for dragging + this._resizeMarkers[i]._cornerIndex = i; + } + }, + + _onMarkerDragStart: function (e) { + L.Edit.SimpleShape.prototype._onMarkerDragStart.call(this, e); + + // Save a reference to the opposite point + var corners = this._getCorners(), + marker = e.target, + currentCornerIndex = marker._cornerIndex; + + this._oppositeCorner = corners[(currentCornerIndex + 2) % 4]; + + this._toggleCornerMarkers(0, currentCornerIndex); + }, + + _onMarkerDragEnd: function (e) { + var marker = e.target, + bounds, center; + + // Reset move marker position to the center + if (marker === this._moveMarker) { + bounds = this._shape.getBounds(); + center = bounds.getCenter(); + + marker.setLatLng(center); + } + + this._toggleCornerMarkers(1); + + this._repositionCornerMarkers(); + + L.Edit.SimpleShape.prototype._onMarkerDragEnd.call(this, e); + }, + + _move: function (newCenter) { + var latlngs = this._shape.getLatLngs(), + bounds = this._shape.getBounds(), + center = bounds.getCenter(), + offset, newLatLngs = []; + + // Offset the latlngs to the new center + for (var i = 0, l = latlngs.length; i < l; i++) { + offset = [latlngs[i].lat - center.lat, latlngs[i].lng - center.lng]; + newLatLngs.push([newCenter.lat + offset[0], newCenter.lng + offset[1]]); + } + + this._shape.setLatLngs(newLatLngs); + + // Reposition the resize markers + this._repositionCornerMarkers(); + }, + + _resize: function (latlng) { + var bounds; + + // Update the shape based on the current position of this corner and the opposite point + this._shape.setBounds(L.latLngBounds(latlng, this._oppositeCorner)); + + // Reposition the move marker + bounds = this._shape.getBounds(); + this._moveMarker.setLatLng(bounds.getCenter()); + }, + + _getCorners: function () { + var bounds = this._shape.getBounds(), + nw = bounds.getNorthWest(), + ne = bounds.getNorthEast(), + se = bounds.getSouthEast(), + sw = bounds.getSouthWest(); + + return [nw, ne, se, sw]; + }, + + _toggleCornerMarkers: function (opacity) { + for (var i = 0, l = this._resizeMarkers.length; i < l; i++) { + this._resizeMarkers[i].setOpacity(opacity); + } + }, + + _repositionCornerMarkers: function () { + var corners = this._getCorners(); + + for (var i = 0, l = this._resizeMarkers.length; i < l; i++) { + this._resizeMarkers[i].setLatLng(corners[i]); + } + } +}); + +L.Rectangle.addInitHook(function () { + if (L.Edit.Rectangle) { + this.editing = new L.Edit.Rectangle(this); + + if (this.options.editable) { + this.editing.enable(); + } + } +}); + + +L.Edit = L.Edit || {}; + +L.Edit.Circle = L.Edit.SimpleShape.extend({ + _createMoveMarker: function () { + var center = this._shape.getLatLng(); + + this._moveMarker = this._createMarker(center, this.options.moveIcon); + }, + + _createResizeMarker: function () { + var center = this._shape.getLatLng(), + resizemarkerPoint = this._getResizeMarkerPoint(center); + + this._resizeMarkers = []; + this._resizeMarkers.push(this._createMarker(resizemarkerPoint, this.options.resizeIcon)); + }, + + _getResizeMarkerPoint: function (latlng) { + // From L.shape.getBounds() + var delta = this._shape._radius * Math.cos(Math.PI / 4), + point = this._map.project(latlng); + return this._map.unproject([point.x + delta, point.y - delta]); + }, + + _move: function (latlng) { + var resizemarkerPoint = this._getResizeMarkerPoint(latlng); + + // Move the resize marker + this._resizeMarkers[0].setLatLng(resizemarkerPoint); + + // Move the circle + this._shape.setLatLng(latlng); + }, + + _resize: function (latlng) { + var moveLatLng = this._moveMarker.getLatLng(), + radius = moveLatLng.distanceTo(latlng); + + this._shape.setRadius(radius); + } +}); + +L.Circle.addInitHook(function () { + if (L.Edit.Circle) { + this.editing = new L.Edit.Circle(this); + + if (this.options.editable) { + this.editing.enable(); + } + } + + this.on('add', function () { + if (this.editing && this.editing.enabled()) { + this.editing.addHooks(); + } + }); + + this.on('remove', function () { + if (this.editing && this.editing.enabled()) { + this.editing.removeHooks(); + } + }); +}); + +/* + * L.LatLngUtil contains different utility functions for LatLngs. + */ + +L.LatLngUtil = { + // Clones a LatLngs[], returns [][] + cloneLatLngs: function (latlngs) { + var clone = []; + for (var i = 0, l = latlngs.length; i < l; i++) { + clone.push(this.cloneLatLng(latlngs[i])); + } + return clone; + }, + + cloneLatLng: function (latlng) { + return L.latLng(latlng.lat, latlng.lng); + } +}; + +L.GeometryUtil = L.extend(L.GeometryUtil || {}, { + // Ported from the OpenLayers implementation. See https://github.com/openlayers/openlayers/blob/master/lib/OpenLayers/Geometry/LinearRing.js#L270 + geodesicArea: function (latLngs) { + var pointsCount = latLngs.length, + area = 0.0, + d2r = L.LatLng.DEG_TO_RAD, + p1, p2; + + if (pointsCount > 2) { + for (var i = 0; i < pointsCount; i++) { + p1 = latLngs[i]; + p2 = latLngs[(i + 1) % pointsCount]; + area += ((p2.lng - p1.lng) * d2r) * + (2 + Math.sin(p1.lat * d2r) + Math.sin(p2.lat * d2r)); + } + area = area * 6378137.0 * 6378137.0 / 2.0; + } + + return Math.abs(area); + }, + + readableArea: function (area, isMetric) { + var areaStr; + + if (isMetric) { + if (area >= 10000) { + areaStr = (area * 0.0001).toFixed(2) + ' ha'; + } else { + areaStr = area.toFixed(2) + ' m²'; + } + } else { + area /= 0.836127; // Square yards in 1 meter + + if (area >= 3097600) { //3097600 square yards in 1 square mile + areaStr = (area / 3097600).toFixed(2) + ' mi²'; + } else if (area >= 4840) {//48040 square yards in 1 acre + areaStr = (area / 4840).toFixed(2) + ' acres'; + } else { + areaStr = Math.ceil(area) + ' yd²'; + } + } + + return areaStr; + }, + + readableDistance: function (distance, isMetric) { + var distanceStr; + + if (isMetric) { + // show metres when distance is < 1km, then show km + if (distance > 1000) { + distanceStr = (distance / 1000).toFixed(2) + ' km'; + } else { + distanceStr = Math.ceil(distance) + ' m'; + } + } else { + distance *= 1.09361; + + if (distance > 1760) { + distanceStr = (distance / 1760).toFixed(2) + ' miles'; + } else { + distanceStr = Math.ceil(distance) + ' yd'; + } + } + + return distanceStr; + } +}); + +L.Util.extend(L.LineUtil, { + // Checks to see if two line segments intersect. Does not handle degenerate cases. + // http://compgeom.cs.uiuc.edu/~jeffe/teaching/373/notes/x06-sweepline.pdf + segmentsIntersect: function (/*Point*/ p, /*Point*/ p1, /*Point*/ p2, /*Point*/ p3) { + return this._checkCounterclockwise(p, p2, p3) !== + this._checkCounterclockwise(p1, p2, p3) && + this._checkCounterclockwise(p, p1, p2) !== + this._checkCounterclockwise(p, p1, p3); + }, + + // check to see if points are in counterclockwise order + _checkCounterclockwise: function (/*Point*/ p, /*Point*/ p1, /*Point*/ p2) { + return (p2.y - p.y) * (p1.x - p.x) > (p1.y - p.y) * (p2.x - p.x); + } +}); + +L.Polyline.include({ + // Check to see if this polyline has any linesegments that intersect. + // NOTE: does not support detecting intersection for degenerate cases. + intersects: function () { + var points = this._originalPoints, + len = points ? points.length : 0, + i, p, p1; + + if (this._tooFewPointsForIntersection()) { + return false; + } + + for (i = len - 1; i >= 3; i--) { + p = points[i - 1]; + p1 = points[i]; + + + if (this._lineSegmentsIntersectsRange(p, p1, i - 2)) { + return true; + } + } + + return false; + }, + + // Check for intersection if new latlng was added to this polyline. + // NOTE: does not support detecting intersection for degenerate cases. + newLatLngIntersects: function (latlng, skipFirst) { + // Cannot check a polyline for intersecting lats/lngs when not added to the map + if (!this._map) { + return false; + } + + return this.newPointIntersects(this._map.latLngToLayerPoint(latlng), skipFirst); + }, + + // Check for intersection if new point was added to this polyline. + // newPoint must be a layer point. + // NOTE: does not support detecting intersection for degenerate cases. + newPointIntersects: function (newPoint, skipFirst) { + var points = this._originalPoints, + len = points ? points.length : 0, + lastPoint = points ? points[len - 1] : null, + // The previous previous line segment. Previous line segment doesn't need testing. + maxIndex = len - 2; + + if (this._tooFewPointsForIntersection(1)) { + return false; + } + + return this._lineSegmentsIntersectsRange(lastPoint, newPoint, maxIndex, skipFirst ? 1 : 0); + }, + + // Polylines with 2 sides can only intersect in cases where points are collinear (we don't support detecting these). + // Cannot have intersection when < 3 line segments (< 4 points) + _tooFewPointsForIntersection: function (extraPoints) { + var points = this._originalPoints, + len = points ? points.length : 0; + // Increment length by extraPoints if present + len += extraPoints || 0; + + return !this._originalPoints || len <= 3; + }, + + // Checks a line segment intersections with any line segments before its predecessor. + // Don't need to check the predecessor as will never intersect. + _lineSegmentsIntersectsRange: function (p, p1, maxIndex, minIndex) { + var points = this._originalPoints, + p2, p3; + + minIndex = minIndex || 0; + + // Check all previous line segments (beside the immediately previous) for intersections + for (var j = maxIndex; j > minIndex; j--) { + p2 = points[j - 1]; + p3 = points[j]; + + if (L.LineUtil.segmentsIntersect(p, p1, p2, p3)) { + return true; + } + } + + return false; + } +}); + + +L.Polygon.include({ + // Checks a polygon for any intersecting line segments. Ignores holes. + intersects: function () { + var polylineIntersects, + points = this._originalPoints, + len, firstPoint, lastPoint, maxIndex; + + if (this._tooFewPointsForIntersection()) { + return false; + } + + polylineIntersects = L.Polyline.prototype.intersects.call(this); + + // If already found an intersection don't need to check for any more. + if (polylineIntersects) { + return true; + } + + len = points.length; + firstPoint = points[0]; + lastPoint = points[len - 1]; + maxIndex = len - 2; + + // Check the line segment between last and first point. Don't need to check the first line segment (minIndex = 1) + return this._lineSegmentsIntersectsRange(lastPoint, firstPoint, maxIndex, 1); + } +}); + +L.Control.Draw = L.Control.extend({ + + options: { + position: 'topleft', + draw: {}, + edit: false + }, + + initialize: function (options) { + if (L.version < '0.7') { + throw new Error('Leaflet.draw 0.2.3+ requires Leaflet 0.7.0+. Download latest from https://github.com/Leaflet/Leaflet/'); + } + + L.Control.prototype.initialize.call(this, options); + + var toolbar; + + this._toolbars = {}; + + // Initialize toolbars + if (L.DrawToolbar && this.options.draw) { + toolbar = new L.DrawToolbar(this.options.draw); + + this._toolbars[L.DrawToolbar.TYPE] = toolbar; + + // Listen for when toolbar is enabled + this._toolbars[L.DrawToolbar.TYPE].on('enable', this._toolbarEnabled, this); + } + + if (L.EditToolbar && this.options.edit) { + toolbar = new L.EditToolbar(this.options.edit); + + this._toolbars[L.EditToolbar.TYPE] = toolbar; + + // Listen for when toolbar is enabled + this._toolbars[L.EditToolbar.TYPE].on('enable', this._toolbarEnabled, this); + } + }, + + onAdd: function (map) { + var container = L.DomUtil.create('div', 'leaflet-draw'), + addedTopClass = false, + topClassName = 'leaflet-draw-toolbar-top', + toolbarContainer; + + for (var toolbarId in this._toolbars) { + if (this._toolbars.hasOwnProperty(toolbarId)) { + toolbarContainer = this._toolbars[toolbarId].addToolbar(map); + + if (toolbarContainer) { + // Add class to the first toolbar to remove the margin + if (!addedTopClass) { + if (!L.DomUtil.hasClass(toolbarContainer, topClassName)) { + L.DomUtil.addClass(toolbarContainer.childNodes[0], topClassName); + } + addedTopClass = true; + } + + container.appendChild(toolbarContainer); + } + } + } + + return container; + }, + + onRemove: function () { + for (var toolbarId in this._toolbars) { + if (this._toolbars.hasOwnProperty(toolbarId)) { + this._toolbars[toolbarId].removeToolbar(); + } + } + }, + + setDrawingOptions: function (options) { + for (var toolbarId in this._toolbars) { + if (this._toolbars[toolbarId] instanceof L.DrawToolbar) { + this._toolbars[toolbarId].setOptions(options); + } + } + }, + + _toolbarEnabled: function (e) { + var enabledToolbar = e.target; + + for (var toolbarId in this._toolbars) { + if (this._toolbars[toolbarId] !== enabledToolbar) { + this._toolbars[toolbarId].disable(); + } + } + } +}); + +L.Map.mergeOptions({ + drawControlTooltips: true, + drawControl: false +}); + +L.Map.addInitHook(function () { + if (this.options.drawControl) { + this.drawControl = new L.Control.Draw(); + this.addControl(this.drawControl); + } +}); + + +L.Toolbar = L.Class.extend({ + includes: [L.Mixin.Events], + + initialize: function (options) { + L.setOptions(this, options); + + this._modes = {}; + this._actionButtons = []; + this._activeMode = null; + }, + + enabled: function () { + return this._activeMode !== null; + }, + + disable: function () { + if (!this.enabled()) { return; } + + this._activeMode.handler.disable(); + }, + + addToolbar: function (map) { + var container = L.DomUtil.create('div', 'leaflet-draw-section'), + buttonIndex = 0, + buttonClassPrefix = this._toolbarClass || '', + modeHandlers = this.getModeHandlers(map), + i; + + this._toolbarContainer = L.DomUtil.create('div', 'leaflet-draw-toolbar leaflet-bar'); + this._map = map; + + for (i = 0; i < modeHandlers.length; i++) { + if (modeHandlers[i].enabled) { + this._initModeHandler( + modeHandlers[i].handler, + this._toolbarContainer, + buttonIndex++, + buttonClassPrefix, + modeHandlers[i].title + ); + } + } + + // if no buttons were added, do not add the toolbar + if (!buttonIndex) { + return; + } + + // Save button index of the last button, -1 as we would have ++ after the last button + this._lastButtonIndex = --buttonIndex; + + // Create empty actions part of the toolbar + this._actionsContainer = L.DomUtil.create('ul', 'leaflet-draw-actions'); + + // Add draw and cancel containers to the control container + container.appendChild(this._toolbarContainer); + container.appendChild(this._actionsContainer); + + return container; + }, + + removeToolbar: function () { + // Dispose each handler + for (var handlerId in this._modes) { + if (this._modes.hasOwnProperty(handlerId)) { + // Unbind handler button + this._disposeButton( + this._modes[handlerId].button, + this._modes[handlerId].handler.enable, + this._modes[handlerId].handler + ); + + // Make sure is disabled + this._modes[handlerId].handler.disable(); + + // Unbind handler + this._modes[handlerId].handler + .off('enabled', this._handlerActivated, this) + .off('disabled', this._handlerDeactivated, this); + } + } + this._modes = {}; + + // Dispose the actions toolbar + for (var i = 0, l = this._actionButtons.length; i < l; i++) { + this._disposeButton( + this._actionButtons[i].button, + this._actionButtons[i].callback, + this + ); + } + this._actionButtons = []; + this._actionsContainer = null; + }, + + _initModeHandler: function (handler, container, buttonIndex, classNamePredix, buttonTitle) { + var type = handler.type; + + this._modes[type] = {}; + + this._modes[type].handler = handler; + + this._modes[type].button = this._createButton({ + title: buttonTitle, + className: classNamePredix + '-' + type, + container: container, + callback: this._modes[type].handler.enable, + context: this._modes[type].handler + }); + + this._modes[type].buttonIndex = buttonIndex; + + this._modes[type].handler + .on('enabled', this._handlerActivated, this) + .on('disabled', this._handlerDeactivated, this); + }, + + _createButton: function (options) { + var link = L.DomUtil.create('a', options.className || '', options.container); + link.href = '#'; + + if (options.text) { + link.innerHTML = options.text; + } + + if (options.title) { + link.title = options.title; + } + + L.DomEvent + .on(link, 'click', L.DomEvent.stopPropagation) + .on(link, 'mousedown', L.DomEvent.stopPropagation) + .on(link, 'dblclick', L.DomEvent.stopPropagation) + .on(link, 'click', L.DomEvent.preventDefault) + .on(link, 'click', options.callback, options.context); + + return link; + }, + + _disposeButton: function (button, callback) { + L.DomEvent + .off(button, 'click', L.DomEvent.stopPropagation) + .off(button, 'mousedown', L.DomEvent.stopPropagation) + .off(button, 'dblclick', L.DomEvent.stopPropagation) + .off(button, 'click', L.DomEvent.preventDefault) + .off(button, 'click', callback); + }, + + _handlerActivated: function (e) { + // Disable active mode (if present) + this.disable(); + + // Cache new active feature + this._activeMode = this._modes[e.handler]; + + L.DomUtil.addClass(this._activeMode.button, 'leaflet-draw-toolbar-button-enabled'); + + this._showActionsToolbar(); + + this.fire('enable'); + }, + + _handlerDeactivated: function () { + this._hideActionsToolbar(); + + L.DomUtil.removeClass(this._activeMode.button, 'leaflet-draw-toolbar-button-enabled'); + + this._activeMode = null; + + this.fire('disable'); + }, + + _createActions: function (handler) { + var container = this._actionsContainer, + buttons = this.getActions(handler), + l = buttons.length, + li, di, dl, button; + + // Dispose the actions toolbar (todo: dispose only not used buttons) + for (di = 0, dl = this._actionButtons.length; di < dl; di++) { + this._disposeButton(this._actionButtons[di].button, this._actionButtons[di].callback); + } + this._actionButtons = []; + + // Remove all old buttons + while (container.firstChild) { + container.removeChild(container.firstChild); + } + + for (var i = 0; i < l; i++) { + if ('enabled' in buttons[i] && !buttons[i].enabled) { + continue; + } + + li = L.DomUtil.create('li', '', container); + + button = this._createButton({ + title: buttons[i].title, + text: buttons[i].text, + container: li, + callback: buttons[i].callback, + context: buttons[i].context + }); + + this._actionButtons.push({ + button: button, + callback: buttons[i].callback + }); + } + }, + + _showActionsToolbar: function () { + var buttonIndex = this._activeMode.buttonIndex, + lastButtonIndex = this._lastButtonIndex, + toolbarPosition = this._activeMode.button.offsetTop - 1; + + // Recreate action buttons on every click + this._createActions(this._activeMode.handler); + + // Correctly position the cancel button + this._actionsContainer.style.top = toolbarPosition + 'px'; + + if (buttonIndex === 0) { + L.DomUtil.addClass(this._toolbarContainer, 'leaflet-draw-toolbar-notop'); + L.DomUtil.addClass(this._actionsContainer, 'leaflet-draw-actions-top'); + } + + if (buttonIndex === lastButtonIndex) { + L.DomUtil.addClass(this._toolbarContainer, 'leaflet-draw-toolbar-nobottom'); + L.DomUtil.addClass(this._actionsContainer, 'leaflet-draw-actions-bottom'); + } + + this._actionsContainer.style.display = 'block'; + }, + + _hideActionsToolbar: function () { + this._actionsContainer.style.display = 'none'; + + L.DomUtil.removeClass(this._toolbarContainer, 'leaflet-draw-toolbar-notop'); + L.DomUtil.removeClass(this._toolbarContainer, 'leaflet-draw-toolbar-nobottom'); + L.DomUtil.removeClass(this._actionsContainer, 'leaflet-draw-actions-top'); + L.DomUtil.removeClass(this._actionsContainer, 'leaflet-draw-actions-bottom'); + } +}); + + +L.Tooltip = L.Class.extend({ + initialize: function (map) { + this._map = map; + this._popupPane = map._panes.popupPane; + + this._container = map.options.drawControlTooltips ? L.DomUtil.create('div', 'leaflet-draw-tooltip', this._popupPane) : null; + this._singleLineLabel = false; + }, + + dispose: function () { + if (this._container) { + this._popupPane.removeChild(this._container); + this._container = null; + } + }, + + updateContent: function (labelText) { + if (!this._container) { + return this; + } + labelText.subtext = labelText.subtext || ''; + + // update the vertical position (only if changed) + if (labelText.subtext.length === 0 && !this._singleLineLabel) { + L.DomUtil.addClass(this._container, 'leaflet-draw-tooltip-single'); + this._singleLineLabel = true; + } + else if (labelText.subtext.length > 0 && this._singleLineLabel) { + L.DomUtil.removeClass(this._container, 'leaflet-draw-tooltip-single'); + this._singleLineLabel = false; + } + + this._container.innerHTML = + (labelText.subtext.length > 0 ? '' + labelText.subtext + '' + '
' : '') + + '' + labelText.text + ''; + + return this; + }, + + updatePosition: function (latlng) { + var pos = this._map.latLngToLayerPoint(latlng), + tooltipContainer = this._container; + + if (this._container) { + tooltipContainer.style.visibility = 'inherit'; + L.DomUtil.setPosition(tooltipContainer, pos); + } + + return this; + }, + + showAsError: function () { + if (this._container) { + L.DomUtil.addClass(this._container, 'leaflet-error-draw-tooltip'); + } + return this; + }, + + removeError: function () { + if (this._container) { + L.DomUtil.removeClass(this._container, 'leaflet-error-draw-tooltip'); + } + return this; + } +}); + +L.DrawToolbar = L.Toolbar.extend({ + + statics: { + TYPE: 'draw' + }, + + options: { + polyline: {}, + polygon: {}, + rectangle: {}, + circle: {}, + marker: {} + }, + + initialize: function (options) { + // Ensure that the options are merged correctly since L.extend is only shallow + for (var type in this.options) { + if (this.options.hasOwnProperty(type)) { + if (options[type]) { + options[type] = L.extend({}, this.options[type], options[type]); + } + } + } + + this._toolbarClass = 'leaflet-draw-draw'; + L.Toolbar.prototype.initialize.call(this, options); + }, + + getModeHandlers: function (map) { + return [ + { + enabled: this.options.polyline, + handler: new L.Draw.Polyline(map, this.options.polyline), + title: L.drawLocal.draw.toolbar.buttons.polyline + }, + { + enabled: this.options.polygon, + handler: new L.Draw.Polygon(map, this.options.polygon), + title: L.drawLocal.draw.toolbar.buttons.polygon + }, + { + enabled: this.options.rectangle, + handler: new L.Draw.Rectangle(map, this.options.rectangle), + title: L.drawLocal.draw.toolbar.buttons.rectangle + }, + { + enabled: this.options.circle, + handler: new L.Draw.Circle(map, this.options.circle), + title: L.drawLocal.draw.toolbar.buttons.circle + }, + { + enabled: this.options.marker, + handler: new L.Draw.Marker(map, this.options.marker), + title: L.drawLocal.draw.toolbar.buttons.marker + } + ]; + }, + + // Get the actions part of the toolbar + getActions: function (handler) { + return [ + { + enabled: handler.deleteLastVertex, + title: L.drawLocal.draw.toolbar.undo.title, + text: L.drawLocal.draw.toolbar.undo.text, + callback: handler.deleteLastVertex, + context: handler + }, + { + title: L.drawLocal.draw.toolbar.actions.title, + text: L.drawLocal.draw.toolbar.actions.text, + callback: this.disable, + context: this + } + ]; + }, + + setOptions: function (options) { + L.setOptions(this, options); + + for (var type in this._modes) { + if (this._modes.hasOwnProperty(type) && options.hasOwnProperty(type)) { + this._modes[type].handler.setOptions(options[type]); + } + } + } +}); + + +/*L.Map.mergeOptions({ + editControl: true +});*/ + +L.EditToolbar = L.Toolbar.extend({ + statics: { + TYPE: 'edit' + }, + + options: { + edit: { + selectedPathOptions: { + color: '#fe57a1', /* Hot pink all the things! */ + opacity: 0.6, + dashArray: '10, 10', + + fill: true, + fillColor: '#fe57a1', + fillOpacity: 0.1, + + // Whether to user the existing layers color + maintainColor: false + } + }, + remove: {}, + featureGroup: null /* REQUIRED! TODO: perhaps if not set then all layers on the map are selectable? */ + }, + + initialize: function (options) { + // Need to set this manually since null is an acceptable value here + if (options.edit) { + if (typeof options.edit.selectedPathOptions === 'undefined') { + options.edit.selectedPathOptions = this.options.edit.selectedPathOptions; + } + options.edit.selectedPathOptions = L.extend({}, this.options.edit.selectedPathOptions, options.edit.selectedPathOptions); + } + + if (options.remove) { + options.remove = L.extend({}, this.options.remove, options.remove); + } + + this._toolbarClass = 'leaflet-draw-edit'; + L.Toolbar.prototype.initialize.call(this, options); + + this._selectedFeatureCount = 0; + }, + + getModeHandlers: function (map) { + var featureGroup = this.options.featureGroup; + return [ + { + enabled: this.options.edit, + handler: new L.EditToolbar.Edit(map, { + featureGroup: featureGroup, + selectedPathOptions: this.options.edit.selectedPathOptions + }), + title: L.drawLocal.edit.toolbar.buttons.edit + }, + { + enabled: this.options.remove, + handler: new L.EditToolbar.Delete(map, { + featureGroup: featureGroup + }), + title: L.drawLocal.edit.toolbar.buttons.remove + } + ]; + }, + + getActions: function () { + return [ + { + title: L.drawLocal.edit.toolbar.actions.save.title, + text: L.drawLocal.edit.toolbar.actions.save.text, + callback: this._save, + context: this + }, + { + title: L.drawLocal.edit.toolbar.actions.cancel.title, + text: L.drawLocal.edit.toolbar.actions.cancel.text, + callback: this.disable, + context: this + } + ]; + }, + + addToolbar: function (map) { + var container = L.Toolbar.prototype.addToolbar.call(this, map); + + this._checkDisabled(); + + this.options.featureGroup.on('layeradd layerremove', this._checkDisabled, this); + + return container; + }, + + removeToolbar: function () { + this.options.featureGroup.off('layeradd layerremove', this._checkDisabled, this); + + L.Toolbar.prototype.removeToolbar.call(this); + }, + + disable: function () { + if (!this.enabled()) { return; } + + this._activeMode.handler.revertLayers(); + + L.Toolbar.prototype.disable.call(this); + }, + + _save: function () { + this._activeMode.handler.save(); + this._activeMode.handler.disable(); + }, + + _checkDisabled: function () { + var featureGroup = this.options.featureGroup, + hasLayers = featureGroup.getLayers().length !== 0, + button; + + if (this.options.edit) { + button = this._modes[L.EditToolbar.Edit.TYPE].button; + + if (hasLayers) { + L.DomUtil.removeClass(button, 'leaflet-disabled'); + } else { + L.DomUtil.addClass(button, 'leaflet-disabled'); + } + + button.setAttribute( + 'title', + hasLayers ? + L.drawLocal.edit.toolbar.buttons.edit + : L.drawLocal.edit.toolbar.buttons.editDisabled + ); + } + + if (this.options.remove) { + button = this._modes[L.EditToolbar.Delete.TYPE].button; + + if (hasLayers) { + L.DomUtil.removeClass(button, 'leaflet-disabled'); + } else { + L.DomUtil.addClass(button, 'leaflet-disabled'); + } + + button.setAttribute( + 'title', + hasLayers ? + L.drawLocal.edit.toolbar.buttons.remove + : L.drawLocal.edit.toolbar.buttons.removeDisabled + ); + } + } +}); + + +L.EditToolbar.Edit = L.Handler.extend({ + statics: { + TYPE: 'edit' + }, + + includes: L.Mixin.Events, + + initialize: function (map, options) { + L.Handler.prototype.initialize.call(this, map); + + L.setOptions(this, options); + + // Store the selectable layer group for ease of access + this._featureGroup = options.featureGroup; + + if (!(this._featureGroup instanceof L.FeatureGroup)) { + throw new Error('options.featureGroup must be a L.FeatureGroup'); + } + + this._uneditedLayerProps = {}; + + // Save the type so super can fire, need to do this as cannot do this.TYPE :( + this.type = L.EditToolbar.Edit.TYPE; + }, + + enable: function () { + if (this._enabled || !this._hasAvailableLayers()) { + return; + } + this.fire('enabled', {handler: this.type}); + //this disable other handlers + + this._map.fire('draw:editstart', { handler: this.type }); + //allow drawLayer to be updated before beginning edition. + + L.Handler.prototype.enable.call(this); + this._featureGroup + .on('layeradd', this._enableLayerEdit, this) + .on('layerremove', this._disableLayerEdit, this); + }, + + disable: function () { + if (!this._enabled) { return; } + this._featureGroup + .off('layeradd', this._enableLayerEdit, this) + .off('layerremove', this._disableLayerEdit, this); + L.Handler.prototype.disable.call(this); + this._map.fire('draw:editstop', { handler: this.type }); + this.fire('disabled', {handler: this.type}); + }, + + addHooks: function () { + var map = this._map; + + if (map) { + map.getContainer().focus(); + + this._featureGroup.eachLayer(this._enableLayerEdit, this); + + this._tooltip = new L.Tooltip(this._map); + this._tooltip.updateContent({ + text: L.drawLocal.edit.handlers.edit.tooltip.text, + subtext: L.drawLocal.edit.handlers.edit.tooltip.subtext + }); + + this._map.on('mousemove', this._onMouseMove, this); + } + }, + + removeHooks: function () { + if (this._map) { + // Clean up selected layers. + this._featureGroup.eachLayer(this._disableLayerEdit, this); + + // Clear the backups of the original layers + this._uneditedLayerProps = {}; + + this._tooltip.dispose(); + this._tooltip = null; + + this._map.off('mousemove', this._onMouseMove, this); + } + }, + + revertLayers: function () { + this._featureGroup.eachLayer(function (layer) { + this._revertLayer(layer); + }, this); + }, + + save: function () { + var editedLayers = new L.LayerGroup(); + this._featureGroup.eachLayer(function (layer) { + if (layer.edited) { + editedLayers.addLayer(layer); + layer.edited = false; + } + }); + this._map.fire('draw:edited', {layers: editedLayers}); + }, + + _backupLayer: function (layer) { + var id = L.Util.stamp(layer); + + if (!this._uneditedLayerProps[id]) { + // Polyline, Polygon or Rectangle + if (layer instanceof L.Polyline || layer instanceof L.Polygon || layer instanceof L.Rectangle) { + this._uneditedLayerProps[id] = { + latlngs: L.LatLngUtil.cloneLatLngs(layer.getLatLngs()) + }; + } else if (layer instanceof L.Circle) { + this._uneditedLayerProps[id] = { + latlng: L.LatLngUtil.cloneLatLng(layer.getLatLng()), + radius: layer.getRadius() + }; + } else if (layer instanceof L.Marker) { // Marker + this._uneditedLayerProps[id] = { + latlng: L.LatLngUtil.cloneLatLng(layer.getLatLng()) + }; + } + } + }, + + _revertLayer: function (layer) { + var id = L.Util.stamp(layer); + layer.edited = false; + if (this._uneditedLayerProps.hasOwnProperty(id)) { + // Polyline, Polygon or Rectangle + if (layer instanceof L.Polyline || layer instanceof L.Polygon || layer instanceof L.Rectangle) { + layer.setLatLngs(this._uneditedLayerProps[id].latlngs); + } else if (layer instanceof L.Circle) { + layer.setLatLng(this._uneditedLayerProps[id].latlng); + layer.setRadius(this._uneditedLayerProps[id].radius); + } else if (layer instanceof L.Marker) { // Marker + layer.setLatLng(this._uneditedLayerProps[id].latlng); + } + + layer.fire('revert-edited', { layer: layer }); + } + }, + + _enableLayerEdit: function (e) { + var layer = e.layer || e.target || e, + pathOptions; + + // Back up this layer (if haven't before) + this._backupLayer(layer); + + // Set different style for editing mode + if (this.options.selectedPathOptions) { + pathOptions = L.Util.extend({}, this.options.selectedPathOptions); + + // Use the existing color of the layer + if (pathOptions.maintainColor) { + pathOptions.color = layer.options.color; + pathOptions.fillColor = layer.options.fillColor; + } + + layer.options.original = L.extend({}, layer.options); + layer.options.editing = pathOptions; + } + + layer.editing.enable(); + }, + + _disableLayerEdit: function (e) { + var layer = e.layer || e.target || e; + + layer.edited = false; + layer.editing.disable(); + + delete layer.options.editing; + delete layer.options.original; + }, + + _onMouseMove: function (e) { + this._tooltip.updatePosition(e.latlng); + }, + + _hasAvailableLayers: function () { + return this._featureGroup.getLayers().length !== 0; + } +}); + + +L.EditToolbar.Delete = L.Handler.extend({ + statics: { + TYPE: 'remove' // not delete as delete is reserved in js + }, + + includes: L.Mixin.Events, + + initialize: function (map, options) { + L.Handler.prototype.initialize.call(this, map); + + L.Util.setOptions(this, options); + + // Store the selectable layer group for ease of access + this._deletableLayers = this.options.featureGroup; + + if (!(this._deletableLayers instanceof L.FeatureGroup)) { + throw new Error('options.featureGroup must be a L.FeatureGroup'); + } + + // Save the type so super can fire, need to do this as cannot do this.TYPE :( + this.type = L.EditToolbar.Delete.TYPE; + }, + + enable: function () { + if (this._enabled || !this._hasAvailableLayers()) { + return; + } + this.fire('enabled', { handler: this.type}); + + this._map.fire('draw:deletestart', { handler: this.type }); + + L.Handler.prototype.enable.call(this); + + this._deletableLayers + .on('layeradd', this._enableLayerDelete, this) + .on('layerremove', this._disableLayerDelete, this); + }, + + disable: function () { + if (!this._enabled) { return; } + + this._deletableLayers + .off('layeradd', this._enableLayerDelete, this) + .off('layerremove', this._disableLayerDelete, this); + + L.Handler.prototype.disable.call(this); + + this._map.fire('draw:deletestop', { handler: this.type }); + + this.fire('disabled', { handler: this.type}); + }, + + addHooks: function () { + var map = this._map; + + if (map) { + map.getContainer().focus(); + + this._deletableLayers.eachLayer(this._enableLayerDelete, this); + this._deletedLayers = new L.LayerGroup(); + + this._tooltip = new L.Tooltip(this._map); + this._tooltip.updateContent({ text: L.drawLocal.edit.handlers.remove.tooltip.text }); + + this._map.on('mousemove', this._onMouseMove, this); + } + }, + + removeHooks: function () { + if (this._map) { + this._deletableLayers.eachLayer(this._disableLayerDelete, this); + this._deletedLayers = null; + + this._tooltip.dispose(); + this._tooltip = null; + + this._map.off('mousemove', this._onMouseMove, this); + } + }, + + revertLayers: function () { + // Iterate of the deleted layers and add them back into the featureGroup + this._deletedLayers.eachLayer(function (layer) { + this._deletableLayers.addLayer(layer); + layer.fire('revert-deleted', { layer: layer }); + }, this); + }, + + save: function () { + this._map.fire('draw:deleted', { layers: this._deletedLayers }); + }, + + _enableLayerDelete: function (e) { + var layer = e.layer || e.target || e; + + layer.on('click', this._removeLayer, this); + }, + + _disableLayerDelete: function (e) { + var layer = e.layer || e.target || e; + + layer.off('click', this._removeLayer, this); + + // Remove from the deleted layers so we can't accidently revert if the user presses cancel + this._deletedLayers.removeLayer(layer); + }, + + _removeLayer: function (e) { + var layer = e.layer || e.target || e; + + this._deletableLayers.removeLayer(layer); + + this._deletedLayers.addLayer(layer); + + layer.fire('deleted'); + }, + + _onMouseMove: function (e) { + this._tooltip.updatePosition(e.latlng); + }, + + _hasAvailableLayers: function () { + return this._deletableLayers.getLayers().length !== 0; + } +}); + + +}(window, document)); \ No newline at end of file diff --git a/public/bower_components/leaflet-draw/dist/leaflet.draw.css b/public/bower_components/leaflet-draw/dist/leaflet.draw.css new file mode 100644 index 0000000..7bc9978 --- /dev/null +++ b/public/bower_components/leaflet-draw/dist/leaflet.draw.css @@ -0,0 +1,303 @@ +/* ================================================================== */ +/* Toolbars +/* ================================================================== */ + +.leaflet-draw-section { + position: relative; +} + +.leaflet-draw-toolbar { + margin-top: 12px; +} + +.leaflet-draw-toolbar-top { + margin-top: 0; +} + +.leaflet-draw-toolbar-notop a:first-child { + border-top-right-radius: 0; +} + +.leaflet-draw-toolbar-nobottom a:last-child { + border-bottom-right-radius: 0; +} + +.leaflet-draw-toolbar a { + background-image: url('images/spritesheet.png'); + background-repeat: no-repeat; +} + +.leaflet-retina .leaflet-draw-toolbar a { + background-image: url('images/spritesheet-2x.png'); + background-size: 270px 30px; +} + +.leaflet-draw a { + display: block; + text-align: center; + text-decoration: none; +} + +/* ================================================================== */ +/* Toolbar actions menu +/* ================================================================== */ + +.leaflet-draw-actions { + display: none; + list-style: none; + margin: 0; + padding: 0; + position: absolute; + left: 26px; /* leaflet-draw-toolbar.left + leaflet-draw-toolbar.width */ + top: 0; + white-space: nowrap; +} + +.leaflet-touch .leaflet-draw-actions { + left: 32px; +} + +.leaflet-right .leaflet-draw-actions { + right:26px; + left:auto; +} + +.leaflet-touch .leaflet-right .leaflet-draw-actions { + right:32px; + left:auto; +} + +.leaflet-draw-actions li { + display: inline-block; +} + +.leaflet-draw-actions li:first-child a { + border-left: none; +} + +.leaflet-draw-actions li:last-child a { + -webkit-border-radius: 0 4px 4px 0; + border-radius: 0 4px 4px 0; +} + +.leaflet-right .leaflet-draw-actions li:last-child a { + -webkit-border-radius: 0; + border-radius: 0; +} + +.leaflet-right .leaflet-draw-actions li:first-child a { + -webkit-border-radius: 4px 0 0 4px; + border-radius: 4px 0 0 4px; +} + +.leaflet-draw-actions a { + background-color: #919187; + border-left: 1px solid #AAA; + color: #FFF; + font: 11px/19px "Helvetica Neue", Arial, Helvetica, sans-serif; + line-height: 28px; + text-decoration: none; + padding-left: 10px; + padding-right: 10px; + height: 28px; +} + +.leaflet-touch .leaflet-draw-actions a { + font-size: 12px; + line-height: 30px; + height: 30px; +} + +.leaflet-draw-actions-bottom { + margin-top: 0; +} + +.leaflet-draw-actions-top { + margin-top: 1px; +} + +.leaflet-draw-actions-top a, +.leaflet-draw-actions-bottom a { + height: 27px; + line-height: 27px; +} + +.leaflet-draw-actions a:hover { + background-color: #A0A098; +} + +.leaflet-draw-actions-top.leaflet-draw-actions-bottom a { + height: 26px; + line-height: 26px; +} + +/* ================================================================== */ +/* Draw toolbar +/* ================================================================== */ + +.leaflet-draw-toolbar .leaflet-draw-draw-polyline { + background-position: -2px -2px; +} + +.leaflet-touch .leaflet-draw-toolbar .leaflet-draw-draw-polyline { + background-position: 0 -1px; +} + +.leaflet-draw-toolbar .leaflet-draw-draw-polygon { + background-position: -31px -2px; +} + +.leaflet-touch .leaflet-draw-toolbar .leaflet-draw-draw-polygon { + background-position: -29px -1px; +} + +.leaflet-draw-toolbar .leaflet-draw-draw-rectangle { + background-position: -62px -2px; +} + +.leaflet-touch .leaflet-draw-toolbar .leaflet-draw-draw-rectangle { + background-position: -60px -1px; +} + +.leaflet-draw-toolbar .leaflet-draw-draw-circle { + background-position: -92px -2px; +} + +.leaflet-touch .leaflet-draw-toolbar .leaflet-draw-draw-circle { + background-position: -90px -1px; +} + +.leaflet-draw-toolbar .leaflet-draw-draw-marker { + background-position: -122px -2px; +} + +.leaflet-touch .leaflet-draw-toolbar .leaflet-draw-draw-marker { + background-position: -120px -1px; +} + +/* ================================================================== */ +/* Edit toolbar +/* ================================================================== */ + +.leaflet-draw-toolbar .leaflet-draw-edit-edit { + background-position: -152px -2px; +} + +.leaflet-touch .leaflet-draw-toolbar .leaflet-draw-edit-edit { + background-position: -150px -1px; +} + +.leaflet-draw-toolbar .leaflet-draw-edit-remove { + background-position: -182px -2px; +} + +.leaflet-touch .leaflet-draw-toolbar .leaflet-draw-edit-remove { + background-position: -180px -1px; +} + +.leaflet-draw-toolbar .leaflet-draw-edit-edit.leaflet-disabled { + background-position: -212px -2px; +} + +.leaflet-touch .leaflet-draw-toolbar .leaflet-draw-edit-edit.leaflet-disabled { + background-position: -210px -1px; +} + +.leaflet-draw-toolbar .leaflet-draw-edit-remove.leaflet-disabled { + background-position: -242px -2px; +} + +.leaflet-touch .leaflet-draw-toolbar .leaflet-draw-edit-remove.leaflet-disabled { + background-position: -240px -2px; +} + +/* ================================================================== */ +/* Drawing styles +/* ================================================================== */ + +.leaflet-mouse-marker { + background-color: #fff; + cursor: crosshair; +} + +.leaflet-draw-tooltip { + background: rgb(54, 54, 54); + background: rgba(0, 0, 0, 0.5); + border: 1px solid transparent; + -webkit-border-radius: 4px; + border-radius: 4px; + color: #fff; + font: 12px/18px "Helvetica Neue", Arial, Helvetica, sans-serif; + margin-left: 20px; + margin-top: -21px; + padding: 4px 8px; + position: absolute; + visibility: hidden; + white-space: nowrap; + z-index: 6; +} + +.leaflet-draw-tooltip:before { + border-right: 6px solid black; + border-right-color: rgba(0, 0, 0, 0.5); + border-top: 6px solid transparent; + border-bottom: 6px solid transparent; + content: ""; + position: absolute; + top: 7px; + left: -7px; +} + +.leaflet-error-draw-tooltip { + background-color: #F2DEDE; + border: 1px solid #E6B6BD; + color: #B94A48; +} + +.leaflet-error-draw-tooltip:before { + border-right-color: #E6B6BD; +} + +.leaflet-draw-tooltip-single { + margin-top: -12px +} + +.leaflet-draw-tooltip-subtext { + color: #f8d5e4; +} + +.leaflet-draw-guide-dash { + font-size: 1%; + opacity: 0.6; + position: absolute; + width: 5px; + height: 5px; +} + +/* ================================================================== */ +/* Edit styles +/* ================================================================== */ + +.leaflet-edit-marker-selected { + background: rgba(254, 87, 161, 0.1); + border: 4px dashed rgba(254, 87, 161, 0.6); + -webkit-border-radius: 4px; + border-radius: 4px; + box-sizing: content-box; +} + +.leaflet-edit-move { + cursor: move; +} + +.leaflet-edit-resize { + cursor: pointer; +} + +/* ================================================================== */ +/* Old IE styles +/* ================================================================== */ + +.leaflet-oldie .leaflet-draw-toolbar { + border: 1px solid #999; +} \ No newline at end of file diff --git a/public/bower_components/requirejs/require.js b/public/bower_components/requirejs/require.js index bc43457..3628047 100644 --- a/public/bower_components/requirejs/require.js +++ b/public/bower_components/requirejs/require.js @@ -1,5 +1,5 @@ /** vim: et:ts=4:sw=4:sts=4 - * @license RequireJS 2.1.16 Copyright (c) 2010-2015, The Dojo Foundation All Rights Reserved. + * @license RequireJS 2.1.18 Copyright (c) 2010-2015, The Dojo Foundation All Rights Reserved. * Available via the MIT or new BSD license. * see: http://github.com/jrburke/requirejs for details */ @@ -12,7 +12,7 @@ var requirejs, require, define; (function (global) { var req, s, head, baseElement, dataMain, src, interactiveScript, currentlyAddingScript, mainScript, subPath, - version = '2.1.16', + version = '2.1.18', commentRegExp = /(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/mg, cjsRequireRegExp = /[^.]\s*require\s*\(\s*["']([^'"\s]+)["']\s*\)/g, jsSuffixRegExp = /\.js$/, @@ -244,7 +244,7 @@ var requirejs, require, define; // still work when converted to a path, even though // as an ID it is less than ideal. In larger point // releases, may be better to just kick out an error. - if (i === 0 || (i == 1 && ary[2] === '..') || ary[i - 1] === '..') { + if (i === 0 || (i === 1 && ary[2] === '..') || ary[i - 1] === '..') { continue; } else if (i > 0) { ary.splice(i - 1, 2); @@ -589,7 +589,7 @@ var requirejs, require, define; id: mod.map.id, uri: mod.map.url, config: function () { - return getOwn(config.config, mod.map.id) || {}; + return getOwn(config.config, mod.map.id) || {}; }, exports: mod.exports || (mod.exports = {}) }); @@ -1117,6 +1117,9 @@ var requirejs, require, define; this.depCount += 1; on(depMap, 'defined', bind(this, function (depExports) { + if (this.undefed) { + return; + } this.defineDep(i, depExports); this.check(); })); @@ -1233,7 +1236,8 @@ var requirejs, require, define; while (defQueue.length) { args = defQueue.shift(); if (args[0] === null) { - return onError(makeError('mismatch', 'Mismatched anonymous define() module: ' + args[args.length - 1])); + return onError(makeError('mismatch', 'Mismatched anonymous define() module: ' + + args[args.length - 1])); } else { //args are id, deps, factory. Should be normalized by the //define() function. @@ -1320,7 +1324,7 @@ var requirejs, require, define; each(cfg.packages, function (pkgObj) { var location, name; - pkgObj = typeof pkgObj === 'string' ? { name: pkgObj } : pkgObj; + pkgObj = typeof pkgObj === 'string' ? {name: pkgObj} : pkgObj; name = pkgObj.name; location = pkgObj.location; @@ -1347,7 +1351,7 @@ var requirejs, require, define; //late to modify them, and ignore unnormalized ones //since they are transient. if (!mod.inited && !mod.map.unnormalized) { - mod.map = makeModuleMap(id); + mod.map = makeModuleMap(id, null, true); } }); @@ -1483,6 +1487,7 @@ var requirejs, require, define; var map = makeModuleMap(id, relMap, true), mod = getOwn(registry, id); + mod.undefed = true; removeScript(id); delete defined[id]; @@ -1493,7 +1498,7 @@ var requirejs, require, define; //in array so that the splices do not //mess up the iteration. eachReverse(defQueue, function(args, i) { - if(args[0] === id) { + if (args[0] === id) { defQueue.splice(i, 1); } }); @@ -1980,7 +1985,7 @@ var requirejs, require, define; //like a module name. mainScript = mainScript.replace(jsSuffixRegExp, ''); - //If mainScript is still a path, fall back to dataMain + //If mainScript is still a path, fall back to dataMain if (req.jsExtRegExp.test(mainScript)) { mainScript = dataMain; } @@ -2066,7 +2071,6 @@ var requirejs, require, define; jQuery: true }; - /** * Executes the text. Normally just uses eval, but can be modified * to use a better, environment-specific call. Only used for transpiling diff --git a/public/build.txt b/public/build.txt index 5308619..1816085 100644 --- a/public/build.txt +++ b/public/build.txt @@ -32,15 +32,16 @@ components/courier/data_source/_decorate_query.js components/courier/data_source/_abstract.js components/courier/fetch/request/search.js utils/rison.js -factories/base_object.js +utils/BaseObject.js +utils/SimpleEmitter.js factories/events.js components/courier/fetch/request/_segmented_handle.js components/courier/fetch/request/segmented.js +components/courier/data_source/_normalize_sort_request.js components/courier/data_source/search_source.js components/courier/data_source/_root_search_source.js utils/routes/_setup.js utils/routes/_wrap_route_with_prep.js -utils/next_tick.js components/notify/_errors.js bower_components/requirejs-text/text.js text!components/notify/partials/fatal_splash_screen.html @@ -68,10 +69,12 @@ directives/input_focus.js directives/config.js services/es.js filters/short_dots.js -components/index_patterns/_get_ids.js utils/indexed_array/_path_getter.js utils/indexed_array/_inflector.js utils/indexed_array/index.js +registry/_registry.js +registry/field_formats.js +components/index_patterns/_get_ids.js components/index_patterns/_cast_mapping_type.js components/index_patterns/_map_field.js components/index_patterns/_transform_mapping_into_fields.js @@ -79,15 +82,19 @@ components/index_patterns/_intervals.js components/index_patterns/_pattern_to_wildcard.js components/index_patterns/_local_cache.js components/index_patterns/_mapper.js -components/index_patterns/_field_formats.js -components/index_patterns/_field_types.js -components/index_patterns/_flatten_search_response.js -components/index_patterns/_flatten_hit.js components/index_patterns/_get_computed_fields.js components/courier/data_source/_doc_send_to_es.js components/courier/fetch/request/doc.js components/courier/data_source/doc_source.js utils/mapping_setup.js +components/index_patterns/_field_format/contentTypes.js +components/index_patterns/_field_format/FieldFormat.js +components/index_patterns/_field_types.js +utils/obj_define.js +components/index_patterns/_field.js +components/index_patterns/_field_list.js +components/index_patterns/_flatten_hit.js +components/index_patterns/_format_hit.js components/index_patterns/_index_pattern.js components/index_patterns/_pattern_cache.js components/index_patterns/index_patterns.js @@ -117,14 +124,30 @@ components/clipboard/clipboard.js css!bower_components/gridster/dist/jquery.gridster bower_components/gridster/dist/jquery.gridster.js plugins/dashboard/directives/grid.js -components/filter_manager/filter_manager.js utils/brush_event.js +components/filter_bar/lib/compareFilters.js components/filter_bar/lib/dedupFilters.js components/filter_bar/lib/uniqFilters.js components/filter_bar/filter_bar_click_handler.js plugins/dashboard/components/panel/lib/visualization.js plugins/dashboard/components/panel/lib/search.js plugins/dashboard/components/panel/lib/load_panel.js +components/filter_bar/lib/onlyDisabled.js +components/filter_bar/lib/onlyStateChanged.js +components/filter_bar/lib/generateMappingChain.js +components/filter_bar/lib/mapTerms.js +components/filter_bar/lib/mapRange.js +components/filter_bar/lib/mapExists.js +components/filter_bar/lib/mapMissing.js +components/filter_bar/lib/mapQueryString.js +components/filter_bar/lib/mapGeoBoundingBox.js +components/filter_bar/lib/mapScript.js +components/filter_bar/lib/mapDefault.js +components/filter_bar/lib/mapFilter.js +components/filter_bar/lib/mapAndFlattenFilters.js +components/filter_bar/query_filter.js +components/filter_manager/filter_manager.js +plugins/settings/saved_object_registry.js bower_components/FileSaver/FileSaver.js components/vis/_agg_config.js components/agg_response/tabify/_table.js @@ -141,7 +164,6 @@ css!components/agg_table/agg_table text!components/agg_table/agg_table.html components/agg_table/agg_table.js text!components/visualize/spy/_table.html -registry/_registry.js registry/spy_modes.js components/visualize/spy/_table.js text!components/visualize/spy/_req_resp_stats.html @@ -160,29 +182,28 @@ directives/infinite_scroll.js text!components/doc_table/components/table_header.html components/doc_table/components/table_header.js utils/add_word_breaks.js -utils/no_white_space.js components/highlight/highlight_tags.js components/highlight/highlight.js +bower_components/ace-builds/src-noconflict/ace.js +bower_components/ace-builds/src-noconflict/mode-json.js +bower_components/angular-ui-ace/ui-ace.js text!components/doc_viewer/doc_viewer.html css!components/doc_viewer/doc_viewer components/doc_viewer/doc_viewer.js filters/trust_as_html.js +utils/no_white_space.js text!components/doc_table/components/table_row/open.html text!components/doc_table/components/table_row/details.html text!components/doc_table/components/table_row/cell.html text!partials/truncate_by_height.html -text!components/doc_table/components/table_row/_source.html components/doc_table/components/table_row.js components/doc_table/doc_table.js text!plugins/dashboard/components/panel/panel.html plugins/dashboard/components/panel/panel.js plugins/dashboard/services/_saved_dashboard.js -plugins/settings/saved_object_registry.js plugins/dashboard/services/saved_dashboards.js css!plugins/dashboard/styles/main text!plugins/dashboard/index.html -components/filter_bar/lib/onlyDisabled.js -components/filter_bar/lib/watchFilters.js text!plugins/dashboard/partials/save_dashboard.html text!plugins/dashboard/partials/load_dashboard.html text!plugins/dashboard/partials/share.html @@ -225,11 +246,11 @@ components/vislib/lib/layout/layout_types.js components/vislib/lib/layout/layout.js components/vislib/lib/handler/handler.js text!components/vislib/partials/legend_header.html +components/vislib/lib/_data_label.js css!components/vislib/styles/main components/vislib/lib/legend.js components/vislib/lib/_error_handler.js components/vislib/lib/x_axis.js -bower_components/numeral/numeral.js components/vislib/lib/y_axis.js components/vislib/lib/axis_title.js components/vislib/components/tooltip/_position_tooltip.js @@ -244,35 +265,41 @@ components/vislib/lib/dispatch.js components/vislib/visualizations/_chart.js text!components/vislib/partials/touchdown.tmpl.html components/vislib/visualizations/_point_series_chart.js +utils/datemath.js +components/vislib/visualizations/time_marker.js components/vislib/visualizations/column_chart.js components/vislib/visualizations/pie_chart.js components/vislib/visualizations/line_chart.js components/vislib/visualizations/area_chart.js css!bower_components/leaflet/dist/leaflet bower_components/leaflet/dist/leaflet.js +bower_components/Leaflet.heat/dist/leaflet-heat.js +css!bower_components/leaflet-draw/dist/leaflet.draw +bower_components/leaflet-draw/dist/leaflet.draw.js components/vislib/visualizations/tile_map.js components/vislib/visualizations/vis_types.js components/vislib/vis.js components/vislib/index.js plugins/discover/directives/timechart.js -text!plugins/discover/components/field_chooser/field_chooser.html -plugins/discover/components/field_chooser/lib/field_calculator.js +css!components/collapsible_sidebar/collapsible_sidebar +components/collapsible_sidebar/collapsible_sidebar.js directives/css_truncate.js directives/field_name.js filters/unique.js text!plugins/discover/components/field_chooser/discover_field.html text!plugins/discover/components/field_chooser/lib/detail_views/string.html plugins/discover/components/field_chooser/discover_field.js +plugins/discover/components/field_chooser/lib/field_calculator.js +text!plugins/discover/components/field_chooser/field_chooser.html plugins/discover/components/field_chooser/field_chooser.js -utils/datemath.js text!components/timepicker/timepicker.html directives/input_datetime.js -directives/greater_than.js +directives/inequality.js components/timepicker/quick_ranges.js components/timepicker/refresh_intervals.js components/timepicker/time_units.js components/timepicker/timepicker.js -directives/fixed_scroll.js +components/fixedScroll.js directives/validate_json.js services/debounce.js components/validate_query/lib/from_user.js @@ -284,7 +311,9 @@ components/state_management/state.js components/state_management/app_state.js utils/diff_time_picker_vals.js components/state_management/global_state.js -services/timefilter.js +components/timefilter/lib/diff_time.js +components/timefilter/lib/diff_interval.js +components/timefilter/timefilter.js text!plugins/discover/index.html filters/label.js text!components/agg_types/controls/field.html @@ -309,20 +338,27 @@ components/agg_types/metrics/_get_response_agg_config.js components/agg_types/metrics/std_deviation.js components/agg_types/metrics/cardinality.js utils/ordinal_suffix.js +text!components/agg_types/controls/percentiles.html +utils/range.js utils/key_map.js -components/agg_types/controls/_percent_list.js -text!components/agg_types/controls/percents.html +components/number_list/number_list_input.js +text!components/number_list/number_list.html +components/number_list/number_list.js components/agg_types/metrics/percentiles.js +text!components/agg_types/controls/percentile_ranks.html +components/agg_types/metrics/percentile_ranks.js components/agg_types/buckets/_bucket_agg_type.js +utils/parse_interval.js components/time_buckets/calc_auto_interval.js components/time_buckets/calc_es_interval.js components/time_buckets/time_buckets.js components/filter_manager/lib/range.js components/agg_types/buckets/create_filter/date_histogram.js -filters/_prop_filter.js -filters/field_type.js directives/input_whole_number.js components/agg_types/buckets/_interval_options.js +filters/_prop_filter.js +filters/field_type.js +components/validateDateInterval.js text!components/agg_types/controls/interval.html components/agg_types/buckets/date_histogram.js components/agg_types/buckets/create_filter/histogram.js @@ -332,8 +368,21 @@ components/agg_types/buckets/histogram.js components/agg_types/buckets/create_filter/range.js text!components/agg_types/controls/ranges.html components/agg_types/buckets/range.js +utils/date_range.js +directives/validate_date_math.js +components/agg_types/buckets/create_filter/date_range.js +text!components/agg_types/controls/date_ranges.html +components/agg_types/buckets/date_range.js +utils/ipv4_address.js +directives/validate_ip.js +utils/cidr_mask.js +directives/validate_cidr_mask.js +components/agg_types/buckets/create_filter/ip_range.js +text!components/agg_types/controls/ip_ranges.html +components/agg_types/buckets/ip_range.js components/agg_types/buckets/_bucket_count_between.js text!plugins/vis_types/controls/rows_or_columns.html +text!plugins/vis_types/controls/radius_ratio_option.html plugins/vis_types/_schemas.js components/filter_manager/lib/phrase.js components/agg_types/buckets/create_filter/terms.js @@ -351,7 +400,6 @@ components/agg_types/index.js components/vis/_agg_configs.js components/vis/vis.js plugins/discover/_hit_sort_fn.js -text!plugins/discover/partials/settings.html text!plugins/discover/partials/load_search.html text!plugins/discover/partials/save_search.html plugins/discover/controllers/discover.js @@ -362,26 +410,10 @@ plugins/doc/controllers/doc.js plugins/doc/index.js bower_components/angular-bootstrap/ui-bootstrap-tpls.js text!components/filter_bar/filter_bar.html -components/filter_bar/lib/toggleFilter.js -components/filter_bar/lib/toggleAll.js -components/filter_bar/lib/invertFilter.js -components/filter_bar/lib/invertAll.js -components/filter_bar/lib/removeFilter.js -components/filter_bar/lib/removeAll.js -components/filter_bar/lib/filterAppliedAndUnwrap.js -components/filter_bar/lib/generateMappingChain.js -components/filter_bar/lib/mapTerms.js -components/filter_bar/lib/mapRange.js -components/filter_bar/lib/mapExists.js -components/filter_bar/lib/mapMissing.js -components/filter_bar/lib/mapQueryString.js -components/filter_bar/lib/mapScript.js -components/filter_bar/lib/mapDefault.js -components/filter_bar/lib/mapFilter.js -components/filter_bar/lib/mapAndFlattenFilters.js components/filter_bar/lib/mapFlattenAndWrapFilters.js components/filter_bar/lib/extractTimeFilter.js components/filter_bar/lib/filterOutTimeBasedFilter.js +components/filter_bar/lib/filterAppliedAndUnwrap.js components/filter_bar/lib/changeTimeFilter.js components/filter_bar/filter_bar.js components/persisted_log/persisted_log.js @@ -399,6 +431,28 @@ components/listen.js components/fancy_forms/kbn_form.js components/fancy_forms/kbn_model.js components/fancy_forms/fancy_forms.js +text!components/field_format_editor/samples/samples.html +components/field_format_editor/samples/samples.js +text!components/field_format_editor/pattern/pattern.html +components/field_format_editor/pattern/pattern.js +text!components/stringify/editors/url.html +components/stringify/types/Url.js +components/bound_to_config_obj.js +bower_components/numeral/numeral.js +text!components/field_format_editor/numeral/numeral.html +components/field_format_editor/numeral/numeral.js +components/stringify/types/_Numeral.js +components/stringify/types/Bytes.js +text!components/stringify/editors/date.html +components/stringify/types/Date.js +components/stringify/types/Ip.js +components/stringify/types/Number.js +components/stringify/types/Percent.js +text!components/stringify/editors/string.html +components/stringify/types/String.js +text!components/stringify/types/_source.html +components/stringify/types/Source.js +components/stringify/register.js directives/click_focus.js text!partials/info.html directives/info.js @@ -433,39 +487,44 @@ plugins/metric_vis/index.js css!plugins/settings/styles/main filters/start_from.js text!plugins/settings/app.html +directives/validate_index_name.js +directives/auto_select_if_only_one.js +text!plugins/settings/sections/indices/_create.html +plugins/settings/sections/indices/_refresh_kibana_index.js +plugins/settings/sections/indices/_create.js text!plugins/settings/sections/indices/_field_name.html text!plugins/settings/sections/indices/_field_type.html -text!plugins/settings/sections/indices/_field_popularity.html +text!plugins/settings/sections/indices/_field_controls.html text!plugins/settings/sections/indices/_indexed_fields.html plugins/settings/sections/indices/_indexed_fields.js -text!plugins/settings/sections/indices/_scripted_field_controls.html text!plugins/settings/sections/indices/_scripted_fields.html plugins/settings/sections/indices/_date_scripts.js plugins/settings/sections/indices/_scripted_fields.js -text!plugins/settings/sections/indices/scripted_fields/index.html -plugins/settings/sections/indices/scripted_fields/index.js -directives/validate_index_name.js -text!plugins/settings/sections/indices/_create.html -plugins/settings/sections/indices/_refresh_kibana_index.js -plugins/settings/sections/indices/_create.js +text!plugins/settings/sections/indices/_index_header.html +plugins/settings/sections/indices/_index_header.js text!plugins/settings/sections/indices/_edit.html plugins/settings/sections/indices/_field_types.js plugins/settings/sections/indices/_edit.js +components/field_format_editor/field_format_editor.js +text!components/field_editor/scripting_info.html +text!components/field_editor/scripting_warning.html +text!components/field_editor/field_editor.html +components/field_editor/field_editor.js +text!plugins/settings/sections/indices/_field_editor.html +plugins/settings/sections/indices/_field_editor.js text!plugins/settings/sections/indices/index.html plugins/settings/sections/indices/index.js plugins/settings/sections/advanced/lib/get_val_type.js +components/elastic_textarea.js text!plugins/settings/sections/advanced/advanced_row.html plugins/settings/sections/advanced/advanced_row.js text!plugins/settings/sections/advanced/index.html plugins/settings/sections/advanced/index.js -bower_components/inflection/lib/inflection.js text!plugins/settings/sections/objects/_view.html plugins/settings/sections/objects/_view.js text!plugins/settings/sections/objects/_objects.html +directives/file_upload.js plugins/settings/sections/objects/_objects.js -bower_components/ace-builds/src-noconflict/ace.js -bower_components/ace-builds/src-noconflict/mode-json.js -bower_components/angular-ui-ace/ui-ace.js bower_components/angular-elastic/elastic.js directives/confirm_click.js plugins/settings/sections/objects/index.js @@ -504,23 +563,31 @@ components/agg_response/hierarchical/_collect_branch.js components/agg_response/hierarchical/_hierarchical_tooltip_formatter.js components/agg_response/hierarchical/build_hierarchical_data.js utils/decode_geo_hash.js -components/agg_response/geo_json/_read_rows.js +components/agg_response/geo_json/rowsToFeatures.js +text!components/agg_response/geo_json/_tooltip.html +components/agg_response/geo_json/_tooltip_formatter.js components/agg_response/geo_json/geo_json.js components/agg_response/index.js plugins/vis_types/vislib/_build_chart_data.js plugins/vis_types/vislib/_vislib_renderbot.js text!plugins/vis_types/controls/vislib_basic_options.html plugins/vis_types/controls/vislib_basic_options.js +text!plugins/vis_types/controls/point_series_options.html +plugins/vis_types/controls/point_series_options.js +text!plugins/vis_types/controls/line_interpolation_option.html +plugins/vis_types/controls/line_interpolation_option.js plugins/vis_types/vislib/_vislib_vis_type.js text!plugins/vis_types/vislib/editors/histogram.html plugins/vis_types/vislib/histogram.js -text!plugins/vis_types/vislib/editors/basic.html +text!plugins/vis_types/vislib/editors/line.html plugins/vis_types/vislib/line.js text!plugins/vis_types/vislib/editors/pie.html plugins/vis_types/vislib/pie.js text!plugins/vis_types/vislib/editors/area.html plugins/vis_types/vislib/area.js +utils/supports.js text!plugins/vis_types/vislib/editors/tile_map.html +components/filter_bar/push_filter.js plugins/vis_types/vislib/tile_map.js plugins/vis_types/index.js css!plugins/visualize/styles/main @@ -546,6 +613,7 @@ plugins/visualize/editor/sidebar.js plugins/visualize/editor/agg_filter.js text!partials/saved_object_finder.html directives/saved_object_finder.js +components/comma_list_filter.js text!plugins/visualize/editor/editor.html text!plugins/visualize/editor/panels/save.html text!plugins/visualize/editor/panels/load.html diff --git a/public/components/agg_response/geo_json/_tooltip.html b/public/components/agg_response/geo_json/_tooltip.html new file mode 100644 index 0000000..3154008 --- /dev/null +++ b/public/components/agg_response/geo_json/_tooltip.html @@ -0,0 +1,8 @@ + + + + + + + +
{{detail.label}}{{detail.value}}
diff --git a/public/components/agg_table/agg_table.html b/public/components/agg_table/agg_table.html index 02d5969..419bdca 100644 --- a/public/components/agg_table/agg_table.html +++ b/public/components/agg_table/agg_table.html @@ -7,10 +7,10 @@
Export:   - Raw + Raw     - Formatted + Formatted
diff --git a/public/components/agg_types/controls/date_ranges.html b/public/components/agg_types/controls/date_ranges.html new file mode 100644 index 0000000..b4ff309 --- /dev/null +++ b/public/components/agg_types/controls/date_ranges.html @@ -0,0 +1,61 @@ +
+ + + + + + + + + + + + + + +
+ + + +
+ + + + + +
+ + Accepted Date Formats + +
+ + +
+

+ + Required: You must specify at least one date range. +

+
+ + +
+ \ No newline at end of file diff --git a/public/components/agg_types/controls/field.html b/public/components/agg_types/controls/field.html index 903b666..48cb9e2 100644 --- a/public/components/agg_types/controls/field.html +++ b/public/components/agg_types/controls/field.html @@ -9,7 +9,7 @@

- Careful! The field selected contains analyzed strings. Values such as foo-bar will be broken into foo and bar. See Mapping Core Types for more information on setting this field as not_analyzed + Careful! The field selected contains analyzed strings. Analyzed strings are highly unique and can use a lot of memory to visualize. Values such as foo-bar will be broken into foo and bar. See Mapping Core Types for more information on setting this field as not_analyzed

@@ -22,8 +22,17 @@ name="field" required ng-model="agg.params.field" + ng-show="indexedFields.length" + auto-select-if-only-one="indexedFields" ng-options="field as field.displayName group by field.type for field in indexedFields" ng-change="aggParam.onChange(agg)"> +

+

+ + No Compatible Fields: The "{{ vis.indexPattern.id }}" index pattern does not contain any of the following field types: {{ agg.type.params.byName.field.filterFieldTypes | commaList:false }} +

+
+
diff --git a/public/components/agg_types/controls/filters.html b/public/components/agg_types/controls/filters.html index ca3feea..cbcd589 100644 --- a/public/components/agg_types/controls/filters.html +++ b/public/components/agg_types/controls/filters.html @@ -1,25 +1,58 @@
- -
+
+ + +
+ + +
+
+ +
+
- +
+ +
+ + +
+

+ + Required: You must specify at least one filter. +

+
+ diff --git a/public/components/agg_types/controls/interval.html b/public/components/agg_types/controls/interval.html index 7a417a3..829f831 100644 --- a/public/components/agg_types/controls/interval.html +++ b/public/components/agg_types/controls/interval.html @@ -18,6 +18,15 @@ name="interval"> + +

+ + +

+ +
+ + + + + + + + + + + +
+ + + +
+ + + + + +
+ + +
+

+ + Required: You must specify at least one IP range. +

+
+ + +
+ +
+ + + + + + + + + +
+ +
+ + + +
+ + +
+

+ + Required: You must specify at least one IP range. +

+
+ + +
+
\ No newline at end of file diff --git a/public/components/agg_types/controls/percentile_ranks.html b/public/components/agg_types/controls/percentile_ranks.html new file mode 100644 index 0000000..ad93a3f --- /dev/null +++ b/public/components/agg_types/controls/percentile_ranks.html @@ -0,0 +1,9 @@ +
+ + + +
diff --git a/public/components/agg_types/controls/percentiles.html b/public/components/agg_types/controls/percentiles.html new file mode 100644 index 0000000..f3cfe03 --- /dev/null +++ b/public/components/agg_types/controls/percentiles.html @@ -0,0 +1,9 @@ +
+ + + +
diff --git a/public/components/agg_types/controls/percents.html b/public/components/agg_types/controls/percents.html deleted file mode 100644 index ecc470f..0000000 --- a/public/components/agg_types/controls/percents.html +++ /dev/null @@ -1,29 +0,0 @@ -
- -
- - - - -
- - -

- You mush specify at least one percentile -

- - -
\ No newline at end of file diff --git a/public/components/agg_types/controls/precision.html b/public/components/agg_types/controls/precision.html index f13c28f..c72fef8 100644 --- a/public/components/agg_types/controls/precision.html +++ b/public/components/agg_types/controls/precision.html @@ -1,5 +1,5 @@ -
-
+
+
-
\ No newline at end of file +
+ +
+ +
+ diff --git a/public/components/agg_types/controls/ranges.html b/public/components/agg_types/controls/ranges.html index 037dae5..219ee79 100644 --- a/public/components/agg_types/controls/ranges.html +++ b/public/components/agg_types/controls/ranges.html @@ -1,4 +1,4 @@ - +
@@ -37,8 +37,16 @@
+ +
+

+ + Required: You must specify at least one range. +

+
+ +
\ No newline at end of file diff --git a/public/components/agg_types/controls/raw_json.html b/public/components/agg_types/controls/raw_json.html index 6229ba0..d27a1a4 100644 --- a/public/components/agg_types/controls/raw_json.html +++ b/public/components/agg_types/controls/raw_json.html @@ -3,7 +3,11 @@ -
Any JSON formatted properties you add here will be merged with the elasticsearch aggregation definition for this section. For example shard_size on a terms aggregation
+
+

+ Any JSON formatted properties you add here will be merged with the elasticsearch aggregation definition for this section. For example shard_size on a terms aggregation +

+

- \ No newline at end of file + diff --git a/public/components/doc_table/components/table_header.html b/public/components/doc_table/components/table_header.html index 9a0c1e0..9e552f7 100644 --- a/public/components/doc_table/components/table_header.html +++ b/public/components/doc_table/components/table_header.html @@ -1,13 +1,14 @@ - Time + Time - - {{name | shortDots}} + + {{name | shortDots}} - - + + + - \ No newline at end of file + diff --git a/public/components/doc_table/components/table_row/cell.html b/public/components/doc_table/components/table_row/cell.html index 6996438..55f1e17 100644 --- a/public/components/doc_table/components/table_row/cell.html +++ b/public/components/doc_table/components/table_row/cell.html @@ -1,3 +1,13 @@ -> +<% +var attributes = ''; +if (timefield) { + attributes='class="discover-table-timefield" width="1%"'; +} else if (sourcefield) { + attributes='class="discover-table-sourcefield"'; +} else { + attributes='class="discover-table-datafield"'; +} +%> +> <%= formatted %> - \ No newline at end of file + diff --git a/public/components/doc_table/components/table_row/details.html b/public/components/doc_table/components/table_row/details.html index e8be121..d83d868 100644 --- a/public/components/doc_table/components/table_row/details.html +++ b/public/components/doc_table/components/table_row/details.html @@ -2,5 +2,5 @@ Link to /{{row._index}}/{{row._type}}/{{row._id | uriescape}} - + \ No newline at end of file diff --git a/public/components/doc_table/doc_table.css b/public/components/doc_table/doc_table.css index 99cdf0c..be61f57 100644 --- a/public/components/doc_table/doc_table.css +++ b/public/components/doc_table/doc_table.css @@ -80,3 +80,17 @@ doc-table { -ms-flex: 1 1 100%; flex: 1 1 100%; } +doc-table .discover-table-datafield { + white-space: pre-wrap; +} +doc-table .loading { + opacity: 0.5; +} +doc-table .spinner { + position: absolute; + top: 40%; + left: 0; + right: 0; + z-index: 20; + opacity: 0.5; +} diff --git a/public/components/doc_table/doc_table.html b/public/components/doc_table/doc_table.html index 1e12d6d..81f8061 100644 --- a/public/components/doc_table/doc_table.html +++ b/public/components/doc_table/doc_table.html @@ -1,4 +1,7 @@ -
+
+
JSON -
-
+
+
- +
- - - + + + - + + + + - + - - - - +
-
{{hit | json}}
+
-
\ No newline at end of file + diff --git a/public/components/field_editor/field_editor.html b/public/components/field_editor/field_editor.html new file mode 100644 index 0000000..18e065a --- /dev/null +++ b/public/components/field_editor/field_editor.html @@ -0,0 +1,127 @@ +
+
+ + +
+
+

+ + Mapping Conflict: + You already have a field with the name {{ editor.field.name }}. Naming your scripted + field with the same name means you won't be able to query both fields at the same time. +

+
+ +
+ + +
+ +
+ + Warning + + + + +
+

+ Format Warning +

+ +

+ Formatting allows you to control the way that specific values are displayed. It can also cause values to be completely changed and prevent highlighting in Discover from working. +

+
+ + +
+
+
+ +
+ +
+ + + + + + + +
+
+ +
+
+ + +
+ +
+
+
+ +
+
+
+ +
+ +
+ + + +
+
diff --git a/public/components/field_editor/scripting_info.html b/public/components/field_editor/scripting_info.html new file mode 100644 index 0000000..0138c01 --- /dev/null +++ b/public/components/field_editor/scripting_info.html @@ -0,0 +1,32 @@ +

+ Scripting Help +

+ +

+ By default, Elasticsearch scripts use Lucene Expressions , which is a lot like JavaScript, but limited to basic arithmetic, bitwise and comparison operations. We'll let you do some reading on Lucene Expressions To access values in the document use the following format: +

+ +

doc['some_field'].value

+ +

+ There are a few limitations when using Lucene Expressions: +

+ + +

+ Here are all the operations available to scripted fields: +

+ diff --git a/public/components/field_editor/scripting_warning.html b/public/components/field_editor/scripting_warning.html new file mode 100644 index 0000000..c525c9e --- /dev/null +++ b/public/components/field_editor/scripting_warning.html @@ -0,0 +1,11 @@ +

+ Proceed with caution +

+ +

+ Please familiarize yourself with script fields and with scripts in aggregations before using scripted fields. +

+ +

+ Scripted fields can be used to display and aggregate calculated values. As such, they can be very slow, and if done incorrectly, can cause Kibana to be unusable. There's no safety net here. If you make a typo, unexpected exceptions will be thrown all over the place! +

diff --git a/public/components/field_format_editor/numeral/numeral.html b/public/components/field_format_editor/numeral/numeral.html new file mode 100644 index 0000000..b594c34 --- /dev/null +++ b/public/components/field_format_editor/numeral/numeral.html @@ -0,0 +1,21 @@ +
+ + + Docs + + + + +
+ + + + diff --git a/public/components/field_format_editor/pattern/pattern.html b/public/components/field_format_editor/pattern/pattern.html new file mode 100644 index 0000000..454f49e --- /dev/null +++ b/public/components/field_format_editor/pattern/pattern.html @@ -0,0 +1,11 @@ +
+ +
+ + + diff --git a/public/components/field_format_editor/samples/samples.html b/public/components/field_format_editor/samples/samples.html new file mode 100644 index 0000000..66e56b3 --- /dev/null +++ b/public/components/field_format_editor/samples/samples.html @@ -0,0 +1,32 @@ +
+

+ Format error +

+

+ An error occured while trying to use this format configuration. +

+
{{ error.message }}
+
+ +
+
+ + + + + + + + + + + + + + +
+ Input + + Formatted +
+
diff --git a/public/components/filter_bar/filter_bar.css b/public/components/filter_bar/filter_bar.css index 811d694..8bc6693 100644 --- a/public/components/filter_bar/filter_bar.css +++ b/public/components/filter_bar/filter_bar.css @@ -148,8 +148,8 @@ filter-bar .bar .filter:hover > .filter-description { overflow: hidden; } filter-bar .bar .filter > .filter-actions { - font-size: 1.3em; - line-height: 1.1em; + font-size: 1.1em; + line-height: 1.4em; position: absolute; padding: 4px 8px; top: 0; @@ -159,16 +159,23 @@ filter-bar .bar .filter > .filter-actions { text-align: center; white-space: nowrap; } -filter-bar .bar .filter > .filter-actions > .action { +filter-bar .bar .filter > .filter-actions > * { border-right: 1px solid rgba(255, 255, 255, 0.4); - padding-right: 6px; - margin-right: 8px; + padding-right: 0; + margin-right: 5px; } -filter-bar .bar .filter > .filter-actions > .action:last-child { +filter-bar .bar .filter > .filter-actions > *:last-child { border-right: 0; padding-right: 0; margin-right: 0; } +filter-bar .bar .filter > .filter-actions > * .unpinned { + zoom: 1; + filter: alpha(opacity=70); + -webkit-opacity: 0.7; + -moz-opacity: 0.7; + opacity: 0.7; +} filter-bar .bar .filter.negate { background-color: #c6675d; } diff --git a/public/components/filter_bar/filter_bar.html b/public/components/filter_bar/filter_bar.html index b5972d8..6154066 100644 --- a/public/components/filter_bar/filter_bar.html +++ b/public/components/filter_bar/filter_bar.html @@ -12,21 +12,25 @@
- + {{ filter.meta.key }}: "{{ filter.meta.value }}"
@@ -52,6 +56,12 @@ + + diff --git a/public/components/filter_bar/lib/remapFilters.js b/public/components/filter_bar/lib/remapFilters.js index 419d540..0cab9bf 100644 --- a/public/components/filter_bar/lib/remapFilters.js +++ b/public/components/filter_bar/lib/remapFilters.js @@ -1,5 +1,5 @@ define(['require'],function (require) { - + 'use strict'; /** * Remap the filter from the intermediary back to it's original. * @param {object} filter The original filter diff --git a/public/components/doc_table/components/table_row/_source.html b/public/components/index_patterns/_object.tmpl.html similarity index 80% rename from public/components/doc_table/components/table_row/_source.html rename to public/components/index_patterns/_object.tmpl.html index 0059031..86bfe8c 100644 --- a/public/components/doc_table/components/table_row/_source.html +++ b/public/components/index_patterns/_object.tmpl.html @@ -1,12 +1,12 @@
<% _.each(highlight, function (value, field) { /* show fields that match the query first */ %> -
<%= shortDotsFilter(field) %>:
+
<%- shortDotsFilter(field) %>:
<%= source[field] %>
<%= ' ' %> <% }); %> <% _.each(source, function (value, field) { %> <% if (_.has(highlight, field)) return; %> -
<%= shortDotsFilter(field) %>:
+
<%- shortDotsFilter(field) %>:
<%= value %>
<%= ' ' %> <% }); %> diff --git a/public/components/number_list/number_list.html b/public/components/number_list/number_list.html new file mode 100644 index 0000000..a7b32c7 --- /dev/null +++ b/public/components/number_list/number_list.html @@ -0,0 +1,34 @@ +
+ + + + + +
+ +

+ You must specify at least one {{numberListCntr.getUnitName()}} +

+ +

+ + Please specify at least one {{numberListCntr.getUnitName()}} +

+ + diff --git a/public/components/paginated_table/paginated_table.html b/public/components/paginated_table/paginated_table.html index 1deb49d..b8f6a32 100644 --- a/public/components/paginated_table/paginated_table.html +++ b/public/components/paginated_table/paginated_table.html @@ -22,7 +22,7 @@ 'fa-sort': paginatedTable.sort.columnIndex !== $index || paginatedTable.sort.direction === null }"> - + diff --git a/public/components/query_input/query_input.css b/public/components/query_input/query_input.css deleted file mode 100644 index 4e82452..0000000 --- a/public/components/query_input/query_input.css +++ /dev/null @@ -1,77 +0,0 @@ -.thumbnail > img, -.thumbnail a > img, -.carousel-inner > .item > img, -.carousel-inner > .item > a > img { - display: block; - max-width: 100%; - height: auto; -} -.btn-group-lg > .btn { - padding: 18px 27px; - font-size: 17px; - line-height: 1.33; - border-radius: 6px; -} -.btn-group-sm > .btn { - padding: 6px 9px; - font-size: 12px; - line-height: 1.5; - border-radius: 3px; -} -.btn-group-xs > .btn { - padding: 1px 5px; - font-size: 12px; - line-height: 1.5; - border-radius: 3px; -} -.container:before, -.container:after, -.container-fluid:before, -.container-fluid:after, -.row:before, -.row:after, -.form-horizontal .form-group:before, -.form-horizontal .form-group:after, -.btn-toolbar:before, -.btn-toolbar:after, -.btn-group-vertical > .btn-group:before, -.btn-group-vertical > .btn-group:after, -.nav:before, -.nav:after, -.navbar:before, -.navbar:after, -.navbar-header:before, -.navbar-header:after, -.navbar-collapse:before, -.navbar-collapse:after, -.pager:before, -.pager:after, -.panel-body:before, -.panel-body:after, -.modal-footer:before, -.modal-footer:after { - content: " "; - display: table; -} -.container:after, -.container-fluid:after, -.row:after, -.form-horizontal .form-group:after, -.btn-toolbar:after, -.btn-group-vertical > .btn-group:after, -.nav:after, -.navbar:after, -.navbar-header:after, -.navbar-collapse:after, -.pager:after, -.panel-body:after, -.modal-footer:after { - clear: both; -} -i.query-input-error { - position: absolute; - margin-left: -25px; - color: #e74c3c; - margin-top: 10px; - z-index: 5; -} diff --git a/public/components/stringify/editors/date.html b/public/components/stringify/editors/date.html new file mode 100644 index 0000000..731d4cf --- /dev/null +++ b/public/components/stringify/editors/date.html @@ -0,0 +1,20 @@ +
+ + + Docs + + + + + + + +
diff --git a/public/components/stringify/editors/string.html b/public/components/stringify/editors/string.html new file mode 100644 index 0000000..e68e2f5 --- /dev/null +++ b/public/components/stringify/editors/string.html @@ -0,0 +1,10 @@ +
+ + +
+ + diff --git a/public/components/stringify/editors/url.html b/public/components/stringify/editors/url.html new file mode 100644 index 0000000..b888440 --- /dev/null +++ b/public/components/stringify/editors/url.html @@ -0,0 +1,124 @@ +
+ + +
+ +
+ + Url Template Help + + + +
+

+ Url Template Help +

+ +

+ If a field only contains part of a url then a "Url Template" can be used to format the value as a complete url. The format is a string which uses double curly brace notation {­{ }­} to inject values. The following values can be accessed: +

+ +
    +
  • + value — The uri-escaped value +
  • +
  • + rawValue — The unescaped value +
  • +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
Examples
ValueTemplateResult
1234http://company.net/profiles?user_id={­{value}­}http://company.net/profiles?user_id=1234
users/adminhttp://company.net/groups?id={­{value}­}http://company.net/groups?id=users%2Fadmin
/images/favicon.icohttp://www.site.com{­{rawValue}­}http://www.site.com/images/favicon.ico
+
+ + +
+ +
+ + Label Template Help + + + +
+

+ Label Template Help +

+ +

+ If the url in this field is large, it might be useful to provide an alternate template for the text version of the url. This will be displayed instead of the url, but will still link to the url. The format is a string which uses double curly brace notation {­{ }­} to inject values. The following values can be accessed: +

+ +
    +
  • + value — The fields value +
  • +
  • + url — The formatted url +
  • +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Examples
ValueUrl TemplateLabel TemplateResult
1234http://company.net/profiles?user_id={­{value}­}User #{­{value}­} + User #1234 +
/assets/main.csshttp://site.com{­{rawValue}­}View Asset + View Asset +
+
+ + +
+ + diff --git a/public/components/stringify/icons/cv.png b/public/components/stringify/icons/cv.png new file mode 100644 index 0000000..8f2ff84 Binary files /dev/null and b/public/components/stringify/icons/cv.png differ diff --git a/public/components/stringify/icons/de.png b/public/components/stringify/icons/de.png new file mode 100644 index 0000000..7827911 Binary files /dev/null and b/public/components/stringify/icons/de.png differ diff --git a/public/components/stringify/icons/flag-icon.LICENSE b/public/components/stringify/icons/flag-icon.LICENSE new file mode 100644 index 0000000..1a86627 --- /dev/null +++ b/public/components/stringify/icons/flag-icon.LICENSE @@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright (c) 2014 Steven Skelton + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/public/components/stringify/icons/go.png b/public/components/stringify/icons/go.png new file mode 100644 index 0000000..34c317d Binary files /dev/null and b/public/components/stringify/icons/go.png differ diff --git a/public/components/stringify/icons/ne.png b/public/components/stringify/icons/ne.png new file mode 100644 index 0000000..d331209 Binary files /dev/null and b/public/components/stringify/icons/ne.png differ diff --git a/public/components/stringify/icons/ni.png b/public/components/stringify/icons/ni.png new file mode 100644 index 0000000..e5bdb0b Binary files /dev/null and b/public/components/stringify/icons/ni.png differ diff --git a/public/components/stringify/icons/stop.png b/public/components/stringify/icons/stop.png new file mode 100644 index 0000000..4bf65fc Binary files /dev/null and b/public/components/stringify/icons/stop.png differ diff --git a/public/components/stringify/icons/us.png b/public/components/stringify/icons/us.png new file mode 100644 index 0000000..f30f21f Binary files /dev/null and b/public/components/stringify/icons/us.png differ diff --git a/public/components/stringify/types/_source.html b/public/components/stringify/types/_source.html new file mode 100644 index 0000000..8cebbbe --- /dev/null +++ b/public/components/stringify/types/_source.html @@ -0,0 +1,7 @@ +
+ <% defPairs.forEach(function (def) { %> +
<%- def[0] %>:
+
<%= def[1] %>
+ <%= ' ' %> + <% }); %> +
diff --git a/public/components/timepicker/timepicker.html b/public/components/timepicker/timepicker.html index b9562a7..d87a5db 100644 --- a/public/components/timepicker/timepicker.html +++ b/public/components/timepicker/timepicker.html @@ -19,30 +19,21 @@ } - -
-
+

@@ -64,7 +55,7 @@
-
+

- - round to the {{units[relative.unit]}} +
@@ -165,11 +158,15 @@
-
+ diff --git a/public/components/vislib/styles/main.css b/public/components/vislib/styles/main.css index 7cf6728..473685d 100644 --- a/public/components/vislib/styles/main.css +++ b/public/components/vislib/styles/main.css @@ -177,7 +177,6 @@ -webkit-flex-direction: column; -ms-flex-direction: column; flex-direction: column; - width: 38px; min-height: 20px; min-width: 0; } @@ -371,7 +370,7 @@ -webkit-flex-direction: row; -ms-flex-direction: row; flex-direction: row; - min-height: 15px; + min-height: 20px; min-width: 0; } .x-axis-chart-title { @@ -405,14 +404,28 @@ .legend-col-wrapper { -webkit-box-flex: 0; -moz-box-flex: 0; - -webkit-flex: 0 1 auto; - -ms-flex: 0 1 auto; - flex: 0 1 auto; + -webkit-flex: 0 0 auto; + -ms-flex: 0 0 auto; + flex: 0 0 auto; + display: -webkit-box; + display: -moz-box; + display: -webkit-flex; + display: -ms-flexbox; + display: flex; + -webkit-box-direction: normal; + -moz-box-direction: normal; + -webkit-box-orient: vertical; + -moz-box-orient: vertical; + -webkit-flex-direction: column; + -ms-flex-direction: column; + flex-direction: column; z-index: 10; - overflow-x: hidden; - overflow-y: auto; min-height: 0; } +.legend-col-wrapper > * { + -webkit-flex-shrink: 0; + flex-shrink: 0; +} .legend-col-wrapper .legend-toggle { cursor: pointer; opacity: 0.75; @@ -430,21 +443,16 @@ text-align: right; } .legend-col-wrapper .legend-ul { + -webkit-box-flex: 1; + -moz-box-flex: 1; + -webkit-flex: 1 1 1px; + -ms-flex: 1 1 1px; + flex: 1 1 1px; + overflow-x: hidden; + overflow-y: auto; list-style-type: none; padding: 0; visibility: visible; - display: -webkit-box; - display: -moz-box; - display: -webkit-flex; - display: -ms-flexbox; - display: flex; - -webkit-box-direction: normal; - -moz-box-direction: normal; - -webkit-box-orient: vertical; - -moz-box-orient: vertical; - -webkit-flex-direction: column; - -ms-flex-direction: column; - flex-direction: column; min-height: 0; min-width: 60px; margin-right: 5px; @@ -457,8 +465,6 @@ color: #666; cursor: default; text-align: left; - -webkit-flex-grow: 2; - flex-grow: 2; white-space: nowrap; overflow-x: hidden; text-overflow: ellipsis; @@ -690,17 +696,45 @@ circle:hover { } .leaflet-popup { margin-bottom: 16px !important; + pointer-events: none; } .leaflet-popup-content-wrapper { - background: rgba(70, 82, 93, 0.95) !important; - color: #ecf0f1 !important; + background: rgba(0, 0, 0, 0.9) !important; + color: #ffffff !important; border-radius: 4px !important; padding: 0 !important; } .leaflet-popup-content { - padding: 8px !important; margin: 0 !important; - line-height: 14px !important; + line-height: 1.1 !important; + font-size: 12px; + font-weight: normal; + word-wrap: break-word; + overflow: hidden; + pointer-events: none; +} +.leaflet-popup-content > :last-child { + margin-bottom: 8px; +} +.leaflet-popup-content > * { + margin: 8px 8px 0; +} +.leaflet-popup-content table td, +.leaflet-popup-content table th { + padding: 4px; +} +.leaflet-popup-content table td.row-bucket, +.leaflet-popup-content table th.row-bucket { + word-break: break-all; +} +.leaflet-popup-content table thead tr { + border-bottom: 1px solid #95a5a6; +} +.leaflet-popup-content table tbody tr { + border-top: 1px solid #95a5a6; +} +.leaflet-popup-content table tbody tr:first-child { + border-top: none; } .leaflet-popup-tip-container, .leaflet-popup-close-button { @@ -717,6 +751,9 @@ circle:hover { margin: 0 !important; padding: 0 !important; } +.leaflet-draw-tooltip { + display: none; +} /* filter to desaturate mapquest tiles */ img.leaflet-tile { -webkit-filter: brightness(1.03) grayscale(0.83) contrast(1.07); diff --git a/public/components/visualize/spy/_table.html b/public/components/visualize/spy/_table.html index 76960e2..2a70eac 100644 --- a/public/components/visualize/spy/_table.html +++ b/public/components/visualize/spy/_table.html @@ -1 +1 @@ - \ No newline at end of file + diff --git a/public/components/visualize/visualize.css b/public/components/visualize/visualize.css index 933d082..98aa1a2 100644 --- a/public/components/visualize/visualize.css +++ b/public/components/visualize/visualize.css @@ -106,6 +106,17 @@ visualize .visualize-chart.spy-visible { visualize .visualize-chart.spy-only { display: none; } +visualize .loading { + opacity: 0.5; +} +visualize .spinner { + position: absolute; + top: 40%; + left: 0; + right: 0; + z-index: 20; + opacity: 0.5; +} .visualize-error { display: -webkit-box; display: -moz-box; @@ -188,6 +199,9 @@ visualize-spy .visualize-show-spy-tab { background: #ffffff; text-align: center; } +visualize-spy .visualize-show-spy-tab:hover { + background-color: #ecf0f1; +} visualize-spy .visualize-show-spy i { padding: 0 10px; } diff --git a/public/components/visualize/visualize.html b/public/components/visualize/visualize.html index b3c9b29..70fcf03 100644 --- a/public/components/visualize/visualize.html +++ b/public/components/visualize/visualize.html @@ -1,12 +1,15 @@ +
-

+

No results found

-
+
\ No newline at end of file diff --git a/public/directives/validate_ip.js b/public/directives/validate_ip.js deleted file mode 100644 index 4e33e5f..0000000 --- a/public/directives/validate_ip.js +++ /dev/null @@ -1,46 +0,0 @@ -define(['require','lodash','modules'],function (require) { - var _ = require('lodash'); - - require('modules') - .get('kibana') - .directive('validateIp', function () { - return { - restrict: 'A', - require: 'ngModel', - scope: { - 'ngModel': '=', - }, - link: function ($scope, elem, attr, ngModel) { - - var isIP = function (value) { - if (!value) return false; - var parts = value.match(/([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)/); - - var valid = true; - if (parts) { - _.each(parts.slice(1, 5), function (octet) { - if (octet > 255 || octet < 0) valid = false; - }); - } else { - valid = false; - } - return valid; - }; - - // From User - ngModel.$parsers.unshift(function (value) { - var valid = isIP(value); - ngModel.$setValidity('ipInput', valid); - return valid ? value : undefined; - }); - - // To user - ngModel.$formatters.unshift(function (value) { - ngModel.$setValidity('ipInput', isIP(value)); - return value; - }); - - } - }; - }); -}); \ No newline at end of file diff --git a/public/index.html b/public/index.html index 4213eac..8dafafb 100644 --- a/public/index.html +++ b/public/index.html @@ -7,31 +7,29 @@ Kibana 4 - + -
- + - - + +