This repository has been archived by the owner on Jul 22, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cluster refactor + Pods + Cluster status
- Loading branch information
Showing
33 changed files
with
405 additions
and
324 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
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 |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* | ||
Copyright 2015 Skippbox, Ltd | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
import alt from 'src/alt'; | ||
import ClustersApi from 'api/ClustersApi'; | ||
import PodsActions from 'actions/PodsActions'; | ||
import ServicesActions from 'actions/ServicesActions'; | ||
import ReplicationsActions from 'actions/ReplicationsActions'; | ||
|
||
class ClustersActions { | ||
|
||
constructor() { | ||
this.generateActions( | ||
'checkClusterStart', | ||
'checkClusterSuccess', | ||
'addCluster', | ||
'editCluster', | ||
'removeCluster', | ||
); | ||
} | ||
|
||
checkClusters() { | ||
return Promise.all(alt.stores.ClustersStore.getClusters().map(cluster => { | ||
return this.checkCluster(cluster); | ||
})); | ||
} | ||
|
||
checkCluster(cluster) { | ||
this.checkClusterStart(cluster); | ||
return ClustersApi.checkCluster(cluster).then(up => { | ||
this.checkClusterSuccess({cluster, up}); | ||
}); | ||
} | ||
|
||
fetchClusterEntities(cluster) { | ||
PodsActions.fetchPods.defer(cluster); | ||
ServicesActions.fetchServices.defer(cluster); | ||
ReplicationsActions.fetchReplications.defer(cluster); | ||
} | ||
} | ||
|
||
export default alt.createActions(ClustersActions); |
This file was deleted.
Oops, something went wrong.
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
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,46 @@ | ||
/* | ||
Copyright 2015 Skippbox, Ltd | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
import BaseApi from './BaseApi'; | ||
|
||
class ClustersApi { | ||
|
||
static checkCluster(cluster) { | ||
return BaseApi.get(`${cluster.get('url')}/api/v1`, {}, cluster) | ||
.then(() => Promise.resolve(true)) | ||
.catch(() => Promise.resolve(false)); | ||
} | ||
|
||
static fetchPods(cluster) { | ||
return BaseApi.get(`${cluster.get('url')}/api/v1/pods`, {}, cluster).then((response) => { | ||
return response.get('items'); | ||
}); | ||
} | ||
|
||
static fetchReplications(cluster) { | ||
return BaseApi.get(`${cluster.get('url')}/api/v1/replicationcontrollers`, {}, cluster).then((response) => { | ||
return response.get('items'); | ||
}); | ||
} | ||
|
||
static fetchServices(cluster) { | ||
return BaseApi.get(`${cluster.get('url')}/api/v1/services`, {}, cluster).then((response) => { | ||
return response.get('items'); | ||
}); | ||
} | ||
|
||
} | ||
|
||
export default ClustersApi; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.