Skip to content

Commit

Permalink
Path part for Icinga api removed
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikWegner committed Nov 17, 2017
1 parent d7f6a80 commit 2bf80de
Show file tree
Hide file tree
Showing 9 changed files with 53 additions and 10 deletions.
2 changes: 1 addition & 1 deletion chrome/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

"manifest_version": 2,
"name": "imoin WebExtensions",
"version": "17.0.1",
"version": "17.1.0",

"description": "Monitor your icinga or nagios instance.",

Expand Down
2 changes: 1 addition & 1 deletion electron/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Imoin",
"version": "17.0.1",
"version": "17.1.0",
"description": "Monitor Icinga on your desktop",
"main": "requireInitElectron.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion firefox/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

"manifest_version": 2,
"name": "imoin WebExtensions",
"version": "17.0.1",
"version": "17.1.0",

"description": "Monitor your icinga or nagios instance.",

Expand Down
20 changes: 19 additions & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ gulp.task('chrome-package', [
.pipe(gulp.dest(targetpaths.target + '/artifacts/'));
});

// bump versions on package/bower/manifest
// bump versions on package/manifest
gulp.task('bump', function () {
// read version from package.json
var pkg = JSON.parse(fs.readFileSync('./package.json', 'utf8'));;
Expand All @@ -157,6 +157,24 @@ gulp.task('bump', function () {
.pipe(gulp.dest('./'));
});

// bump versions on package/manifest
gulp.task('bump-minor', function () {
// read version from package.json
var pkg = JSON.parse(fs.readFileSync('./package.json', 'utf8'));;
// increment version
var newVer = semver.inc(pkg.version, 'minor');

return gulp.src([
'./chrome/manifest.json',
'./firefox/manifest.json',
'./electron/package.json',
'./package.json'], { base: './' })
.pipe(bump({
version: newVer
}))
.pipe(gulp.dest('./'));
});

gulp.task('clean-firefox', ['firefox-setpaths'], function () {
return gulp.src(targetpaths.target, { read: false })
.pipe(clean());
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
{
"name": "imoin",
"version": "17.0.1",
"version": "17.1.0",
"description": "Icinga/Nagios status display",
"main": "",
"scripts": {
"test": "mocha -r ts-node/register test/**/*.ts",
"bump-version": "gulp bump",
"bump-version-minor": "gulp bump-minor",
"build:firefox": "gulp firefox",
"build:chrome": "gulp chrome",
"build:electron": "gulp electron",
Expand Down
12 changes: 12 additions & 0 deletions scripts/definitions/common-webextension/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ declare namespace WebExtension {
}

class Runtime {
onInstalled: InstalledEvent;
onConnect: RuntimeEvent;
connect(extensionId?: string, connectInfo? : {name?: string, includeTlsChannelId?: boolean}): Port;
openOptionsPage(): void;
Expand All @@ -37,6 +38,17 @@ declare namespace WebExtension {

}

interface InstalledEventDetails {
id? : string;
previousVersion?: string;
reason: string;
temporary: boolean;
}

class InstalledEvent {
addListener(callback: (details: InstalledEventDetails) => void): void;
}

class RuntimeEvent {
addListener(callback: (message?: any, sender?: MessageSender, sendResponse?: (response: any) => void) => void): void;
}
Expand Down
6 changes: 6 additions & 0 deletions scripts/firefox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ export class Firefox extends AbstractWebExtensionsEnvironment {
constructor() {
super();
browser.runtime.onConnect.addListener(this.connected.bind(this));
// temporary update notification
browser.runtime.onInstalled.addListener((details)=> {
if (details.reason === 'update') {
this.openWebPage('https://github.com/ErikWegner/imoin/releases/tag/17.1.0');
}
});
}

loadSettings(): Promise<Settings> {
Expand Down
14 changes: 10 additions & 4 deletions scripts/icingaapi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export interface IServiceJsonData {
export class IcingaApi extends AbstractMonitor {
handleUICommand(param: UICommand): void {
if (param.command == "recheck") {
let url = this.settings.url + "/api/v1/actions/reschedule-check";
let url = this.settings.url + "/v1/actions/reschedule-check";
let data = {
type: "Host",
force_check: true,
Expand All @@ -53,8 +53,8 @@ export class IcingaApi extends AbstractMonitor {
fetchStatus(): Promise<Monitor.MonitorData> {
return new Promise<Monitor.MonitorData>(
(resolve, reject) => {
const hosturl = this.settings.url + "/api/v1/objects/hosts?attrs=display_name&attrs=last_check_result";
const servicesurl = this.settings.url + "/api/v1/objects/services?attrs=display_name&attrs=last_check_result";
const hosturl = this.settings.url + "/v1/objects/hosts?attrs=display_name&attrs=last_check_result";
const servicesurl = this.settings.url + "/v1/objects/services?attrs=display_name&attrs=last_check_result";

const hostsrequest = this.environment.load(hosturl, this.settings.username, this.settings.password);
const servicesrequest = this.environment.load(servicesurl, this.settings.username, this.settings.password);
Expand All @@ -68,7 +68,13 @@ export class IcingaApi extends AbstractMonitor {
resolve(m);
})
.catch(a => {
resolve(Monitor.ErrorMonitorData("Connection error. Check settings and log. " + a[0] + "|" + a[1]));
let msg = "Connection error: ";
if (typeof a === "string") {
msg += a;
} else {
msg += 'Check settings and log.';
}
resolve(Monitor.ErrorMonitorData(msg));
})
}
);
Expand Down
2 changes: 1 addition & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ module.exports = {
},

// Source maps support ('inline-source-map' also works)
devtool: 'source-map',
devtool: 'inline-source-map',

// Add the loader for .ts files.
module: {
Expand Down

0 comments on commit 2bf80de

Please sign in to comment.