Commit f3926d01 authored by Bas Lijnse's avatar Bas Lijnse

Merge branch...

Merge branch '224-older-applications-are-not-working-with-the-new-api-incidone-shipadventure' into 'master'

Resolve "Older applications are not working with the new API (Incidone, ShipAdventure)"

Closes #224

See merge request !160
parents 815c8f7e 5578633c
Pipeline #12436 passed with stage
in 2 minutes and 36 seconds
test:
before_script:
- install_clean.sh bundle-complete && apt-get update -qq && apt-get install -y -qq build-essential
- install_clean.sh bundle-complete && apt-get update -qq && apt-get install -y -qq build-essential libsqlite3-dev libmariadbclient-dev-compat
image: "camilstaps/clean:nightly"
script:
- bash Tests/ci-tests.bash
......@@ -120,7 +120,7 @@ manageIncidentWeather incidentNo
where
weather = sdsFocus incidentNo incidentWeather
log = logIncidentWeatherUpdated incidentNo
viewWebWeather widgets = viewInformation (Title "Web weather info") [] (RawText widgets)
viewWebWeather widgets = viewInformation (Title "Web weather info") [] (Html widgets)
manageIncidentLog :: IncidentNo -> Task ()
manageIncidentLog incidentNo
......
......@@ -57,7 +57,7 @@ doAuthenticated task
= ( enterCredentials
>>* [OnAction (Action "Login")
(hasValue (\cred -> verifyCredentials cred >>- executeTask task))
] ) <<@ ApplyLayout (beforeStep (sequenceLayouts (setUIAttributes (titleAttr "Login")) frameCompact)) //Compact layout before login, full screen afterwards
] ) <<@ ApplyLayout (beforeStep (sequenceLayouts [setUIAttributes (titleAttr "Login"), frameCompact])) //Compact layout before login, full screen afterwards
where
enterCredentials :: Task Credentials
enterCredentials
......@@ -90,7 +90,7 @@ where
workOnTasks = doIndependent tasks <<@ ArrangeWithTabs True
layoutControlDash = foldl1 sequenceLayouts
layoutControlDash = sequenceLayouts
[moveSubUIs (SelectByPath [0,0]) [] 1
,moveSubUIs (SelectByPath [0,0]) [] 2
,removeSubUIs (SelectByPath [0])
......
Version: 1.4
Global
ProjectRoot: .
Target: iTasks
Exec: {Project}/IncidoneCCC.exe
CodeGen
CheckStacks: False
CheckIndexes: True
Application
HeapSize: 209715200
StackSize: 1512000
ExtraMemory: 8192
IntialHeapSize: 204800
HeapSizeMultiplier: 4096
ShowExecutionTime: False
ShowGC: False
ShowStackSize: False
MarkingCollector: False
DisableRTSFlags: False
StandardRuntimeEnv: True
Profile
Memory: False
MemoryMinimumHeapSize: 0
Time: False
Stack: False
Dynamics: True
GenericFusion: False
DescExL: False
Output
Output: ShowConstructors
Font: Monaco
FontSize: 9
WriteStdErr: False
Link
LinkMethod: Static
GenerateRelocations: False
GenerateSymbolTable: False
GenerateLinkMap: False
LinkResources: False
ResourceSource:
GenerateDLL: False
ExportedNames:
Paths
Path: {Project}
Precompile:
Postlink:
MainModule
Name: IncidoneCCC
Dir: {Project}
Compiler
NeverMemoryProfile: False
NeverTimeProfile: False
StrictnessAnalysis: True
ListTypes: StrictExportTypes
ListAttributes: True
Warnings: True
Verbose: True
ReadableABC: False
ReuseUniqueNodes: True
Fusion: False
......@@ -15,8 +15,11 @@ import C2.Apps.ShipAdventure.Images
import qualified Data.Map as DM
import qualified Data.IntMap.Strict as DIS
import qualified Data.Set as DS
from Graphics.Scalable import normalFontDef, above, class margin(..), instance margin (Span,Span), px
from Graphics.Scalable import :: ImageOffset, :: Host(..)
import Graphics.Scalable.Image => qualified grid
import Graphics.Scalable.Types
//from Graphics.Scalable import normalFontDef, above, class margin(..), instance margin (Span,Span), px
//from Graphics.Scalable import :: ImageOffset, :: Host(..)
derive JSEncode Map2D, Section, Maybe, Coord2D, Borders, Border, IntMap, Device, DeviceType, DeviceKind, CableType, Map
derive JSEncode Network, Cable, Object, ObjectType, MapAction, SectionStatus, Dir
......@@ -193,7 +196,8 @@ where
imageEditor = fromSVGEditor
{ initView = fst
, renderImage = \((_, act), ((inventoryMap, network), allDevices)) (ms2d, _) _ ->
above [] [] [margin (px 5.0, px zero) (editLayoutImage act allDevices network inventoryMap idx m2d) \\ m2d <- ms2d & idx <- [0..]] NoHost
//TODO above [] [] [margin (px 5.0, px zero) (editLayoutImage act allDevices network inventoryMap idx m2d) \\ m2d <- ms2d & idx <- [0..]] NoHost
above [] [] Nothing [] [margin (px 5.0, px zero) (editLayoutImage act allDevices network inventoryMap idx m2d) \\ m2d <- ms2d & idx <- [0..]] NoHost
, updView = \m v -> fst m
, updModel = \(_,data) newClSt -> (newClSt,data)
}
......@@ -209,10 +213,10 @@ editLayout
, OnAction (Action "Remove outer borders" ) (hasValue (uncurry (editOuterBorders Open)))
]
) @! ()
] <<@ ApplyLayout layout @! ()
] @! ()//TODO <<@ ApplyLayout layout @! ()
/*
where
layout = idLayout
/*
layout = sequenceLayouts
[ insertSubAt [1] (ui UIContainer) // Group the 'tool' tasks
, moveSubAt[2] [1,0]
......@@ -265,7 +269,7 @@ editSectionContents
[ChooseFromCheckGroup (\d -> d.Cable.description)]
(mapRead ('DIS'.elems o fst) (myCables |+< focusedShare)) focusedShare
)
] <<@ ApplyLayout layout @! ()
] @! () //TODO <<@ ApplyLayout layout @! ()
where
updateSectionEditor :: !String ![ChoiceOption a] (Shared [a]) (Shared [a]) -> Task [a] | iTask a
updateSectionEditor d updOpts listShare focusedShare
......@@ -279,8 +283,8 @@ editSectionContents
_ = viewInformation (Title "Please select section") [] "Please select section" @! ()
)
layout = idLayout
/*
layout = idLayout
layout = sequenceLayouts
[insertSubAt [1] (uia UIContainer (directionAttr Horizontal))
,moveSubAt [2] [1,0]
......@@ -497,7 +501,7 @@ initSection = {Section | sectionName = ""
, borders = initBorders
, hops = []
}
initBorders = {n=Open,e=Open,s=Open,w=Open}
initBorders = {Borders|n=Open,e=Open,s=Open,w=Open}
frigate_outline =: [(0.0,0.5)] ++ port ++ [(1.0,0.5)] ++ starboard
where
port = [(0.006,0.048),(0.107,0.01),(0.179,0.0),(0.684,0.0),(0.719,0.01),(0.752,0.029),(0.787,0.067),(0.829,0.106),(0.852,0.135),(0.898,0.212),(0.926,0.279),(0.999,0.462)]
......
......@@ -23,7 +23,13 @@ import C2.Apps.ShipAdventure.Editor
derive gLexOrd CableType, Capability
derive class iTask ObjectType, ActorStatus, Availability, ActorHealth, ActorEnergy, DeviceType, SectionStatus
derive class iTask Cable, Priority, Network, Device, CableType, DeviceKind, CommandAim, Set, Capability, CapabilityExpr
derive class iTask Cable, Priority, Network, Device, CableType, DeviceKind, CommandAim, Capability, CapabilityExpr
derive gEditor Set
derive gDefault Set
derive gText Set
derive JSONEncode Set
derive JSONDecode Set
derive JSEncode Map2D, Coord2D, Map, IntMap, Dir, User, Maybe, Section, Borders, Border, MapAction, Object, Actor
derive JSEncode ObjectType, ActorStatus, Availability, ActorHealth, ActorEnergy, DeviceType, SectionStatus
......@@ -286,7 +292,7 @@ deviceIdInNetworkSectionShare = sdsLens "deviceIdInNetworkSectionShare" (const (
write c3d network devIds = Ok (Just ({network & devices = 'DM'.put c3d devIds network.devices}))
notify :: !Coord3D !Network ![DeviceId] -> SDSNotifyPred Coord3D
notify c3d network devIds = \idx` -> c3d == idx`
notify c3d network devIds = \_ idx` -> c3d == idx`
devicesInSectionShare :: RWShared Coord3D [Device] [Device]
devicesInSectionShare
......@@ -360,8 +366,8 @@ cablesInSectionShare = sdsLens "cablesInSectionShare" (const ()) (SDSRead read)
in if inList network
{network & cableMapping = 'DIS'.put cable.cableId [(True, c3d) : coords] network.cableMapping}
) network cables))
notify :: !Coord3D !Network ![Cable] -> (Coord3D -> Bool)
notify c3d oldNetwork newCables = \c3d` -> c3d === c3d`
notify :: !Coord3D !Network ![Cable] -> SDSNotifyPred Coord3D
notify c3d oldNetwork newCables = \_ c3d` -> c3d === c3d`
cablesForSection :: !Coord3D !Network -> [Cable]
cablesForSection c3d { Network | cables, cableMapping }
......
......@@ -36,7 +36,7 @@ selectedContactShare = sdsLens "selectedContactShare" (const ()) (SDSRead read)
write _ st=:{selection, entities} e = Ok (Just {st & entities = 'DIS'.put selection e entities})
notify :: () MapState Entity -> SDSNotifyPred ()
notify _ _ _ = \_ -> False
notify _ _ _ = \_ _ -> False
userMapState :: User -> Shared MapState
userMapState u = sharedStore ("userMapState" +++ toString u) defSettings
......@@ -70,7 +70,7 @@ contactWithId = sdsLens "contactWithId" (const ()) (SDSRead read) (SDSWrite writ
write idx st=:{entities} e = Ok (Just {st & entities = 'DIS'.put idx e entities})
notify :: Int MapState Entity -> SDSNotifyPred Int
notify idx _ _ = \idx` -> idx == idx`
notify idx _ _ = \_ idx` -> idx == idx`
resetMapState :: Task ()
resetMapState = set defSettings mapState @! ()
......
......@@ -29,7 +29,7 @@ where
>>| allTasks (map (\f -> f me) (regEntities me))
>>~ \ents -> (allTasks (map (\f -> f me ents) (contBgTasks me)))
||-
whileAuthenticated me ents alwaysOnTasks tlist <<@ ApplyLayout (foldl1 sequenceLayouts [removeSubUIs (SelectByPath [0]),unwrapUI])
whileAuthenticated me ents alwaysOnTasks tlist <<@ ApplyLayout (sequenceLayouts [removeSubUIs (SelectByPath [0]),unwrapUI])
whileAuthenticated :: User [Entity]
(User -> [(String, User [Entity] -> Task ())])
......@@ -59,7 +59,7 @@ whileAuthenticated user ents alwaysOnTasks tlist
doOpen :: Workspace [(TaskId, WorklistRow)] -> Task ()
doOpen ws xs = sequence "openAssignedTasks" (map (\(taskId, _) -> appendOnce taskId (workOn taskId @! ()) ws) xs) @! ()
layout = foldl1 sequenceLayouts
layout = sequenceLayouts
[removeSubUIs (SelectByPath [1]) //Don't show the openAssignedTasks UI
,arrangeWithSideBar 0 RightSide 300 True
,layoutSubUIs (SelectByPath [0]) (arrangeWithTabs True)
......
......@@ -80,7 +80,7 @@ sharedGraph = sdsLens "sharedGraph" (const ()) (SDSRead read) (SDSWriteConst wri
write _ _ = Ok Nothing
notify _ _ = const True
notify _ _ = const (const True)
sectionUsersShare :: SectionUsersShare
sectionUsersShare = sharedStore "sectionUsersShare" 'DM'.newMap
......@@ -393,9 +393,9 @@ uiAbove refs = UIAbove refs
/*
modifyUI :: (TaskUITree -> TaskUILayout) -> Layout
modifyUI f = idLayout
/*
modifyUI f = \(uichange, json) -> case uichange of
ReplaceUI ui -> (ReplaceUI (toLayout ui (f (uiToRefs ui))), json)
_ -> (uichange, json)
......@@ -415,7 +415,7 @@ moveAround :: !(DrawMapForActor r o a) !User
moveAround viewDeck user inventoryForSectionShare
shipStatusShare userToActorShare inventoryForAllSectionsShare
= forever ( walkAround -||- changeDecks
-||- pickUpItems -||- dropItems) <<@ ApplyLayout (modifyUI moveAroundUI)
-||- pickUpItems -||- dropItems) //<<@ ApplyLayout (idLayout modifyUI moveAroundUI)
where
walkAround :: Task ()
walkAround
......@@ -526,7 +526,7 @@ sectionForSectionNumberShare = sdsLens "sectionForSectionNumberShare" (const ())
write (floorIdx, c2d) ms2d section = Ok (Just (updMap2D floorIdx (setSection c2d section) ms2d))
notify :: Coord3D Maps2D Section -> SDSNotifyPred Coord3D
notify c3d _ _ = \c3d` -> c3d == c3d`
notify c3d _ _ = \_ c3d` -> c3d == c3d`
pickupObject :: !Coord3D !(Object o) !User !(UserActorShare o a) !(FocusedSectionInventoryShare o)
-> Task () | iTask o & iTask a
......@@ -633,7 +633,7 @@ actorsInSectionShare userActorShare = sdsLens "actorsInSectionShare" (const ())
write c3d (sectionUsersMap, userActorMap) actors = Ok (Just ('DM'.put c3d (map (\a -> a.userName) actors) sectionUsersMap, 'DM'.fromList [(a.userName, a) \\ a <- actors]))
notify :: Coord3D (SectionUsersMap, UserActorMap o a) [Actor o a] -> SDSNotifyPred Coord3D
notify c3d _ _ = \c3d` -> c3d == c3d`
notify c3d _ _ = \_ c3d` -> c3d == c3d`
actorForUserShare :: (UserActorShare o a) -> FocusedUserActorShare o a | iTask o & iTask a
actorForUserShare userActorShare = mapMaybeLens "actorForUserShare" userActorShare
......
......@@ -53,7 +53,11 @@ damagePrediction
resetSections = set 'DS'.newSet disabledSections >>| damagePrediction
isDisabled c3d disSects = 'DS'.member c3d disSects
derive class iTask Set
derive gEditor Set
derive gDefault Set
derive gText Set
derive JSONEncode Set
derive JSONDecode Set
showCommandAims :: Task ()
showCommandAims = viewSharedInformation "Current Command Aims" [] commandAims @! ()
......
Version: 1.4
Global
ProjectRoot: .
Target: iTasks
Exec: {Project}/main.exe
CodeGen
CheckStacks: False
CheckIndexes: True
Application
HeapSize: 524288000
StackSize: 10485760
ExtraMemory: 81920
IntialHeapSize: 8388608
HeapSizeMultiplier: 4096
ShowExecutionTime: False
ShowGC: False
ShowStackSize: False
MarkingCollector: False
DisableRTSFlags: False
StandardRuntimeEnv: True
Profile
Memory: False
MemoryMinimumHeapSize: 0
Time: False
Stack: False
Dynamics: True
GenericFusion: False
DescExL: False
Output
Output: ShowConstructors
Font: Courier
FontSize: 9
WriteStdErr: False
Link
LinkMethod: Static
GenerateRelocations: False
GenerateSymbolTable: False
GenerateLinkMap: False
LinkResources: False
ResourceSource:
GenerateDLL: False
ExportedNames:
Paths
Path: {Project}
Precompile:
Postlink:
MainModule
Name: main
Dir: {Project}
Compiler
NeverMemoryProfile: False
NeverTimeProfile: False
StrictnessAnalysis: True
ListTypes: NoTypes
ListAttributes: True
Warnings: True
Verbose: True
ReadableABC: False
ReuseUniqueNodes: True
Fusion: False
......@@ -10,5 +10,4 @@ find . -name "*.prj.default" | while read f; do
done
find . -name "*.prj" | xargs dirname | sort -u | xargs -I{} sh -c "cd {}; cpm make"
#Run the tests
( cd Tools; ./RunUnitTestsForCI; )
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment