From 70158d0f205b2fb058a1872c63213e4ae2cb5b41 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Wed, 26 Jun 2019 07:59:37 +0200 Subject: [PATCH] subscriptions: Drop This was only built on RHEL/CentOS 7, which is not supported by master any more. --- Makefile.am | 1 - doc/guide/Makefile-guide.am | 1 - doc/guide/cockpit-guide.xml | 1 - doc/guide/feature-subscription.xml | 28 -- pkg/subscriptions/index.html | 38 -- pkg/subscriptions/main.js | 117 ------ pkg/subscriptions/manifest.json.in | 13 - pkg/subscriptions/subscriptions-client.js | 416 ------------------- pkg/subscriptions/subscriptions-register.jsx | 194 --------- pkg/subscriptions/subscriptions-view.jsx | 263 ------------ pkg/subscriptions/subscriptions.css | 88 ---- tools/cockpit.spec | 19 - tools/debian/rules | 2 +- webpack.config.js | 5 - 14 files changed, 1 insertion(+), 1185 deletions(-) delete mode 100644 doc/guide/feature-subscription.xml delete mode 100644 pkg/subscriptions/index.html delete mode 100644 pkg/subscriptions/main.js delete mode 100644 pkg/subscriptions/manifest.json.in delete mode 100644 pkg/subscriptions/subscriptions-client.js delete mode 100644 pkg/subscriptions/subscriptions-register.jsx delete mode 100644 pkg/subscriptions/subscriptions-view.jsx delete mode 100644 pkg/subscriptions/subscriptions.css diff --git a/Makefile.am b/Makefile.am index b7e5df42b..b4c056c8c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -165,7 +165,6 @@ WEBPACK_PACKAGES = \ sosreport \ ssh \ storaged \ - subscriptions \ systemd \ tuned \ users \ diff --git a/doc/guide/Makefile-guide.am b/doc/guide/Makefile-guide.am index 4fc702902..4e89ce77b 100644 --- a/doc/guide/Makefile-guide.am +++ b/doc/guide/Makefile-guide.am @@ -34,7 +34,6 @@ GUIDE_INCLUDES = \ doc/guide/feature-selinux.xml \ doc/guide/feature-sosreport.xml \ doc/guide/feature-storaged.xml \ - doc/guide/feature-subscription.xml \ doc/guide/feature-systemd.xml \ doc/guide/feature-terminal.xml \ doc/guide/feature-tuned.xml \ diff --git a/doc/guide/cockpit-guide.xml b/doc/guide/cockpit-guide.xml index 30ed58543..c139da6d8 100644 --- a/doc/guide/cockpit-guide.xml +++ b/doc/guide/cockpit-guide.xml @@ -44,7 +44,6 @@ - diff --git a/doc/guide/feature-subscription.xml b/doc/guide/feature-subscription.xml deleted file mode 100644 index 6b86115fd..000000000 --- a/doc/guide/feature-subscription.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - Subscription Manager - - Cockpit can use - Subscription Manager to join the - attach the machine to a subscription, if the operating system (such as RHEL) requires this. This - functionality is in the Cockpit subscriptions package. - - Subscription Manager limits its use to root only. Therefore if a non-root user - is logged into Cockpit, Cockpit tries to escalate privileges - to root in order to access subscription information or make changes. - - To perform similar tasks from the command line, use the - subscription-manager - tool: - - -$ sudo subscription-manager status -+-------------------------------------------+ - System Status Details -+-------------------------------------------+ -... - - - diff --git a/pkg/subscriptions/index.html b/pkg/subscriptions/index.html deleted file mode 100644 index fa8670e55..000000000 --- a/pkg/subscriptions/index.html +++ /dev/null @@ -1,38 +0,0 @@ - - - - - Subscriptions - - - - - - - - - - - - - -
- - diff --git a/pkg/subscriptions/main.js b/pkg/subscriptions/main.js deleted file mode 100644 index db40dd892..000000000 --- a/pkg/subscriptions/main.js +++ /dev/null @@ -1,117 +0,0 @@ -/* - * This file is part of Cockpit. - * - * Copyright (C) 2015 Red Hat, Inc. - * - * Cockpit 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 2.1 of the License, or - * (at your option) any later version. - * - * Cockpit 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 Cockpit; If not, see . - */ - -import cockpit from "cockpit"; -import React from "react"; -import ReactDOM from "react-dom"; -import { client } from "./subscriptions-client"; -import * as subscriptionsRegister from "./subscriptions-register.jsx"; -import { SubscriptionsPage } from "./subscriptions-view.jsx"; -import { show_modal_dialog } from "cockpit-components-dialog.jsx"; - -const _ = cockpit.gettext; - -var dataStore = { }; - -function dismissStatusError() { - client.subscriptionStatus.error = undefined; - dataStore.render(); -} - -var registerDialogDetails; - -function registerSystem () { - return client.registerSystem(registerDialogDetails); -} - -var footerProps = { - 'actions': [ - { 'clicked': registerSystem, - 'caption': _("Register"), - 'style': 'primary', - }, - ] -}; - -function openRegisterDialog() { - registerDialogDetails = subscriptionsRegister.defaultSettings(); - - // show dialog to register - var renderDialog; - var updatedData = function(prop, data) { - if (prop) { - if (data.target) { - if (data.target.type == "checkbox") { - registerDialogDetails[prop] = data.target.checked; - } else { - registerDialogDetails[prop] = data.target.value; - } - } else { - registerDialogDetails[prop] = data; - } - } - - registerDialogDetails.onChange = updatedData; - - var dialogProps = { - 'title': _("Register system"), - 'body': React.createElement(subscriptionsRegister.DialogBody, registerDialogDetails), - }; - - if (renderDialog) - renderDialog.setProps(dialogProps); - else - renderDialog = show_modal_dialog(dialogProps, footerProps); - }; - updatedData(); -} - -function unregisterSystem() { - client.unregisterSystem(); -} - -function initStore(rootElement) { - client.addEventListener("dataChanged", - function() { - dataStore.render(); - } - ); - - client.init(); - - dataStore.render = function() { - ReactDOM.render(React.createElement( - SubscriptionsPage, - { - status: client.subscriptionStatus.status, - products:client.subscriptionStatus.products, - error: client.subscriptionStatus.error, - dismissError: dismissStatusError, - register: openRegisterDialog, - unregister: unregisterSystem, - }), - rootElement - ); - }; -} - -document.addEventListener("DOMContentLoaded", function() { - initStore(document.getElementById('app')); - dataStore.render(); -}); diff --git a/pkg/subscriptions/manifest.json.in b/pkg/subscriptions/manifest.json.in deleted file mode 100644 index 1ec02c812..000000000 --- a/pkg/subscriptions/manifest.json.in +++ /dev/null @@ -1,13 +0,0 @@ -{ - "version": "@VERSION@", - "requires": { - "cockpit": "122" - }, - - "tools": { - "index": { - "label": "Subscriptions" - } - }, - "content-security-policy": "img-src 'self' data:" -} diff --git a/pkg/subscriptions/subscriptions-client.js b/pkg/subscriptions/subscriptions-client.js deleted file mode 100644 index 9a349d745..000000000 --- a/pkg/subscriptions/subscriptions-client.js +++ /dev/null @@ -1,416 +0,0 @@ -/* - * This file is part of Cockpit. - * - * Copyright (C) 2016 Red Hat, Inc. - * - * Cockpit 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 2.1 of the License, or - * (at your option) any later version. - * - * Cockpit 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 Cockpit; If not, see . - */ - -import cockpit from "cockpit"; -const _ = cockpit.gettext; - -export var client = { }; - -cockpit.event_target(client); - -client.subscriptionStatus = { - serviceStatus: undefined, - status: undefined, - products: [], - error: undefined, -}; - -// we trigger an event called "dataChanged" when the data has changed - -// DBUS service -var service; - -function needRender() { - var ev = new Event("dataChanged", { bubbles: false, cancelable: false }); - client.dispatchEvent(ev); -} - -/* we trigger status update via dbus - * if we don't get a timely reply, consider subscription-manager failure - */ -var updateTimeout; - -/* - * Parses lines like: - * - * id: text - */ -function parseSingleSubscription(text) { - var ret = { }; - text.split('\n').forEach(function(line, i) { - var pos = line.indexOf(':'); - if (pos !== -1) - ret[line.substring(0, pos).trim()] = line.substring(pos + 1).trim(); - }); - return ret; -} - -function parseMultipleSubscriptions(text) { - var ret = [ ]; - var segmentInfo, status; - text.split('\n\n').forEach(function(segment) { - if (segment.indexOf('Product Name:') === -1) - return; - - segmentInfo = parseSingleSubscription(segment); - - status = segmentInfo['Status']; - - /* if we have status details, add those to the status */ - if (segmentInfo['Status Details'] !== '') - status = status + ' (' + segmentInfo['Status Details'] + ')'; - - /* convert text output to mustache template variables */ - ret.push({ - 'productName': segmentInfo['Product Name'], - 'productId': segmentInfo['Product ID'], - 'version': segmentInfo['Version'], - 'arch': segmentInfo['Arch'], - 'status': status, - 'starts': segmentInfo['Starts'], - 'ends': segmentInfo['Ends'], - }); - }); - return ret; -} - -var gettingDetails = false; -var getDetailsRequested = false; -function getSubscriptionDetails() { - /* TODO DBus API doesn't deliver what we need, so we call subscription manager - * without translations and parse the output - * https://bugzilla.redhat.com/show_bug.cgi?id=1304056 - */ - if (gettingDetails) { - getDetailsRequested = true; - return; - } - getDetailsRequested = false; - gettingDetails = true; - cockpit.spawn(['subscription-manager', 'list'], - { directory: '/', superuser: "require", environ: ['LC_ALL=C'] }) - .done(function(output) { - client.subscriptionStatus.products = parseMultipleSubscriptions(output); - }) - .fail(function(ex) { - client.subscriptionStatus.error = ex; - console.warn("Subscriptions [getSubscriptionDetails]: couldn't get details: " + ex); - }) - .always(function(output) { - gettingDetails = false; - if (getDetailsRequested) - getSubscriptionDetails(); - needRender(); - }); -} - -client.registerSystem = function(subscriptionDetails) { - var dfd = cockpit.defer(); - - var args = ['subscription-manager', 'register']; - if (subscriptionDetails.url != 'default') - args.push('--serverurl', subscriptionDetails.serverUrl); - - // activation keys can't be used with auto-attach - if (subscriptionDetails.activationKeys) - args.push('--activationkey', subscriptionDetails.activationKeys); - else - args.push('--auto-attach'); - - if (subscriptionDetails.user || subscriptionDetails.password) { - if (!subscriptionDetails.user) - subscriptionDetails.user = ''; - if (!subscriptionDetails.password) - subscriptionDetails.password = ''; - args.push('--username', subscriptionDetails.user, '--password', subscriptionDetails.password); - } - - // proxy is optional - if (subscriptionDetails.proxy) { - if (!subscriptionDetails.proxyServer) - subscriptionDetails.proxyServer = ''; - if (!subscriptionDetails.proxyUser) - subscriptionDetails.proxyUser = ''; - if (!subscriptionDetails.proxyPass) - subscriptionDetails.proxyPass = ''; - args.push('--proxy', subscriptionDetails.proxyServer, - '--proxyuser', subscriptionDetails.proxyUser, - '--proxypass', subscriptionDetails.proxyPass); - } - - // only pass org info if user provided it - if (subscriptionDetails.org) - args.push('--org', subscriptionDetails.org); - - /* TODO DBus API doesn't deliver what we need, so we call subscription manager - * without translations and parse the output - * https://bugzilla.redhat.com/show_bug.cgi?id=1304056 - */ - var process = cockpit.spawn(args, { - directory: '/', - superuser: "require", - environ: ['LC_ALL=C'], - err: "out" - }); - - var promise; - var buffer = ''; - process - .input('') - .stream(function(text) { - buffer += text; - }) - .done(function(output) { - dfd.resolve(); - }) - .fail(function(ex) { - if (ex.problem === "cancelled") { - dfd.reject(ex); - return; - } - - /* detect error types we recognize, fall back is generic error */ - var invalidUsernameString = 'Invalid username or password.'; - var invalidCredentialsString = 'Invalid Credentials'; - var message = buffer.trim(); - if (message.indexOf(invalidUsernameString) !== -1) { - message = cockpit.format("$0 ($1)", _("Invalid username or password"), message.substring(invalidUsernameString.length).trim()); - } else if (message.indexOf(invalidCredentialsString) !== -1) { - message = cockpit.format("$0 ($1)", _("Invalid credentials"), message.substring(invalidCredentialsString.length).trim()); - } else if ((message.indexOf('EOF') === 0) && (message.indexOf('Organization:') !== -1)) { - message = _("'Organization' required to register."); - } else if ((message.indexOf('EOF') === 0) && (message.indexOf('Username:') !== -1)) { - message = _("Login/password or activation key required to register."); - } else if (message.indexOf('Must provide --org with activation keys') !== -1) { - message = _("'Organization' required when using activation keys."); - } else if (message.indexOf('The system has been registered') !== -1) { - /* - * Currently we don't separate registration & subscription. - * Our auto-attach may have failed, so close the dialog and - * update status. - */ - dfd.resolve(); - return; - } else { - // unrecognized output - console.log("unrecognized subscription-manager failure output: ", ex, message); - } - var error = new Error(message); - dfd.reject(error); - }); - - promise = dfd.promise(); - promise.cancel = function cancel() { - process.close("cancelled"); - // we have no idea what the current state is - requestUpdate(); - }; - - return promise; -}; - -client.unregisterSystem = function() { - var dfd = cockpit.defer(); - - var args = ['subscription-manager', 'unregister']; - - /* TODO DBus API doesn't deliver what we need, so we call subscription manager - * without translations and parse the output - */ - var process = cockpit.spawn(args, { - directory: '/', - superuser: "require", - environ: ['LC_ALL=C'], - err: "out" - }); - - client.subscriptionStatus.status = "unregistering"; - needRender(); - var promise; - var buffer = ''; - process - .input('') - .stream(function(text) { - buffer += text; - }) - .done(function(output) { - dfd.resolve(); - }) - .fail(function(ex) { - if (ex.problem === "cancelled") { - dfd.reject(ex); - return; - } - var error = new Error(buffer.trim()); - dfd.reject(error); - requestUpdate(); - }); - - promise = dfd.promise(); - promise.cancel = function cancel() { - process.close("cancelled"); - // we have no idea what the current state is - requestUpdate(); - }; - - return promise; -}; - -function statusUpdateFailed(reason) { - console.warn("Subscription status update failed:", reason); - client.subscriptionStatus.status = "not-found"; - needRender(); -} - -/* request update via DBus - * possible status values: https://github.com/candlepin/subscription-manager/blob/30c3b52320c3e73ebd7435b4fc8b0b6319985d19/src/rhsm_icon/rhsm_icon.c#L98 - * [ RHSM_VALID, RHSM_EXPIRED, RHSM_WARNING, RHN_CLASSIC, RHSM_PARTIALLY_VALID, RHSM_REGISTRATION_REQUIRED ] - */ -var subscriptionStatusValues = [ - 'RHSM_VALID', - 'RHSM_EXPIRED', - 'RHSM_WARNING', - 'RHN_CLASSIC', - 'RHSM_PARTIALLY_VALID', - 'RHSM_REGISTRATION_REQUIRED' -]; -function requestUpdate() { - service.call( - '/EntitlementStatus', - 'com.redhat.SubscriptionManager.EntitlementStatus', - 'check_status', - []) - .always(function() { - window.clearTimeout(updateTimeout); - }) - .done(function(result) { - client.subscriptionStatus.serviceStatus = subscriptionStatusValues[result[0]]; - client.getSubscriptionStatus(); - }) - .catch(function(ex) { - statusUpdateFailed("EntitlementStatus.check_status() failed:", ex); - }); - - /* TODO: Don't use a timeout here. Needs better API */ - updateTimeout = window.setTimeout( - function() { - statusUpdateFailed("timeout"); - }, 60000); -} - -function processStatusOutput(text, exitDetails) { - if (exitDetails && exitDetails.problem === 'access-denied') { - client.subscriptionStatus.status = "access-denied"; - needRender(); - return; - } - /* if output isn't as expected, maybe not properly installed? */ - if (text.indexOf('Overall Status:') === -1) { - console.warn(text, exitDetails); - client.subscriptionStatus.status = "not-found"; - return; - } - - /* clear old subscription details */ - client.subscriptionStatus.products = []; - - var status = parseSingleSubscription(text); - client.subscriptionStatus.status = status['Overall Status']; - - /* if refresh was requested, try again - otherwise get details */ - if (client.subscriptionStatus !== 'Unknown') - getSubscriptionDetails(); - else - needRender(); -} - -var gettingStatus = false; -var getStatusRequested = false; -/* get subscription summary using 'subscription-manager status' */ -client.getSubscriptionStatus = function() { - if (gettingStatus) { - getStatusRequested = true; - return; - } - getStatusRequested = false; - gettingStatus = true; - /* we need a buffer for 'subscription-manager status' output, since that can fail with a return code != 0 - * even if we need its output (no valid subscription) - */ - var status_buffer = ''; - /* TODO DBus API doesn't deliver what we need, so we call subscription manager - * without translations and parse the output - * - * 'subscription-manager status' will only return with exit code 0 if all is well (and subscriptions current) - */ - cockpit.spawn(['subscription-manager', 'status'], - { directory: '/', superuser: "require", environ: ['LC_ALL=C'], err: "out" }) - .stream(function(text) { - status_buffer += text; - }) - .done(function(text) { - processStatusOutput(status_buffer + text, undefined); - }) - .fail(function(ex) { - processStatusOutput(status_buffer, ex); - }) - .always(function() { - gettingStatus = false; - if (getStatusRequested) - client.getSubscriptionStatus(); - }); -}; - -client.init = function() { - service = cockpit.dbus('com.redhat.SubscriptionManager'); - - /* we want to get notified if subscription status of the system changes */ - service.subscribe( - { path: '/EntitlementStatus', - interface: 'com.redhat.SubscriptionManager.EntitlementStatus', - member: 'entitlement_status_changed' - }, - function(path, dbus_interface, signal, args) { - window.clearTimeout(updateTimeout); - /* - * status has changed, now get actual status via command line - * since older versions of subscription-manager don't deliver this via DBus - * note: subscription-manager needs superuser privileges - */ - - client.getSubscriptionStatus(); - } - ); - - /* ideally we could get detailed subscription info via DBus, but we - * can't rely on this being present on all systems we work on - */ - service.subscribe( - { path: "/EntitlementStatus", - interface: "org.freedesktop.DBUS.Properties", - member: "PropertiesChanged" - }, - function(path, iface, signal, args) { - client.getSubscriptionStatus(); - } - ); - - // get initial status - requestUpdate(); -}; diff --git a/pkg/subscriptions/subscriptions-register.jsx b/pkg/subscriptions/subscriptions-register.jsx deleted file mode 100644 index 3d633202f..000000000 --- a/pkg/subscriptions/subscriptions-register.jsx +++ /dev/null @@ -1,194 +0,0 @@ -/* - * This file is part of Cockpit. - * - * Copyright (C) 2016 Red Hat, Inc. - * - * Cockpit 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 2.1 of the License, or - * (at your option) any later version. - * - * Cockpit 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 Cockpit; If not, see . - */ - -import React from "react"; - -import cockpit from "cockpit"; - -import * as Select from "cockpit-components-select.jsx"; - -const _ = cockpit.gettext; - -export function defaultSettings() { - return { - url: 'default', - serverUrl: 'subscription.rhn.redhat.com', - proxy: false, - proxyServer: '', - proxyUser: '', - proxyPassword: '', - user: '', - password: '', - activationKeys: '', - org: '', - }; -} -/* Subscriptions: registration dialog body - * Expected props: - * - onChange callback to signal when the data has changed - * - properties as in defaultRegisterDialogSettings() - */ -export class DialogBody extends React.Component { - render() { - var customURL; - if (this.props.url == 'custom') { - customURL = ( - - ); - } - var proxy; - if (this.props.proxy) { - proxy = [ -
, - - - - - - - - - - - - - - - - - -
- - -
- - -
- - -
- ]; - } - var urlEntries = { - 'default': _("Default"), - 'custom': _("Custom URL"), - }; - return ( -
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - { urlEntries['default'] } - { urlEntries['custom'] } - - {customURL} -
- - - - {proxy} -
- - - -
- - - -
- - - -
- - - -
-
- ); - } -} diff --git a/pkg/subscriptions/subscriptions-view.jsx b/pkg/subscriptions/subscriptions-view.jsx deleted file mode 100644 index e191500df..000000000 --- a/pkg/subscriptions/subscriptions-view.jsx +++ /dev/null @@ -1,263 +0,0 @@ -/* - * This file is part of Cockpit. - * - * Copyright (C) 2016 Red Hat, Inc. - * - * Cockpit 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 2.1 of the License, or - * (at your option) any later version. - * - * Cockpit 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 Cockpit; If not, see . - */ - -import React from "react"; - -import cockpit from "cockpit"; -import * as cockpitListing from "cockpit-components-listing.jsx"; - -const _ = cockpit.gettext; - -// Show details for an installed product -class SubscriptionProductDetails extends React.Component { - render() { - return ( - - - - - - - - - - -
{_("Product name")}{this.props.productName}
{_("Product ID")}{this.props.productId}
{_("Version")}{this.props.version}
{_("Architecture")}{this.props.arch}
{_("Status")}{this.props.status}
{_("Starts")}{this.props.starts}
{_("Ends")}{this.props.ends}
- ); - } -} - -/* 'Curtains' implements a subset of the PatternFly Empty State pattern - * https://www.patternfly.org/patterns/empty-state/ - * Special values for icon property: - * - 'waiting' - display spinner - * - 'error' - display error icon - */ -class Curtains extends React.Component { - render() { - var description = null; - if (this.props.description) - description =

{this.props.description}

; - - var message = null; - if (this.props.message) - message =

{this.props.message}

; - - var curtains = "curtains-ct"; - - var icon = this.props.icon; - if (icon == 'waiting') - icon =
; - else if (icon == 'error') - icon =
; - - return ( -
-
- {icon} -
- {description} - {message} -
- ); - } -} - -/* Component to show a dismissable error, message as child text - * dismissError callback function triggered when the close button is pressed - */ -class DismissableError extends React.Component { - constructor(props) { - super(props); - this.handleDismissError = this.handleDismissError.bind(this); - } - - handleDismissError(e) { - // only consider primary mouse button - if (!e || e.button !== 0) - return; - if (this.props.dismissError) - this.props.dismissError(); - e.stopPropagation(); - } - - render() { - return ( -
- - {this.props.children} - -
- ); - } -} - -/* Show subscriptions status of the system, offer to register/unregister the system - * Expected properties: - * status subscription status - * error error message to show (in Curtains if not connected, as a dismissable alert otherwise - * dismissError callback, triggered for the dismissable error in connected state - * register callback, triggered when user clicks on register - * unregister callback, triggered when user clicks on unregister - */ -class SubscriptionStatus extends React.Component { - constructor(props) { - super(props); - this.handleRegisterSystem = this.handleRegisterSystem.bind(this); - this.handleUnregisterSystem = this.handleUnregisterSystem.bind(this); - } - - handleRegisterSystem(e) { - // only consider primary mouse button - if (!e || e.button !== 0) - return; - this.props.register(); - e.stopPropagation(); - } - - handleUnregisterSystem(e) { - // only consider primary mouse button - if (!e || e.button !== 0) - return; - this.props.unregister(); - e.stopPropagation(); - } - - render() { - var errorMessage; - if (this.props.error) { - errorMessage = ( - {this.props.error} - ); - } - - var label; - var action; - var note; - var isUnregistering = (this.props.status == "unregistering"); - if (this.props.status == 'Unknown') { - label = ; - action = ( - ); - } else { - label = ; - action = ( - ); - if (isUnregistering) { - note = ( -
-
- { _("Unregistering system...") } -
- ); - } - } - return ( -
-

{_("Subscriptions")}

- {errorMessage} - {label} - {action} - {note} -
- ); - } -} - -/* Show subscriptions status of the system and registered products, offer to register/unregister the system - * Expected properties: - * status subscription status - * error error message to show (in Curtains if not connected, as a dismissable alert otherwise - * dismissError callback, triggered for the dismissable error in connected state - * products subscribed products (properties as in subscriptions-client) - * register callback, triggered when user clicks on register - * unregister callback, triggered when user clicks on unregister - */ -export class SubscriptionsPage extends React.Component { - constructor(props) { - super(props); - this.renderCurtains = this.renderCurtains.bind(this); - this.renderSubscriptions = this.renderSubscriptions.bind(this); - } - - renderCurtains() { - var icon; - var description; - var message; - if (this.props.status === undefined) { - icon =
; - message = _("Updating"); - description = _("Retrieving subscription status..."); - } else if (this.props.status == 'access-denied') { - icon = ; - message = _("Access denied"); - description = _("The current user isn't allowed to access system subscription status."); - } else { - icon = ; - message = _("Unable to connect"); - description = _("Couldn't get system subscription status. Please ensure subscription-manager is installed."); - } - return ( - - ); - } - - renderSubscriptions() { - var entries = this.props.products.map(function(itm) { - var tabRenderers = [ - { - name: _("Details"), - renderer: SubscriptionProductDetails, - data: itm, - }, - ]; - var columns = [ { name: itm.productName, 'header': true } ]; - return ; - }); - - return ( -
- - - {entries} - -
- ); - } - - render() { - if (this.props.status === undefined || - this.props.status == 'not-found' || - this.props.status == 'access-denied') { - return this.renderCurtains(); - } else { - return this.renderSubscriptions(); - } - } -} diff --git a/pkg/subscriptions/subscriptions.css b/pkg/subscriptions/subscriptions.css deleted file mode 100644 index ac2be3d10..000000000 --- a/pkg/subscriptions/subscriptions.css +++ /dev/null @@ -1,88 +0,0 @@ -/* - * This file is part of Cockpit. - * - * Copyright (C) 2013 Red Hat, Inc. - * - * Cockpit 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 2.1 of the License, or - * (at your option) any later version. - * - * Cockpit 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 Cockpit; If not, see . - */ - -@import "/page.css"; -@import "/table.css"; - -.subscription-status-ct label { - font-size: 13px; -} - -.subscription-status-ct button { - margin-left: 12px; -} - -.container-fluid.alert { - margin: 20px; -} - - -#subscription-register-url { - margin-bottom: 3px; -} - -#subscriptions-registering > span { - margin-left: 7px; -} - -.form-tr-ct-title { - text-align: right; - white-space: nowrap; - color: #888888; - width: 5px; /* will be expanded by nowrap */ - padding-right: 7px; -} - -.form-td-ct-subscriptions { - width: 80px; -} - -#subscription-proxy-use { - vertical-align: sub; -} - -.form-table-ct .form-inline { - background: #f4f4f4; - border-width: 1px; - border-style: solid; - border-color: #bababa; - padding: 4px; -} - -.form-group-ct { - background: #f4f4f4; - border-width: 1px; - border-style: solid; - border-color: #bababa; - padding: 4px; - width: 100%; -} - -.form-group-ct tr td:last-child { - padding-right: 4px; -} - -.form-group-ct tr:first-child td:last-child { - padding-top: 6px; -} - -.form-group-ct tr:last-child td:last-child { - padding-bottom: 6px; - padding-top:; -} diff --git a/tools/cockpit.spec b/tools/cockpit.spec index 05b8b97b7..5a4b98f4d 100644 --- a/tools/cockpit.spec +++ b/tools/cockpit.spec @@ -43,12 +43,6 @@ %define __lib lib -# on RHEL 7.x we build subscriptions; superseded later by -# external subscription-manager-cockpit -%if (0%{?rhel} >= 7 && 0%{?rhel} < 8) && 0%{?centos} == 0 -%define build_subscriptions 1 -%endif - %if 0%{?rhel} >= 7 %define vdo_on_demand 1 %endif @@ -121,9 +115,7 @@ Recommends: (cockpit-docker if /usr/bin/docker) Recommends: (cockpit-networkmanager if NetworkManager) Recommends: (cockpit-storaged if udisks2) Recommends: cockpit-packagekit -%if 0%{?rhel} >= 8 && 0%{?centos} == 0 Recommends: subscription-manager-cockpit -%endif Suggests: cockpit-pcp Suggests: cockpit-selinux %endif @@ -205,13 +197,6 @@ find %{buildroot}%{_datadir}/cockpit/kdump -type f >> kdump.list echo '%dir %{_datadir}/cockpit/sosreport' > sosreport.list find %{buildroot}%{_datadir}/cockpit/sosreport -type f >> sosreport.list -%if %{defined build_subscriptions} -echo '%dir %{_datadir}/cockpit/subscriptions' >> system.list -find %{buildroot}%{_datadir}/cockpit/subscriptions -type f >> system.list -%else -rm -rf %{buildroot}/%{_datadir}/cockpit/subscriptions -%endif - echo '%dir %{_datadir}/cockpit/storaged' > storaged.list find %{buildroot}%{_datadir}/cockpit/storaged -type f >> storaged.list @@ -411,10 +396,6 @@ Recommends: setroubleshoot-server >= 3.3.3 Provides: cockpit-selinux = %{version}-%{release} Provides: cockpit-sosreport = %{version}-%{release} %endif -%if %{defined build_subscriptions} -Provides: cockpit-subscriptions = %{version}-%{release} -Requires: subscription-manager >= 1.13 -%endif # NPM modules which are also available as packages Provides: bundled(js-jquery) = %{npm-version:jquery} Provides: bundled(js-moment) = %{npm-version:moment} diff --git a/tools/debian/rules b/tools/debian/rules index a8e2f6aa6..eac00215b 100755 --- a/tools/debian/rules +++ b/tools/debian/rules @@ -42,7 +42,7 @@ override_dh_install: dpkg-vendor --derives-from ubuntu || rm -r debian/tmp/usr/share/cockpit/branding/ubuntu # unpackaged modules - for m in kdump selinux subscriptions; do rm -r debian/tmp/usr/share/cockpit/$$m; done + for m in kdump selinux; do rm -r debian/tmp/usr/share/cockpit/$$m; done rm debian/tmp/usr/share/metainfo/org.cockpit-project.cockpit-kdump.metainfo.xml rm debian/tmp/usr/share/metainfo/org.cockpit-project.cockpit-selinux.metainfo.xml diff --git a/webpack.config.js b/webpack.config.js index 39a230f36..c3ee2b6bd 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -95,11 +95,6 @@ var info = { "storaged/devices.jsx" ], - "subscriptions/subscriptions": [ - "subscriptions/main.js", - "subscriptions/subscriptions.css", - ], - "systemd/services": [ "systemd/init.js", "systemd/services.css",