From 4064ea3d8241568ccc7a1cf556bd8eeb0e92c5e9 Mon Sep 17 00:00:00 2001 From: Grégoire Aubert Date: Fri, 20 Oct 2017 14:41:27 +0200 Subject: Remove old updatecenter ui --- .../js/app/components/nav/settings/SettingsNav.tsx | 24 +-- .../__snapshots__/SettingsNav-test.tsx.snap | 37 +--- .../src/main/js/app/utils/startReactApp.js | 7 - .../marketplace/components/PluginChangeLogItem.tsx | 2 +- .../components/UpdateCenterAppContainer.js | 54 ----- .../src/main/js/apps/update-center/controller.js | 47 ----- .../src/main/js/apps/update-center/footer-view.js | 36 ---- .../src/main/js/apps/update-center/header-view.js | 52 ----- .../src/main/js/apps/update-center/init.js | 87 -------- .../src/main/js/apps/update-center/layout.js | 32 --- .../main/js/apps/update-center/list-item-view.js | 118 ----------- .../src/main/js/apps/update-center/list-view.js | 26 --- .../js/apps/update-center/plugin-changelog-view.js | 45 ---- .../src/main/js/apps/update-center/plugin.js | 87 -------- .../src/main/js/apps/update-center/plugins.js | 233 --------------------- .../src/main/js/apps/update-center/router.js | 54 ----- .../src/main/js/apps/update-center/routes.ts | 56 ----- .../src/main/js/apps/update-center/search-view.js | 104 --------- .../templates/_update-center-plugin-actions.hbs | 29 --- .../_update-center-plugin-changelog-entry.hbs | 13 -- .../templates/update-center-footer.hbs | 3 - .../templates/update-center-header.hbs | 36 ---- .../templates/update-center-layout.hbs | 6 - .../templates/update-center-plugin-changelog.hbs | 16 -- .../templates/update-center-plugin.hbs | 122 ----------- .../templates/update-center-search.hbs | 47 ----- .../templates/update-center-system-update.hbs | 58 ----- 27 files changed, 11 insertions(+), 1420 deletions(-) delete mode 100644 server/sonar-web/src/main/js/apps/update-center/components/UpdateCenterAppContainer.js delete mode 100644 server/sonar-web/src/main/js/apps/update-center/controller.js delete mode 100644 server/sonar-web/src/main/js/apps/update-center/footer-view.js delete mode 100644 server/sonar-web/src/main/js/apps/update-center/header-view.js delete mode 100644 server/sonar-web/src/main/js/apps/update-center/init.js delete mode 100644 server/sonar-web/src/main/js/apps/update-center/layout.js delete mode 100644 server/sonar-web/src/main/js/apps/update-center/list-item-view.js delete mode 100644 server/sonar-web/src/main/js/apps/update-center/list-view.js delete mode 100644 server/sonar-web/src/main/js/apps/update-center/plugin-changelog-view.js delete mode 100644 server/sonar-web/src/main/js/apps/update-center/plugin.js delete mode 100644 server/sonar-web/src/main/js/apps/update-center/plugins.js delete mode 100644 server/sonar-web/src/main/js/apps/update-center/router.js delete mode 100644 server/sonar-web/src/main/js/apps/update-center/routes.ts delete mode 100644 server/sonar-web/src/main/js/apps/update-center/search-view.js delete mode 100644 server/sonar-web/src/main/js/apps/update-center/templates/_update-center-plugin-actions.hbs delete mode 100644 server/sonar-web/src/main/js/apps/update-center/templates/_update-center-plugin-changelog-entry.hbs delete mode 100644 server/sonar-web/src/main/js/apps/update-center/templates/update-center-footer.hbs delete mode 100644 server/sonar-web/src/main/js/apps/update-center/templates/update-center-header.hbs delete mode 100644 server/sonar-web/src/main/js/apps/update-center/templates/update-center-layout.hbs delete mode 100644 server/sonar-web/src/main/js/apps/update-center/templates/update-center-plugin-changelog.hbs delete mode 100644 server/sonar-web/src/main/js/apps/update-center/templates/update-center-plugin.hbs delete mode 100644 server/sonar-web/src/main/js/apps/update-center/templates/update-center-search.hbs delete mode 100644 server/sonar-web/src/main/js/apps/update-center/templates/update-center-system-update.hbs (limited to 'server/sonar-web/src/main') diff --git a/server/sonar-web/src/main/js/app/components/nav/settings/SettingsNav.tsx b/server/sonar-web/src/main/js/app/components/nav/settings/SettingsNav.tsx index 34dc8b4f72c..49bb352fb63 100644 --- a/server/sonar-web/src/main/js/app/components/nav/settings/SettingsNav.tsx +++ b/server/sonar-web/src/main/js/app/components/nav/settings/SettingsNav.tsx @@ -57,7 +57,7 @@ export default class SettingsNav extends React.PureComponent { } isSystemActive() { - const urls = ['/admin/update_center', '/admin/system']; + const urls = ['/admin/system']; return this.isSomethingActive(urls); } @@ -85,7 +85,6 @@ export default class SettingsNav extends React.PureComponent { const securityClassName = classNames('dropdown-toggle', { active: isSecurity }); const projectsClassName = classNames('dropdown-toggle', { active: isProjects }); - const systemClassName = classNames('dropdown-toggle', { active: isSystem }); const configurationClassNames = classNames('dropdown-toggle', { active: !isSecurity && !isProjects && !isSystem && !isSupport && !this.isMarketplace() }); @@ -184,23 +183,10 @@ export default class SettingsNav extends React.PureComponent { - -
  • - - {translate('sidebar.system')} - -
      -
    • - - {translate('update_center.page')} - -
    • -
    • - - {translate('system_info.page')} - -
    • -
    +
  • + + {translate('sidebar.system')} +
  • diff --git a/server/sonar-web/src/main/js/app/components/nav/settings/__tests__/__snapshots__/SettingsNav-test.tsx.snap b/server/sonar-web/src/main/js/app/components/nav/settings/__tests__/__snapshots__/SettingsNav-test.tsx.snap index 62c113f24bb..bded1f0a092 100644 --- a/server/sonar-web/src/main/js/app/components/nav/settings/__tests__/__snapshots__/SettingsNav-test.tsx.snap +++ b/server/sonar-web/src/main/js/app/components/nav/settings/__tests__/__snapshots__/SettingsNav-test.tsx.snap @@ -153,40 +153,13 @@ exports[`should work with extensions 1`] = `
  • -
  • - + sidebar.system - - - -
      -
    • - - update_center.page - -
    • -
    • - - system_info.page - -
    • -
    +
  • { - - - - - @@ -227,7 +221,6 @@ const startReactApp = () => { - diff --git a/server/sonar-web/src/main/js/apps/marketplace/components/PluginChangeLogItem.tsx b/server/sonar-web/src/main/js/apps/marketplace/components/PluginChangeLogItem.tsx index 5093609838c..e3b927807cb 100644 --- a/server/sonar-web/src/main/js/apps/marketplace/components/PluginChangeLogItem.tsx +++ b/server/sonar-web/src/main/js/apps/marketplace/components/PluginChangeLogItem.tsx @@ -48,7 +48,7 @@ export default function PluginChangeLogItem({ release, update }: Props) { {release.changeLogUrl && ( - {translate('update_center.release_notes')} + {translate('marketplace.release_notes')} )} diff --git a/server/sonar-web/src/main/js/apps/update-center/components/UpdateCenterAppContainer.js b/server/sonar-web/src/main/js/apps/update-center/components/UpdateCenterAppContainer.js deleted file mode 100644 index 454396e0a87..00000000000 --- a/server/sonar-web/src/main/js/apps/update-center/components/UpdateCenterAppContainer.js +++ /dev/null @@ -1,54 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2017 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -import React from 'react'; -import Helmet from 'react-helmet'; -import { connect } from 'react-redux'; -import init from '../init'; -import { getGlobalSettingValue } from '../../../store/rootReducer'; -import { translate } from '../../../helpers/l10n'; - -class UpdateCenterAppContainer extends React.PureComponent { - componentDidMount() { - this.stop = init(this.refs.container, this.props.updateCenterActive); - } - - componentWillUnmount() { - this.stop(); - } - - render() { - // placing container inside div is required, - // because when backbone.marionette's layout is destroyed, - // it also destroys the root element, - // but react wants it to be there to unmount it - return ( -
    - -
    -
    - ); - } -} - -const mapStateToProps = state => ({ - updateCenterActive: (getGlobalSettingValue(state, 'sonar.updatecenter.activate') || {}).value -}); - -export default connect(mapStateToProps)(UpdateCenterAppContainer); diff --git a/server/sonar-web/src/main/js/apps/update-center/controller.js b/server/sonar-web/src/main/js/apps/update-center/controller.js deleted file mode 100644 index 79a2d133b76..00000000000 --- a/server/sonar-web/src/main/js/apps/update-center/controller.js +++ /dev/null @@ -1,47 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2017 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -import Marionette from 'backbone.marionette'; - -export default Marionette.Controller.extend({ - initialize(options) { - this.collection = options.collection; - this.state = options.state; - }, - - showInstalled() { - this.state.set({ section: 'installed' }); - this.collection.fetchInstalled(); - }, - - showUpdates() { - this.state.set({ section: 'updates' }); - this.collection.fetchUpdates(); - }, - - showAvailable() { - this.state.set({ section: 'available' }); - this.collection.fetchAvailable(); - }, - - showSystemUpgrades() { - this.state.set({ section: 'system' }); - this.collection.fetchSystemUpgrades(); - } -}); diff --git a/server/sonar-web/src/main/js/apps/update-center/footer-view.js b/server/sonar-web/src/main/js/apps/update-center/footer-view.js deleted file mode 100644 index aa4a117cc06..00000000000 --- a/server/sonar-web/src/main/js/apps/update-center/footer-view.js +++ /dev/null @@ -1,36 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2017 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -import Marionette from 'backbone.marionette'; -import Template from './templates/update-center-footer.hbs'; - -export default Marionette.ItemView.extend({ - template: Template, - - collectionEvents: { - all: 'render' - }, - - serializeData() { - return { - ...Marionette.ItemView.prototype.serializeData.apply(this, arguments), - total: this.collection.where({ _hidden: false }).length - }; - } -}); diff --git a/server/sonar-web/src/main/js/apps/update-center/header-view.js b/server/sonar-web/src/main/js/apps/update-center/header-view.js deleted file mode 100644 index cc0ac80a8c1..00000000000 --- a/server/sonar-web/src/main/js/apps/update-center/header-view.js +++ /dev/null @@ -1,52 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2017 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -import Marionette from 'backbone.marionette'; -import Template from './templates/update-center-header.hbs'; -import RestartModal from '../../components/RestartModal'; - -export default Marionette.ItemView.extend({ - template: Template, - - collectionEvents: { - all: 'render' - }, - - events: { - 'click .js-restart': 'restart', - 'click .js-cancel-all': 'cancelAll' - }, - - restart() { - new RestartModal().render(); - }, - - cancelAll() { - this.collection.cancelAll(); - }, - - serializeData() { - return { - ...Marionette.ItemView.prototype.serializeData.apply(this, arguments), - installing: this.collection._installedCount, - updating: this.collection._updatedCount, - uninstalling: this.collection._uninstalledCount - }; - } -}); diff --git a/server/sonar-web/src/main/js/apps/update-center/init.js b/server/sonar-web/src/main/js/apps/update-center/init.js deleted file mode 100644 index 36595131ccb..00000000000 --- a/server/sonar-web/src/main/js/apps/update-center/init.js +++ /dev/null @@ -1,87 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2017 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -import Backbone from 'backbone'; -import Marionette from 'backbone.marionette'; -import Layout from './layout'; -import HeaderView from './header-view'; -import SearchView from './search-view'; -import ListView from './list-view'; -import FooterView from './footer-view'; -import Controller from './controller'; -import Router from './router'; -import Plugins from './plugins'; - -const App = new Marionette.Application(); - -const init = function({ el, updateCenterActive }) { - // State - this.state = new Backbone.Model({ updateCenterActive }); - - // Layout - this.layout = new Layout({ el }); - this.layout.render(); - - // Plugins - this.plugins = new Plugins(); - - // Controller - this.controller = new Controller({ collection: this.plugins, state: this.state }); - - // Router - this.router = new Router({ controller: this.controller }); - - // Header - this.headerView = new HeaderView({ collection: this.plugins }); - this.layout.headerRegion.show(this.headerView); - - // Search - this.searchView = new SearchView({ - collection: this.plugins, - router: this.router, - state: this.state - }); - this.layout.searchRegion.show(this.searchView); - this.searchView.focusSearch(); - - // List - this.listView = new ListView({ collection: this.plugins }); - this.layout.listRegion.show(this.listView); - - // Footer - this.footerView = new FooterView({ collection: this.plugins }); - this.layout.footerRegion.show(this.footerView); - - // Go - Backbone.history.start({ - pushState: true, - root: window.baseUrl + '/admin/update_center' - }); -}; - -App.on('start', options => init.call(App, options)); - -export default function(el, updateCenterActive) { - App.start({ el, updateCenterActive }); - - return () => { - Backbone.history.stop(); - App.layout.destroy(); - }; -} diff --git a/server/sonar-web/src/main/js/apps/update-center/layout.js b/server/sonar-web/src/main/js/apps/update-center/layout.js deleted file mode 100644 index 329ce8499c6..00000000000 --- a/server/sonar-web/src/main/js/apps/update-center/layout.js +++ /dev/null @@ -1,32 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2017 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -import Marionette from 'backbone.marionette'; -import Template from './templates/update-center-layout.hbs'; - -export default Marionette.LayoutView.extend({ - template: Template, - - regions: { - headerRegion: '#update-center-header', - searchRegion: '#update-center-search', - listRegion: '#update-center-plugins', - footerRegion: '#update-center-footer' - } -}); diff --git a/server/sonar-web/src/main/js/apps/update-center/list-item-view.js b/server/sonar-web/src/main/js/apps/update-center/list-item-view.js deleted file mode 100644 index 30802397395..00000000000 --- a/server/sonar-web/src/main/js/apps/update-center/list-item-view.js +++ /dev/null @@ -1,118 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2017 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -import $ from 'jquery'; -import Backbone from 'backbone'; -import Marionette from 'backbone.marionette'; -import PluginChangelogView from './plugin-changelog-view'; -import Template from './templates/update-center-plugin.hbs'; -import SystemTemplate from './templates/update-center-system-update.hbs'; - -export default Marionette.ItemView.extend({ - tagName: 'li', - className: 'panel panel-vertical', - template: Template, - systemTemplate: SystemTemplate, - - modelEvents: { - 'change:_hidden': 'toggleDisplay', - change: 'onModelChange', - request: 'onRequest' - }, - - events: { - 'click .js-changelog': 'onChangelogClick', - 'click .js-install': 'install', - 'click .js-update': 'update', - 'click .js-uninstall': 'uninstall', - 'change .js-terms': 'onTermsChange', - 'click .js-plugin-category': 'onCategoryClick' - }, - - getTemplate() { - return this.model.get('_system') ? this.systemTemplate : this.template; - }, - - onRender() { - this.$el.attr('data-id', this.model.id); - if (this.model.get('_system')) { - this.$el.attr('data-system', ''); - } - this.$('[data-toggle="tooltip"]').tooltip({ container: 'body', placement: 'bottom' }); - }, - - onDestroy() { - this.$('[data-toggle="tooltip"]').tooltip('destroy'); - }, - - onModelChange() { - if (!this.model.hasChanged('_hidden')) { - this.render(); - } - }, - - onChangelogClick(e) { - e.preventDefault(); - e.stopPropagation(); - $('body').click(); - const index = $(e.currentTarget).data('idx'); - - // if show changelog of update, show details of this update - // otherwise show changelog of the available release - const update = this.model.has('release') - ? this.model.toJSON() - : this.model.get('updates')[index]; - const popup = new PluginChangelogView({ - triggerEl: $(e.currentTarget), - model: new Backbone.Model(update) - }); - popup.render(); - }, - - onRequest() { - this.$('.js-actions').addClass('hidden'); - this.$('.js-spinner').removeClass('hidden'); - }, - - toggleDisplay() { - this.$el.toggleClass('hidden', this.model.get('_hidden')); - }, - - install() { - this.model.install(); - }, - - update() { - this.model.update(); - }, - - uninstall() { - this.model.uninstall(); - }, - - onTermsChange() { - const isAccepted = this.$('.js-terms').is(':checked'); - this.$('.js-install').prop('disabled', !isAccepted); - }, - - onCategoryClick(e) { - e.preventDefault(); - this.model.trigger('filter', this.model); - } -}); diff --git a/server/sonar-web/src/main/js/apps/update-center/list-view.js b/server/sonar-web/src/main/js/apps/update-center/list-view.js deleted file mode 100644 index 3746db3f037..00000000000 --- a/server/sonar-web/src/main/js/apps/update-center/list-view.js +++ /dev/null @@ -1,26 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2017 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -import Marionette from 'backbone.marionette'; -import ListItemView from './list-item-view'; - -export default Marionette.CollectionView.extend({ - tagName: 'ul', - childView: ListItemView -}); diff --git a/server/sonar-web/src/main/js/apps/update-center/plugin-changelog-view.js b/server/sonar-web/src/main/js/apps/update-center/plugin-changelog-view.js deleted file mode 100644 index e28db827b42..00000000000 --- a/server/sonar-web/src/main/js/apps/update-center/plugin-changelog-view.js +++ /dev/null @@ -1,45 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2017 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -import Popup from '../../components/common/popup'; -import Template from './templates/update-center-plugin-changelog.hbs'; - -export default Popup.extend({ - template: Template, - - onRender() { - Popup.prototype.onRender.apply(this, arguments); - this.$('.bubble-popup-container').isolatedScroll(); - this.$('[data-toggle="tooltip"]').tooltip({ container: 'body', placement: 'bottom' }); - }, - - onDestroy() { - Popup.prototype.onDestroy.apply(this, arguments); - this.$('[data-toggle="tooltip"]').tooltip('destroy'); - }, - - serializeData() { - return { - ...Popup.prototype.serializeData.apply(this, arguments), - // if there is no status, this is a new plugin - // => force COMPATIBLE status - status: this.model.get('status') || 'COMPATIBLE' - }; - } -}); diff --git a/server/sonar-web/src/main/js/apps/update-center/plugin.js b/server/sonar-web/src/main/js/apps/update-center/plugin.js deleted file mode 100644 index 3bbfe655277..00000000000 --- a/server/sonar-web/src/main/js/apps/update-center/plugin.js +++ /dev/null @@ -1,87 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2017 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -import Backbone from 'backbone'; - -export default Backbone.Model.extend({ - idAttribute: 'key', - - defaults: { - _hidden: false, - _system: false - }, - - _matchAttribute(attr, query) { - const value = this.get(attr) || ''; - return value.toLowerCase().includes(query.toLowerCase()); - }, - - match(query) { - return ( - this._matchAttribute('name', query) || - this._matchAttribute('category', query) || - this._matchAttribute('description', query) - ); - }, - - _action(options) { - const that = this; - const opts = { - ...options, - type: 'POST', - data: { key: this.id }, - success() { - options.success(that); - }, - error(jqXHR) { - that.set({ _status: 'failed', _errors: jqXHR.responseJSON.errors }); - } - }; - const xhr = Backbone.ajax(opts); - this.trigger('request', this, xhr); - return xhr; - }, - - install() { - return this._action({ - url: window.baseUrl + '/api/plugins/install', - success(model) { - model.set({ _status: 'installing' }); - } - }); - }, - - update() { - return this._action({ - url: window.baseUrl + '/api/plugins/update', - success(model) { - model.set({ _status: 'updating' }); - } - }); - }, - - uninstall() { - return this._action({ - url: window.baseUrl + '/api/plugins/uninstall', - success(model) { - model.set({ _status: 'uninstalling' }); - } - }); - } -}); diff --git a/server/sonar-web/src/main/js/apps/update-center/plugins.js b/server/sonar-web/src/main/js/apps/update-center/plugins.js deleted file mode 100644 index 7389bc4179d..00000000000 --- a/server/sonar-web/src/main/js/apps/update-center/plugins.js +++ /dev/null @@ -1,233 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2017 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -import $ from 'jquery'; -import { findLastIndex } from 'lodash'; -import Backbone from 'backbone'; -import Plugin from './plugin'; - -const Plugins = Backbone.Collection.extend({ - model: Plugin, - - comparator(model) { - return model.get('name') || ''; - }, - - initialize() { - this._installedCount = 0; - this._updatedCount = 0; - this._uninstalledCount = 0; - this.listenTo(this, 'change:_status', this.onStatusChange); - }, - - parse(r) { - const that = this; - return r.plugins.map(plugin => { - let updates = [ - that._getLastWithStatus(plugin.updates, 'COMPATIBLE'), - that._getLastWithStatus(plugin.updates, 'REQUIRES_SYSTEM_UPGRADE'), - that._getLastWithStatus(plugin.updates, 'DEPS_REQUIRE_SYSTEM_UPGRADE') - ].filter(update => update); - updates = updates.map(update => that._extendChangelog(plugin.updates, update)); - return { ...plugin, updates }; - }); - }, - - _getLastWithStatus(updates, status) { - const index = findLastIndex(updates, update => update.status === status); - return index !== -1 ? updates[index] : null; - }, - - _extendChangelog(updates, update) { - const index = updates.indexOf(update); - const previousUpdates = index > 0 ? updates.slice(0, index) : []; - return { ...update, previousUpdates }; - }, - - _fetchInstalled() { - if (this._installed) { - return $.Deferred() - .resolve() - .promise(); - } - const that = this; - const opts = { - type: 'GET', - url: window.baseUrl + '/api/plugins/installed?f=category', - success(r) { - that._installed = that.parse(r); - } - }; - return Backbone.ajax(opts); - }, - - _fetchUpdates() { - if (this._updates) { - return $.Deferred() - .resolve() - .promise(); - } - const that = this; - const opts = { - type: 'GET', - url: window.baseUrl + '/api/plugins/updates', - success(r) { - that._updates = that.parse(r); - } - }; - return Backbone.ajax(opts); - }, - - _fetchAvailable() { - if (this._available) { - return $.Deferred() - .resolve() - .promise(); - } - const that = this; - const opts = { - type: 'GET', - url: window.baseUrl + '/api/plugins/available', - success(r) { - that._available = that.parse(r); - } - }; - return Backbone.ajax(opts); - }, - - _fetchPending() { - const that = this; - const opts = { - type: 'GET', - url: window.baseUrl + '/api/plugins/pending', - success(r) { - const installing = r.installing.map(plugin => { - return { key: plugin.key, _status: 'installing' }; - }); - const updating = r.updating.map(plugin => { - return { key: plugin.key, _status: 'updating' }; - }); - const uninstalling = r.removing.map(plugin => { - return { key: plugin.key, _status: 'uninstalling' }; - }); - that._installedCount = installing.length; - that._updatedCount = updating.length; - that._uninstalledCount = uninstalling.length; - that._pending = new Plugins([].concat(installing, updating, uninstalling)).models; - } - }; - return Backbone.ajax(opts); - }, - - _fetchSystemUpgrades() { - if (this._systemUpdates) { - return $.Deferred() - .resolve() - .promise(); - } - const that = this; - const opts = { - type: 'GET', - url: window.baseUrl + '/api/system/upgrades', - success(r) { - that._systemUpdates = r.upgrades.map(update => ({ ...update, _system: true })); - } - }; - return Backbone.ajax(opts); - }, - - fetchInstalled() { - const that = this; - return $.when(this._fetchInstalled(), this._fetchUpdates(), this._fetchPending()).done(() => { - const plugins = new Plugins(); - plugins.set(that._installed); - plugins.set(that._updates, { remove: false }); - plugins.set(that._pending, { add: false, remove: false }); - that.reset(plugins.models); - }); - }, - - fetchUpdates() { - const that = this; - return $.when(this._fetchInstalled(), this._fetchUpdates(), this._fetchPending()).done(() => { - const plugins = new Plugins(); - plugins.set(that._installed); - plugins.set(that._updates, { remove: true }); - plugins.set(that._pending, { add: false, remove: false }); - that.reset(plugins.models); - }); - }, - - fetchAvailable() { - const that = this; - return $.when(this._fetchAvailable(), this._fetchPending()).done(() => { - const plugins = new Plugins(); - plugins.set(that._available); - plugins.set(that._pending, { add: false, remove: false }); - that.reset(plugins.models); - }); - }, - - fetchSystemUpgrades() { - const that = this; - return $.when(this._fetchSystemUpgrades()).done(() => { - that.reset(that._systemUpdates); - }); - }, - - search(query) { - /* eslint-disable array-callback-return */ - this.filter(model => { - model.set({ _hidden: !model.match(query) }); - }); - }, - - cancelAll() { - const that = this; - const opts = { - type: 'POST', - url: window.baseUrl + '/api/plugins/cancel_all', - success() { - that._installedCount = 0; - that._updatedCount = 0; - that._uninstalledCount = 0; - that.forEach(model => { - model.unset('_status'); - }); - that.trigger('change'); - } - }; - return Backbone.ajax(opts); - }, - - onStatusChange(model, status) { - if (status === 'installing') { - this._installedCount++; - } - if (status === 'updating') { - this._updatedCount++; - } - if (status === 'uninstalling') { - this._uninstalledCount++; - } - this.trigger('change'); - } -}); - -export default Plugins; diff --git a/server/sonar-web/src/main/js/apps/update-center/router.js b/server/sonar-web/src/main/js/apps/update-center/router.js deleted file mode 100644 index a4c92fc2dc6..00000000000 --- a/server/sonar-web/src/main/js/apps/update-center/router.js +++ /dev/null @@ -1,54 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2017 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -import Backbone from 'backbone'; - -export default Backbone.Router.extend({ - routes: { - '': 'index', - installed: 'showInstalled', - updates: 'showUpdates', - available: 'showAvailable', - system: 'showSystemUpgrades' - }, - - initialize(options) { - this.controller = options.controller; - }, - - index() { - this.navigate('installed', { trigger: true, replace: true }); - }, - - showInstalled() { - this.controller.showInstalled(); - }, - - showUpdates() { - this.controller.showUpdates(); - }, - - showAvailable() { - this.controller.showAvailable(); - }, - - showSystemUpgrades() { - this.controller.showSystemUpgrades(); - } -}); diff --git a/server/sonar-web/src/main/js/apps/update-center/routes.ts b/server/sonar-web/src/main/js/apps/update-center/routes.ts deleted file mode 100644 index e41cfdc073a..00000000000 --- a/server/sonar-web/src/main/js/apps/update-center/routes.ts +++ /dev/null @@ -1,56 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2017 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -import { RouterState, RouteComponent, IndexRouteProps } from 'react-router'; - -const routes = [ - { - getIndexRoute(_: RouterState, callback: (err: any, route: IndexRouteProps) => any) { - import('./components/UpdateCenterAppContainer').then(i => - callback(null, { component: i.default }) - ); - } - }, - { - path: 'installed', - getComponent(_: RouterState, callback: (err: any, component: RouteComponent) => any) { - import('./components/UpdateCenterAppContainer').then(i => callback(null, i.default)); - } - }, - { - path: 'updates', - getComponent(_: RouterState, callback: (err: any, component: RouteComponent) => any) { - import('./components/UpdateCenterAppContainer').then(i => callback(null, i.default)); - } - }, - { - path: 'available', - getComponent(_: RouterState, callback: (err: any, component: RouteComponent) => any) { - import('./components/UpdateCenterAppContainer').then(i => callback(null, i.default)); - } - }, - { - path: 'system', - getComponent(_: RouterState, callback: (err: any, component: RouteComponent) => any) { - import('./components/UpdateCenterAppContainer').then(i => callback(null, i.default)); - } - } -]; - -export default routes; diff --git a/server/sonar-web/src/main/js/apps/update-center/search-view.js b/server/sonar-web/src/main/js/apps/update-center/search-view.js deleted file mode 100644 index a181e17a44c..00000000000 --- a/server/sonar-web/src/main/js/apps/update-center/search-view.js +++ /dev/null @@ -1,104 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2017 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -import { debounce } from 'lodash'; -import Marionette from 'backbone.marionette'; -import Template from './templates/update-center-search.hbs'; - -export default Marionette.ItemView.extend({ - template: Template, - - events: { - 'change [name="update-center-filter"]': 'onFilterChange', - - 'submit #update-center-search-form': 'onFormSubmit', - 'search #update-center-search-query': 'onKeyUp', - 'keyup #update-center-search-query': 'onKeyUp', - 'change #update-center-search-query': 'onKeyUp' - }, - - collectionEvents: { - filter: 'onFilter' - }, - - initialize() { - this._bufferedValue = null; - this.search = debounce(this.search, 50); - this.listenTo(this.options.state, 'change', this.render); - }, - - onRender() { - this.$('[data-toggle="tooltip"]').tooltip({ container: 'body', placement: 'bottom' }); - }, - - onDestroy() { - this.$('[data-toggle="tooltip"]').tooltip('destroy'); - }, - - onFilterChange() { - const value = this.$('[name="update-center-filter"]:checked').val(); - this.filter(value); - }, - - filter(value) { - this.options.router.navigate(value, { trigger: true }); - }, - - onFormSubmit(e) { - e.preventDefault(); - this.debouncedOnKeyUp(); - }, - - onKeyUp() { - const q = this.getQuery(); - if (q === this._bufferedValue) { - return; - } - this._bufferedValue = this.getQuery(); - this.search(q); - }, - - getQuery() { - return this.$('#update-center-search-query').val(); - }, - - search(q) { - this.collection.search(q); - }, - - focusSearch() { - const that = this; - setTimeout(() => { - that.$('#update-center-search-query').focus(); - }, 0); - }, - - onFilter(model) { - const q = model.get('category'); - this.$('#update-center-search-query').val(q); - this.search(q); - }, - - serializeData() { - return { - ...Marionette.ItemView.prototype.serializeData.apply(this, arguments), - state: this.options.state.toJSON() - }; - } -}); diff --git a/server/sonar-web/src/main/js/apps/update-center/templates/_update-center-plugin-actions.hbs b/server/sonar-web/src/main/js/apps/update-center/templates/_update-center-plugin-actions.hbs deleted file mode 100644 index bda3b53a5d5..00000000000 --- a/server/sonar-web/src/main/js/apps/update-center/templates/_update-center-plugin-actions.hbs +++ /dev/null @@ -1,29 +0,0 @@ -
    - {{#if version}} - -
    - {{#each updates}} - {{#eq status 'COMPATIBLE'}} - - {{/eq}} - {{/each}} - -
    - - {{else}} - - {{#if termsAndConditionsUrl}} -

    - - -

    - - {{else}} - - {{/if}} - - {{/if}} -
    diff --git a/server/sonar-web/src/main/js/apps/update-center/templates/_update-center-plugin-changelog-entry.hbs b/server/sonar-web/src/main/js/apps/update-center/templates/_update-center-plugin-changelog-entry.hbs deleted file mode 100644 index a1ea88ce680..00000000000 --- a/server/sonar-web/src/main/js/apps/update-center/templates/_update-center-plugin-changelog-entry.hbs +++ /dev/null @@ -1,13 +0,0 @@ -
    - {{#notEq status 'COMPATIBLE'}} - {{release.version}} - {{else}} - {{release.version}} - {{/notEq}} - {{d release.date}} - {{#if release.changeLogUrl}} - {{t 'update_center.release_notes'}} - {{/if}} -
    -
    {{{release.description}}}
    diff --git a/server/sonar-web/src/main/js/apps/update-center/templates/update-center-footer.hbs b/server/sonar-web/src/main/js/apps/update-center/templates/update-center-footer.hbs deleted file mode 100644 index c2ce68490d7..00000000000 --- a/server/sonar-web/src/main/js/apps/update-center/templates/update-center-footer.hbs +++ /dev/null @@ -1,3 +0,0 @@ -
    - {{tp 'x_show' total}} -
    diff --git a/server/sonar-web/src/main/js/apps/update-center/templates/update-center-header.hbs b/server/sonar-web/src/main/js/apps/update-center/templates/update-center-header.hbs deleted file mode 100644 index e2eb7f9cefc..00000000000 --- a/server/sonar-web/src/main/js/apps/update-center/templates/update-center-header.hbs +++ /dev/null @@ -1,36 +0,0 @@ - - -{{#any installing updating uninstalling}} -
    -
    -

    {{t 'update_center.sonarqube_needs_to_be_restarted_to'}}

    -
      - {{#if installing}} -
    • - {{t 'update_center._install'}} - {{installing}} plugins -
    • - {{/if}} - {{#if updating}} -
    • - {{t 'update_center._update'}} - {{updating}} plugins -
    • - {{/if}} - {{#if uninstalling}} -
    • - {{t 'update_center._uninstall'}} - {{uninstalling}} plugins -
    • - {{/if}} -
    -
    -
    - - -
    -
    -{{/any}} diff --git a/server/sonar-web/src/main/js/apps/update-center/templates/update-center-layout.hbs b/server/sonar-web/src/main/js/apps/update-center/templates/update-center-layout.hbs deleted file mode 100644 index 599f049ef0b..00000000000 --- a/server/sonar-web/src/main/js/apps/update-center/templates/update-center-layout.hbs +++ /dev/null @@ -1,6 +0,0 @@ -
    -
    - -
    - -
    diff --git a/server/sonar-web/src/main/js/apps/update-center/templates/update-center-plugin-changelog.hbs b/server/sonar-web/src/main/js/apps/update-center/templates/update-center-plugin-changelog.hbs deleted file mode 100644 index b75523b983c..00000000000 --- a/server/sonar-web/src/main/js/apps/update-center/templates/update-center-plugin-changelog.hbs +++ /dev/null @@ -1,16 +0,0 @@ -
    -
    {{t 'changelog'}}
    - -
      - {{#each previousUpdates}} -
    • - {{> '_update-center-plugin-changelog-entry'}} -
    • - {{/each}} -
    • - {{> '_update-center-plugin-changelog-entry'}} -
    • -
    -
    - -
    diff --git a/server/sonar-web/src/main/js/apps/update-center/templates/update-center-plugin.hbs b/server/sonar-web/src/main/js/apps/update-center/templates/update-center-plugin.hbs deleted file mode 100644 index 0a6f40d4b1f..00000000000 --- a/server/sonar-web/src/main/js/apps/update-center/templates/update-center-plugin.hbs +++ /dev/null @@ -1,122 +0,0 @@ - - - - - - - - - - -
    -
    - {{name}} - {{#if category}} - {{category}} - {{/if}} -
    -
    {{{description}}}
    -
    -
      - {{#if version}} -
    • - {{version}} {{t 'update_center._installed'}} -
    • - {{/if}} - {{#notEmpty updates}} -
    • - {{t 'update_center.updates'}}: -
    • - {{#each updates}} -
    • -
      - {{#notEq status 'COMPATIBLE'}} - {{release.version}} - {{else}} - {{release.version}} - {{/notEq}} -
      -
      - {{{release.description}}} - -
      -
    • - {{/each}} - {{/notEmpty}} - {{#if release}} -
    • -
      - {{release.version}} -
      -
      - {{{release.description}}} - - {{#notEmpty update.requires}} -

      - {{t 'update_center.installing_this_plugin_will_also_install'}}: {{#each update.requires}} {{name}}{{/each}} -

      - {{/notEmpty}} -
      -
    • - {{/if}} -
    -
    -
      - {{#any homepageUrl issueTrackerUrl termsAndConditionsUrl}} -
    • - -
    • - {{/any}} - - {{#if license}} -
    • - {{t 'update_center.licensed_under'}} - {{license}} -
    • - {{/if}} - - {{#if organizationName}} -
    • - {{t 'update_center.developed_by'}} - {{#if organizationUrl}} - {{organizationName}} - {{else}} - {{organizationName}} - {{/if}} -
    • - {{/if}} -
    -
    - {{#eq _status 'installing'}} -

    {{t 'update_center.install_pending'}}

    - {{/eq}} - - {{#eq _status 'updating'}} -

    {{t 'update_center.update_pending'}}

    - {{/eq}} - - {{#eq _status 'uninstalling'}} -

    {{t 'update_center.uninstall_pending'}}

    - {{/eq}} - - {{#eq _status 'failed'}} - - {{#each _errors}} - {{msg}} - {{/each}} - - {{/eq}} - - {{#unless _status}} - - {{> '_update-center-plugin-actions'}} - {{/unless}} -
    diff --git a/server/sonar-web/src/main/js/apps/update-center/templates/update-center-search.hbs b/server/sonar-web/src/main/js/apps/update-center/templates/update-center-search.hbs deleted file mode 100644 index 5a2b91a6d81..00000000000 --- a/server/sonar-web/src/main/js/apps/update-center/templates/update-center-search.hbs +++ /dev/null @@ -1,47 +0,0 @@ -
    -
    -
      -
    • - - -
    • -
    • - - -
    • -
    • - - -
    • -
    - -
      -
    • - - -
    • -
    -
    - - {{#notEq state.section 'system'}} - - {{/notEq}} -
    diff --git a/server/sonar-web/src/main/js/apps/update-center/templates/update-center-system-update.hbs b/server/sonar-web/src/main/js/apps/update-center/templates/update-center-system-update.hbs deleted file mode 100644 index 0a8f1e1838a..00000000000 --- a/server/sonar-web/src/main/js/apps/update-center/templates/update-center-system-update.hbs +++ /dev/null @@ -1,58 +0,0 @@ - - - - - - - - -
    - - - - - - - - -
    - SonarQube {{version}} - {{t 'update_center.system_upgrade'}} -
    -
    {{{description}}}
    - - -
    -
    - {{t 'update_center.how_to_upgrade'}} -
    -
      -
    1. - {{t 'update_center.how_to_upgrade.1'}} -
    2. -
    3. - {{t 'update_center.how_to_upgrade.2'}} -
    4. -
    5. - {{t 'update_center.how_to_upgrade.3'}} -
    6. -
    7. - {{t 'update_center.how_to_upgrade.4'}} -
    8. -
    9. - {{t 'update_center.how_to_upgrade.5'}} -
    10. -
    11. - {{t 'update_center.how_to_upgrade.6'}} -
    12. -
    -
    -- cgit v1.2.3