forked from spinnaker/deck
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(managed): add 'managedResources' data source
- Loading branch information
1 parent
4ed015a
commit efcceb3
Showing
4 changed files
with
57 additions
and
0 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
31 changes: 31 additions & 0 deletions
31
app/scripts/modules/core/src/managed/managed.dataSource.ts
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,31 @@ | ||
import { module, IQService } from 'angular'; | ||
|
||
import { SETTINGS } from 'core/config/settings'; | ||
import { ApplicationDataSourceRegistry } from 'core/application/service/ApplicationDataSourceRegistry'; | ||
import { Application } from 'core/application'; | ||
import { ManagedReader, IManagedApplicationSummary } from './ManagedReader'; | ||
|
||
export const MANAGED_RESOURCES_DATA_SOURCE = 'spinnaker.core.managed.dataSource'; | ||
module(MANAGED_RESOURCES_DATA_SOURCE, []).run([ | ||
'$q', | ||
($q: IQService) => { | ||
if (!SETTINGS.feature.managedResources) { | ||
return; | ||
} | ||
const loadManagedResources = (application: Application) => { | ||
return ManagedReader.getApplicationSummary(application.name); | ||
}; | ||
|
||
const addManagedResources = (_application: Application, data: IManagedApplicationSummary) => { | ||
return $q.when(data); | ||
}; | ||
|
||
ApplicationDataSourceRegistry.registerDataSource({ | ||
key: 'managedResources', | ||
visible: false, | ||
loader: loadManagedResources, | ||
onLoad: addManagedResources, | ||
defaultData: { hasManagedResources: false, resources: [] }, | ||
}); | ||
}, | ||
]); |