Skip to content

CourseWork#19

Open
vlyulin wants to merge 3 commits intomasterfrom
CourseWork
Open

CourseWork#19
vlyulin wants to merge 3 commits intomasterfrom
CourseWork

Conversation

@vlyulin
Copy link
Copy Markdown
Owner

@vlyulin vlyulin commented Jan 8, 2021

No description provided.


group 'ru.otus'
version '1.0'
sourceCompatibility = JavaVersion.VERSION_1_8
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

стоит использовать более новую версию java

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Исправил. Тянется со времен попытки деплоя на Tomcat


dependencies {
compile project(':CourseWork:MessageSystem')
testCompile group: 'junit', name: 'junit', version: '4.12'
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

лучше использовать 5ю версию.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Исправил.

import java.io.Serializable;
import java.util.List;

public class OperationStatusMsgData extends ResultDataType implements Serializable {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ResultDataType уже
public class ResultDataType implements Serializable
надо ли наследников делать Serializable ?

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Не нужно. Исправил.

operationStatusMsgData = new OperationStatusMsgData(SUCCESS, new ArrayList<>());

} catch (Exception e) {
System.out.println(e.getMessage());
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

лучше использовать логгер.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Переделал.

import java.util.Optional;

public class RegisterClientRequestHandler implements RequestHandler<OperationStatusMsgData> {
public static final String SUCCESS = "SUCCESS";
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

в каких-то Handler-ах есть эти статусы, в каких-то нет (например, GetFilteredUserListDataRequestHandler)
хорошо бы вынести эти константы в enum и унифицировать работу.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Константы перенес в enum.
Статусы возвращаются только там, где не надо возвращать данные.
Долго ломал голову как сделать лучше. Ничего не возвращать плохо. Возвращать статус только для части handlers, тоже плохо. Не придумал, как сделать лучше.

// return new KafkaAdmin(configs);
// }

@Bean("DbServerListener")
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

бины традиционно с маленькой буквы называют.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Исправил.

return toFrontendMsClient;
}

// @KafkaListener(topics="${front2db.topic}")
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

закоментированный код не стоит пушить в гит

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Пропустил. Исправил


for(var opIdx = 0; opIdx < operationsData.length; opIdx++ ) {
console.log("opIdx = " + opIdx);
var colorName = colorNames[opIdx];
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

почитайте про отличия var, let, const.
Если кратко, то стоит использовать let вместо var, а где возможно - const

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Прочитал, исправил на let

let arr = new Array(barChartData.labels.length);
for(const [key, value] of Object.entries(operationsData[opIdx].chartData)) {
for (var index = 0; index < barChartData.labels.length; index++) {
if (barChartData.labels[index] == key) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

В JavaScript есть разница межу == и ===

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Исправил на ===

<button id="getData">Plan B</button>

<script>
var OPEARATIONS = ['RegisterClient','UserData','FilteredUsersData','SaveUser', 'DeleteUser', 'OperationStatus'];
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

скриптовую часть стоит вынести из html

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Вынес.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants