-
-
Notifications
You must be signed in to change notification settings - Fork 203
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
closes #42
- Loading branch information
Showing
5 changed files
with
81 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import ActuatorService from '@/services/actuator.service' | ||
import { AxiosInstance } from 'axios' | ||
import _Vue from 'vue' | ||
|
||
export default { | ||
install ( | ||
Vue: typeof _Vue, | ||
{ http }: { http: AxiosInstance }) { | ||
Vue.prototype.$actuator = new ActuatorService(http) | ||
} | ||
} | ||
|
||
declare module 'vue/types/vue' { | ||
interface Vue { | ||
$actuator: ActuatorService; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { AxiosInstance } from 'axios' | ||
|
||
const API_ACTUATOR = '/actuator' | ||
|
||
export default class ActuatorService { | ||
private http: AxiosInstance; | ||
|
||
constructor (http: AxiosInstance) { | ||
this.http = http | ||
} | ||
|
||
async getInfo (): Promise<ActuatorInfo> { | ||
try { | ||
return (await this.http.get(`${API_ACTUATOR}/info`)).data | ||
} catch (e) { | ||
let msg = 'An error occurred while trying to retrieve actuator info' | ||
if (e.response.data.message) { | ||
msg += `: ${e.response.data.message}` | ||
} | ||
throw new Error(msg) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
interface ActuatorInfo { | ||
git: ActuatorGit, | ||
build: ActuatorBuild | ||
} | ||
|
||
interface ActuatorGit { | ||
commit: ActuatorGitCommit, | ||
branch: string | ||
} | ||
|
||
interface ActuatorGitCommit { | ||
time: Date, | ||
id: string | ||
} | ||
|
||
interface ActuatorBuild { | ||
version: string, | ||
artifact: string, | ||
name: string, | ||
group: string, | ||
time: Date | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters