Add a new tab to user page with pushers (#85)
* Add a new tab to user page with pushers * Update pushers `total` and `id`
This commit is contained in:
		
							parent
							
								
									425c210cfc
								
							
						
					
					
						commit
						f2a1275673
					
				@ -52,6 +52,7 @@ const App = () => (
 | 
			
		||||
    <Resource name="connections" />
 | 
			
		||||
    <Resource name="devices" />
 | 
			
		||||
    <Resource name="room_members" />
 | 
			
		||||
    <Resource name="pushers" />
 | 
			
		||||
    <Resource name="servernotices" />
 | 
			
		||||
  </Admin>
 | 
			
		||||
);
 | 
			
		||||
 | 
			
		||||
@ -5,6 +5,7 @@ import ContactMailIcon from "@material-ui/icons/ContactMail";
 | 
			
		||||
import DevicesIcon from "@material-ui/icons/Devices";
 | 
			
		||||
import GetAppIcon from "@material-ui/icons/GetApp";
 | 
			
		||||
import SettingsInputComponentIcon from "@material-ui/icons/SettingsInputComponent";
 | 
			
		||||
import NotificationsIcon from "@material-ui/icons/Notifications";
 | 
			
		||||
import {
 | 
			
		||||
  ArrayInput,
 | 
			
		||||
  ArrayField,
 | 
			
		||||
@ -312,6 +313,7 @@ export const UserEdit = props => {
 | 
			
		||||
          />
 | 
			
		||||
          <TextField source="consent_version" />
 | 
			
		||||
        </FormTab>
 | 
			
		||||
 | 
			
		||||
        <FormTab
 | 
			
		||||
          label="resources.users.threepid"
 | 
			
		||||
          icon={<ContactMailIcon />}
 | 
			
		||||
@ -330,6 +332,7 @@ export const UserEdit = props => {
 | 
			
		||||
            </SimpleFormIterator>
 | 
			
		||||
          </ArrayInput>
 | 
			
		||||
        </FormTab>
 | 
			
		||||
 | 
			
		||||
        <FormTab
 | 
			
		||||
          label={translate("resources.devices.name", { smart_count: 2 })}
 | 
			
		||||
          icon={<DevicesIcon />}
 | 
			
		||||
@ -361,6 +364,7 @@ export const UserEdit = props => {
 | 
			
		||||
            </Datagrid>
 | 
			
		||||
          </ReferenceManyField>
 | 
			
		||||
        </FormTab>
 | 
			
		||||
 | 
			
		||||
        <FormTab
 | 
			
		||||
          label="resources.connections.name"
 | 
			
		||||
          icon={<SettingsInputComponentIcon />}
 | 
			
		||||
@ -400,6 +404,29 @@ export const UserEdit = props => {
 | 
			
		||||
            </ArrayField>
 | 
			
		||||
          </ReferenceField>
 | 
			
		||||
        </FormTab>
 | 
			
		||||
 | 
			
		||||
        <FormTab
 | 
			
		||||
          label={translate("resources.pushers.name", { smart_count: 2 })}
 | 
			
		||||
          icon={<NotificationsIcon />}
 | 
			
		||||
          path="pushers"
 | 
			
		||||
        >
 | 
			
		||||
          <ReferenceManyField
 | 
			
		||||
            reference="pushers"
 | 
			
		||||
            target="user_id"
 | 
			
		||||
            addLabel={false}
 | 
			
		||||
          >
 | 
			
		||||
            <Datagrid style={{ width: "100%" }}>
 | 
			
		||||
              <TextField source="kind" sortable={false} />
 | 
			
		||||
              <TextField source="app_display_name" sortable={false} />
 | 
			
		||||
              <TextField source="app_id" sortable={false} />
 | 
			
		||||
              <TextField source="data.url" sortable={false} />
 | 
			
		||||
              <TextField source="device_display_name" sortable={false} />
 | 
			
		||||
              <TextField source="lang" sortable={false} />
 | 
			
		||||
              <TextField source="profile_tag" sortable={false} />
 | 
			
		||||
              <TextField source="pushkey" sortable={false} />
 | 
			
		||||
            </Datagrid>
 | 
			
		||||
          </ReferenceManyField>
 | 
			
		||||
        </FormTab>
 | 
			
		||||
      </TabbedForm>
 | 
			
		||||
    </Edit>
 | 
			
		||||
  );
 | 
			
		||||
 | 
			
		||||
@ -223,6 +223,20 @@ export default {
 | 
			
		||||
        },
 | 
			
		||||
      },
 | 
			
		||||
    },
 | 
			
		||||
    pushers: {
 | 
			
		||||
      name: "Pusher |||| Pushers",
 | 
			
		||||
      fields: {
 | 
			
		||||
        app: "App",
 | 
			
		||||
        app_display_name: "App-Anzeigename",
 | 
			
		||||
        app_id: "App ID",
 | 
			
		||||
        device_display_name: "Geräte-Anzeigename",
 | 
			
		||||
        kind: "Art",
 | 
			
		||||
        lang: "Sprache",
 | 
			
		||||
        profile_tag: "Profil-Tag",
 | 
			
		||||
        pushkey: "Pushkey",
 | 
			
		||||
        data: { url: "URL" },
 | 
			
		||||
      },
 | 
			
		||||
    },
 | 
			
		||||
    servernotices: {
 | 
			
		||||
      name: "Serverbenachrichtigungen",
 | 
			
		||||
      send: "Servernachricht versenden",
 | 
			
		||||
 | 
			
		||||
@ -220,6 +220,20 @@ export default {
 | 
			
		||||
        },
 | 
			
		||||
      },
 | 
			
		||||
    },
 | 
			
		||||
    pushers: {
 | 
			
		||||
      name: "Pusher |||| Pushers",
 | 
			
		||||
      fields: {
 | 
			
		||||
        app: "App",
 | 
			
		||||
        app_display_name: "App display name",
 | 
			
		||||
        app_id: "App ID",
 | 
			
		||||
        device_display_name: "Device display name",
 | 
			
		||||
        kind: "Kind",
 | 
			
		||||
        lang: "Language",
 | 
			
		||||
        profile_tag: "Profile tag",
 | 
			
		||||
        pushkey: "Pushkey",
 | 
			
		||||
        data: { url: "URL" },
 | 
			
		||||
      },
 | 
			
		||||
    },
 | 
			
		||||
    servernotices: {
 | 
			
		||||
      name: "Server Notices",
 | 
			
		||||
      send: "Send server notices",
 | 
			
		||||
 | 
			
		||||
@ -117,6 +117,19 @@ const resourceMap = {
 | 
			
		||||
      return json.total;
 | 
			
		||||
    },
 | 
			
		||||
  },
 | 
			
		||||
  pushers: {
 | 
			
		||||
    map: p => ({
 | 
			
		||||
      ...p,
 | 
			
		||||
      id: p.pushkey,
 | 
			
		||||
    }),
 | 
			
		||||
    reference: id => ({
 | 
			
		||||
      endpoint: `/_synapse/admin/v1/users/${id}/pushers`,
 | 
			
		||||
    }),
 | 
			
		||||
    data: "pushers",
 | 
			
		||||
    total: json => {
 | 
			
		||||
      return json.total;
 | 
			
		||||
    },
 | 
			
		||||
  },
 | 
			
		||||
  servernotices: {
 | 
			
		||||
    map: n => ({ id: n.event_id }),
 | 
			
		||||
    create: data => ({
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user