]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-9936 Update marketplace pending plugins notif
authorGrégoire Aubert <gregoire.aubert@sonarsource.com>
Tue, 17 Oct 2017 14:30:21 +0000 (16:30 +0200)
committerGrégoire Aubert <gregoire.aubert@sonarsource.com>
Mon, 23 Oct 2017 15:01:13 +0000 (08:01 -0700)
12 files changed:
server/sonar-web/src/main/js/app/components/nav/settings/SettingsNav.tsx
server/sonar-web/src/main/js/apps/marketplace/App.tsx
server/sonar-web/src/main/js/apps/marketplace/PendingActions.tsx
server/sonar-web/src/main/js/apps/marketplace/Search.tsx
server/sonar-web/src/main/js/apps/marketplace/__tests__/__snapshots__/PendingActions-test.tsx.snap
server/sonar-web/src/main/js/apps/marketplace/components/EditionsStatusNotif.tsx
server/sonar-web/src/main/js/apps/marketplace/components/PluginActions.tsx
server/sonar-web/src/main/js/apps/marketplace/components/PluginUpdateButton.tsx
server/sonar-web/src/main/js/apps/marketplace/components/__tests__/__snapshots__/EditionsStatusNotif-test.tsx.snap
server/sonar-web/src/main/js/apps/marketplace/style.css
server/sonar-web/src/main/less/components/alerts.less
server/sonar-web/src/main/less/init/misc.less

index 7f7632d66306285cc5c11344fde7a2cbabf365f9..34dc8b4f72c9697b1bcf47aacf82edd082b28425 100644 (file)
@@ -61,6 +61,11 @@ export default class SettingsNav extends React.PureComponent<Props> {
     return this.isSomethingActive(urls);
   }
 
+  isMarketplace() {
+    const urls = ['/admin/marketplace'];
+    return this.isSomethingActive(urls);
+  }
+
   renderExtension = ({ key, name }: Extension) => {
     return (
       <li key={key}>
@@ -82,7 +87,7 @@ export default class SettingsNav extends React.PureComponent<Props> {
     const projectsClassName = classNames('dropdown-toggle', { active: isProjects });
     const systemClassName = classNames('dropdown-toggle', { active: isSystem });
     const configurationClassNames = classNames('dropdown-toggle', {
-      active: !isSecurity && !isProjects && !isSystem && !isSupport
+      active: !isSecurity && !isProjects && !isSystem && !isSupport && !this.isMarketplace()
     });
 
     const extensionsWithoutSupport = extensions.filter(
index 02910f26c5e94cf00445eb17af651be27bcf7c62..74512fb5dd6db346f932d4792d0ab7b4ad1747f7 100644 (file)
@@ -164,24 +164,21 @@ export default class App extends React.PureComponent<Props, State> {
     this.setState({ editionStatus: editionStatus });
 
   updateQuery = (newQuery: Partial<Query>) => {
-    const query = serializeQuery({
-      ...parseQuery(this.props.location.query),
-      ...newQuery
-    });
-    this.context.router.push({
-      pathname: this.props.location.pathname,
-      query
-    });
+    const query = serializeQuery({ ...parseQuery(this.props.location.query), ...newQuery });
+    this.context.router.push({ pathname: this.props.location.pathname, query });
   };
 
   render() {
-    const { editionStatus, plugins, pending } = this.state;
+    const { editionStatus, loading, plugins, pending } = this.state;
     const query = parseQuery(this.props.location.query);
     const filteredPlugins = query.search ? filterPlugins(plugins, query.search) : plugins;
     return (
       <div className="page page-limited" id="marketplace-page">
         <Helmet title={translate('marketplace.page')} />
-        {editionStatus && <EditionsStatusNotif editionStatus={editionStatus} />}
+        <div className="marketplace-notifs">
+          {editionStatus && <EditionsStatusNotif editionStatus={editionStatus} />}
+          <PendingActions refreshPending={this.fetchPendingPlugins} pending={pending} />
+        </div>
         <Header />
         <EditionBoxes
           editionStatus={editionStatus}
@@ -190,19 +187,21 @@ export default class App extends React.PureComponent<Props, State> {
           updateCenterActive={this.props.updateCenterActive}
           updateEditionStatus={this.updateEditionStatus}
         />
-        <PendingActions refreshPending={this.fetchPendingPlugins} pending={pending} />
         <Search
           query={query}
           updateCenterActive={this.props.updateCenterActive}
           updateQuery={this.updateQuery}
         />
-        <PluginsList
-          plugins={filteredPlugins}
-          pending={pending}
-          refreshPending={this.fetchPendingPlugins}
-          updateQuery={this.updateQuery}
-        />
-        <Footer total={filteredPlugins.length} />
+        {loading && <i className="spinner" />}
+        {!loading && (
+          <PluginsList
+            plugins={filteredPlugins}
+            pending={pending}
+            refreshPending={this.fetchPendingPlugins}
+            updateQuery={this.updateQuery}
+          />
+        )}
+        {!loading && <Footer total={filteredPlugins.length} />}
       </div>
     );
   }
index bc96da9bbf078ec2b33fe45010c10260ae76a566..a42c72145b30fb38af3772b3d5098db17a6636ea 100644 (file)
@@ -53,9 +53,8 @@ export default class PendingActions extends React.PureComponent<Props, State> {
       return null;
     }
 
-    const nbPluginsClass = 'big little-spacer-left little-spacer-right';
     return (
-      <div className="js-pending panel panel-warning big-spacer-bottom">
+      <div className="js-pending alert alert-warning">
         <div className="display-inline-block">
           <p>{translate('marketplace.sonarqube_needs_to_be_restarted_to')}</p>
           <ul className="list-styled spacer-top">
@@ -64,13 +63,7 @@ export default class PendingActions extends React.PureComponent<Props, State> {
                 <FormattedMessage
                   defaultMessage={translate('marketplace.install_x_plugins')}
                   id="marketplace.install_x_plugins"
-                  values={{
-                    nb: (
-                      <strong className={'text-success ' + nbPluginsClass}>
-                        {installing.length}
-                      </strong>
-                    )
-                  }}
+                  values={{ nb: <strong>{installing.length}</strong> }}
                 />
               </li>
             )}
@@ -79,13 +72,7 @@ export default class PendingActions extends React.PureComponent<Props, State> {
                 <FormattedMessage
                   defaultMessage={translate('marketplace.update_x_plugins')}
                   id="marketplace.update_x_plugins"
-                  values={{
-                    nb: (
-                      <strong className={'text-success ' + nbPluginsClass}>
-                        {updating.length}
-                      </strong>
-                    )
-                  }}
+                  values={{ nb: <strong>{updating.length}</strong> }}
                 />
               </li>
             )}
@@ -94,18 +81,14 @@ export default class PendingActions extends React.PureComponent<Props, State> {
                 <FormattedMessage
                   defaultMessage={translate('marketplace.uninstall_x_plugins')}
                   id="marketplace.uninstall_x_plugins"
-                  values={{
-                    nb: (
-                      <strong className={'text-danger ' + nbPluginsClass}>{removing.length}</strong>
-                    )
-                  }}
+                  values={{ nb: <strong>{removing.length}</strong> }}
                 />
               </li>
             )}
           </ul>
         </div>
-        <div className="pull-right button-group">
-          <button className="js-restart" onClick={this.handleOpenRestart}>
+        <div className="pull-right">
+          <button className="js-restart little-spacer-right" onClick={this.handleOpenRestart}>
             {translate('marketplace.restart')}
           </button>
           <button className="js-cancel-all button-red" onClick={this.handleRevert}>
index 194427a709eaab844b6d2e15efdd3ad55c911425..3bef8189711ee051d117623439e1918614ec8ea3 100644 (file)
@@ -69,7 +69,7 @@ export default class Search extends React.PureComponent<Props, State> {
     ];
     return (
       <div id="marketplace-search" className="panel panel-vertical bordered-bottom spacer-bottom">
-        <div className="display-inline-block text-top nowrap big-spacer-right">
+        <div className="display-inline-block text-top nowrap abs-width-150 spacer-right">
           <RadioToggle
             name="marketplace-filter"
             onCheck={this.handleFilterChange}
index 3afbde17ba65efb200f8b7ad59ec5d86040ade9d..b30e1e22d36b9fc7358b96ceb3316652807553b8 100644 (file)
@@ -2,7 +2,7 @@
 
 exports[`should display pending actions 1`] = `
 <div
-  className="js-pending panel panel-warning big-spacer-bottom"
+  className="js-pending alert alert-warning"
 >
   <div
     className="display-inline-block"
@@ -19,9 +19,7 @@ exports[`should display pending actions 1`] = `
           id="marketplace.install_x_plugins"
           values={
             Object {
-              "nb": <strong
-                className="text-success big little-spacer-left little-spacer-right"
-            >
+              "nb": <strong>
                 2
             </strong>,
             }
@@ -34,9 +32,7 @@ exports[`should display pending actions 1`] = `
           id="marketplace.uninstall_x_plugins"
           values={
             Object {
-              "nb": <strong
-                className="text-danger big little-spacer-left little-spacer-right"
-            >
+              "nb": <strong>
                 1
             </strong>,
             }
@@ -46,10 +42,10 @@ exports[`should display pending actions 1`] = `
     </ul>
   </div>
   <div
-    className="pull-right button-group"
+    className="pull-right"
   >
     <button
-      className="js-restart"
+      className="js-restart little-spacer-right"
       onClick={[Function]}
     >
       marketplace.restart
index 1ef4aacc308201a76d806022e50339eae8a3cda3..312f0360afdf39c1e1108ee68d276250b2941047 100644 (file)
@@ -40,14 +40,14 @@ export default class EditionsStatusNotif extends React.PureComponent<Props, Stat
     const { editionStatus } = this.props;
     if (editionStatus.installationStatus === 'AUTOMATIC_IN_PROGRESS') {
       return (
-        <div className="alert alert-page alert-info">
+        <div className="alert alert-info">
           <i className="spinner spacer-right text-bottom" />
           <span>{translate('marketplace.status.AUTOMATIC_IN_PROGRESS')}</span>
         </div>
       );
     } else if (editionStatus.installationStatus === 'AUTOMATIC_READY') {
       return (
-        <div className="alert alert-page alert-success">
+        <div className="alert alert-success">
           <span>{translate('marketplace.status.AUTOMATIC_READY')}</span>
           <button className="js-restart spacer-left" onClick={this.handleOpenRestart}>
             {translate('marketplace.restart')}
@@ -59,7 +59,7 @@ export default class EditionsStatusNotif extends React.PureComponent<Props, Stat
       ['MANUAL_IN_PROGRESS', 'AUTOMATIC_FAILURE'].includes(editionStatus.installationStatus)
     ) {
       return (
-        <div className="alert alert-page alert-danger">
+        <div className="alert alert-danger">
           {translate('marketplace.status', editionStatus.installationStatus)}
           <a className="little-spacer-left" href="https://www.sonarsource.com" target="_blank">
             {translate('marketplace.how_to_install')}
index f2fce9f658e042f72d8247b265dca84d0df7a2b2..c895d0aedd16baf96c171d77429cb3e35bc16774 100644 (file)
@@ -134,7 +134,7 @@ export default class PluginActions extends React.PureComponent<Props, State> {
         )}
         {loading && <i className="spinner spacer-right" />}
         {isPluginInstalled(plugin) && (
-          <div className="button-group">
+          <div className="display-inlin-block">
             {plugin.updates &&
               plugin.updates.map((update, idx) => (
                 <PluginUpdateButton
@@ -145,7 +145,7 @@ export default class PluginActions extends React.PureComponent<Props, State> {
                 />
               ))}
             <button
-              className="js-uninstall button-red"
+              className="js-uninstall button-red little-spacer-left"
               disabled={loading}
               onClick={this.handleUninstall}>
               {translate('marketplace.uninstall')}
index 41028a6ff0a438156afc9d9399656e2a039913bf..26ac38460584f94da7109253eb79add59402963a 100644 (file)
@@ -36,7 +36,10 @@ export default class PluginUpdateButton extends React.PureComponent<Props> {
       return null;
     }
     return (
-      <button className="js-update" onClick={this.handleClick} disabled={disabled}>
+      <button
+        className="js-update little-spacer-bottom"
+        onClick={this.handleClick}
+        disabled={disabled}>
         {translateWithParameters('marketplace.update_to_x', update.release.version)}
       </button>
     );
index 807a7c6714a4fe1849e989727a9dbde4427238b4..537348e08af0a3355588bf3908ee04ff6fc61fb8 100644 (file)
@@ -2,7 +2,7 @@
 
 exports[`should display a ready notification 1`] = `
 <div
-  className="alert alert-page alert-success"
+  className="alert alert-success"
 >
   <span>
     marketplace.status.AUTOMATIC_READY
@@ -18,7 +18,7 @@ exports[`should display a ready notification 1`] = `
 
 exports[`should display an error notification 1`] = `
 <div
-  className="alert alert-page alert-danger"
+  className="alert alert-danger"
 >
   marketplace.status.AUTOMATIC_FAILURE
   <a
@@ -33,7 +33,7 @@ exports[`should display an error notification 1`] = `
 
 exports[`should display an in progress notif 1`] = `
 <div
-  className="alert alert-page alert-info"
+  className="alert alert-info"
 >
   <i
     className="spinner spacer-right text-bottom"
index 037a0c133d99409cc9e2c7875cd1b84972dd33ae..6363589603f82b4e0195cc4d6dd584bcbf3f0777 100644 (file)
   align-items: baseline;
   justify-content: space-between;
 }
+
+.marketplace-notifs .alert {
+  padding: 8px;
+}
+
+.marketplace-notifs .alert:last-child {
+  margin-bottom: 16px;
+}
index ee471b96bbb6f2eb5df3001d262a31f0d3c3b3f1..656940462611b4383fe9aa2efdcb9645fa7556b0 100644 (file)
   vertical-align: middle;
 }
 
-.alert-page {
-  margin-bottom: 16px;
-  padding: 8px;
-}
-
 .modal-alert {
   margin: -10px -10px 16px;
   padding: 10px;
index b5f4e4f5ada41fb1b6abeaf8c6670e9441d10405..f7a4583cb98219bb9aa8b6b156bedb693c372c8d 100644 (file)
@@ -194,6 +194,9 @@ td.big-spacer-top {
   width: 10%;
 }
 
+.abs-width-150 {
+  width: 150px;
+}
 .abs-width-240 {
   width: 240px;
 }