debian-mirror-gitlab/app/assets/javascripts/logs/stores/getters.js
2020-11-24 15:15:51 +05:30

21 lines
701 B
JavaScript

import { formatDate } from '../utils';
const mapTrace = ({ timestamp = null, pod = '', message = '' }) =>
[timestamp ? formatDate(timestamp) : '', pod, message].join(' | ');
export const trace = state => state.logs.lines.map(mapTrace).join('\n');
export const showAdvancedFilters = state => {
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,
);
return Boolean(managedApp?.enable_advanced_logs_querying);
};