-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
257 additions
and
9 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "Launch Package", | ||
"type": "go", | ||
"request": "launch", | ||
"mode": "auto", | ||
"program": "${fileDirname}" | ||
} | ||
] | ||
} |
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
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
{ | ||
"singleQuote": true | ||
} | ||
} |
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
(function(window) { | ||
window["env"] = window["env"] || {}; | ||
(function (window) { | ||
window['env'] = window['env'] || {}; | ||
// Environment variables | ||
window["env"]["apiUrl"] = "${FACTORY_API_URL}"; | ||
window['env']['apiUrl'] = '${FACTORY_API_URL}'; | ||
})(this); |
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,116 @@ | ||
import { | ||
doGetConfig, | ||
doSaveConfig, | ||
doVerifyHub, | ||
doVerifyPersistence, | ||
doGetKerberosAgentTags, | ||
} from '../api/agent'; | ||
|
||
export const verifyPersistence = (config, onSuccess, onError) => { | ||
return function (dispatch) { | ||
doVerifyPersistence( | ||
config, | ||
() => { | ||
dispatch({ | ||
type: 'VERIFY_PERSISTENCE', | ||
}); | ||
if (onSuccess) { | ||
onSuccess(); | ||
} | ||
}, | ||
(error) => { | ||
const { data } = error.response.data; | ||
if (onError) { | ||
onError(data); | ||
} | ||
} | ||
); | ||
}; | ||
}; | ||
|
||
export const verifyHub = (config, onSuccess, onError) => { | ||
return function (dispatch) { | ||
doVerifyHub( | ||
config, | ||
() => { | ||
dispatch({ | ||
type: 'VERIFY_HUB', | ||
}); | ||
if (onSuccess) { | ||
onSuccess(); | ||
} | ||
}, | ||
(error) => { | ||
const { data } = error.response.data; | ||
if (onError) { | ||
onError(data); | ||
} | ||
} | ||
); | ||
}; | ||
}; | ||
|
||
export const getKerberosAgentTags = (onSuccess, onError) => { | ||
return function (dispatch) { | ||
doGetKerberosAgentTags( | ||
(data) => { | ||
dispatch({ | ||
type: 'GET_MACHINERY_TAGS', | ||
tags: data.data, | ||
}); | ||
if (onSuccess) { | ||
onSuccess(); | ||
} | ||
}, | ||
() => { | ||
if (onError) { | ||
onError(); | ||
} | ||
} | ||
); | ||
}; | ||
}; | ||
|
||
export const getConfig = (service, onSuccess, onError) => { | ||
return function (dispatch) { | ||
doGetConfig( | ||
service, | ||
(data) => { | ||
dispatch({ | ||
type: 'GET_CONFIG', | ||
data, | ||
}); | ||
if (onSuccess) { | ||
onSuccess(); | ||
} | ||
}, | ||
() => { | ||
if (onError) { | ||
onError(); | ||
} | ||
} | ||
); | ||
}; | ||
}; | ||
|
||
export const saveConfig = (service, config, onSuccess, onError) => { | ||
return function (dispatch) { | ||
doSaveConfig( | ||
service, | ||
config, | ||
() => { | ||
dispatch({ | ||
type: 'SAVE_CONTAINER', | ||
}); | ||
if (onSuccess) { | ||
onSuccess(); | ||
} | ||
}, | ||
() => { | ||
if (onError) { | ||
onError(); | ||
} | ||
} | ||
); | ||
}; | ||
}; |
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,92 @@ | ||
import API from './api'; | ||
|
||
export function doGetConfig(onSuccess, onError) { | ||
const endpoint = API.get(`config`); | ||
endpoint | ||
.then((res) => { | ||
if (res.status !== 200) { | ||
throw new Error(res.data); | ||
} | ||
return res.data; | ||
}) | ||
.then(function (data) { | ||
onSuccess(data); | ||
}) | ||
.catch(function (error) { | ||
onError(error); | ||
}); | ||
} | ||
|
||
export function doSaveConfig(config, onSuccess, onError) { | ||
const endpoint = API.post(`config`, { | ||
...config, | ||
}); | ||
endpoint | ||
.then((res) => { | ||
if (res.status !== 200) { | ||
throw new Error(res.data); | ||
} | ||
return res.data; | ||
}) | ||
.then(function (data) { | ||
onSuccess(data); | ||
}) | ||
.catch(function (error) { | ||
onError(error); | ||
}); | ||
} | ||
|
||
export function doGetKerberosAgentTags(onSuccess, onError) { | ||
const endpoint = API.get(`kerberos-agent/tags`); | ||
endpoint | ||
.then((res) => { | ||
if (res.status !== 200) { | ||
throw new Error(res.data); | ||
} | ||
return res.data; | ||
}) | ||
.then(function (data) { | ||
onSuccess(data); | ||
}) | ||
.catch(function (error) { | ||
onError(error); | ||
}); | ||
} | ||
|
||
export function doVerifyPersistence(config, onSuccess, onError) { | ||
const endpoint = API.post(`persistence/verify`, { | ||
...config, | ||
}); | ||
endpoint | ||
.then((res) => { | ||
if (res.status !== 200) { | ||
throw new Error(res.data); | ||
} | ||
return res.data; | ||
}) | ||
.then(function (data) { | ||
onSuccess(data); | ||
}) | ||
.catch(function (error) { | ||
onError(error); | ||
}); | ||
} | ||
|
||
export function doVerifyHub(config, onSuccess, onError) { | ||
const endpoint = API.post(`hub/verify`, { | ||
...config, | ||
}); | ||
endpoint | ||
.then((res) => { | ||
if (res.status !== 200) { | ||
throw new Error(res.data); | ||
} | ||
return res.data; | ||
}) | ||
.then(function (data) { | ||
onSuccess(data); | ||
}) | ||
.catch(function (error) { | ||
onError(error); | ||
}); | ||
} |
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