code stringlengths 1 1.05M | repo_name stringlengths 6 83 | path stringlengths 3 242 | language stringclasses 222
values | license stringclasses 20
values | size int64 1 1.05M |
|---|---|---|---|---|---|
import sessionStore from '@/stores/sessionStore'
import { createRouter, createWebHistory } from 'vue-router'
import settingsStore from './stores/settingsStore'
const routes = [
{
path: '/setup',
name: 'Setup',
component: () => import('@/setup/Setup.vue'),
meta: {
hideSidebar: true,
},
},
{
path: '/lo... | 2302_79757062/insights | frontend/src/router.ts | TypeScript | agpl-3.0 | 5,348 |
<script setup>
import settingsStore from '@/stores/settingsStore'
import { computed, markRaw, provide, reactive, ref } from 'vue'
import SetupQuestions from './SetupQuestions.vue'
import SourceConnectionStep from './SourceConnectionStep.vue'
import SourceTypeStep from './SourceTypeStep.vue'
import { useRouter } from 'v... | 2302_79757062/insights | frontend/src/setup/Setup.vue | Vue | agpl-3.0 | 4,166 |
<script setup>
import { inject, reactive, ref } from 'vue'
import { call } from 'frappe-ui'
const emit = defineEmits(['next', 'prev'])
const questions = reactive([
{
question: 'What type of data/database system(s) are you planning to connect with Insights?',
answerOptions: [
'I plan to connect to ERPNext',
... | 2302_79757062/insights | frontend/src/setup/SetupQuestions.vue | Vue | agpl-3.0 | 4,300 |
<script setup>
import { call } from 'frappe-ui'
import { inject, ref } from 'vue'
import FileSourceForm from '../datasource/FileSourceForm.vue'
import MariaDBForm from '../datasource/MariaDBForm.vue'
import PostgreSQLForm from '../datasource/PostgreSQLForm.vue'
import SampleDatasetList from '../datasource/SampleDataset... | 2302_79757062/insights | frontend/src/setup/SourceConnectionStep.vue | Vue | agpl-3.0 | 1,726 |
<script setup>
import { inject, reactive, ref } from 'vue'
const emit = defineEmits(['next'])
const selectedOption = ref(null)
const options = reactive([
{
title: 'ERPNext',
description: 'Connect to your ERPNext site',
img: 'ERPNextIcon.png',
},
{
title: 'MariaDB',
description: 'Connect to MariaDB databas... | 2302_79757062/insights | frontend/src/setup/SourceTypeStep.vue | Vue | agpl-3.0 | 2,812 |
import { io } from 'socket.io-client'
import { socketio_port } from '../../../../sites/common_site_config.json'
export function initSocket() {
let host = window.location.hostname
let siteName = import.meta.env.DEV ? host : window.site_name
let port = window.location.port ? `:${socketio_port}` : ''
let protocol = p... | 2302_79757062/insights | frontend/src/socket.js | JavaScript | agpl-3.0 | 495 |
import { DataSource } from '@/datasource/useDataSource'
import { DataSourceTable } from '@/datasource/useDataSourceTable'
import { defineStore } from 'pinia'
import { ref } from 'vue'
type DataSourceCache = Record<string, DataSource>
type TableCache = Record<string, DataSourceTable>
const useCacheStore = defineStore(... | 2302_79757062/insights | frontend/src/stores/cacheStore.ts | TypeScript | agpl-3.0 | 897 |
import * as api from '@/api'
import dayjs from '@/utils/dayjs'
import { defineStore } from 'pinia'
import { computed } from 'vue'
const useDataSourceStore = defineStore('insights:data_sources', () => {
const listResource = api.getListResource({
doctype: 'Insights Data Source',
cache: 'dataSourceList',
filters: ... | 2302_79757062/insights | frontend/src/stores/dataSourceStore.ts | TypeScript | agpl-3.0 | 2,253 |
import * as api from '@/api'
import dayjs from '@/utils/dayjs'
import { VALID_CHARTS } from '@/widgets/widgets'
import { defineStore } from 'pinia'
import { computed } from 'vue'
type QueryListItem = {
name: string
title: string
status: string
is_assisted_query: boolean
is_native_query: boolean
is_script_query: ... | 2302_79757062/insights | frontend/src/stores/queryStore.ts | TypeScript | agpl-3.0 | 3,679 |
import * as api from '@/api'
import { defineStore } from 'pinia'
import { computed, ref } from 'vue'
const emptyUser: SessionUser = {
email: '',
first_name: '',
last_name: '',
full_name: '',
user_image: '',
is_admin: false,
is_user: false,
country: '',
locale: 'en-US',
is_v2_user: false,
default_version: ''... | 2302_79757062/insights | frontend/src/stores/sessionStore.ts | TypeScript | agpl-3.0 | 2,478 |
import * as api from '@/api'
import { createToast } from '@/utils/toasts'
import { defineStore } from 'pinia'
import { computed } from 'vue'
type InsightsSettings = {
setup_complete: boolean
enable_permissions: boolean
allow_subquery: boolean
auto_execute_query: boolean
query_result_expiry: number
query_result_l... | 2302_79757062/insights | frontend/src/stores/settingsStore.ts | TypeScript | agpl-3.0 | 1,374 |
import { createResource, call } from 'frappe-ui'
import { reactive } from 'vue'
const subscription = reactive({
trialExpired: null,
fetchTrialStatus,
})
async function fetchTrialStatus() {
subscription.trialExpired = await call('insights.api.subscription.trial_expired')
return subscription.trialExpired
}
export ... | 2302_79757062/insights | frontend/src/subscription/index.js | JavaScript | agpl-3.0 | 627 |
export const COLOR_MAP = {
blue: '#318AD8',
pink: '#F683AE',
green: '#48BB74',
red: '#F56B6B',
yellow: '#FACF7A',
purple: '#44427B',
teal: '#5FD8C4',
orange: '#F8814F',
cyan: '#15CCEF',
grey: '#A6B1B9',
'#449CF0': '#449CF0',
'#ECAD4B': '#ECAD4B',
'#761ACB': '#761ACB',
'#CB2929': '#CB2929',
'#ED6396': '#E... | 2302_79757062/insights | frontend/src/utils/colors.ts | TypeScript | agpl-3.0 | 3,699 |
import { reactive } from 'vue'
import { useRouter } from 'vue-router'
const commandPalette = reactive({
isOpen: false,
commands: [],
open,
close,
search,
})
function open() {
commandPalette.isOpen = true
}
function close() {
commandPalette.isOpen = false
}
function search(searchTerm) {
return commandPalette.c... | 2302_79757062/insights | frontend/src/utils/commandPalette.js | JavaScript | agpl-3.0 | 1,325 |
import dayjs from 'dayjs'
import relativeTime from 'dayjs/esm/plugin/relativeTime'
import quarterOfYear from 'dayjs/esm/plugin/quarterOfYear'
import advancedFormat from 'dayjs/esm/plugin/advancedFormat'
import customParseFormat from 'dayjs/esm/plugin/customParseFormat'
dayjs.extend(relativeTime)
dayjs.extend(quarterOf... | 2302_79757062/insights | frontend/src/utils/dayjs.js | JavaScript | agpl-3.0 | 409 |
function toLogicalExpression(binaryExpression) {
// converts a binary expression with logical operators to a logical expression
// logical expression schema
// {
// type: "LogicalExpression",
// operator: "&&" | "||",
// conditions: [ left, right ]
// }
function isLogicalOperator(operator) {
return operato... | 2302_79757062/insights | frontend/src/utils/expressions/filter.js | JavaScript | agpl-3.0 | 3,143 |
import tokenize from '@/utils/expressions/tokenize'
import { TOKEN_TYPES } from '@/utils/expressions/tokenize'
const MAX_PRECEDENCE = 5
function getPrecedence(tokenType) {
switch (tokenType) {
case TOKEN_TYPES.NUMBER:
case TOKEN_TYPES.STRING:
case TOKEN_TYPES.COLUMN:
case TOKEN_TYPES.FUNCTION:
case TOKEN_T... | 2302_79757062/insights | frontend/src/utils/expressions/index.js | JavaScript | agpl-3.0 | 5,217 |
export const TOKEN_TYPES = {
EOF: 'EOF',
NUMBER: 'NUMBER',
OPEN_PARENTHESIS: 'OPEN_PARENTHESIS',
CLOSE_PARENTHESIS: 'CLOSE_PARENTHESIS',
OPERATOR_ADD: 'OPERATOR_ADD',
OPERATOR_SUB: 'OPERATOR_SUB',
OPERATOR_MUL: 'OPERATOR_MUL',
OPERATOR_DIV: 'OPERATOR_DIV',
OPERATOR_GT: 'OPERATOR_GT',
OPERATOR_LT: 'OPERATOR_LT... | 2302_79757062/insights | frontend/src/utils/expressions/tokenize.js | JavaScript | agpl-3.0 | 6,515 |
import dayjs from './dayjs'
export const dateFormats = [
{ label: 'January 12, 2020 1:14 PM', value: 'Minute' },
{ label: 'January 12, 2020 1:00 PM', value: 'Hour' },
{ label: '1:00 PM', value: 'Hour of Day' },
{ label: '12th January, 2020', value: 'Day' },
{ label: '12th Jan, 20', value: 'Day Short' },
{ label:... | 2302_79757062/insights | frontend/src/utils/format.js | JavaScript | agpl-3.0 | 1,389 |
import sessionStore from '@/stores/sessionStore'
import { createToast } from '@/utils/toasts'
import { watchDebounced } from '@vueuse/core'
import domtoimage from 'dom-to-image'
import { call } from 'frappe-ui'
import {
Baseline,
Calendar,
CalendarClock,
Clock,
Hash,
ShieldQuestion,
ToggleLeft,
Type,
} from 'lu... | 2302_79757062/insights | frontend/src/utils/index.js | JavaScript | agpl-3.0 | 13,393 |
import { reactive } from 'vue'
let prompt = reactive({
show: false,
options: {},
})
export default function usePrompt() {
return prompt
}
export function showPrompt(promptOptions) {
prompt.show = true
prompt.options = {
title: promptOptions.title,
message: promptOptions.message,
icon: promptOptions.icon,
... | 2302_79757062/insights | frontend/src/utils/prompt.js | JavaScript | agpl-3.0 | 647 |
import { FIELDTYPES, isEqual, safeJSONParse } from '@/utils'
import { useStorage } from '@vueuse/core'
import { computed, watch } from 'vue'
export function useQueryColumns(query) {
const data = computed(() =>
query.doc?.columns.map((column) => {
return {
...column,
format_option: column.format_option ? ... | 2302_79757062/insights | frontend/src/utils/query/columns.js | JavaScript | agpl-3.0 | 2,155 |
import { FIELDTYPES, safeJSONParse } from '@/utils'
import { convertIntoQueryFilters } from '@/utils/expressions/filter'
import { getColumn } from '@/utils/query/columns'
import { computed, reactive } from 'vue'
const DEFAULT_FILTERS = {
type: 'LogicalExpression',
level: 1,
position: 1,
operator: '&&',
conditions... | 2302_79757062/insights | frontend/src/utils/query/filters.js | JavaScript | agpl-3.0 | 7,170 |
export const FUNCTIONS = {
// Comparison Operators
in: {
syntax: 'in(column_name, "value1", "value2", ...)',
description: 'Checks if column contains any of the provided values.',
example: 'in(`order.status`, "Closed", "Resolved")',
returnType: 'boolean',
},
not_in: {
syntax: 'not_in(column_name, "value1",... | 2302_79757062/insights | frontend/src/utils/query/index.js | JavaScript | agpl-3.0 | 7,427 |
import { FIELDTYPES, safeJSONParse } from '@/utils'
import { getFormattedDate } from '../format'
function applyColumnFormatOption(formatOption, cell) {
if (!formatOption) return cell
if (formatOption.prefix) {
return `${formatOption.prefix} ${cell}`
}
if (formatOption.suffix) {
return `${cell} ${formatOption.s... | 2302_79757062/insights | frontend/src/utils/query/results.js | JavaScript | agpl-3.0 | 1,277 |
import { safeJSONParse } from '@/utils'
import { computed } from 'vue'
export function useQueryTables(query) {
query.fetchTables.submit()
const data = computed(() =>
query.doc?.tables.map((table) => {
return {
...table,
value: table.table,
join: table.join ? safeJSONParse(table.join) : null,
}
... | 2302_79757062/insights | frontend/src/utils/query/tables.js | JavaScript | agpl-3.0 | 1,817 |
import { ref, unref, reactive, computed } from 'vue'
export default function useResizer({
handle,
target,
direction,
limits,
inverse,
disabled,
start,
stop,
onResize,
}) {
const isDragging = ref(false)
const startX = ref(0)
const startY = ref(0)
const state = reactive({
startWidth: 0,
startHeight: 0,... | 2302_79757062/insights | frontend/src/utils/resizer.js | JavaScript | agpl-3.0 | 2,138 |
import { createDocumentResource } from 'frappe-ui'
const resource = createDocumentResource({
doctype: 'System Settings',
name: 'System Settings',
auto: false,
})
export default resource
| 2302_79757062/insights | frontend/src/utils/systemSettings.js | JavaScript | agpl-3.0 | 191 |
import { useStorage } from '@/vueuse/core'
import { call } from 'frappe-ui'
import '../../../frappe/public/js/lib/posthog.js'
const APP = 'insights'
const SITENAME = window.location.hostname
const telemetry = useStorage('insights:telemetry', {
enabled: false,
project_id: undefined,
telemetry_host: undefined,
})
a... | 2302_79757062/insights | frontend/src/utils/telemetry.js | JavaScript | agpl-3.0 | 1,456 |
import Toast from '@/components/Toast.vue'
import { h, markRaw } from 'vue'
import { toast } from 'vue-sonner'
export function createToast(toastOptions) {
const options = {}
if (toastOptions.message && toastOptions.title) {
options.message = toastOptions.message
options.title = toastOptions.title
} else if (toa... | 2302_79757062/insights | frontend/src/utils/toasts.js | JavaScript | agpl-3.0 | 844 |
export const slideDownTransition = {
enterActiveClass: 'transition duration-200 ease-out',
leaveActiveClass: 'transition duration-150 ease-in',
enterFromClass: 'translate-y-1 opacity-0',
enterToClass: 'translate-y-0 opacity-100',
leaveFromClass: 'translate-y-0 opacity-100',
leaveToClass: 'translate-y-1 opacity-0'... | 2302_79757062/insights | frontend/src/utils/transitions.js | JavaScript | agpl-3.0 | 650 |
import { reactive, computed } from 'vue'
import { createDocumentResource, createResource, debounce } from 'frappe-ui'
import { showPrompt } from './prompt'
import { useUsers } from './useUsers'
const users = useUsers()
const teamListResource = createResource(
'insights.insights.doctype.insights_team.insights_team_cli... | 2302_79757062/insights | frontend/src/utils/useTeams.js | JavaScript | agpl-3.0 | 3,327 |
import { reactive, computed } from 'vue'
import { createResource } from 'frappe-ui'
const userListResource = createResource('insights.api.user.get_users')
const addUserResource = createResource({
url: 'insights.api.user.add_insights_user',
})
export function useUsers() {
const users = reactive({
list: computed(()... | 2302_79757062/insights | frontend/src/utils/useUsers.js | JavaScript | agpl-3.0 | 602 |
<script setup>
import Autocomplete from '@/components/Controls/Autocomplete.vue'
import ColorPalette from '@/components/Controls/ColorPalette.vue'
import DraggableList from '@/components/DraggableList.vue'
import DraggableListItemMenu from '@/components/DraggableListItemMenu.vue'
import { FIELDTYPES } from '@/utils'
im... | 2302_79757062/insights | frontend/src/widgets/AxisChart/AxisChartOptions.vue | Vue | agpl-3.0 | 4,505 |
import { formatNumber, getShortNumber, ellipsis } from '@/utils'
import { getColors as getDefaultColors } from '@/utils/colors'
import { graphic } from 'echarts/core'
export default function getAxisChartOptions({ chartType, options, data }) {
const xAxisColumns = getXAxisColumns(options, data)
const xAxisValues = ge... | 2302_79757062/insights | frontend/src/widgets/AxisChart/getAxisChartOptions.js | JavaScript | agpl-3.0 | 7,138 |
<script setup>
import BaseChart from '@/components/Charts/BaseChart.vue'
import { computed } from 'vue'
import getAxisChartOptions from '../AxisChart/getAxisChartOptions'
import getBarChartOptions from './getBarChartOptions'
const props = defineProps({
data: { type: Object, required: true },
options: { type: Object,... | 2302_79757062/insights | frontend/src/widgets/Bar/Bar.vue | Vue | agpl-3.0 | 592 |
<script setup>
import AxisChartOptions from '@/widgets/AxisChart/AxisChartOptions.vue'
const options = defineModel()
const props = defineProps({
columns: { type: Array, required: true },
})
</script>
<template>
<div class="space-y-4">
<AxisChartOptions seriesType="bar" v-model:options="options" :columns="props.co... | 2302_79757062/insights | frontend/src/widgets/Bar/BarOptions.vue | Vue | agpl-3.0 | 605 |
import { formatNumber } from '@/utils'
import { getColors } from '@/utils/colors'
import { inject } from 'vue'
export default function getBarChartOptions(labels, datasets, options) {
const $utils = inject('$utils')
if (!labels?.length || !datasets?.length) {
return {}
}
const markLine = options.referenceLine
... | 2302_79757062/insights | frontend/src/widgets/Bar/getBarChartOptions.js | JavaScript | agpl-3.0 | 2,161 |
<script setup>
import SimpleFilter from '@/dashboard/SimpleFilter.vue'
import { computed, inject, provide } from 'vue'
const props = defineProps({
item_id: { required: true },
options: { type: Object, required: true },
})
provide('item_id', props.item_id)
const dashboard = inject('dashboard')
const filterState = co... | 2302_79757062/insights | frontend/src/widgets/Filter/Filter.vue | Vue | agpl-3.0 | 848 |
<script setup>
import { getQueriesColumn, getQueryColumns } from '@/dashboard/useDashboards'
import FilterValueSelector from '@/query/visual/FilterValueSelector.vue'
import { getOperatorOptions } from '@/utils'
import { computed, inject, reactive, ref, watch } from 'vue'
const emit = defineEmits(['update:modelValue'])... | 2302_79757062/insights | frontend/src/widgets/Filter/FilterOptions.vue | Vue | agpl-3.0 | 6,002 |
<script setup>
import BaseChart from '@/components/Charts/BaseChart.vue'
import { computed } from 'vue'
import getFunnelChartOptions from './getFunnelChartOptions'
const props = defineProps({
data: { type: Object, required: true },
options: { type: Object, required: true },
})
const labels = computed(() => {
if (!... | 2302_79757062/insights | frontend/src/widgets/Funnel/Funnel.vue | Vue | agpl-3.0 | 855 |
<script setup>
import ColorPalette from '@/components/Controls/ColorPalette.vue'
import { FIELDTYPES } from '@/utils'
import { computed } from 'vue'
const emit = defineEmits(['update:modelValue'])
const props = defineProps({
modelValue: { type: Object, required: true },
columns: { type: Array, required: true },
})
... | 2302_79757062/insights | frontend/src/widgets/Funnel/FunnelOptions.vue | Vue | agpl-3.0 | 1,575 |
import { formatNumber } from '@/utils'
import { getColors } from '@/utils/colors'
export default function getFunnelChartOptions(labels, dataset, options) {
if (!labels?.length || !dataset?.data?.length) {
return {}
}
const colors = options.colors?.length ? [...options.colors, ...getColors()] : getColors()
retu... | 2302_79757062/insights | frontend/src/widgets/Funnel/getFunnelChartOptions.js | JavaScript | agpl-3.0 | 1,687 |
<script setup>
const props = defineProps({
icon: { type: String, default: 'alert-triangle' },
iconClass: { type: String, default: 'text-yellow-400' },
title: { type: String, required: true, default: 'Invalid Widget' },
message: {
type: String,
default: 'Remove this widget and try adding a new one.',
},
})
</sc... | 2302_79757062/insights | frontend/src/widgets/InvalidWidget.vue | Vue | agpl-3.0 | 649 |
<script setup>
import BaseChart from '@/components/Charts/BaseChart.vue'
import { computed } from 'vue'
import getAxisChartOptions from '../AxisChart/getAxisChartOptions'
import getLineChartOptions from './getLineChartOptions'
const props = defineProps({
data: { type: Object, required: true },
options: { type: Objec... | 2302_79757062/insights | frontend/src/widgets/Line/Line.vue | Vue | agpl-3.0 | 597 |
<script setup>
import AxisChartOptions from '@/widgets/AxisChart/AxisChartOptions.vue'
const options = defineModel()
const props = defineProps({
columns: { type: Array, required: true },
})
</script>
<template>
<div class="space-y-4">
<AxisChartOptions seriesType="line" v-model:options="options" :columns="props.c... | 2302_79757062/insights | frontend/src/widgets/Line/LineOptions.vue | Vue | agpl-3.0 | 706 |
import { formatNumber } from '@/utils'
import { getColors } from '@/utils/colors'
import { graphic } from 'echarts/core'
import { inject } from 'vue'
import { getShortNumber } from '@/utils'
export default function getLineChartOptions(labels, datasets, options) {
if (!datasets || !datasets.length) {
return {}
}
... | 2302_79757062/insights | frontend/src/widgets/Line/getLineChartOptions.js | JavaScript | agpl-3.0 | 2,254 |
<script setup>
import BaseChart from '@/components/Charts/BaseChart.vue'
import { computed } from 'vue'
import getAxisChartOptions from '../AxisChart/getAxisChartOptions'
import getMixedAxisChartOptions from './getMixedAxisChartOptions'
const props = defineProps({
data: { type: Object, required: true },
options: { t... | 2302_79757062/insights | frontend/src/widgets/MixedAxis/MixedAxis.vue | Vue | agpl-3.0 | 620 |
<script setup>
import AxisChartOptions from '@/widgets/AxisChart/AxisChartOptions.vue'
const options = defineModel()
const props = defineProps({
columns: { type: Array, required: true },
})
</script>
<template>
<div class="space-y-4">
<AxisChartOptions v-model:options="options" :columns="props.columns" />
</div>... | 2302_79757062/insights | frontend/src/widgets/MixedAxis/MixedAxisOptions.vue | Vue | agpl-3.0 | 333 |
import { formatNumber, getShortNumber } from '@/utils'
import { getColors } from '@/utils/colors'
export default function getMixedAxisChartOptions(labels, datasets, options) {
if (!datasets || !datasets.length) {
return {}
}
const markLine = options.referenceLine
? {
data: [
{
name: options.refe... | 2302_79757062/insights | frontend/src/widgets/MixedAxis/getMixedAxisChartOptions.js | JavaScript | agpl-3.0 | 2,349 |
<script setup>
import { computed, inject } from 'vue'
const $utils = inject('$utils')
const props = defineProps({
data: { type: Object, required: true },
options: { type: Object, required: true },
})
const formattedValue = computed(() => {
if (!props.data?.length) return
if (!props.options.column) return
const _... | 2302_79757062/insights | frontend/src/widgets/Number/Number.vue | Vue | agpl-3.0 | 1,229 |
<script setup>
import { FIELDTYPES } from '@/utils'
import { computed } from 'vue'
const emit = defineEmits(['update:modelValue'])
const props = defineProps({
modelValue: { type: Object, required: true },
columns: { type: Array, required: true },
})
const options = computed({
get: () => props.modelValue,
set: (va... | 2302_79757062/insights | frontend/src/widgets/Number/NumberOptions.vue | Vue | agpl-3.0 | 1,615 |
<script setup>
import BaseChart from '@/components/Charts/BaseChart.vue'
import { computed } from 'vue'
import getPieChartOptions from './getPieChartOptions'
const props = defineProps({
data: { type: Object, required: true },
options: { type: Object, required: true },
})
const labels = computed(() => {
if (!props.... | 2302_79757062/insights | frontend/src/widgets/Pie/Pie.vue | Vue | agpl-3.0 | 840 |
<script setup>
import ColorPalette from '@/components/Controls/ColorPalette.vue'
import { FIELDTYPES } from '@/utils'
import { computed } from 'vue'
const emit = defineEmits(['update:modelValue'])
const props = defineProps({
modelValue: { type: Object, required: true },
columns: { type: Array, required: true },
})
... | 2302_79757062/insights | frontend/src/widgets/Pie/PieOptions.vue | Vue | agpl-3.0 | 2,119 |
import { ellipsis, formatNumber } from '@/utils'
import { getColors } from '@/utils/colors'
export default function getPieChartOptions(labels, dataset, options) {
const MAX_SLICES = 9
if (!labels?.length || !dataset?.data?.length) {
return {}
}
const colors = options.colors?.length ? [...options.colors, ...get... | 2302_79757062/insights | frontend/src/widgets/Pie/getPieChartOptions.js | JavaScript | agpl-3.0 | 3,783 |
<script setup>
import ChartTitle from '@/components/Charts/ChartTitle.vue'
import TanstackTable from '@/components/Table/TanstackTable.vue'
import { watchDebounced } from '@vueuse/core'
import { call } from 'frappe-ui'
import { computed, ref, watch } from 'vue'
import { convertToNestedObject, convertToTanstackColumns }... | 2302_79757062/insights | frontend/src/widgets/PivotTable/PivotTable.vue | Vue | agpl-3.0 | 2,265 |
<script setup>
import { computed } from 'vue'
import DraggableList from '@/components/DraggableList.vue'
const emit = defineEmits(['update:modelValue'])
const props = defineProps({
modelValue: { type: Object, required: true },
columns: { type: Array, required: true },
})
const options = computed({
get: () => props... | 2302_79757062/insights | frontend/src/widgets/PivotTable/PivotTableOptions.vue | Vue | agpl-3.0 | 2,617 |
import { getFormattedCell } from '@/components/Table/utils'
import { formatNumber } from '@/utils'
import { createColumnHelper } from '@tanstack/vue-table'
/**
* A recursive function to convert a flat dict to a nested dict
* Input: {
* "Date": "2018-01-01",
* "OK___No___Price": 100,
* "OK___No___Quantity": 10,
... | 2302_79757062/insights | frontend/src/widgets/PivotTable/utils.js | JavaScript | agpl-3.0 | 2,769 |
<script setup>
import { getShortNumber } from '@/utils'
import { computed } from 'vue'
const props = defineProps({
data: { type: Object, required: true },
options: { type: Object, required: true },
})
const progress = computed(() => {
if (!props.options.progress) return 0
return props.data.reduce((acc, row) => ac... | 2302_79757062/insights | frontend/src/widgets/Progress/Progress.vue | Vue | agpl-3.0 | 1,942 |
<script setup>
import InputWithTabs from '@/components/Controls/InputWithTabs.vue'
import { FIELDTYPES } from '@/utils'
import { computed } from 'vue'
const emit = defineEmits(['update:modelValue'])
const props = defineProps({
modelValue: { type: Object, required: true },
columns: { type: Array, required: true },
})... | 2302_79757062/insights | frontend/src/widgets/Progress/ProgressOptions.vue | Vue | agpl-3.0 | 2,381 |
<script setup>
import BaseChart from '@/components/Charts/BaseChart.vue'
import { computed } from 'vue'
import getAxisChartOptions from '../AxisChart/getAxisChartOptions'
const props = defineProps({
data: { type: Object, required: true },
options: { type: Object, required: true },
})
const rowChartOptions = compute... | 2302_79757062/insights | frontend/src/widgets/Row/Row.vue | Vue | agpl-3.0 | 1,021 |
<script setup>
import AxisChartOptions from '@/widgets/AxisChart/AxisChartOptions.vue'
const options = defineModel()
const props = defineProps({
columns: { type: Array, required: true },
})
</script>
<template>
<div class="space-y-4">
<AxisChartOptions seriesType="bar" v-model:options="options" :columns="props.co... | 2302_79757062/insights | frontend/src/widgets/Row/RowOptions.vue | Vue | agpl-3.0 | 476 |
import { formatNumber } from '@/utils'
import { getColors } from '@/utils/colors'
import { inject } from 'vue'
export default function getBarChartOptions(labels, datasets, options) {
const axes = [
{
type: 'category',
data: options.invertAxis ? labels.reverse() : labels,
axisTick: false,
axisLabel: {
... | 2302_79757062/insights | frontend/src/widgets/Row/getRowChartOptions.js | JavaScript | agpl-3.0 | 1,828 |
<script setup>
import BaseChart from '@/components/Charts/BaseChart.vue'
import { computed } from 'vue'
import getScatterChartOptions from './getScatterChartOptions'
import getAxisChartOptions from '../AxisChart/getAxisChartOptions'
const props = defineProps({
data: { type: Object, required: true },
options: { type:... | 2302_79757062/insights | frontend/src/widgets/Scatter/Scatter.vue | Vue | agpl-3.0 | 612 |
<script setup>
import ColorPalette from '@/components/Controls/ColorPalette.vue'
import AxisChartOptions from '@/widgets/AxisChart/AxisChartOptions.vue'
const emit = defineEmits(['update:modelValue'])
const options = defineModel()
const props = defineProps({
columns: { type: Array, required: true },
})
</script>
<te... | 2302_79757062/insights | frontend/src/widgets/Scatter/ScatterOptions.vue | Vue | agpl-3.0 | 447 |
import { formatNumber } from '@/utils'
import { getColors } from '@/utils/colors'
import { inject } from 'vue'
export default function getScatterChartOptions(labels, datasets, options) {
const $utils = inject('$utils')
if (!labels?.length || !datasets?.length) {
return {}
}
const colors = options.colors?.lengt... | 2302_79757062/insights | frontend/src/widgets/Scatter/getScatterChartOptions.js | JavaScript | agpl-3.0 | 1,427 |
<script setup>
import ColorInput from '@/components/Controls/ColorInput.vue'
import { computed } from 'vue'
const emit = defineEmits(['update:modelValue'])
const props = defineProps({
modelValue: { required: true },
seriesType: { type: String },
})
const series = computed({
get: () => props.modelValue,
set: (value... | 2302_79757062/insights | frontend/src/widgets/SeriesOption.vue | Vue | agpl-3.0 | 1,115 |
<script setup>
import ChartTitle from '@/components/Charts/ChartTitle.vue'
import TanstackTable from '@/components/Table/TanstackTable.vue'
import { getCellComponent } from '@/components/Table/utils'
import { formatNumber } from '@/utils'
import { computed } from 'vue'
const props = defineProps({
data: { type: Object... | 2302_79757062/insights | frontend/src/widgets/Table/Table.vue | Vue | agpl-3.0 | 2,418 |
<script setup>
import { FIELDTYPES } from '@/utils'
import { dateFormats } from '@/utils/format'
import { computed } from 'vue'
const props = defineProps({
modelValue: { type: Object, required: true },
column: { type: Object, required: true },
})
if (!props.modelValue.column_type) {
props.modelValue.column_type = ... | 2302_79757062/insights | frontend/src/widgets/Table/TableColumnOptions.vue | Vue | agpl-3.0 | 2,346 |
<script setup>
import Autocomplete from '@/components/Controls/Autocomplete.vue'
import DraggableList from '@/components/DraggableList.vue'
import DraggableListItemMenu from '@/components/DraggableListItemMenu.vue'
import { computed } from 'vue'
import TableColumnOptions from './TableColumnOptions.vue'
const emit = d... | 2302_79757062/insights | frontend/src/widgets/Table/TableOptions.vue | Vue | agpl-3.0 | 2,844 |
<script setup>
import { TextEditor } from 'frappe-ui'
import { inject } from 'vue'
const props = defineProps({
item_id: { required: true },
options: { type: Object, required: true },
})
const dashboard = inject('dashboard')
</script>
<template>
<div
v-if="options.markdown"
class="relative flex h-full w-full ite... | 2302_79757062/insights | frontend/src/widgets/Text/Text.vue | Vue | agpl-3.0 | 760 |
<script setup>
import { TextEditor } from 'frappe-ui'
import { computed } from 'vue'
const emit = defineEmits(['update:modelValue'])
const props = defineProps({
modelValue: { type: Object, required: true },
})
const options = computed({
get() {
return props.modelValue
},
set(value) {
emit('update:modelValue',... | 2302_79757062/insights | frontend/src/widgets/Text/TextOptions.vue | Vue | agpl-3.0 | 680 |
<script setup>
import BaseChart from '@/components/Charts/BaseChart.vue'
import { computed, inject } from 'vue'
const $utils = inject('$utils')
const props = defineProps({
data: { type: Object, required: true },
options: { type: Object, required: true },
})
const values = computed(() => {
if (!props.options.valueC... | 2302_79757062/insights | frontend/src/widgets/Trend/Trend.vue | Vue | agpl-3.0 | 3,304 |
<script setup>
import { FIELDTYPES } from '@/utils'
import { computed } from 'vue'
const emit = defineEmits(['update:modelValue'])
const props = defineProps({
modelValue: { type: Object, required: true },
columns: { type: Array, required: true },
})
const options = computed({
get: () => props.modelValue,
set: (va... | 2302_79757062/insights | frontend/src/widgets/Trend/TrendOptions.vue | Vue | agpl-3.0 | 1,929 |
import { FIELDTYPES } from '@/utils'
import { getFormattedResult } from '@/utils/query/results'
import { reactive } from 'vue'
/**
* @param {Object} options
* @param {Object} options.query
* @param {Object} options.resultsFetcher
* @returns {Object} chartData
* @returns {Array} chartData.data
* @returns {Boolean... | 2302_79757062/insights | frontend/src/widgets/useChartData.js | JavaScript | agpl-3.0 | 6,003 |
import ComboChartIcon from '@/components/Icons/ComboChartIcon.vue'
import {
AlignLeft,
BarChart3,
BarChartHorizontal,
BatteryMedium,
DollarSign,
GitBranch,
LineChart,
ListFilter,
PieChart,
ScatterChart,
Sparkles,
Square,
Table,
TextCursorInput,
TrendingUp,
} from 'lucide-vue-next'
import { defineAsyncCom... | 2302_79757062/insights | frontend/src/widgets/widgets.ts | TypeScript | agpl-3.0 | 5,264 |
<template>
<div class="flex h-screen w-screen overflow-hidden bg-white text-base antialiased">
<div v-if="!route.meta.hideSidebar" class="h-full border-r bg-gray-50">
<AppSidebar />
</div>
<div class="flex h-full flex-1 flex-col overflow-auto">
<RouterView />
</div>
<Toaster :visible-toasts="2" positio... | 2302_79757062/insights | frontend/src2/App.vue | Vue | agpl-3.0 | 1,138 |
<template>
<LoginBox class="bg-gray-50" title="Log in to your account">
<form class="flex flex-col" @submit.prevent="makeLoginRequest">
<FormControl
label="Email"
placeholder="johndoe@mail.com"
v-model="email"
name="email"
autocomplete="email"
:type="email !== 'Administrator' ? 'email' : '... | 2302_79757062/insights | frontend/src2/auth/Login.vue | Vue | agpl-3.0 | 1,726 |
<template>
<div class="h-full w-full pt-4 sm:pt-16">
<div class="relative z-10">
<div class="flex">
<img src="../assets/insights-logo-new.svg" class="mx-auto h-12" />
</div>
<div
class="mx-auto bg-white px-4 py-8 sm:mt-6 sm:w-96 sm:rounded-lg sm:px-8 sm:shadow-xl"
>
<div class="mb-6 text-cent... | 2302_79757062/insights | frontend/src2/auth/LoginBox.vue | Vue | agpl-3.0 | 687 |
<template>
<div class="mt-40 h-full w-full">
<div class="flex flex-col items-center justify-center">
<p class="text-2xl font-semibold text-blue-600">404</p>
<h1 class="mt-1 text-[48px] font-bold tracking-tight text-gray-900">Not Found</h1>
<div class="text-xl font-light">The page you are looking for does no... | 2302_79757062/insights | frontend/src2/auth/NotFound.vue | Vue | agpl-3.0 | 453 |
<script setup lang="ts">
import { useMagicKeys, watchDebounced, whenever } from '@vueuse/core'
import { onBeforeUnmount, provide } from 'vue'
import InlineFormControlLabel from '../components/InlineFormControlLabel.vue'
import LoadingOverlay from '../components/LoadingOverlay.vue'
import { WorkbookChart, WorkbookQuery ... | 2302_79757062/insights | frontend/src2/charts/ChartBuilder.vue | Vue | agpl-3.0 | 3,150 |
import { useDebouncedRefHistory, UseRefHistoryReturn, watchDebounced } from '@vueuse/core'
import { computed, reactive, ref, unref, watch } from 'vue'
import { copy, getUniqueId, waitUntil, wheneverChanges } from '../helpers'
import { createToast } from '../helpers/toasts'
import { column, count } from '../query/helper... | 2302_79757062/insights | frontend/src2/charts/chart.ts | TypeScript | agpl-3.0 | 8,217 |
export const COLOR_MAP = {
blue: '#318AD8',
pink: '#F683AE',
green: '#48BB74',
red: '#F56B6B',
yellow: '#FACF7A',
purple: '#44427B',
teal: '#5FD8C4',
orange: '#F8814F',
cyan: '#15CCEF',
grey: '#A6B1B9',
'#449CF0': '#449CF0',
'#ECAD4B': '#ECAD4B',
'#761ACB': '#761ACB',
'#CB2929': '#CB2929',
'#ED6396': '#... | 2302_79757062/insights | frontend/src2/charts/colors.ts | TypeScript | agpl-3.0 | 695 |
<script setup lang="ts">
import InlineFormControlLabel from '../../components/InlineFormControlLabel.vue'
import { AxisChartConfig } from '../../types/chart.types'
import { DimensionOption, MeasureOption } from './ChartConfigForm.vue'
const props = defineProps<{
dimensions: DimensionOption[]
measures: MeasureOption[... | 2302_79757062/insights | frontend/src2/charts/components/AxisChartConfigForm.vue | Vue | agpl-3.0 | 2,092 |
<script setup lang="ts">
import InlineFormControlLabel from '../../components/InlineFormControlLabel.vue'
import { BarChartConfig } from '../../types/chart.types'
import AxisChartConfigForm from './AxisChartConfigForm.vue'
import { DimensionOption, MeasureOption } from './ChartConfigForm.vue'
const props = defineProps... | 2302_79757062/insights | frontend/src2/charts/components/BarChartConfigForm.vue | Vue | agpl-3.0 | 1,482 |
<script setup>
import * as echarts from 'echarts'
import { onBeforeUnmount, onMounted, ref, watch } from 'vue'
import { areDeeplyEqual } from '../../helpers'
import ChartTitle from './ChartTitle.vue'
const props = defineProps({
title: { type: String, required: false },
subtitle: { type: String, required: false },
o... | 2302_79757062/insights | frontend/src2/charts/components/BaseChart.vue | Vue | agpl-3.0 | 1,628 |
<script setup lang="ts">
import { inject } from 'vue'
import DataTable from '../../components/DataTable.vue'
import { Chart } from '../chart'
import ChartBuilderTableColumn from './ChartBuilderTableColumn.vue'
const chart = inject('chart') as Chart
</script>
<template>
<div v-if="chart.doc.chart_type != 'Table'" cla... | 2302_79757062/insights | frontend/src2/charts/components/ChartBuilderTable.vue | Vue | agpl-3.0 | 652 |
<script setup lang="ts">
import ContentEditable from '../../components/ContentEditable.vue'
import { FIELDTYPES } from '../../helpers/constants'
import {
ArrowDownWideNarrow,
ArrowUpDown,
ArrowUpNarrowWide,
Calendar,
Check,
XIcon,
} from 'lucide-vue-next'
import { computed, h, inject } from 'vue'
import { column ... | 2302_79757062/insights | frontend/src2/charts/components/ChartBuilderTableColumn.vue | Vue | agpl-3.0 | 3,929 |
<script setup lang="ts">
import { computed } from 'vue'
import InlineFormControlLabel from '../../components/InlineFormControlLabel.vue'
import { Dimension, Measure } from '../../types/query.types'
import { Chart } from '../chart'
import BarChartConfigForm from './BarChartConfigForm.vue'
import DonutChartConfigForm fro... | 2302_79757062/insights | frontend/src2/charts/components/ChartConfigForm.vue | Vue | agpl-3.0 | 2,022 |
<script setup lang="ts">
import { Plus, X } from 'lucide-vue-next'
import { ref } from 'vue'
import DataTypeIcon from '../../query/components/DataTypeIcon.vue'
import FiltersSelectorDialog from '../../query/components/FiltersSelectorDialog.vue'
import { ColumnOption, FilterArgs, FilterGroupArgs } from '../../types/quer... | 2302_79757062/insights | frontend/src2/charts/components/ChartFilterConfig.vue | Vue | agpl-3.0 | 2,378 |
<script setup lang="ts">
import {
AreaChart,
BarChart3,
BarChartHorizontal,
BatteryMedium,
Filter,
Hash,
LifeBuoy,
LineChart,
ScatterChart,
Table2,
} from 'lucide-vue-next'
import { computed } from 'vue'
import { ChartType } from '../../types/chart.types'
const props = defineProps<{ chartType: ChartType }>()... | 2302_79757062/insights | frontend/src2/charts/components/ChartIcon.vue | Vue | agpl-3.0 | 863 |
<script setup lang="ts">
import { Edit, Plus, X } from 'lucide-vue-next'
import { inject, ref } from 'vue'
import DataTypeIcon from '../../query/components/DataTypeIcon.vue'
import NewColumnSelectorDialog from '../../query/components/NewColumnSelectorDialog.vue'
import { ExpressionMeasure, MeasureDataType, MutateArgs }... | 2302_79757062/insights | frontend/src2/charts/components/ChartQueryColumns.vue | Vue | agpl-3.0 | 3,220 |
<script setup lang="ts">
import { Table2 } from 'lucide-vue-next'
import { WorkbookQuery } from '../../types/workbook.types'
import InlineFormControlLabel from '../../components/InlineFormControlLabel.vue'
const query = defineModel()
const props = defineProps<{ queries: WorkbookQuery[] }>()
if (!query.value && props.q... | 2302_79757062/insights | frontend/src2/charts/components/ChartQuerySelector.vue | Vue | agpl-3.0 | 834 |
<script setup lang="ts">
import { computed, ref } from 'vue'
import { downloadImage } from '../../helpers'
import { Chart } from '../chart'
import { getBarChartOptions, getDonutChartOptions, getLineChartOptions } from '../helpers'
import BaseChart from './BaseChart.vue'
import NumberChart from './NumberChart.vue'
impor... | 2302_79757062/insights | frontend/src2/charts/components/ChartRenderer.vue | Vue | agpl-3.0 | 1,788 |
<script setup lang="ts">
import { Plus, SortAscIcon, SortDescIcon, X } from 'lucide-vue-next'
import { computed } from 'vue'
import DraggableList from '../../components/DraggableList.vue'
import { column } from '../../query/helpers'
import { ColumnOption, OrderByArgs } from '../../types/query.types'
const props = defi... | 2302_79757062/insights | frontend/src2/charts/components/ChartSortConfig.vue | Vue | agpl-3.0 | 3,521 |
<script setup>
const props = defineProps({
title: { type: String, required: false },
})
</script>
<template>
<div class="px-4 py-2 font-medium leading-6 text-gray-800">
{{ title }}
</div>
</template>
| 2302_79757062/insights | frontend/src2/charts/components/ChartTitle.vue | Vue | agpl-3.0 | 206 |
<script setup lang="ts">
import InlineFormControlLabel from '../../components/InlineFormControlLabel.vue'
import { CHARTS, ChartType } from '../../types/chart.types'
import ChartIcon from './ChartIcon.vue'
const chartType = defineModel<ChartType>()
</script>
<template>
<InlineFormControlLabel label="Chart Type">
<... | 2302_79757062/insights | frontend/src2/charts/components/ChartTypeSelector.vue | Vue | agpl-3.0 | 810 |
<script setup lang="ts">
import { FIELDTYPES } from '../../helpers/constants'
import { computed } from 'vue'
import InlineFormControlLabel from '../../components/InlineFormControlLabel.vue'
import { DountChartConfig } from '../../types/chart.types'
import { DimensionOption, MeasureOption } from './ChartConfigForm.vue'
... | 2302_79757062/insights | frontend/src2/charts/components/DonutChartConfigForm.vue | Vue | agpl-3.0 | 1,189 |
<script setup lang="ts">
import { LineChartConfig } from '../../types/chart.types'
import AxisChartConfigForm from './AxisChartConfigForm.vue'
import { DimensionOption, MeasureOption } from './ChartConfigForm.vue'
import InlineFormControlLabel from '../../components/InlineFormControlLabel.vue'
const props = defineProp... | 2302_79757062/insights | frontend/src2/charts/components/LineChartConfigForm.vue | Vue | agpl-3.0 | 1,455 |
<script setup lang="ts">
import { computed } from 'vue'
import { formatNumber, getShortNumber } from '../../helpers'
import { NumberChartConfig } from '../../types/chart.types'
import { Measure } from '../../types/query.types'
import { Chart } from '../chart'
import Sparkline from './Sparkline.vue'
const props = defin... | 2302_79757062/insights | frontend/src2/charts/components/NumberChart.vue | Vue | agpl-3.0 | 3,155 |