mirror of
https://github.com/apache/zeppelin
synced 2026-05-24 09:38:26 +00:00
### What is this PR for? eslint ruleset is NOT applied at all due to invalid `.eslintrc`. This PR includes - fixes which are automatically done by eslint (`eslint --fix src`) - modification in `.eslintrc`, `package.json` - while removing eslint conf in `gruntfile.js` As a result of this PR, we can have more strict and modernized rulesets which can help us to prevent bugs. ### What type of PR is it? [Improvement] ### Todos * [x] - Setup rules * [x] - Remove grunt eslint config * [x] - Ignore useless rules * [x] - Fix code for applied rules ### What is the Jira issue? [ZEPPELIN-1940](https://issues.apache.org/jira/browse/ZEPPELIN-1940) ### How should this be tested? - `cd zeppelin-web` - `npm install` (or `yarn install` if you have yarn) - `npm run lint:once` ### Screenshots (if appropriate) ### Questions: * Does the licenses files need update? - NO * Is there breaking changes for older versions? - NO * Does this needs documentation? - NO Author: 1ambda <[email protected]> Closes #2252 from 1ambda/ZEPPELIN-1940/apply-lint-rule-set and squashes the following commits:d3e6c0a[1ambda] fix: eslint errors for #2245013d7ca[1ambda] fix: eslint errors for #22446feb158[1ambda] fix: eslint errors for #213302545c7[1ambda] fix: eslint for #2203, #22484ab8a39[1ambda] fix: eslint errors for #2228cc874d2[1ambda] fix: semid4a8082[1ambda] fix: lint for src/app/tabledata/advanced-4d991a2[1ambda] fix: ignore array-bracket-spacingd69113a[1ambda] fix: ignore space-before-function-paren526dbeb[1ambda] fix: no-var3fd91fe[1ambda] fix: no-redeclarea5947da[1ambda] fix: prefer-spreada20d20e[1ambda] fix: prefer-rest-paramse3f9641[1ambda] fix: no-unused-expressionsbd981d7[1ambda] fix: ignore no-unneeded-ternaryc52b095[1ambda] fix: no-useless-constructor83d6789[1ambda] fix: no-eval7a740b5[1ambda] fix: ignore comma-dangle7d3b393[1ambda] fix: ignore standard/object-curly-even-spacinga3f1264[1ambda] fix: padded-blocks5d19c6f[1ambda] fix: space-infix-opseac6b43[1ambda] fix: no-extra-semibfd7984[1ambda] fix: ignore arrow-parens3c91566[1ambda] fix: ignore object-curly-spacing6e44e96[1ambda] fix: space-before-function-paren59c3996[1ambda] fix: indent40125e9[1ambda] fix: no-multiple-empty-lines3a6626f[1ambda] fix: no-trailing-spacesca94341[1ambda] fix: spaced-commentd65c47b[1ambda] fix: comma-spacing9150539[1ambda] fix: operator-linebreak925dc7b[1ambda] fix: block-spacing021f9e7[1ambda] fix: space-before-blocksa896442[1ambda] fix: keyword-spacing5948d97[1ambda] fix: space-in-parensb094fff[1ambda] fix: no-empty131c901[1ambda] fix: no-multi-spaces1de9a8d[1ambda] fix: one-var7aa4b1a[1ambda] fix: brace-stylecde8a2d[1ambda] fix: dot-locationd62af8d[1ambda] fix: object-property-newline70cb63b[1ambda] fix: no-extra-boolean-casta5c7842[1ambda] fix: semi-spacing3abfc7c[1ambda] fix: no-mixed-spaces-and-tabs8d5a3d9[1ambda] fix: yoda4b36afb[1ambda] fix: ignore all rules7840ca5[1ambda] fix: Set ignored, warn lint rules5566911[1ambda] fix: Remove invalid visdev4baadbb[1ambda] fix: Use eslint instead of grunt-eslint
87 lines
2.6 KiB
JavaScript
87 lines
2.6 KiB
JavaScript
/*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
|
|
angular.module('zeppelinWebApp').controller('NotebookReposCtrl', NotebookReposCtrl)
|
|
|
|
function NotebookReposCtrl ($http, baseUrlSrv, ngToast) {
|
|
'ngInject'
|
|
|
|
let vm = this
|
|
vm.notebookRepos = []
|
|
vm.showDropdownSelected = showDropdownSelected
|
|
vm.saveNotebookRepo = saveNotebookRepo
|
|
|
|
_init()
|
|
|
|
// Public functions
|
|
|
|
function saveNotebookRepo (valueform, repo, data) {
|
|
console.log('data %o', data)
|
|
$http.put(baseUrlSrv.getRestApiBase() + '/notebook-repositories', {
|
|
'name': repo.className,
|
|
'settings': data
|
|
}).success(function (data) {
|
|
let index = _.findIndex(vm.notebookRepos, {'className': repo.className})
|
|
if (index >= 0) {
|
|
vm.notebookRepos[index] = data.body
|
|
console.log('repos %o, data %o', vm.notebookRepos, data.body)
|
|
}
|
|
valueform.$show()
|
|
}).error(function () {
|
|
ngToast.danger({
|
|
content: 'We couldn\'t save that NotebookRepo\'s settings',
|
|
verticalPosition: 'bottom',
|
|
timeout: '3000'
|
|
})
|
|
valueform.$show()
|
|
})
|
|
|
|
return 'manual'
|
|
}
|
|
|
|
function showDropdownSelected (setting) {
|
|
let index = _.findIndex(setting.value, {'value': setting.selected})
|
|
if (index < 0) {
|
|
return 'No value'
|
|
} else {
|
|
return setting.value[index].name
|
|
}
|
|
}
|
|
|
|
// Private functions
|
|
|
|
function _getInterpreterSettings () {
|
|
$http.get(baseUrlSrv.getRestApiBase() + '/notebook-repositories')
|
|
.success(function (data, status, headers, config) {
|
|
vm.notebookRepos = data.body
|
|
console.log('ya notebookRepos %o', vm.notebookRepos)
|
|
}).error(function (data, status, headers, config) {
|
|
if (status === 401) {
|
|
ngToast.danger({
|
|
content: 'You don\'t have permission on this page',
|
|
verticalPosition: 'bottom',
|
|
timeout: '3000'
|
|
})
|
|
setTimeout(function () {
|
|
window.location.replace('/')
|
|
}, 3000)
|
|
}
|
|
console.log('Error %o %o', status, data.message)
|
|
})
|
|
}
|
|
|
|
function _init () {
|
|
_getInterpreterSettings()
|
|
}
|
|
}
|