Resolve "Metrics drop down doesn't show all environment, some not clickable"
This commit is contained in:
parent
2f16eab03d
commit
236e752bfb
|
@ -1,7 +1,10 @@
|
|||
import _ from 'underscore';
|
||||
|
||||
function sortMetrics(metrics) {
|
||||
return _.chain(metrics).sortBy('title').sortBy('weight').value();
|
||||
return _.chain(metrics)
|
||||
.sortBy('title')
|
||||
.sortBy('weight')
|
||||
.value();
|
||||
}
|
||||
|
||||
function normalizeMetrics(metrics) {
|
||||
|
@ -39,7 +42,9 @@ export default class MonitoringStore {
|
|||
}
|
||||
|
||||
storeEnvironmentsData(environmentsData = []) {
|
||||
this.environmentsData = environmentsData;
|
||||
this.environmentsData = environmentsData.filter(
|
||||
environment => !!environment.latest.last_deployment,
|
||||
);
|
||||
}
|
||||
|
||||
getMetricsCount() {
|
||||
|
|
|
@ -6561,6 +6561,9 @@ export const environmentData = [
|
|||
folder_path: '/root/hello-prometheus/environments/folders/production',
|
||||
created_at: '2018-06-29T16:53:38.301Z',
|
||||
updated_at: '2018-06-29T16:57:09.825Z',
|
||||
last_deployment: {
|
||||
id: 127,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -6580,6 +6583,20 @@ export const environmentData = [
|
|||
folder_path: '/root/hello-prometheus/environments/folders/review',
|
||||
created_at: '2018-07-03T18:39:41.702Z',
|
||||
updated_at: '2018-07-03T18:44:54.010Z',
|
||||
last_deployment: {
|
||||
id: 128,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'no-deployment',
|
||||
size: 1,
|
||||
latest: {
|
||||
id: 36,
|
||||
name: 'no-deployment/noop-branch',
|
||||
state: 'available',
|
||||
created_at: '2018-07-04T18:39:41.702Z',
|
||||
updated_at: '2018-07-04T18:44:54.010Z',
|
||||
},
|
||||
},
|
||||
];
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import MonitoringStore from '~/monitoring/stores/monitoring_store';
|
||||
import MonitoringMock, { deploymentData } from './mock_data';
|
||||
import MonitoringMock, { deploymentData, environmentData } from './mock_data';
|
||||
|
||||
describe('MonitoringStore', function () {
|
||||
this.store = new MonitoringStore();
|
||||
|
@ -21,4 +21,9 @@ describe('MonitoringStore', function () {
|
|||
expect(this.store.deploymentData.length).toEqual(3);
|
||||
expect(typeof this.store.deploymentData[0]).toEqual('object');
|
||||
});
|
||||
|
||||
it('only stores environment data that contains deployments', () => {
|
||||
this.store.storeEnvironmentsData(environmentData);
|
||||
expect(this.store.environmentsData.length).toEqual(2);
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue