Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert files related to redux from js to ts #462

Open
wants to merge 24 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
61fa7eb
[MM-222] Convert reducer and action types file to typescript and remo…
raghavaggarwal2308 Feb 16, 2024
90db1a0
[MM-222] Converted select file to typescript and fixes some css warnings
raghavaggarwal2308 Feb 16, 2024
f7b3d14
[MM-222] Convert actions file to typescript
raghavaggarwal2308 Feb 16, 2024
9588241
[MM-222] Updated reducer, used reducer type for store and added more …
ayusht2810 Mar 26, 2024
58fb984
Merge branch 'master' of github.com:mattermost/mattermost-plugin-gitl…
ayusht2810 Mar 26, 2024
c765edd
[MM-222] Resolved conflicts from master
ayusht2810 Mar 26, 2024
950a339
[MM-222] Migrate a component to TS and minor review fixes
ayusht2810 Mar 28, 2024
7eaf225
[MM-222] Fix flaky test
ayusht2810 Mar 28, 2024
70f6986
Merge branch 'master' of github.com:mattermost/mattermost-plugin-gitl…
raghavaggarwal2308 Jun 25, 2024
ee206bc
[MM-520] Review fixes
raghavaggarwal2308 Jun 25, 2024
98b9f75
[MM-520] Fix ts error in index file
raghavaggarwal2308 Jun 25, 2024
e501324
Merge branch 'master' of github.com:mattermost/mattermost-plugin-gitl…
raghavaggarwal2308 Jul 3, 2024
a696754
[MM-542] Review fixes
raghavaggarwal2308 Jul 3, 2024
c8c2c38
MM-222: converted client file to TS
Kshitij-Katiyar Jul 8, 2024
ec3d6a0
[MM-222]: Added type to the client promises
Kshitij-Katiyar Jul 9, 2024
ce22b9a
[MM-222]: Added more types to the client.ts file
Kshitij-Katiyar Jul 9, 2024
e75b2c6
[MM-222]: updated function return type and added few types to client.ts
Kshitij-Katiyar Jul 10, 2024
7ac4b3b
[MM-222]: fixed linting issue
Kshitij-Katiyar Jul 10, 2024
35554b2
[MM-222]: resolved conflicts
Kshitij-Katiyar Jul 10, 2024
d1ebe67
[MM-222]: removed null type from client.ts API response
Kshitij-Katiyar Jul 10, 2024
64b28bc
[MM-222]: Added some additional types
Kshitij-Katiyar Jul 15, 2024
64b4385
Added lint types
Kshitij-Katiyar Jul 15, 2024
f7b2bf2
Merge branch 'master' of github.com:mattermost/mattermost-plugin-gitl…
raghavaggarwal2308 Jul 31, 2024
ff8d95d
[MM-656] Add types for redux funcs related to create issue and attach…
raghavaggarwal2308 Aug 1, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions webapp/src/actions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import {AnyAction, Dispatch} from 'redux';

import Client from '../client';
import ActionTypes from '../action_types';
import manifest from '../manifest';
import {APIError, ConnectedData, GitlabUsersData, LHSData, ShowRhsPluginActionData, SubscriptionData} from 'src/types';
import {Item} from 'src/types/gitlab_items';
import {GlobalState, pluginStateKey} from 'src/types/store';
import {GlobalState} from 'src/types/store';
import {getPluginState} from 'src/selectors';

export function getConnected(reminder = false) {
return async (dispatch: Dispatch<AnyAction>) => {
Expand Down Expand Up @@ -120,7 +120,7 @@ export function getLHSData() {
* Stores "showRHSPlugin" action returned by
* "registerRightHandSidebarComponent" in plugin initialization.
*/
export function setShowRHSAction(showRHSPluginAction: ShowRhsPluginActionData) {
export function setShowRHSAction(showRHSPluginAction: () => ShowRhsPluginActionData) {
return {
type: ActionTypes.RECEIVED_SHOW_RHS_ACTION,
showRHSPluginAction,
Expand All @@ -142,7 +142,7 @@ export function getGitlabUser(userID: string) {
return {};
}

const user = getState()[pluginStateKey].gitlabUsers[userID];
const user = getPluginState(getState()).gitlabUsers[userID];
if (
user &&
user.last_try &&
Expand Down
5 changes: 2 additions & 3 deletions webapp/src/components/user_attribute/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {GlobalState, pluginStateKey} from 'src/types/store';

import UserAttribute from './user_attribute';

export type UserAttributeProps = UserAttributeStateProps & UserAttributeDispatchProps
Kshitij-Katiyar marked this conversation as resolved.
Show resolved Hide resolved
interface UserAttributeStateProps {
id: string,
username: string,
Expand All @@ -17,12 +18,10 @@ interface UserAttributeStateProps {

interface UserAttributeDispatchProps {
actions: {
getGitlabUser:(userID: string) => (dispatch: Dispatch<AnyAction>, getState: () => GlobalState) => Promise<any>,
getGitlabUser: typeof getGitlabUser,
},
}

export type UserAttributeProps = UserAttributeStateProps & UserAttributeDispatchProps

function mapStateToProps(state: GlobalState, ownProps: {user: UserProfile}): UserAttributeStateProps {
const idUser = ownProps.user ? ownProps.user.id : '';
const user = state[pluginStateKey].gitlabUsers[idUser] || {};
Expand Down
7 changes: 3 additions & 4 deletions webapp/src/components/user_attribute/user_attribute.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import React, {PureComponent} from 'react';

import {UserAttributeProps} from '.';
import type {UserAttributeProps} from '.';

export default class UserAttribute extends PureComponent<UserAttributeProps> {
Kshitij-Katiyar marked this conversation as resolved.
Show resolved Hide resolved
constructor(props: UserAttributeProps) {
super(props);
props.actions.getGitlabUser(props.id);
componentDidMount() {
this.props.actions.getGitlabUser(this.props.id);
}

render() {
Expand Down
5 changes: 2 additions & 3 deletions webapp/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
// See License.txt for license information.

import {getConfig} from 'mattermost-redux/selectors/entities/general';

import {GlobalState} from 'mattermost-redux/types/store';

import {Store, Action} from 'redux';

import SidebarHeader from './components/sidebar_header';
Expand All @@ -14,6 +11,8 @@ import UserAttribute from './components/user_attribute';
import SidebarRight from './components/sidebar_right';
import LinkTooltip from './components/link_tooltip';

import {GlobalState} from './types/store';

import Reducer from './reducers';
import {getConnected, setShowRHSAction} from './actions';
import {
Expand Down
Loading