@/store#IRootState TypeScript Examples

The following examples show how to use @/store#IRootState. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CPUCard.tsx    From nebula-dashboard with Apache License 2.0 6 votes vote down vote up
mapState = (state: IRootState) => {
  const { cpuStat } = state.machine;
  const { cpuBaseLine } = state.setting;
  const { aliasConfig } = state.app;
  return {
    baseLine: cpuBaseLine,
    data: getDataByType({
      data: cpuStat,
      type: 'all',
      name: 'instance',
      aliasConfig,
    }),
    valueType: VALUE_TYPE.percentage,
    loading: !!state.loading.effects.machine.asyncGetCPUStatByRange,
  };
}
Example #2
Source File: DiskCard.tsx    From nebula-dashboard with Apache License 2.0 6 votes vote down vote up
mapState = (state: IRootState) => {
  const { diskSizeStat, diskStat } = state.machine;
  const { aliasConfig } = state.app;

  return {
    // According to type, only the detail increases total
    diskUsageDetail: diskStat
      .filter(item => item.metric.instance !== 'total')
      .map((instance, idx) => {
        const latestValues = _.last(instance.values);
        let size = 0;
        if (diskSizeStat[idx]) {
          size = Number(diskSizeStat[idx].value[1]);
        }
        const name = instance.metric.instance;
        return {
          size,
          type: aliasConfig[name] || name,
          value: latestValues ? Number(latestValues[1]) : 0,
        };
      }),
  };
}
Example #3
Source File: LoadCard.tsx    From nebula-dashboard with Apache License 2.0 6 votes vote down vote up
mapState = (state: IRootState) => {
  const { loadStat } = state.machine;
  const { loadBaseLine } = state.setting;
  const { aliasConfig } = state.app;
  return {
    baseLine: loadBaseLine,
    data: getDataByType({
      data: loadStat,
      type: 'all',
      name: 'instance',
      aliasConfig,
    }),
    valueType: VALUE_TYPE.number,
    loading: !!state.loading.effects.machine.asyncGetLoadByRange,
  };
}
Example #4
Source File: MemoryCard.tsx    From nebula-dashboard with Apache License 2.0 6 votes vote down vote up
mapState = (state: IRootState) => {
  const { memoryStat, memorySizeStat } = state.machine;
  const { memoryBaseLine } = state.setting;
  const { aliasConfig } = state.app;
  return {
    data: getDataByType({
      data: memoryStat,
      type: 'all',
      name: 'instance',
      aliasConfig,
    }),
    sizes: memorySizeStat,
    baseLine: memoryBaseLine,
    valueType: VALUE_TYPE.percentage,
    loading:
      !!state.loading.effects.machine.asyncGetMemorySizeStat &&
      !!state.loading.effects.machine.asyncGetMemoryStatByRange,
  };
}
Example #5
Source File: NetworkIn.tsx    From nebula-dashboard with Apache License 2.0 6 votes vote down vote up
mapState = (state: IRootState) => {
  const { networkInStat } = state.machine;
  const { networkInBaseLine } = state.setting;
  const { aliasConfig } = state.app;
  return {
    baseLine: networkInBaseLine,
    data: getDataByType({
      data: networkInStat,
      type: 'all',
      name: 'instance',
      aliasConfig,
    }),
    valueType: VALUE_TYPE.byteSecondNet,
    loading: !!state.loading.effects.machine.asyncGetNetworkStatByRange,
  };
}
Example #6
Source File: NetworkOut.tsx    From nebula-dashboard with Apache License 2.0 6 votes vote down vote up
mapState = (state: IRootState) => {
  const { networkOutStat } = state.machine;
  const { networkOutBaseLine } = state.setting;
  const { aliasConfig } = state.app;
  return {
    baseLine: networkOutBaseLine,
    data: getDataByType({
      data: networkOutStat,
      type: 'all',
      name: 'instance',
      aliasConfig,
    }),
    valueType: VALUE_TYPE.byteSecondNet,
    loading: !!state.loading.effects.machine.asyncGetNetworkStatByRange,
  };
}
Example #7
Source File: index.tsx    From nebula-dashboard with Apache License 2.0 5 votes vote down vote up
mapState = (state: IRootState) => ({
  spaces: state.nebula.spaces,
  loading: state.loading.models.nebula,
  currentSpace: state.nebula.currentSpace,
})
Example #8
Source File: NetworkDetail.tsx    From nebula-dashboard with Apache License 2.0 5 votes vote down vote up
mapState = (state: IRootState) => ({
  type: 'network',
  dataSource: state.machine.networkStat,
  metricOptions: SUPPORT_METRICS.network,
  loading: state.loading.effects.machine.asyncGetNetworkStatByRange,
})
Example #9
Source File: index.tsx    From nebula-dashboard with Apache License 2.0 5 votes vote down vote up
mapState = (state: IRootState) => ({
  aliasConfig: state.app.aliasConfig,
  serviceMetric: state.serviceMetric,
  spaces: state.nebula.spaces,
})
Example #10
Source File: index.tsx    From nebula-dashboard with Apache License 2.0 5 votes vote down vote up
mapState = (state: IRootState) => ({
  loading: state.loading.models.service,
  aliasConfig: state.app.aliasConfig,
  serviceMetric: state.serviceMetric,
})
Example #11
Source File: index.tsx    From nebula-dashboard with Apache License 2.0 5 votes vote down vote up
mapState = (state: IRootState) => ({
  aliasConfig: state.app.aliasConfig,
})
Example #12
Source File: index.tsx    From nebula-dashboard with Apache License 2.0 5 votes vote down vote up
mapState = (state: IRootState) => ({
  panelConfig: state.service.panelConfig,
  aliasConfig: state.app.aliasConfig,
  serviceMetric: state.serviceMetric,
})
Example #13
Source File: index.tsx    From nebula-dashboard with Apache License 2.0 5 votes vote down vote up
mapState = (state: IRootState) => ({
  loading: state.loading.effects.nebula.asyncGetServiceConfigs,
  configs: state.nebula.configs,
})
Example #14
Source File: index.tsx    From nebula-dashboard with Apache License 2.0 5 votes vote down vote up
mapState = (state: IRootState) => ({
  loading: state.loading.effects.nebula.asyncGetJobs,
  jobs: state.nebula.jobs,
  version: state.nebula.version,
  spaces: state.nebula.spaces,
  currentSpace: state.nebula.currentSpace,
})
Example #15
Source File: index.tsx    From nebula-dashboard with Apache License 2.0 5 votes vote down vote up
mapState = (state: IRootState) => ({
  loading: state.loading.effects.nebula.asyncGetParts,
  spaces: state.nebula.spaces,
  parts: state.nebula.parts,
  currentSpace: state.nebula.currentSpace,
})
Example #16
Source File: index.tsx    From nebula-dashboard with Apache License 2.0 5 votes vote down vote up
mapState = (state: IRootState) => ({
  loading: state.loading.effects.nebula.asyncGetServices,
  services: state.nebula.services,
})
Example #17
Source File: index.tsx    From nebula-dashboard with Apache License 2.0 5 votes vote down vote up
mapState = (state: IRootState) => ({
  loading: state.loading.models.service,
})
Example #18
Source File: index.tsx    From nebula-dashboard with Apache License 2.0 5 votes vote down vote up
mapState = (state: IRootState) => ({
  appVersion: state.app.version,
  nebluaVersion: state.nebula.version,
})
Example #19
Source File: index.tsx    From nebula-dashboard with Apache License 2.0 5 votes vote down vote up
mapState = (state: IRootState) => ({
  cpuBaseLine: state.setting.cpuBaseLine,
  memoryBaseLine: state.setting.memoryBaseLine,
  networkOutBaseLine: state.setting.networkOutBaseLine,
  networkInBaseLine: state.setting.networkInBaseLine,
  loadBaseLine: state.setting.loadBaseLine,
})
Example #20
Source File: index.tsx    From nebula-dashboard with Apache License 2.0 5 votes vote down vote up
mapState = (state: IRootState) => ({
  aliasConfig: state.app.aliasConfig,
  cpuBaseLine: state.setting.cpuBaseLine,
  memoryBaseLine: state.setting.memoryBaseLine,
  loadBaseLine: state.setting.loadBaseLine,
  diskBaseLine: state.setting.diskBaseLine,
  networkBaseLine: state.setting.networkBaseLine,
})
Example #21
Source File: AuthorizedRoute.tsx    From nebula-dashboard with Apache License 2.0 5 votes vote down vote up
mapState = (state: IRootState) => ({
  username: state.app.username,
})
Example #22
Source File: MemoryDetail.tsx    From nebula-dashboard with Apache License 2.0 5 votes vote down vote up
mapState = (state: IRootState) => ({
  type: 'memory',
  dataSource: state.machine.memoryStat,
  metricOptions: SUPPORT_METRICS.memory,
  loading: state.loading.effects.machine.asyncGetMemoryStatByRange,
})
Example #23
Source File: LoadDetail.tsx    From nebula-dashboard with Apache License 2.0 5 votes vote down vote up
mapState = (state: IRootState) => ({
  type: 'load',
  dataSource: state.machine.loadStat,
  metricOptions: SUPPORT_METRICS.load,
  loading: state.loading.effects.machine.asyncGetLoadByRange,
})
Example #24
Source File: DiskDetail.tsx    From nebula-dashboard with Apache License 2.0 5 votes vote down vote up
mapState = (state: IRootState) => ({
  type: 'disk',
  dataSource: state.machine.diskStat,
  metricOptions: SUPPORT_METRICS.disk,
  loading: state.loading.effects.machine.asyncGetDiskStatByRange,
})
Example #25
Source File: CPUDetail.tsx    From nebula-dashboard with Apache License 2.0 5 votes vote down vote up
mapState = (state: IRootState) => ({
  type: 'cpu',
  dataSource: state.machine.cpuStat,
  metricOptions: SUPPORT_METRICS.cpu,
  loading: !!state.loading.effects.machine.asyncGetCPUStatByRange,
})
Example #26
Source File: index.tsx    From nebula-dashboard with Apache License 2.0 5 votes vote down vote up
mapState = (state: IRootState) => ({
  appVersion: state.app.version,
  connection: state.app.connection,
})
Example #27
Source File: index.tsx    From nebula-dashboard with Apache License 2.0 5 votes vote down vote up
mapState = (state: IRootState) => ({
  loading: state.loading.effects.nebula.asyncGetHostsInfo,
})