Merged with latest and added some new dev dependencies for unit tests and flow language
This commit is contained in:
commit
a9a3c34358
10 changed files with 298 additions and 13 deletions
5
.gitignore
vendored
5
.gitignore
vendored
|
|
@ -1,4 +1,7 @@
|
||||||
*~
|
*~
|
||||||
*.retry
|
*.retry
|
||||||
node_modules/
|
node_modules/
|
||||||
build/
|
dist/
|
||||||
|
/.vagrant
|
||||||
|
lib/
|
||||||
|
testlib/
|
||||||
21
Makefile
Normal file
21
Makefile
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
all:
|
||||||
|
npm run build
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -rf dist/
|
||||||
|
rm -rf _install
|
||||||
|
|
||||||
|
install: all
|
||||||
|
mkdir -p /usr/share/cockpit
|
||||||
|
cp -r dist/ /usr/share/cockpit/subscription-manager
|
||||||
|
|
||||||
|
srpm: clean all
|
||||||
|
mkdir -p _install/usr/share/cockpit
|
||||||
|
cp -r dist/ _install/usr/share/cockpit/subscription-manager
|
||||||
|
mkdir -p _install/usr/share/metainfo/
|
||||||
|
cp *.metainfo.xml _install/usr/share/metainfo/
|
||||||
|
tar -C _install/ -czf subscription-manager-cockpit.tar.gz .
|
||||||
|
rpmbuild -bs \
|
||||||
|
--define "_sourcedir `pwd`" \
|
||||||
|
--define "_srcrpmdir `pwd`" \
|
||||||
|
subscription-manager-cockpit.spec
|
||||||
30
Vagrantfile
vendored
Normal file
30
Vagrantfile
vendored
Normal file
|
|
@ -0,0 +1,30 @@
|
||||||
|
Vagrant.configure(2) do |config|
|
||||||
|
config.vm.box = "fedora/25-cloud-base"
|
||||||
|
config.vm.network "forwarded_port", guest: 9090, host: 9090
|
||||||
|
|
||||||
|
if Dir.glob("dist/*").length == 0
|
||||||
|
config.vm.post_up_message = "NOTE: Distribution directory is empty. Run `make` to see your module show up in cockpit"
|
||||||
|
end
|
||||||
|
|
||||||
|
config.vm.synced_folder ".", "/vagrant", disabled: true
|
||||||
|
config.vm.synced_folder "dist/", "/usr/local/share/cockpit/" + File.basename(Dir.pwd), create: true
|
||||||
|
|
||||||
|
config.vm.provider "libvirt" do |libvirt|
|
||||||
|
libvirt.memory = 1024
|
||||||
|
end
|
||||||
|
|
||||||
|
config.vm.provider "virtualbox" do |virtualbox|
|
||||||
|
virtualbox.memory = 1024
|
||||||
|
end
|
||||||
|
|
||||||
|
config.vm.provision "shell", inline: <<-EOF
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
sudo dnf install -y cockpit
|
||||||
|
|
||||||
|
printf "[WebService]\nAllowUnencrypted=true\n" > /etc/cockpit/cockpit.conf
|
||||||
|
|
||||||
|
systemctl enable cockpit.socket
|
||||||
|
systemctl start cockpit.socket
|
||||||
|
EOF
|
||||||
|
end
|
||||||
15
org.cockpit-project.subscription-manager.metainfo.xml
Normal file
15
org.cockpit-project.subscription-manager.metainfo.xml
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
<component type="addon">
|
||||||
|
<id>org.cockpit-project.subscription-manager</id>
|
||||||
|
<metadata_license>CC0-1.0</metadata_license>
|
||||||
|
<name>Subscription Manager</name>
|
||||||
|
<summary>
|
||||||
|
Subscription Manager in Cockpit
|
||||||
|
</summary>
|
||||||
|
<description>
|
||||||
|
<p>
|
||||||
|
Manage subscriptions to a Candlepin backend, such as for Red Hat products.
|
||||||
|
</p>
|
||||||
|
</description>
|
||||||
|
<extends>cockpit.desktop</extends>
|
||||||
|
<launchable type="cockpit-package">subscription-manager-cockpit</launchable>
|
||||||
|
</component>
|
||||||
20
package.json
20
package.json
|
|
@ -7,17 +7,31 @@
|
||||||
"author": "",
|
"author": "",
|
||||||
"license": "LGPL-2.1",
|
"license": "LGPL-2.1",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "webpack"
|
"build": "webpack",
|
||||||
|
"flow-tests": "babel tests/ -d testlib/",
|
||||||
|
"flow-src": "babel src/ -d lib/"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"babel-cli": "^6.24.1",
|
||||||
"babel-core": "^6.25.0",
|
"babel-core": "^6.25.0",
|
||||||
"babel-loader": "^7.0.0",
|
"babel-loader": "^7.0.0",
|
||||||
"babel-plugin-transform-react-jsx": "^6.24.1",
|
"babel-plugin-transform-react-jsx": "^6.24.1",
|
||||||
"babel-preset-env": "^1.5.2",
|
"babel-preset-env": "^1.5.2",
|
||||||
|
"babel-preset-flow": "^6.23.0",
|
||||||
|
"copy-webpack-plugin": "~3.0.1",
|
||||||
|
"enzyme": "^2.9.1",
|
||||||
|
"eslint": "^3.0.0",
|
||||||
|
"eslint-loader": "~1.6.1",
|
||||||
|
"eslint-plugin-react": "~6.9.0",
|
||||||
|
"flow-bin": "^0.49.1",
|
||||||
|
"jshint": "~2.9.1",
|
||||||
|
"jshint-loader": "~0.8.3",
|
||||||
|
"react-test-renderer": "^15.6.1",
|
||||||
|
"tape": "^4.7.0",
|
||||||
"webpack": "^2.6.1"
|
"webpack": "^2.6.1"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"react": "^15.6.0",
|
"react": "^15.6.1",
|
||||||
"react-dom": "^15.6.0"
|
"react-dom": "^15.6.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
38
src/index.html
Normal file
38
src/index.html
Normal file
|
|
@ -0,0 +1,38 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<!--
|
||||||
|
This file is part of subscription-manager.
|
||||||
|
|
||||||
|
Copyright (C) 2017 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 subscription-manager; If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
-->
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<title translatable="yes">Subscriptions</title>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="description" content="">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="../base1/patternfly.css">
|
||||||
|
<link href="subscriptions.css" rel="stylesheet">
|
||||||
|
|
||||||
|
<script type="text/javascript" src="../base1/cockpit.js"></script>
|
||||||
|
<script type="text/javascript" src="../*/po.js"></script>
|
||||||
|
<script type="text/javascript" src="index.js"></script>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div id="app"></div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
24
src/index.js
24
src/index.js
|
|
@ -0,0 +1,24 @@
|
||||||
|
/*
|
||||||
|
* This file is part of Cockpit.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2017 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 subscription-manager; If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
var cockpit = require("cockpit");
|
||||||
|
|
||||||
|
document.addEventListener("DOMContentLoaded", function() {
|
||||||
|
console.log("subscription-manager loaded");
|
||||||
|
});
|
||||||
12
src/manifest.json
Normal file
12
src/manifest.json
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
{
|
||||||
|
"version": "0.1",
|
||||||
|
"requires": {
|
||||||
|
"cockpit": "137"
|
||||||
|
},
|
||||||
|
|
||||||
|
"tools": {
|
||||||
|
"index": {
|
||||||
|
"label": "subscription-manager"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
27
subscription-manager-cockpit.spec
Normal file
27
subscription-manager-cockpit.spec
Normal file
|
|
@ -0,0 +1,27 @@
|
||||||
|
Name: subscription-manager-cockpit
|
||||||
|
Version: 1
|
||||||
|
Release: 0
|
||||||
|
Summary: Subscription Manager Cockpit UI
|
||||||
|
License: LGPLv2.1+
|
||||||
|
|
||||||
|
Source: subscription-manager-cockpit.tar.gz
|
||||||
|
BuildArch: noarch
|
||||||
|
|
||||||
|
Requires: subscription-manager
|
||||||
|
|
||||||
|
%define debug_package %{nil}
|
||||||
|
|
||||||
|
%description
|
||||||
|
Subscription Manager Cockpit UI
|
||||||
|
|
||||||
|
%prep
|
||||||
|
|
||||||
|
%build
|
||||||
|
|
||||||
|
%install
|
||||||
|
mkdir -p %{buildroot}
|
||||||
|
tar --strip-components=1 -xzf %{sources} -C %{buildroot}
|
||||||
|
find %{buildroot} -type f >> files.list
|
||||||
|
sed -i "s|%{buildroot}||" *.list
|
||||||
|
|
||||||
|
%files -f files.list
|
||||||
|
|
@ -1,18 +1,119 @@
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
|
const copy = require("copy-webpack-plugin");
|
||||||
|
const fs = require("fs");
|
||||||
|
|
||||||
|
var externals = {
|
||||||
|
"cockpit": "cockpit",
|
||||||
|
};
|
||||||
|
|
||||||
|
/* These can be overridden, typically from the Makefile.am */
|
||||||
|
const srcdir = (process.env.SRCDIR || __dirname) + path.sep + "src";
|
||||||
|
const builddir = (process.env.SRCDIR || __dirname);
|
||||||
|
const distdir = builddir + path.sep + "dist";
|
||||||
|
const section = process.env.ONLYDIR || null;
|
||||||
|
|
||||||
|
var info = {
|
||||||
|
entries: {
|
||||||
|
"index": [
|
||||||
|
"./index.js"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
files: [
|
||||||
|
"index.html",
|
||||||
|
"manifest.json",
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
|
var output = {
|
||||||
|
path: distdir,
|
||||||
|
filename: "[name].js",
|
||||||
|
sourceMapFilename: "[file].map",
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Note that we're avoiding the use of path.join as webpack and nodejs
|
||||||
|
* want relative paths that start with ./ explicitly.
|
||||||
|
*
|
||||||
|
* In addition we mimic the VPATH style functionality of GNU Makefile
|
||||||
|
* where we first check builddir, and then srcdir.
|
||||||
|
*/
|
||||||
|
|
||||||
|
function vpath(/* ... */) {
|
||||||
|
var filename = Array.prototype.join.call(arguments, path.sep);
|
||||||
|
var expanded = builddir + path.sep + filename;
|
||||||
|
if (fs.existsSync(expanded))
|
||||||
|
return expanded;
|
||||||
|
expanded = srcdir + path.sep + filename;
|
||||||
|
return expanded;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Qualify all the paths in entries */
|
||||||
|
Object.keys(info.entries).forEach(function(key) {
|
||||||
|
if (section && key.indexOf(section) !== 0) {
|
||||||
|
delete info.entries[key];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
info.entries[key] = info.entries[key].map(function(value) {
|
||||||
|
if (value.indexOf("/") === -1)
|
||||||
|
return value;
|
||||||
|
else
|
||||||
|
return vpath(value);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
/* Qualify all the paths in files listed */
|
||||||
|
var files = [];
|
||||||
|
info.files.forEach(function(value) {
|
||||||
|
if (!section || value.indexOf(section) === 0)
|
||||||
|
files.push({ from: vpath("src", value), to: value });
|
||||||
|
});
|
||||||
|
info.files = files;
|
||||||
|
|
||||||
|
var plugins = [
|
||||||
|
new copy(info.files)
|
||||||
|
];
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
entry: ["./src/index.js"],
|
entry: info.entries,
|
||||||
output: {
|
externals: externals,
|
||||||
filename: "bundle.js",
|
output: output,
|
||||||
path: path.resolve(__dirname, "build")
|
|
||||||
},
|
|
||||||
module: {
|
module: {
|
||||||
rules: [
|
rules: [
|
||||||
|
{
|
||||||
|
enforce: 'pre',
|
||||||
|
exclude: /node_modules/,
|
||||||
|
loader: 'jshint-loader',
|
||||||
|
test: /\.js$/
|
||||||
|
},
|
||||||
|
{
|
||||||
|
enforce: 'pre',
|
||||||
|
exclude: /node_modules/,
|
||||||
|
loader: 'eslint-loader',
|
||||||
|
test: /\.jsx$/
|
||||||
|
},
|
||||||
|
{
|
||||||
|
enforce: 'pre',
|
||||||
|
exclude: /node_modules/,
|
||||||
|
loader: 'jshint-loader?esversion=6',
|
||||||
|
test: /\.es6$/
|
||||||
|
},
|
||||||
{
|
{
|
||||||
exclude: /node_modules/,
|
exclude: /node_modules/,
|
||||||
loader: 'babel-loader',
|
loader: 'babel-loader',
|
||||||
test: /\.js$/
|
test: /\.js$/
|
||||||
|
},
|
||||||
|
{
|
||||||
|
exclude: /node_modules/,
|
||||||
|
loader: 'babel-loader',
|
||||||
|
test: /\.jsx$/
|
||||||
|
},
|
||||||
|
{
|
||||||
|
exclude: /node_modules/,
|
||||||
|
loader: 'babel-loader',
|
||||||
|
test: /\.es6$/
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
},
|
||||||
|
plugins: plugins
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue