Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use storaged 2.0 #2308

Closed
wants to merge 14 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -120,3 +120,4 @@ org.freedesktop.UDisks2.h
/po/po.pl.js
/po/po.pl.js.gz
/shell.min.js.gz
/pkg/storaged/devices.min.html.gz
2 changes: 1 addition & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -240,10 +240,10 @@ include pkg/realmd/Makefile.am
include pkg/shell/Makefile.am
include pkg/subscriptions/Makefile.am
include pkg/systemd/Makefile.am
include pkg/storaged/Makefile.am
include src/bridge/Makefile.am
include src/common/Makefile-common.am
include src/legacy/Makefile.am
include src/legacy/lvm/Makefile.am
include src/websocket/Makefile-websocket.am
include tools/Makefile-tools.am
include src/ws/Makefile-ws.am
Expand Down
3 changes: 3 additions & 0 deletions pkg/base1/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ update-lib:: update-bower
$(srcdir)/tools/uglifyjs $(BOWER)/jquery-flot/jquery.flot.js > jquery.flot.min.js
$(srcdir)/tools/uglifyjs $(BOWER)/jquery-flot/jquery.flot.selection.js > jquery.flot.selection.min.js
$(srcdir)/tools/uglifyjs $(BOWER)/jquery-flot/jquery.flot.time.js > jquery.flot.time.min.js
$(srcdir)/tools/uglifyjs $(BOWER)/jquery-amend/jquery-amend.js > jquery-amend.min.js
sed -f $(srcdir)/tools/patternfly.sed \
$(BOWER)/patternfly/dist/css/patternfly.css > patternfly.css
$(JSMODULE) -o $(srcdir)/pkg/base1/jquery.js \
Expand All @@ -134,6 +135,7 @@ update-lib:: update-bower
$(BOWER)/jquery-flot/jquery.flot.js \
$(BOWER)/jquery-flot/jquery.flot.selection.js \
$(BOWER)/jquery-flot/jquery.flot.time.js \
$(BOWER)/jquery-amend/jquery-amend.js \
$(srcdir)/pkg/base1/jquery-scoped.js \
$(srcdir)/pkg/base1/attrchange.js
$(JSMODULE) -o $(srcdir)/pkg/base1/jquery.min.js \
Expand All @@ -146,6 +148,7 @@ update-lib:: update-bower
jquery.flot.min.js \
jquery.flot.selection.min.js \
jquery.flot.time.min.js \
jquery-amend.min.js \
$(srcdir)/pkg/base1/jquery-scoped.js \
$(srcdir)/pkg/base1/attrchange.min.js
$(srcdir)/tools/uglifyjs $(BOWER)/requirejs/require.js > require.min.js
Expand Down
78 changes: 78 additions & 0 deletions pkg/base1/jquery.js
Original file line number Diff line number Diff line change
Expand Up @@ -18801,6 +18801,84 @@ API.txt for details.

})(jQuery);

(function ($) {
"use strict";

function sync(output, input, depth) {
var na, nb, a, b, i;
var attrs, attr, seen;

if (depth > 0) {
if (output.nodeType != input.nodeType ||
output.nodeName != input.nodeName ||
(output.nodeType != 1 && output.nodeType != 3)) {
output.parentNode.replaceChild(input.parentNode.removeChild(input), output);
return;

} else if (output.nodeType == 3) {
if (output.nodeValue != input.nodeValue)
output.nodeValue = input.nodeValue;
return;
}
}

if (output.nodeType == 1) {

/* Sync attributes */
if (depth > 0) {
seen = { };
attrs = output.attributes;
for (i = attrs.length - 1; i >= 0; i--)
seen[attrs[i].name] = attrs[i].value;
for (i = input.attributes.length - 1; i >= 0; i--) {
attr = input.attributes[i];
if (seen[attr.name] !== attr.value)
output.setAttribute(attr.name, attr.value);
delete seen[attr.name];
}
for (i in seen)
output.removeAttribute(i);
}

/* Sync children */
na = output.firstChild;
nb = input.firstChild;
for(;;) {
a = na;
b = nb;
while (a && a.nodeType != 1 && a.nodeType != 3)
a = a.nextSibling;
while (b && b.nodeType != 1 && b.nodeType != 3)
b = b.nextSibling;
if (!a && !b) {
break;
} else if (!a) {
na = null;
nb = b.nextSibling;
output.appendChild(input.removeChild(b));
} else if (!b) {
na = a.nextSibling;
nb = null;
output.removeChild(a);
} else {
na = a.nextSibling;
nb = b.nextSibling;
sync(a, b, (depth || 0) + 1);
}
}
}
}

$.fn.amend = function amend(data, options) {
this.each(function() {
var el = $("<div>").html(data);
sync(this, el[0], 0);
});
return this;
};

}(jQuery));

(function(jq) {
"use strict";
jq.scoped = function scoped(/* ... */) {
Expand Down
3 changes: 3 additions & 0 deletions pkg/base1/jquery.min.js

Large diffs are not rendered by default.

3 changes: 0 additions & 3 deletions pkg/shell/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ shelldebug_DATA = \
pkg/shell/cockpit-cpu-status.js \
pkg/shell/cockpit-memory-status.js \
pkg/shell/cockpit-networking.js \
pkg/shell/cockpit-storage.js \
pkg/shell/cockpit-accounts.js \
pkg/shell/cockpit-docker.js \
$(NULL)
Expand Down Expand Up @@ -58,7 +57,6 @@ shell_SHELL = \
pkg/shell/cockpit-cpu-status.min.js \
pkg/shell/cockpit-memory-status.min.js \
pkg/shell/cockpit-networking.min.js \
pkg/shell/cockpit-storage.min.js \
pkg/shell/cockpit-accounts.min.js \
pkg/shell/cockpit-docker.min.js \
$(NULL)
Expand All @@ -72,7 +70,6 @@ shellimages_DATA = \
pkg/shell/images/server-small.png \
pkg/shell/images/server-error.png \
pkg/shell/images/dialog-error.png \
pkg/shell/images/storage-disk.png \
$(NULL)

pmlogconfdir = $(localstatedir)/lib/pcp/config/pmlogconf/tools
Expand Down
3 changes: 0 additions & 3 deletions pkg/shell/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -514,9 +514,6 @@ define([
} else if (component == "network/interfaces") {
component = "shell/shell";
hash = "/networking" + hash;
} else if (component == "storage/devices") {
component = "shell/shell";
hash = "/storage" + hash;
} else if (component == "users/local") {
component = "shell/shell";
if (options && options.id)
Expand Down
5 changes: 0 additions & 5 deletions pkg/shell/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@
"path": "network/interfaces",
"label": "Networking",
"order": 10
},
"_storage_": {
"path": "storage/devices",
"label": "Storage",
"order": 15
}
},

Expand Down
1 change: 0 additions & 1 deletion pkg/shell/shell.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
"shell/cockpit-plot",
"shell/cockpit-server",
"shell/cockpit-setup",
"shell/cockpit-storage",
"shell/cockpit-util",
], function(cockpit, shell) {

Expand Down
1 change: 1 addition & 0 deletions pkg/storage
63 changes: 63 additions & 0 deletions pkg/storaged/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
storageddir = $(pkgdatadir)/storage
storaged_DATA = \
pkg/storaged/bundle.min.js.gz \
pkg/storaged/devices.min.html.gz \
pkg/storaged/manifest.json \
pkg/storaged/storage.min.css.gz \
$(NULL)

storageddebugdir = $(DBGDIR)$(storageddir)
storageddebug_DATA = \
pkg/storaged/bundle.js \
pkg/storaged/details.js \
pkg/storaged/devices.html \
pkg/storaged/devices.js \
pkg/storaged/dialog.js \
pkg/storaged/client.js \
pkg/storaged/jobs.js \
pkg/storaged/overview.js \
pkg/storaged/permissions.js \
pkg/storaged/storage.css \
pkg/storaged/utils.js \
$(NULL)

storaged_BUNDLE = \
pkg/storaged/details.min.js \
pkg/storaged/devices.min.js \
pkg/storaged/dialog.min.js \
pkg/storaged/client.min.js \
pkg/storaged/jobs.min.js \
pkg/storaged/overview.min.js \
pkg/storaged/permissions.min.js \
pkg/storaged/utils.min.js \
$(NULL)

pkg/storaged/bundle.min.js: $(storaged_BUNDLE)
$(AM_V_GEN) $(srcdir)/tools/missing $(srcdir)/tools/jsbundle $@ $^

storagedimagesdir = $(pkgdatadir)/storage/images
storagedimages_DATA = \
pkg/storaged/images/storage-disk.png \
pkg/storaged/images/storage-array.png \
$(NULL)

storaged_TESTS = \
$(NULL)

TESTS += $(storaged_TESTS)

CLEANFILES += \
pkg/storaged/bundle.min.js \
pkg/storaged/devices.min.html \
$(storaged_BUNDLE) \
$(NULL)

EXTRA_DIST += \
pkg/storaged/bundle.min.js \
pkg/storaged/devices.min.html \
$(storaged_DATA) \
$(storageddebug_DATA) \
$(storagedimages_DATA) \
$(storaged_TESTS) \
$(storaged_BUNDLE) \
$(NULL)
1 change: 1 addition & 0 deletions pkg/storaged/bundle.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/* Empty. Replaced in production by a javascript bundle. */