save, but will need polish of nodejs integration when there are errors
This commit is contained in:
parent
25ae21c8e8
commit
fd7b407de4
4 changed files with 20 additions and 13 deletions
|
@ -848,7 +848,7 @@ void Application::parseCmdArgumentsFromMyInstance() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::onNodeJsPackageUpdateError(const QList<NodeJs::PackageMetadata>& pkgs, const QString& error) {
|
void Application::onNodeJsPackageUpdateError(const QList<NodeJs::PackageMetadata>& pkgs, const QString& error) {
|
||||||
qApp->showGuiMessage(Notification::Event::NodePackageUpdated,
|
qApp->showGuiMessage(Notification::Event::NodePackageFailedToUpdate,
|
||||||
{ {},
|
{ {},
|
||||||
tr("Packages %1 were NOT updated because of error: %3.").arg(NodeJs::packagesToString(pkgs),
|
tr("Packages %1 were NOT updated because of error: %3.").arg(NodeJs::packagesToString(pkgs),
|
||||||
error),
|
error),
|
||||||
|
|
|
@ -99,17 +99,24 @@ void NodeJs::installUpdatePackages(const QList<PackageMetadata>& pkgs) {
|
||||||
QStringList desc;
|
QStringList desc;
|
||||||
|
|
||||||
for (const PackageMetadata& mt : pkgs) {
|
for (const PackageMetadata& mt : pkgs) {
|
||||||
auto pkg_status = packageStatus(mt);
|
try {
|
||||||
|
auto pkg_status = packageStatus(mt);
|
||||||
|
|
||||||
switch (pkg_status) {
|
switch (pkg_status) {
|
||||||
case PackageStatus::NotInstalled:
|
case PackageStatus::NotInstalled:
|
||||||
case PackageStatus::OutOfDate:
|
case PackageStatus::OutOfDate:
|
||||||
to_install.append(mt);
|
to_install.append(mt);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
desc << QSL("%1@%2").arg(mt.m_name, mt.m_version);
|
desc << QSL("%1@%2").arg(mt.m_name, mt.m_version);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (const ApplicationException& ex) {
|
||||||
|
emit packageError(pkgs, ex.message());
|
||||||
|
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -64,6 +64,8 @@ class NodeJs : public QObject {
|
||||||
// NOTE: https://docs.npmjs.com/cli/v8/commands/npm-install
|
// NOTE: https://docs.npmjs.com/cli/v8/commands/npm-install
|
||||||
void installUpdatePackages(const QList<PackageMetadata>& pkgs);
|
void installUpdatePackages(const QList<PackageMetadata>& pkgs);
|
||||||
|
|
||||||
|
void installPackages(const QList<PackageMetadata>& pkgs);
|
||||||
|
|
||||||
static QString packagesToString(const QList<PackageMetadata>& pkgs);
|
static QString packagesToString(const QList<PackageMetadata>& pkgs);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
@ -71,8 +73,6 @@ class NodeJs : public QObject {
|
||||||
void packageInstalledUpdated(const QList<PackageMetadata>& pkgs, bool already_up_to_date);
|
void packageInstalledUpdated(const QList<PackageMetadata>& pkgs, bool already_up_to_date);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void installPackages(const QList<PackageMetadata>& pkgs);
|
|
||||||
|
|
||||||
Settings* m_settings;
|
Settings* m_settings;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -74,7 +74,7 @@ void Readability::makeHtmlReadable(const QString& html, const QString& base_url)
|
||||||
"You will be notified when installation is complete.").arg(QSL(APP_NAME)),
|
"You will be notified when installation is complete.").arg(QSL(APP_NAME)),
|
||||||
QSystemTrayIcon::MessageIcon::Information },
|
QSystemTrayIcon::MessageIcon::Information },
|
||||||
{ true, true, false });
|
{ true, true, false });
|
||||||
qApp->nodejs()->installUpdatePackages({ { QSL(READABILITY_PACKAGE), QSL(READABILITY_VERSION) } });
|
qApp->nodejs()->installPackages({ { QSL(READABILITY_PACKAGE), QSL(READABILITY_VERSION) } });
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Add table
Reference in a new issue