mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-09 22:57:21 +00:00
Merge branch 'main' into dev
This commit is contained in:
10
.github/.github/dependabot.yaml
vendored
Normal file
10
.github/.github/dependabot.yaml
vendored
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
version: 2
|
||||||
|
updates:
|
||||||
|
- package-ecosystem: "github-actions"
|
||||||
|
directory: "/"
|
||||||
|
schedule:
|
||||||
|
interval: "daily"
|
||||||
|
- package-ecosystem: "pub"
|
||||||
|
directory: "/"
|
||||||
|
schedule:
|
||||||
|
interval: "daily"
|
@ -21,7 +21,6 @@ class HomeBloc extends Bloc<HomeEvent, HomeState> {
|
|||||||
String policy = '';
|
String policy = '';
|
||||||
|
|
||||||
HomeBloc() : super((HomeInitial())) {
|
HomeBloc() : super((HomeInitial())) {
|
||||||
// on<CreateNewNode>(_createNode);
|
|
||||||
on<FetchUserInfo>(_fetchUserInfo);
|
on<FetchUserInfo>(_fetchUserInfo);
|
||||||
on<FetchTermEvent>(_fetchTerms);
|
on<FetchTermEvent>(_fetchTerms);
|
||||||
on<FetchPolicyEvent>(_fetchPolicy);
|
on<FetchPolicyEvent>(_fetchPolicy);
|
||||||
@ -126,41 +125,5 @@ class HomeBloc extends Bloc<HomeEvent, HomeState> {
|
|||||||
},
|
},
|
||||||
color: const Color(0xFF023DFE),
|
color: const Color(0xFF023DFE),
|
||||||
),
|
),
|
||||||
|
|
||||||
// HomeItemModel(
|
|
||||||
// title: 'Move in',
|
|
||||||
// icon: Assets.moveinIcon,
|
|
||||||
// active: false,
|
|
||||||
// onPress: (context) {},
|
|
||||||
// color: ColorsManager.primaryColor,
|
|
||||||
// ),
|
|
||||||
// HomeItemModel(
|
|
||||||
// title: 'Construction',
|
|
||||||
// icon: Assets.constructionIcon,
|
|
||||||
// active: false,
|
|
||||||
// onPress: (context) {},
|
|
||||||
// color: ColorsManager.primaryColor,
|
|
||||||
// ),
|
|
||||||
// HomeItemModel(
|
|
||||||
// title: 'Energy',
|
|
||||||
// icon: Assets.energyIcon,
|
|
||||||
// active: false,
|
|
||||||
// onPress: (context) {},
|
|
||||||
// color: ColorsManager.slidingBlueColor.withOpacity(0.2),
|
|
||||||
// ),
|
|
||||||
// HomeItemModel(
|
|
||||||
// title: 'Integrations',
|
|
||||||
// icon: Assets.integrationsIcon,
|
|
||||||
// active: false,
|
|
||||||
// onPress: (context) {},
|
|
||||||
// color: ColorsManager.slidingBlueColor.withOpacity(0.2),
|
|
||||||
// ),
|
|
||||||
// HomeItemModel(
|
|
||||||
// title: 'Asset',
|
|
||||||
// icon: Assets.assetIcon,
|
|
||||||
// active: false,
|
|
||||||
// onPress: (context) {},
|
|
||||||
// color: ColorsManager.slidingBlueColor.withOpacity(0.2),
|
|
||||||
// ),
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,6 @@ import 'package:syncrow_web/utils/color_manager.dart';
|
|||||||
import 'package:syncrow_web/utils/constants/assets.dart';
|
import 'package:syncrow_web/utils/constants/assets.dart';
|
||||||
import 'package:syncrow_web/utils/extension/build_context_x.dart';
|
import 'package:syncrow_web/utils/extension/build_context_x.dart';
|
||||||
import 'package:syncrow_web/utils/style.dart';
|
import 'package:syncrow_web/utils/style.dart';
|
||||||
|
|
||||||
class UsersPage extends StatelessWidget {
|
class UsersPage extends StatelessWidget {
|
||||||
UsersPage({super.key});
|
UsersPage({super.key});
|
||||||
|
|
||||||
|
@ -4,8 +4,8 @@ import 'package:bloc/bloc.dart';
|
|||||||
import 'package:dio/dio.dart';
|
import 'package:dio/dio.dart';
|
||||||
import 'package:equatable/equatable.dart';
|
import 'package:equatable/equatable.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:syncrow_web/pages/common/bloc/project_manager.dart';
|
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
|
import 'package:syncrow_web/pages/common/bloc/project_manager.dart';
|
||||||
import 'package:syncrow_web/pages/device_managment/all_devices/models/devices_model.dart';
|
import 'package:syncrow_web/pages/device_managment/all_devices/models/devices_model.dart';
|
||||||
import 'package:syncrow_web/pages/routines/bloc/automation_scene_trigger_bloc/automation_status_update.dart';
|
import 'package:syncrow_web/pages/routines/bloc/automation_scene_trigger_bloc/automation_status_update.dart';
|
||||||
import 'package:syncrow_web/pages/routines/bloc/create_routine_bloc/create_routine_bloc.dart';
|
import 'package:syncrow_web/pages/routines/bloc/create_routine_bloc/create_routine_bloc.dart';
|
||||||
@ -27,9 +27,6 @@ import 'package:uuid/uuid.dart';
|
|||||||
part 'routine_event.dart';
|
part 'routine_event.dart';
|
||||||
part 'routine_state.dart';
|
part 'routine_state.dart';
|
||||||
|
|
||||||
// String spaceId = '25c96044-fadf-44bb-93c7-3c079e527ce6';
|
|
||||||
// String communityId = 'aff21a57-2f91-4e5c-b99b-0182c3ab65a9';
|
|
||||||
|
|
||||||
class RoutineBloc extends Bloc<RoutineEvent, RoutineState> {
|
class RoutineBloc extends Bloc<RoutineEvent, RoutineState> {
|
||||||
RoutineBloc() : super(const RoutineState()) {
|
RoutineBloc() : super(const RoutineState()) {
|
||||||
on<AddToIfContainer>(_onAddToIfContainer);
|
on<AddToIfContainer>(_onAddToIfContainer);
|
||||||
@ -173,45 +170,45 @@ class RoutineBloc extends Bloc<RoutineEvent, RoutineState> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _onLoadScenes(
|
Future<void> _onLoadScenes(
|
||||||
LoadScenes event, Emitter<RoutineState> emit) async {
|
LoadScenes event, Emitter<RoutineState> emit) async {
|
||||||
emit(state.copyWith(isLoading: true, errorMessage: null));
|
emit(state.copyWith(isLoading: true, errorMessage: null));
|
||||||
List<ScenesModel> scenes = [];
|
List<ScenesModel> scenes = [];
|
||||||
try {
|
try {
|
||||||
BuildContext context = NavigationService.navigatorKey.currentContext!;
|
BuildContext context = NavigationService.navigatorKey.currentContext!;
|
||||||
var createRoutineBloc = context.read<CreateRoutineBloc>();
|
var createRoutineBloc = context.read<CreateRoutineBloc>();
|
||||||
final projectUuid = await ProjectManager.getProjectUUID() ?? '';
|
final projectUuid = await ProjectManager.getProjectUUID() ?? '';
|
||||||
if (createRoutineBloc.selectedSpaceId == '' &&
|
if (createRoutineBloc.selectedSpaceId == '' &&
|
||||||
createRoutineBloc.selectedCommunityId == '') {
|
createRoutineBloc.selectedCommunityId == '') {
|
||||||
var spaceBloc = context.read<SpaceTreeBloc>();
|
var spaceBloc = context.read<SpaceTreeBloc>();
|
||||||
for (var communityId in spaceBloc.state.selectedCommunities) {
|
for (var communityId in spaceBloc.state.selectedCommunities) {
|
||||||
List<String> spacesList =
|
List<String> spacesList =
|
||||||
spaceBloc.state.selectedCommunityAndSpaces[communityId] ?? [];
|
spaceBloc.state.selectedCommunityAndSpaces[communityId] ?? [];
|
||||||
for (var spaceId in spacesList) {
|
for (var spaceId in spacesList) {
|
||||||
scenes.addAll(
|
scenes.addAll(
|
||||||
await SceneApi.getScenes(spaceId, communityId, projectUuid));
|
await SceneApi.getScenes(spaceId, communityId, projectUuid));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
scenes.addAll(await SceneApi.getScenes(
|
|
||||||
createRoutineBloc.selectedSpaceId,
|
|
||||||
createRoutineBloc.selectedCommunityId,
|
|
||||||
projectUuid));
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
emit(state.copyWith(
|
scenes.addAll(await SceneApi.getScenes(
|
||||||
scenes: scenes,
|
createRoutineBloc.selectedSpaceId,
|
||||||
isLoading: false,
|
createRoutineBloc.selectedCommunityId,
|
||||||
));
|
projectUuid));
|
||||||
} catch (e) {
|
|
||||||
emit(state.copyWith(
|
|
||||||
isLoading: false,
|
|
||||||
loadScenesErrorMessage: 'Failed to load scenes',
|
|
||||||
errorMessage: '',
|
|
||||||
loadAutomationErrorMessage: '',
|
|
||||||
scenes: scenes));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
emit(state.copyWith(
|
||||||
|
scenes: scenes,
|
||||||
|
isLoading: false,
|
||||||
|
));
|
||||||
|
} catch (e) {
|
||||||
|
emit(state.copyWith(
|
||||||
|
isLoading: false,
|
||||||
|
loadScenesErrorMessage: 'Failed to load scenes',
|
||||||
|
errorMessage: '',
|
||||||
|
loadAutomationErrorMessage: '',
|
||||||
|
scenes: scenes));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Future<void> _onLoadAutomation(
|
Future<void> _onLoadAutomation(
|
||||||
LoadAutomation event, Emitter<RoutineState> emit) async {
|
LoadAutomation event, Emitter<RoutineState> emit) async {
|
||||||
@ -1163,8 +1160,8 @@ class RoutineBloc extends Bloc<RoutineEvent, RoutineState> {
|
|||||||
|
|
||||||
if (result['success']) {
|
if (result['success']) {
|
||||||
add(ResetRoutineState());
|
add(ResetRoutineState());
|
||||||
add(LoadAutomation());
|
add(const LoadAutomation());
|
||||||
add(LoadScenes());
|
add(const LoadScenes());
|
||||||
} else {
|
} else {
|
||||||
emit(state.copyWith(
|
emit(state.copyWith(
|
||||||
isLoading: false,
|
isLoading: false,
|
||||||
|
@ -34,9 +34,8 @@ class UserPermissionApi {
|
|||||||
path: ApiEndpoints.roleTypes,
|
path: ApiEndpoints.roleTypes,
|
||||||
showServerMessage: true,
|
showServerMessage: true,
|
||||||
expectedResponseModel: (json) {
|
expectedResponseModel: (json) {
|
||||||
final List<RoleTypeModel> fetchedRoles = (json['data'] as List)
|
final List<RoleTypeModel> fetchedRoles =
|
||||||
.map((item) => RoleTypeModel.fromJson(item))
|
(json['data'] as List).map((item) => RoleTypeModel.fromJson(item)).toList();
|
||||||
.toList();
|
|
||||||
return fetchedRoles;
|
return fetchedRoles;
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@ -48,9 +47,7 @@ class UserPermissionApi {
|
|||||||
path: ApiEndpoints.permission.replaceAll("roleUuid", roleUuid),
|
path: ApiEndpoints.permission.replaceAll("roleUuid", roleUuid),
|
||||||
showServerMessage: true,
|
showServerMessage: true,
|
||||||
expectedResponseModel: (json) {
|
expectedResponseModel: (json) {
|
||||||
return (json as List)
|
return (json as List).map((data) => PermissionOption.fromJson(data)).toList();
|
||||||
.map((data) => PermissionOption.fromJson(data))
|
|
||||||
.toList();
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
return response ?? [];
|
return response ?? [];
|
||||||
@ -195,14 +192,10 @@ class UserPermissionApi {
|
|||||||
|
|
||||||
Future<bool> changeUserStatusById(userUuid, status, String projectUuid) async {
|
Future<bool> changeUserStatusById(userUuid, status, String projectUuid) async {
|
||||||
try {
|
try {
|
||||||
Map<String, dynamic> bodya = {
|
Map<String, dynamic> bodya = {"disable": status, "projectUuid": projectUuid};
|
||||||
"disable": status,
|
|
||||||
"projectUuid": projectUuid
|
|
||||||
};
|
|
||||||
|
|
||||||
final response = await _httpService.put(
|
final response = await _httpService.put(
|
||||||
path: ApiEndpoints.changeUserStatus
|
path: ApiEndpoints.changeUserStatus.replaceAll("{invitedUserUuid}", userUuid),
|
||||||
.replaceAll("{invitedUserUuid}", userUuid),
|
|
||||||
body: bodya,
|
body: bodya,
|
||||||
expectedResponseModel: (json) {
|
expectedResponseModel: (json) {
|
||||||
return json['success'];
|
return json['success'];
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
||||||
|
|
||||||
abstract class ApiEndpoints {
|
abstract class ApiEndpoints {
|
||||||
static const String projectUuid = "0e62577c-06fa-41b9-8a92-99a21fbaf51c";
|
static const String projectUuid = "bcda711e-9fc2-4168-a05e-171b4026d1ff";
|
||||||
static String baseUrl = dotenv.env['BASE_URL'] ?? '';
|
static String baseUrl = dotenv.env['BASE_URL'] ?? '';
|
||||||
static const String signUp = '/authentication/user/signup';
|
static const String signUp = '/authentication/user/signup';
|
||||||
static const String login = '/authentication/user/login';
|
static const String login = '/authentication/user/login';
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
class TempConst {
|
class TempConst {
|
||||||
static const projectId = '0e62577c-06fa-41b9-8a92-99a21fbaf51c';
|
static const projectId = 'bcda711e-9fc2-4168-a05e-171b4026d1ff';
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user