зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1363680 - Move the repeat information outside of the message type. r=Honza
MozReview-Commit-ID: J7IJgEYnLhn --HG-- extra : rebase_source : 2d216915e9e3c59b9d128f4484b340d902bc9c86
This commit is contained in:
Родитель
a95523e2a5
Коммит
568a26e351
|
@ -15,6 +15,7 @@ const {
|
||||||
getAllMessagesUiById,
|
getAllMessagesUiById,
|
||||||
getAllMessagesTableDataById,
|
getAllMessagesTableDataById,
|
||||||
getVisibleMessages,
|
getVisibleMessages,
|
||||||
|
getAllRepeatById,
|
||||||
} = require("devtools/client/webconsole/new-console-output/selectors/messages");
|
} = require("devtools/client/webconsole/new-console-output/selectors/messages");
|
||||||
const MessageContainer = createFactory(require("devtools/client/webconsole/new-console-output/components/message-container").MessageContainer);
|
const MessageContainer = createFactory(require("devtools/client/webconsole/new-console-output/components/message-container").MessageContainer);
|
||||||
|
|
||||||
|
@ -32,6 +33,7 @@ const ConsoleOutput = createClass({
|
||||||
dispatch: PropTypes.func.isRequired,
|
dispatch: PropTypes.func.isRequired,
|
||||||
timestampsVisible: PropTypes.bool,
|
timestampsVisible: PropTypes.bool,
|
||||||
messagesTableData: PropTypes.object.isRequired,
|
messagesTableData: PropTypes.object.isRequired,
|
||||||
|
messagesRepeat: PropTypes.object.isRequired,
|
||||||
visibleMessages: PropTypes.array.isRequired,
|
visibleMessages: PropTypes.array.isRequired,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -75,6 +77,7 @@ const ConsoleOutput = createClass({
|
||||||
visibleMessages,
|
visibleMessages,
|
||||||
messagesUi,
|
messagesUi,
|
||||||
messagesTableData,
|
messagesTableData,
|
||||||
|
messagesRepeat,
|
||||||
serviceContainer,
|
serviceContainer,
|
||||||
timestampsVisible,
|
timestampsVisible,
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
@ -90,6 +93,7 @@ const ConsoleOutput = createClass({
|
||||||
tableData: messagesTableData.get(message.id),
|
tableData: messagesTableData.get(message.id),
|
||||||
indent: message.indent,
|
indent: message.indent,
|
||||||
timestampsVisible,
|
timestampsVisible,
|
||||||
|
repeat: messagesRepeat[message.id]
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@ -123,6 +127,7 @@ function mapStateToProps(state, props) {
|
||||||
visibleMessages: getVisibleMessages(state),
|
visibleMessages: getVisibleMessages(state),
|
||||||
messagesUi: getAllMessagesUiById(state),
|
messagesUi: getAllMessagesUiById(state),
|
||||||
messagesTableData: getAllMessagesTableDataById(state),
|
messagesTableData: getAllMessagesTableDataById(state),
|
||||||
|
messagesRepeat: getAllRepeatById(state),
|
||||||
timestampsVisible: state.ui.timestampsVisible,
|
timestampsVisible: state.ui.timestampsVisible,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,6 +37,7 @@ const MessageContainer = createClass({
|
||||||
indent: PropTypes.number.isRequired,
|
indent: PropTypes.number.isRequired,
|
||||||
tableData: PropTypes.object,
|
tableData: PropTypes.object,
|
||||||
timestampsVisible: PropTypes.bool.isRequired,
|
timestampsVisible: PropTypes.bool.isRequired,
|
||||||
|
repeat: PropTypes.object,
|
||||||
},
|
},
|
||||||
|
|
||||||
getDefaultProps: function () {
|
getDefaultProps: function () {
|
||||||
|
@ -47,7 +48,7 @@ const MessageContainer = createClass({
|
||||||
},
|
},
|
||||||
|
|
||||||
shouldComponentUpdate(nextProps, nextState) {
|
shouldComponentUpdate(nextProps, nextState) {
|
||||||
const repeatChanged = this.props.message.repeat !== nextProps.message.repeat;
|
const repeatChanged = this.props.repeat !== nextProps.repeat;
|
||||||
const openChanged = this.props.open !== nextProps.open;
|
const openChanged = this.props.open !== nextProps.open;
|
||||||
const tableDataChanged = this.props.tableData !== nextProps.tableData;
|
const tableDataChanged = this.props.tableData !== nextProps.tableData;
|
||||||
const responseChanged = this.props.message.response !== nextProps.message.response;
|
const responseChanged = this.props.message.response !== nextProps.message.response;
|
||||||
|
|
|
@ -42,13 +42,13 @@ function ConsoleApiCall(props) {
|
||||||
serviceContainer,
|
serviceContainer,
|
||||||
indent,
|
indent,
|
||||||
timestampsVisible,
|
timestampsVisible,
|
||||||
|
repeat,
|
||||||
} = props;
|
} = props;
|
||||||
const {
|
const {
|
||||||
id: messageId,
|
id: messageId,
|
||||||
source,
|
source,
|
||||||
type,
|
type,
|
||||||
level,
|
level,
|
||||||
repeat,
|
|
||||||
stacktrace,
|
stacktrace,
|
||||||
frame,
|
frame,
|
||||||
timeStamp,
|
timeStamp,
|
||||||
|
|
|
@ -35,6 +35,8 @@ const MessageState = Immutable.Record({
|
||||||
// List of removed messages is used to release related (parameters) actors.
|
// List of removed messages is used to release related (parameters) actors.
|
||||||
// This array is not supposed to be consumed by any UI component.
|
// This array is not supposed to be consumed by any UI component.
|
||||||
removedMessages: [],
|
removedMessages: [],
|
||||||
|
// Map of the form {messageId : numberOfRepeat}
|
||||||
|
repeatById: {}
|
||||||
});
|
});
|
||||||
|
|
||||||
function messages(state = new MessageState(), action, filtersState, prefsState) {
|
function messages(state = new MessageState(), action, filtersState, prefsState) {
|
||||||
|
@ -44,6 +46,7 @@ function messages(state = new MessageState(), action, filtersState, prefsState)
|
||||||
messagesTableDataById,
|
messagesTableDataById,
|
||||||
groupsById,
|
groupsById,
|
||||||
currentGroup,
|
currentGroup,
|
||||||
|
repeatById,
|
||||||
visibleMessages,
|
visibleMessages,
|
||||||
} = state;
|
} = state;
|
||||||
|
|
||||||
|
@ -65,13 +68,15 @@ function messages(state = new MessageState(), action, filtersState, prefsState)
|
||||||
|
|
||||||
if (newMessage.allowRepeating && messagesById.size > 0) {
|
if (newMessage.allowRepeating && messagesById.size > 0) {
|
||||||
let lastMessage = messagesById.last();
|
let lastMessage = messagesById.last();
|
||||||
if (lastMessage.repeatId === newMessage.repeatId) {
|
if (
|
||||||
|
lastMessage.repeatId === newMessage.repeatId
|
||||||
|
&& lastMessage.groupId === currentGroup
|
||||||
|
) {
|
||||||
return state.set(
|
return state.set(
|
||||||
"messagesById",
|
"repeatById",
|
||||||
messagesById.set(
|
Object.assign({}, repeatById, {
|
||||||
lastMessage.id,
|
[lastMessage.id]: (repeatById[lastMessage.id] || 1) + 1
|
||||||
lastMessage.set("repeat", lastMessage.repeat + 1)
|
})
|
||||||
)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -321,6 +326,17 @@ function limitTopLevelMessageCount(state, record, logLimit) {
|
||||||
record.set("groupsById", record.groupsById.withMutations(cleanUpCollection));
|
record.set("groupsById", record.groupsById.withMutations(cleanUpCollection));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Object.keys(record.repeatById).includes(removedMessagesId)) {
|
||||||
|
record.set("repeatById",
|
||||||
|
[...Object.entries(record.repeatById)].reduce((res, [id, repeat]) => {
|
||||||
|
if (!isInRemovedId(id)) {
|
||||||
|
res[id] = repeat;
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}, {})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return record;
|
return record;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,10 @@ function getVisibleMessages(state) {
|
||||||
return state.messages.visibleMessages.map(id => getMessage(state, id));
|
return state.messages.visibleMessages.map(id => getMessage(state, id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getAllRepeatById(state) {
|
||||||
|
return state.messages.repeatById;
|
||||||
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
getMessage,
|
getMessage,
|
||||||
getAllMessagesById,
|
getAllMessagesById,
|
||||||
|
@ -41,4 +45,5 @@ module.exports = {
|
||||||
getAllGroupsById,
|
getAllGroupsById,
|
||||||
getCurrentGroup,
|
getCurrentGroup,
|
||||||
getVisibleMessages,
|
getVisibleMessages,
|
||||||
|
getAllRepeatById,
|
||||||
};
|
};
|
||||||
|
|
|
@ -33,7 +33,6 @@ exports.ConsoleMessage = Immutable.Record({
|
||||||
level: null,
|
level: null,
|
||||||
messageText: null,
|
messageText: null,
|
||||||
parameters: null,
|
parameters: null,
|
||||||
repeat: 1,
|
|
||||||
repeatId: null,
|
repeatId: null,
|
||||||
stacktrace: null,
|
stacktrace: null,
|
||||||
frame: null,
|
frame: null,
|
||||||
|
|
|
@ -237,7 +237,6 @@ function transformPacket(packet) {
|
||||||
// Helpers
|
// Helpers
|
||||||
function getRepeatId(message) {
|
function getRepeatId(message) {
|
||||||
message = message.toJS();
|
message = message.toJS();
|
||||||
message.repeat = null;
|
|
||||||
message.timeStamp = null;
|
message.timeStamp = null;
|
||||||
return JSON.stringify(message);
|
return JSON.stringify(message);
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче