debian-mirror-gitlab/app/assets/javascripts/logs/stores/getters.js

22 lines
705 B
JavaScript
Raw Normal View History

2020-04-08 14:13:33 +05:30
import { formatDate } from '../utils';
2020-04-22 19:07:51 +05:30
const mapTrace = ({ timestamp = null, pod = '', message = '' }) =>
[timestamp ? formatDate(timestamp) : '', pod, message].join(' | ');
2020-04-08 14:13:33 +05:30
2021-03-08 18:12:59 +05:30
export const trace = (state) => state.logs.lines.map(mapTrace).join('\n');
2020-04-08 14:13:33 +05:30
2021-03-08 18:12:59 +05:30
export const showAdvancedFilters = (state) => {
2020-11-24 15:15:51 +05:30
if (state.environments.current) {
const environment = state.environments.options.find(
({ name }) => name === state.environments.current,
);
return Boolean(environment?.enable_advanced_logs_querying);
}
const managedApp = state.managedApps.options.find(
({ name }) => name === state.managedApps.current,
2020-04-22 19:07:51 +05:30
);
2020-11-24 15:15:51 +05:30
return Boolean(managedApp?.enable_advanced_logs_querying);
2020-04-22 19:07:51 +05:30
};